summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2016-12-19 11:39:39 +0100
committerMichal Klocek <michal.klocek@qt.io>2016-12-20 10:22:10 +0000
commit87778abf5a1f89266f37d1321b92a21851d8244d (patch)
tree6e6bf1cbca09cb63589210c8249cef437439ccbf
parentf0e73b6da23ab32db1edfbc912bc3ce989bf9a06 (diff)
Remove unused third party components
The components are unused in normal builds, but still show up in the 3rd party documentation as GPL only or LGPLv3 only. Just remove them. Done-with: Kai Koehne <kai.koehne@qt.io> Change-Id: I49e4a9410903908e46d46f1e64246dabe17130f7 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
-rw-r--r--chromium/third_party/lcov/CHANGES491
-rw-r--r--chromium/third_party/lcov/COPYING339
-rw-r--r--chromium/third_party/lcov/Makefile99
-rw-r--r--chromium/third_party/lcov/README137
-rw-r--r--chromium/third_party/lcov/README.chromium17
-rwxr-xr-xchromium/third_party/lcov/bin/gendesc226
-rwxr-xr-xchromium/third_party/lcov/bin/genhtml5799
-rwxr-xr-xchromium/third_party/lcov/bin/geninfo3657
-rwxr-xr-xchromium/third_party/lcov/bin/genpng389
-rwxr-xr-xchromium/third_party/lcov/bin/install.sh71
-rwxr-xr-xchromium/third_party/lcov/bin/lcov4303
-rwxr-xr-xchromium/third_party/lcov/bin/mcov305
-rwxr-xr-xchromium/third_party/lcov/bin/updateversion.pl146
-rw-r--r--chromium/third_party/lcov/contrib/galaxy/CHANGES1
-rw-r--r--chromium/third_party/lcov/contrib/galaxy/README48
-rwxr-xr-xchromium/third_party/lcov/contrib/galaxy/conglomerate_functions.pl195
-rwxr-xr-xchromium/third_party/lcov/contrib/galaxy/gen_makefile.sh129
-rwxr-xr-xchromium/third_party/lcov/contrib/galaxy/genflat.pl1238
-rwxr-xr-xchromium/third_party/lcov/contrib/galaxy/posterize.pl312
-rw-r--r--chromium/third_party/lcov/descriptions.tests2990
-rw-r--r--chromium/third_party/lcov/example/Makefile98
-rw-r--r--chromium/third_party/lcov/example/README6
-rw-r--r--chromium/third_party/lcov/example/descriptions.txt10
-rw-r--r--chromium/third_party/lcov/example/example.c60
-rw-r--r--chromium/third_party/lcov/example/gauss.h6
-rw-r--r--chromium/third_party/lcov/example/iterate.h6
-rw-r--r--chromium/third_party/lcov/example/methods/gauss.c48
-rw-r--r--chromium/third_party/lcov/example/methods/iterate.c45
-rw-r--r--chromium/third_party/lcov/lcovrc157
-rw-r--r--chromium/third_party/lcov/man/gendesc.178
-rw-r--r--chromium/third_party/lcov/man/genhtml.1569
-rw-r--r--chromium/third_party/lcov/man/geninfo.1512
-rw-r--r--chromium/third_party/lcov/man/genpng.1101
-rw-r--r--chromium/third_party/lcov/man/lcov.1883
-rw-r--r--chromium/third_party/lcov/man/lcovrc.5821
-rw-r--r--chromium/third_party/lcov/rpm/lcov.spec51
-rw-r--r--chromium/third_party/logilab/README.chromium12
-rw-r--r--chromium/third_party/logilab/logilab/__init__.py0
-rw-r--r--chromium/third_party/logilab/logilab/astroid/LICENSE.txt340
-rw-r--r--chromium/third_party/logilab/logilab/astroid/README.chromium12
-rw-r--r--chromium/third_party/logilab/logilab/astroid/__init__.py131
-rw-r--r--chromium/third_party/logilab/logilab/astroid/__pkginfo__.py42
-rw-r--r--chromium/third_party/logilab/logilab/astroid/as_string.py499
-rw-r--r--chromium/third_party/logilab/logilab/astroid/bases.py665
-rw-r--r--chromium/third_party/logilab/logilab/astroid/brain/builtin_inference.py245
-rw-r--r--chromium/third_party/logilab/logilab/astroid/brain/py2gi.py155
-rw-r--r--chromium/third_party/logilab/logilab/astroid/brain/py2mechanize.py18
-rw-r--r--chromium/third_party/logilab/logilab/astroid/brain/py2pytest.py31
-rw-r--r--chromium/third_party/logilab/logilab/astroid/brain/py2qt4.py22
-rw-r--r--chromium/third_party/logilab/logilab/astroid/brain/py2stdlib.py334
-rw-r--r--chromium/third_party/logilab/logilab/astroid/brain/pynose.py56
-rw-r--r--chromium/third_party/logilab/logilab/astroid/brain/pysix_moves.py225
-rw-r--r--chromium/third_party/logilab/logilab/astroid/builder.py240
-rw-r--r--chromium/third_party/logilab/logilab/astroid/exceptions.py51
-rw-r--r--chromium/third_party/logilab/logilab/astroid/inference.py401
-rw-r--r--chromium/third_party/logilab/logilab/astroid/inspector.py273
-rw-r--r--chromium/third_party/logilab/logilab/astroid/manager.py390
-rw-r--r--chromium/third_party/logilab/logilab/astroid/mixins.py124
-rw-r--r--chromium/third_party/logilab/logilab/astroid/modutils.py670
-rw-r--r--chromium/third_party/logilab/logilab/astroid/node_classes.py966
-rw-r--r--chromium/third_party/logilab/logilab/astroid/nodes.py73
-rw-r--r--chromium/third_party/logilab/logilab/astroid/protocols.py361
-rw-r--r--chromium/third_party/logilab/logilab/astroid/raw_building.py366
-rw-r--r--chromium/third_party/logilab/logilab/astroid/rebuilder.py906
-rw-r--r--chromium/third_party/logilab/logilab/astroid/scoped_nodes.py1459
-rw-r--r--chromium/third_party/logilab/logilab/astroid/test_utils.py218
-rw-r--r--chromium/third_party/logilab/logilab/astroid/utils.py239
-rw-r--r--chromium/third_party/logilab/logilab/common/LICENSE.txt339
-rw-r--r--chromium/third_party/logilab/logilab/common/README.chromium13
-rw-r--r--chromium/third_party/logilab/logilab/common/__init__.py175
-rw-r--r--chromium/third_party/logilab/logilab/common/__pkginfo__.py57
-rw-r--r--chromium/third_party/logilab/logilab/common/cache.py114
-rw-r--r--chromium/third_party/logilab/logilab/common/changelog.py238
-rw-r--r--chromium/third_party/logilab/logilab/common/clcommands.py334
-rw-r--r--chromium/third_party/logilab/logilab/common/cli.py211
-rw-r--r--chromium/third_party/logilab/logilab/common/compat.py78
-rw-r--r--chromium/third_party/logilab/logilab/common/configuration.py1105
-rw-r--r--chromium/third_party/logilab/logilab/common/contexts.py5
-rw-r--r--chromium/third_party/logilab/logilab/common/corbautils.py117
-rw-r--r--chromium/third_party/logilab/logilab/common/daemon.py101
-rw-r--r--chromium/third_party/logilab/logilab/common/date.py335
-rw-r--r--chromium/third_party/logilab/logilab/common/dbf.py231
-rw-r--r--chromium/third_party/logilab/logilab/common/debugger.py214
-rw-r--r--chromium/third_party/logilab/logilab/common/decorators.py281
-rw-r--r--chromium/third_party/logilab/logilab/common/deprecation.py189
-rw-r--r--chromium/third_party/logilab/logilab/common/fileutils.py404
-rw-r--r--chromium/third_party/logilab/logilab/common/graph.py282
-rw-r--r--chromium/third_party/logilab/logilab/common/interface.py71
-rw-r--r--chromium/third_party/logilab/logilab/common/logging_ext.py195
-rw-r--r--chromium/third_party/logilab/logilab/common/modutils.py702
-rw-r--r--chromium/third_party/logilab/logilab/common/optik_ext.py392
-rw-r--r--chromium/third_party/logilab/logilab/common/optparser.py92
-rw-r--r--chromium/third_party/logilab/logilab/common/proc.py277
-rw-r--r--chromium/third_party/logilab/logilab/common/pyro_ext.py180
-rw-r--r--chromium/third_party/logilab/logilab/common/pytest.py1199
-rw-r--r--chromium/third_party/logilab/logilab/common/registry.py1119
-rw-r--r--chromium/third_party/logilab/logilab/common/shellutils.py462
-rw-r--r--chromium/third_party/logilab/logilab/common/sphinx_ext.py87
-rw-r--r--chromium/third_party/logilab/logilab/common/sphinxutils.py122
-rw-r--r--chromium/third_party/logilab/logilab/common/table.py929
-rw-r--r--chromium/third_party/logilab/logilab/common/tasksqueue.py101
-rw-r--r--chromium/third_party/logilab/logilab/common/testlib.py1392
-rw-r--r--chromium/third_party/logilab/logilab/common/textutils.py537
-rw-r--r--chromium/third_party/logilab/logilab/common/tree.py369
-rw-r--r--chromium/third_party/logilab/logilab/common/umessage.py194
-rw-r--r--chromium/third_party/logilab/logilab/common/ureports/__init__.py172
-rw-r--r--chromium/third_party/logilab/logilab/common/ureports/docbook_writer.py140
-rw-r--r--chromium/third_party/logilab/logilab/common/ureports/html_writer.py133
-rw-r--r--chromium/third_party/logilab/logilab/common/ureports/nodes.py203
-rw-r--r--chromium/third_party/logilab/logilab/common/ureports/text_writer.py145
-rw-r--r--chromium/third_party/logilab/logilab/common/urllib2ext.py89
-rw-r--r--chromium/third_party/logilab/logilab/common/vcgutils.py216
-rw-r--r--chromium/third_party/logilab/logilab/common/visitor.py109
-rw-r--r--chromium/third_party/logilab/logilab/common/xmlrpcutils.py131
-rw-r--r--chromium/third_party/logilab/logilab/common/xmlutils.py61
-rw-r--r--chromium/third_party/pylint/README.chromium55
-rw-r--r--chromium/third_party/pylint/pylint/LICENSE.txt340
-rw-r--r--chromium/third_party/pylint/pylint/__init__.py46
-rwxr-xr-xchromium/third_party/pylint/pylint/__main__.py3
-rw-r--r--chromium/third_party/pylint/pylint/__pkginfo__.py70
-rw-r--r--chromium/third_party/pylint/pylint/checkers/__init__.py124
-rw-r--r--chromium/third_party/pylint/pylint/checkers/base.py1248
-rw-r--r--chromium/third_party/pylint/pylint/checkers/classes.py981
-rw-r--r--chromium/third_party/pylint/pylint/checkers/design_analysis.py363
-rw-r--r--chromium/third_party/pylint/pylint/checkers/exceptions.py332
-rw-r--r--chromium/third_party/pylint/pylint/checkers/format.py964
-rw-r--r--chromium/third_party/pylint/pylint/checkers/imports.py413
-rw-r--r--chromium/third_party/pylint/pylint/checkers/logging.py256
-rw-r--r--chromium/third_party/pylint/pylint/checkers/misc.py104
-rw-r--r--chromium/third_party/pylint/pylint/checkers/newstyle.py172
-rw-r--r--chromium/third_party/pylint/pylint/checkers/python3.py476
-rw-r--r--chromium/third_party/pylint/pylint/checkers/raw_metrics.py129
-rw-r--r--chromium/third_party/pylint/pylint/checkers/similar.py372
-rw-r--r--chromium/third_party/pylint/pylint/checkers/spelling.py241
-rw-r--r--chromium/third_party/pylint/pylint/checkers/stdlib.py173
-rw-r--r--chromium/third_party/pylint/pylint/checkers/strings.py615
-rw-r--r--chromium/third_party/pylint/pylint/checkers/typecheck.py627
-rw-r--r--chromium/third_party/pylint/pylint/checkers/utils.py564
-rw-r--r--chromium/third_party/pylint/pylint/checkers/variables.py1069
-rw-r--r--chromium/third_party/pylint/pylint/config.py157
-rw-r--r--chromium/third_party/pylint/pylint/epylint.py176
-rw-r--r--chromium/third_party/pylint/pylint/gui.py531
-rw-r--r--chromium/third_party/pylint/pylint/interfaces.py84
-rw-r--r--chromium/third_party/pylint/pylint/lint.py1333
-rw-r--r--chromium/third_party/pylint/pylint/pyreverse/__init__.py5
-rw-r--r--chromium/third_party/pylint/pylint/pyreverse/diadefslib.py233
-rw-r--r--chromium/third_party/pylint/pylint/pyreverse/diagrams.py247
-rw-r--r--chromium/third_party/pylint/pylint/pyreverse/main.py124
-rw-r--r--chromium/third_party/pylint/pylint/pyreverse/utils.py132
-rw-r--r--chromium/third_party/pylint/pylint/pyreverse/writer.py199
-rw-r--r--chromium/third_party/pylint/pylint/reporters/__init__.py133
-rw-r--r--chromium/third_party/pylint/pylint/reporters/guireporter.py27
-rw-r--r--chromium/third_party/pylint/pylint/reporters/html.py69
-rw-r--r--chromium/third_party/pylint/pylint/reporters/json.py58
-rw-r--r--chromium/third_party/pylint/pylint/reporters/text.py146
-rw-r--r--chromium/third_party/pylint/pylint/testutils.py412
-rw-r--r--chromium/third_party/pylint/pylint/utils.py919
-rw-r--r--chromium/third_party/speech-dispatcher/COPYING808
-rw-r--r--chromium/third_party/speech-dispatcher/OWNERS2
-rw-r--r--chromium/third_party/speech-dispatcher/README.chromium19
-rw-r--r--chromium/third_party/speech-dispatcher/libspeechd.h268
-rw-r--r--chromium/third_party/talloc/LICENSE22
-rw-r--r--chromium/third_party/talloc/Makefile.in62
-rw-r--r--chromium/third_party/talloc/NEWS13
-rw-r--r--chromium/third_party/talloc/README.chromium25
-rw-r--r--chromium/third_party/talloc/aclocal.m41
-rwxr-xr-xchromium/third_party/talloc/autogen.sh14
-rw-r--r--chromium/third_party/talloc/build_macros.m414
-rw-r--r--chromium/third_party/talloc/chromium.patch371
-rw-r--r--chromium/third_party/talloc/compat/talloc_compat1.c51
-rw-r--r--chromium/third_party/talloc/compat/talloc_compat1.m414
-rwxr-xr-xchromium/third_party/talloc/config.guess1561
-rw-r--r--chromium/third_party/talloc/config.h.in803
-rwxr-xr-xchromium/third_party/talloc/config.sub1686
-rwxr-xr-xchromium/third_party/talloc/configure23592
-rw-r--r--chromium/third_party/talloc/configure.ac49
-rwxr-xr-xchromium/third_party/talloc/install-sh238
-rw-r--r--chromium/third_party/talloc/libreplace/.checker_innocent4
-rw-r--r--chromium/third_party/talloc/libreplace/Makefile.in70
-rw-r--r--chromium/third_party/talloc/libreplace/README124
-rw-r--r--chromium/third_party/talloc/libreplace/aclocal.m41
-rw-r--r--chromium/third_party/talloc/libreplace/autoconf-2.60.m4212
-rwxr-xr-xchromium/third_party/talloc/libreplace/autogen.sh13
-rw-r--r--chromium/third_party/talloc/libreplace/build_macros.m414
-rwxr-xr-xchromium/third_party/talloc/libreplace/config.guess1561
-rwxr-xr-xchromium/third_party/talloc/libreplace/config.sub1686
-rw-r--r--chromium/third_party/talloc/libreplace/configure.ac33
-rw-r--r--chromium/third_party/talloc/libreplace/crypt.c770
-rw-r--r--chromium/third_party/talloc/libreplace/crypt.m46
-rw-r--r--chromium/third_party/talloc/libreplace/dlfcn.c76
-rw-r--r--chromium/third_party/talloc/libreplace/dlfcn.m431
-rw-r--r--chromium/third_party/talloc/libreplace/getaddrinfo.c497
-rw-r--r--chromium/third_party/talloc/libreplace/getaddrinfo.h91
-rw-r--r--chromium/third_party/talloc/libreplace/getifaddrs.c352
-rw-r--r--chromium/third_party/talloc/libreplace/getpass.c222
-rw-r--r--chromium/third_party/talloc/libreplace/getpass.m424
-rw-r--r--chromium/third_party/talloc/libreplace/inet_aton.c33
-rw-r--r--chromium/third_party/talloc/libreplace/inet_ntoa.c39
-rw-r--r--chromium/third_party/talloc/libreplace/inet_ntop.c191
-rw-r--r--chromium/third_party/talloc/libreplace/inet_pton.c213
-rwxr-xr-xchromium/third_party/talloc/libreplace/install-sh238
-rw-r--r--chromium/third_party/talloc/libreplace/libreplace.m4311
-rw-r--r--chromium/third_party/talloc/libreplace/libreplace_cc.m4180
-rw-r--r--chromium/third_party/talloc/libreplace/libreplace_ld.m4337
-rw-r--r--chromium/third_party/talloc/libreplace/libreplace_macros.m4332
-rw-r--r--chromium/third_party/talloc/libreplace/libreplace_network.m4389
-rw-r--r--chromium/third_party/talloc/libreplace/repdir.m481
-rw-r--r--chromium/third_party/talloc/libreplace/repdir_getdents.c166
-rw-r--r--chromium/third_party/talloc/libreplace/repdir_getdirentries.c183
-rw-r--r--chromium/third_party/talloc/libreplace/replace.c683
-rw-r--r--chromium/third_party/talloc/libreplace/replace.h726
-rw-r--r--chromium/third_party/talloc/libreplace/samba.m434
-rw-r--r--chromium/third_party/talloc/libreplace/snprintf.c1530
-rw-r--r--chromium/third_party/talloc/libreplace/socket.c35
-rw-r--r--chromium/third_party/talloc/libreplace/socketpair.c46
-rw-r--r--chromium/third_party/talloc/libreplace/strptime.c990
-rw-r--r--chromium/third_party/talloc/libreplace/strptime.m413
-rw-r--r--chromium/third_party/talloc/libreplace/system/README4
-rw-r--r--chromium/third_party/talloc/libreplace/system/aio.h32
-rw-r--r--chromium/third_party/talloc/libreplace/system/capability.h55
-rw-r--r--chromium/third_party/talloc/libreplace/system/config.m4131
-rw-r--r--chromium/third_party/talloc/libreplace/system/dir.h67
-rw-r--r--chromium/third_party/talloc/libreplace/system/filesys.h186
-rw-r--r--chromium/third_party/talloc/libreplace/system/glob.h37
-rw-r--r--chromium/third_party/talloc/libreplace/system/iconv.h57
-rw-r--r--chromium/third_party/talloc/libreplace/system/kerberos.h141
-rw-r--r--chromium/third_party/talloc/libreplace/system/locale.h42
-rw-r--r--chromium/third_party/talloc/libreplace/system/network.h372
-rw-r--r--chromium/third_party/talloc/libreplace/system/passwd.h110
-rw-r--r--chromium/third_party/talloc/libreplace/system/readline.h52
-rw-r--r--chromium/third_party/talloc/libreplace/system/select.h41
-rw-r--r--chromium/third_party/talloc/libreplace/system/shmem.h59
-rw-r--r--chromium/third_party/talloc/libreplace/system/syslog.h70
-rw-r--r--chromium/third_party/talloc/libreplace/system/terminal.h46
-rw-r--r--chromium/third_party/talloc/libreplace/system/time.h69
-rw-r--r--chromium/third_party/talloc/libreplace/system/wait.h59
-rw-r--r--chromium/third_party/talloc/libreplace/timegm.c78
-rw-r--r--chromium/third_party/talloc/libreplace/timegm.m41
-rw-r--r--chromium/third_party/talloc/libreplace/win32.m420
-rw-r--r--chromium/third_party/talloc/libreplace/win32_replace.h159
-rw-r--r--chromium/third_party/talloc/libtalloc.m438
-rw-r--r--chromium/third_party/talloc/pytalloc.c93
-rw-r--r--chromium/third_party/talloc/pytalloc.h57
-rwxr-xr-xchromium/third_party/talloc/script/abi_checks.sh80
-rwxr-xr-xchromium/third_party/talloc/script/abi_checks_gcc.sh34
-rwxr-xr-xchromium/third_party/talloc/script/mksigs.pl183
-rw-r--r--chromium/third_party/talloc/script/mksyms.awk63
-rwxr-xr-xchromium/third_party/talloc/script/mksyms.sh62
-rwxr-xr-xchromium/third_party/talloc/script/release-script.sh58
-rw-r--r--chromium/third_party/talloc/talloc.3.xml812
-rw-r--r--chromium/third_party/talloc/talloc.c2020
-rw-r--r--chromium/third_party/talloc/talloc.exports68
-rw-r--r--chromium/third_party/talloc/talloc.h206
-rw-r--r--chromium/third_party/talloc/talloc.i31
-rw-r--r--chromium/third_party/talloc/talloc.pc.in11
-rw-r--r--chromium/third_party/talloc/talloc.signatures62
-rw-r--r--chromium/third_party/talloc/talloc_guide.txt757
-rw-r--r--chromium/third_party/talloc/testsuite.c1199
-rw-r--r--chromium/third_party/talloc/testsuite_main.c37
-rw-r--r--chromium/third_party/talloc/web/index.html51
260 files changed, 0 insertions, 113191 deletions
diff --git a/chromium/third_party/lcov/CHANGES b/chromium/third_party/lcov/CHANGES
deleted file mode 100644
index 18cfcefa803..00000000000
--- a/chromium/third_party/lcov/CHANGES
+++ /dev/null
@@ -1,491 +0,0 @@
-Version 1.10
-============
-
-All:
-- Disabled branch coverage processing per default to improve processing
- performance (can be re-enabled using a config file setting)
-- Added option --rc to override config file settings from the command line
-- Added option --config-file to override the config file location
-- Fixed handling of '<' in filenames
-
-genhtml:
-- Added option --ignore-errors to continue after errors
-- Added man page note to further explain branch coverage output
-- Fixed man page description of default coverage rates
-- Fixed HTML page title for directory pages
-- Fixed handling of special characters in file and directory names
-- Fixed directory prefix calculation
-- Fixed warning when source files are found in root directory
-
-geninfo:
-- Added options --external and --no-external to include/exclude external
- source files such as standard libary headers
-- Added option --compat to specify compatibility modes
-- Added missing man page sections for --derive-func-data and --no-markers
-- Added support for MinGW output on MSYS. From martin.hopfeld@sse-erfurt.de
-- Added support for gcc 4.7 .gcno file format. Based on patch by
- berrange@redhat.com
-- Added auto-detection of gcc-4.7 function record format. Includes
- suggestions by garnold@google.com
-- Fixed exclusion markers for --derive-func-data. Reported by bettse@gmail.com
-- Fixed processing of pre-3.3 gcov files. Reported by georgysebastian@gmail.com
-- Fixed handling of '<built-in>.gcov' files
-- Fixed warning about unhandled .gcov files
-- Improved --debug output
-- Removed help text for obsolete parameter --function-coverage
-
-genpng:
-- Fixed handling of empty source files. Reported by: sylvestre@debian.org
-
-lcov:
-- Added options --external and --no-external to include/exclude external source
- files such as standard libary headers
-- Added option --summary to show summary coverage information
-- Added option --compat to specify compatibility modes
-- Fixed missing Perl version dependency in RPM spec file. Reported by
- Martin Hopfeld <martin.hopfeld@sse-erfurt.de>
-- Fixed geninfo not recognizing Objective-C functions. Based on patch
- by abrahamh@web.de
-- Fixed option --no-recursion not being passed to geninfo
-- Fixed capitalization of the term 'Perl'
-- Improved coverage rate calculation to only show 0%/100% when no/full coverage
- is achieved. Based on suggestions by Paul.Zimmermann@loria.fr and
- vincent@vinc17.net
-
-lcovrc:
-- Added description for geninfo_compat setting
-- Added config file setting 'genhtml_charset' to specify HTML charset
-- Added config file setting 'geninfo_external' to include/exclude external
- source files such as standard libary headers
-- Added config file setting 'geninfo_gcov_all_blocks' to modify lcov's use
- of gcov's -a option
-- Added config file setting 'geninfo_compat' to specify compatibility modes
-- Added config file setting 'geninfo_adjust_src_path' to enabled source path
- adjustments. Inspired by patch by ammon.riley@gmail.com
-- Added config file setting 'geninfo_auto_base' to automatically determine
- the base directory when collecting coverage data
-- Added config file setting 'lcov_function_coverage' to enable/disable
- function coverage processing
-- Added config file setting 'lcov_branch_coverage' to enable/disable
- branch coverage processing
-
-
-Version 1.9
-===========
-
-genhtml:
-- Improved wording for branch representation tooltip text
-- Fixed vertical alignment of HTML branch representation
-
-geninfo:
-- Improved warning message about --initial not generating branch coverage data
-- Debugging messages are now printed to STDERR instead of STDOUT
-- Fixed problem with some .gcno files. Reported by gui@futarque.com.
- (file.gcno: reached unexpected end of file)
-- Fixed problem with relative build paths. Reported by zhanbiao2000@gmail.com.
- (cannot find an entry for ^#src#test.c.gcov in .gcno file, skipping file!)
-- Fixed problem where coverage data is missing for some files. Reported by
- weston_schmidt@open-roadster.com
-- Fixed problem where exclusion markers are ignored when gathering
- initial coverage data. Reported by ahmed_osman@mentor.com.
-- Fixed large execution counts showing as negative numbers in HTML output.
- Reported by kkyriako@yahoo.com.
-- Fixed problem that incorrectly associated branches outside of a block with
- branches inside the first block
-
-lcov:
-- Fixed problem that made lcov ignore --kernel-directory parameters when
- specifying --initial. Reported by hjia@redhat.com.
-- Added --list-full-path option to prevent lcov from truncating paths in list
- output
-- Added lcov_list_width and lcov_list_truncate_max directives to the
- lcov configuration file to allow for list output customization
-- Improved list output
-
-COPYING:
-- Added license text to better comply with GPL recommendations
-
-
-Version 1.8
-===========
-
-gendesc:
-- Fixed problem with single word descriptions
-
-genhtml:
-- Added support for branch coverage measurements
-- Added --demangle-cpp option to convert C++ function names to human readable
- format. Based on a patch by slava.semushin@gmail.com.
-- Improved color legend: legend display takes up less space in HTML output
-- Improved coverage rate limits: all coverage types use the same limits
- unless specified otherwise
-- Fixed CRLF line breaks in source code when generating html output. Based
- on patch by michael.knigge@set-software.de.
-- Fixed warning when $HOME is not set
-- Fixed problem with --baseline-file option. Reported by sixarm@gmail.com.
- (Undefined subroutine &main::add_fnccounts called at genhtml line 4560.)
-- Fixed problem with --baseline-file option and files without function
- coverage data (Can't use an undefined value as a HASH reference at genhtml
- line 4441.)
-- Fixed short-name option ambiguities
-- Fixed --highlight option not showing line data from converted test data
-- Fixed warnings about undefined value used. Reported by nikita@zhuk.fi.
-- Fixed error when processing tracefiles without function data. Reported
- by richard.corden@gmail.com (Can't use an undefined value as a HASH
- reference at genhtml line 1506.)
-
-geninfo:
-- Added support for branch coverage measurements
-- Added support for exclusion markers: Users can exclude lines of code from
- coverage reports by adding keywords to the source code.
-- Added --derive-func-data option
-- Added --debug option to better debug problems with graph files
-- Fixed CRLF line breaks in source code when generating tracefiles. Based on
- patch by michael.knigge@set-software.de.
-- Fixed problems with unnamed source files
-- Fixed warning when $HOME is not set. Reported by acalando@free.fr.
-- Fixed errors when processing unnamed source files
-- Fixed help text typo
-- Fixed errors when processing incomplete function names in .bb files
-- Fixed filename prefix detection
-- Fixed problem with matching filename
-- Fixed problem when LANG is set to non-english locale. Reported by
- benoit_belbezet@yahoo.fr.
-- Fixed short-name option ambiguities
-
-genpng:
-- Fixed runtime-warning
-
-lcov:
-- Added support for branch coverage measurements
-- Added support for the linux-2.6.31 upstream gcov kernel support
-- Added --from-package and --to-package options
-- Added --derive-func-data option
-- Added overall coverage result output for more operations
-- Improved output of lcov --list
-- Improved gcov-kernel handling
-- Fixed minor problem with --diff
-- Fixed double-counting of function data
-- Fixed warning when $HOME is not set. Reported by acalando@free.fr.
-- Fixed error when combining tracefiles without function data. Reported by
- richard.corden@gmail.com. (Can't use an undefined value as a HASH reference
- at lcov line 1341.)
-- Fixed help text typo
-- Fixed filename prefix detection
-- Fixed lcov ignoring information about converted test data
-
-README:
-- Added note to mention required -lgcov switch during linking
-
-
-Version 1.7:
-============
-
-gendesc:
-- Updated error and warning messages
-- Updated man page
-
-genhtml:
-- Added function coverage data display patch by tomzo@nefkom.net (default is on)
-- Added --function-coverage to enable function coverage display
-- Added --no-function-coverage to disable function coverage display
-- Added sorting option in HTLM output (default is on)
-- Added --sort to enable sorting
-- Added --no-sort to disable sorting
-- Added --html-gzip to create gzip-compressed HTML output (patch by
- dnozay@vmware.com)
-- Fixed problem when using --baseline-file on coverage data files that
- contain data for files not found in the baseline file
-- Updated error and warning messages
-- Updated man page
-
-geninfo:
-- Added function coverage data collection patch by tomzo@nefkom.net
-- Added more verbose output when a "ERROR: reading string" error occurs
- (patch by scott.heavner@philips.com)
-- Fixed geninfo not working with directory names containing spaces (reported
- by jeffconnelly@users.sourceforge.net)
-- Fixed "ERROR: reading string" problem with gcc 4.1
-- Fixed problem with function names that contain non-alphanumerical characters
-- Fixed problem with gcc versions before 3.3
-- Updated error and warning messages
-- Updated man page
-
-genpng:
-- Updated error and warning messages
-- Updated man page
-
-lcov:
-- Added support for function coverage data for adding/diffing tracefiles
-- Added --no-recursion option to disable recursion into sub-directories
- while scanning for gcov data files
-- Fixed lcov -z not working with directory names containing spaces (reported
- by Jeff Connelly)
-- Updated error and warning messages
-- Updated man page
-
-lcov.spec:
-- Updated of description and title information
-
-lcovrc:
-- Added genhtml_function_hi_limit
-- Added genhtml_function_med_limit
-- Added genhtml_function_coverage
-- Added genhtml_sort
-- Updated man page
-
-Makefile:
-- Updated info text
-
-
-Version 1.6:
-============
-
-geninfo:
-- Added libtool compatibility patch by thomas@apestaart.org (default is on)
-- Added --compat-libtool option to enable libtool compatibility mode
-- Added --no-compat-libtool option to disable libtool compatibility mode
-- Changed default for line checksumming to off
-- Added --checksum option to enable line checksumming
-- Added --gcov-tool option
-- Added --ignore-errors option
-- Added --initial option to generate zero coverage from graph files
-- Removed automatic test name modification on s390
-- Added --checksum option
-- Updated man page
-
-lcov:
-- Added libtool compatibility patch by thomas@apestaart.org
-- Added --compat-libtool option to enable libtool compatibility mode
-- Added --no-compat-libtool option to disable libtool compatibility mode
-- Added --checksum option to enable line checksumming
-- Added --gcov-tool option
-- Added --ignore-errors option
-- Added --initial option to generate zero coverage from graph files
-- Updated help text
-- Updated man page
-- Fixed lcov not working when -k is specified more than once
-- Fixed lcov not deleting .gcda files when specifying -z and -d
-
-lcovrc:
-- Added geninfo_compat_libtool option
-- Added geninfo_checksum option
-- Removed geninfo_no_checksum option from example lcovrc
-- Updated man page
-
-README:
-- Added description of lcovrc file
-
-
-Version 1.5:
-============
-
-genhtml:
-- Added check for invalid characters in test names
-- Added --legend option
-- Added --html-prolog option
-- Added --html-epilog option
-- Added --html-extension option
-- Added warning when specifying --no-prefix and --prefix
-- Reworked help text to make it more readable
-
-geninfo:
-- Renamed 'sles9' compatibility mode to 'hammer' compatibility mode
-- Added support for mandrake gcc 3.3.2
-- Fixed bbg file reading in hammer compatibility mode
-- Added check for invalid characters in test names
-- Added --base-directory option
-
-lcov:
-- Added check for invalid characters in test names
-- Added --base-directory option
-
-
-Version 1.4:
-============
-
-All:
-- Added configuration file support
-
-genhtml:
-- Fixed help text message
-- Fixed handling of special characters in file- and directory names
-- Added description of --css-file option to man page
-
-geninfo:
-- Added support for GCOV file format as used by GCC 3.3.3 on SUSE SLES9
-- Fixed error text message
-- Added check to abort processing if no source code file is available
-- Added workaround for a problem where geninfo could not find source code
- files for a C++ project
-- Fixed 'branch'-statement parsing for GCC>=3.3 .gcov files
-- Fixed exec count-statement parsing for GCC>=3.3 .gcov files
-- Fixed .gcno-file parser (some lines were not counted as being instrumented)
-
-lcov:
-- Modified path for temporary files from '.' to '/tmp'
-- Fixed comments
-- Removed unused function 'escape_shell'
-
-lcovrc:
-- Introduced sample configuration file
-
-Makefile:
-- Added rule to install configuration file
-- Fixed installation path for man pages
-
-
-Version 1.3:
-============
-
-All:
-- Added compatibility for gcc-3.4
-
-lcov:
-- Modified --diff function to better cope with ambiguous entries in patch files
-- Modified --capture option to use modprobe before insmod (needed for 2.6)
-- Added --path option required for --diff function
-
-
-Version 1.2:
-============
-
-All:
-- Added compatibility for gcc-3.3
-- Adjusted LCOV-URL (http://ltp.sourceforge.net/coverage/lcov.php)
-- Minor changes to whitespaces/line breaks/spelling
-- Modified call mechanism so that parameters for external commands are not
- parsed by the shell mechanism anymore (no more problems with special
- characters in paths/filenames)
-- Added checksumming mechanism: each tracefile now contains a checksum for
- each instrumented line to detect incompatible data
-
-Makefile:
-- Added rule to build source RPM
-- Changed install path for executables (/usr/local/bin -> /usr/bin)
-
-lcov.spec:
-- Modified to support building source rpms
-
-updateversion.pl:
-- Modified to include update of release number in spec file
-
-genhtml:
-- Fixed bug which would not correctly associate data sets with an empty
- test name (only necessary when using --show-details in genhtml)
-- Implemented new command line option '--nochecksum' to suppress generation
- of checksums
-- Implemented new command line option '--highlight' which highlights lines of
- code which were only covered in converted tracefiles (see '--diff' option of
- lcov)
-
-geninfo:
-- Added workaround for a bug in gcov shipped with gcc-3.2 which aborts when
- encountering empty .da files
-- Fixed geninfo so that it does not abort after encountering empty .bb files
-- Added function to collect branch coverage data
-- Added check for gcov tool
-- Added check for the '--preserve-paths' option of gcov; if available, this
- will prevent losing .gcov files in some special cases (include files with
- same name in different subdirectories)
-- Implemented new command line option '--follow' to control whether or not
- links should be followed while searching for .da files.
-- Implemented new command line option '--nochecksum' to suppress generation
- of checksums
-
-lcov:
-- Fixed bug which would not correctly associate data sets with an empty
- test name (only necessary when using --show-details in genhtml)
-- Cleaned up internal command line option check
-- Files are now processed in alphabetical order
-- Added message when reading tracefiles
-- Implemented new command line option '--nochecksum' to suppress generation
- of checksums
-- Implemented new command line option '--diff' which allows converting
- coverage data from an older source code version by using a diff file
- to map line numbers
-- Implemented new command line option '--follow' to control whether or not
- links should be followed while searching for .da files.
-
-genpng:
-- Added support for the highlighting option of genhtml
-- Corrected tab to spaces conversion
-- Modified genpng to take number of spaces to use in place of tab as input
- instead of replacement string
-
-
-Version 1.1:
-============
-
-- Added CHANGES file
-- Added Makefile implementing the following targets:
- * install : install LCOV scripts and man pages
- * uninstall : revert previous installation
- * dist : create lcov.tar.gz file and lcov.rpm file
- * clean : clean up example directory, remove .tar and .rpm files
-- Added man pages for all scripts
-- Added example program to demonstrate the use of LCOV with a userspace
- application
-- Implemented RPM build process
-- New directory structure:
- * bin : contains all executables
- * example : contains a userspace example for LCOV
- * man : contains man pages
- * rpm : contains files required for the RPM build process
-- LCOV-scripts are now in bin/
-- Removed .pl-extension from LCOV-script files
-- Renamed readme.txt to README
-
-README:
-- Adjusted mailing list address to ltp-coverage@lists.sourceforge.net
-- Fixed incorrect parameter '--output-filename' in example LCOV call
-- Removed tool descriptions and turned them into man pages
-- Installation instructions now refer to RPM and tarball
-
-descriptions.tests:
-- Fixed some spelling errors
-
-genhtml:
-- Fixed bug which resulted in an error when trying to combine .info files
- containing data without a test name
-- Fixed bug which would not correctly handle data files in directories
- with names containing some special characters ('+', etc.)
-- Added check for empty tracefiles to prevent division-by-zeros
-- Implemented new command line option --num-spaces / the number of spaces
- which replace a tab in source code view is now user defined
-- Fixed tab expansion so that in source code view, a tab doesn't produce a
- fixed number of spaces, but as many spaces as are needed to advance to the
- next tab position
-- Output directory is now created if it doesn't exist
-- Renamed "overview page" to "directory view page"
-- HTML output pages are now titled "LCOV" instead of "GCOV"
-- Information messages are now printed to STDERR instead of STDOUT
-
-geninfo:
-- Fixed bug which would not allow .info files to be generated in directories
- with names containing some special characters
-- Information messages are now printed to STDERR instead of STDOUT
-
-lcov:
-- Fixed bug which would cause lcov to fail when the tool is installed in
- a path with a name containing some special characters
-- Implemented new command line option '--add-tracefile' which allows the
- combination of data from several tracefiles
-- Implemented new command line option '--list' which lists the contents
- of a tracefile
-- Implemented new command line option '--extract' which allows extracting
- data for a particular set of files from a tracefile
-- Implemented new command line option '--remove' which allows removing
- data for a particular set of files from a tracefile
-- Renamed '--reset' to '--zerocounters' to avoid a naming ambiguity with
- '--remove'
-- Changed name of gcov kernel directory from /proc/gcov to a global constant
- so that it may be changed easily when required in future versions
-- Information messages are now printed to STDERR instead of STDOUT
-
-
-Version 1.0 (2002-09-05):
-=========================
-
-- Initial version
-
diff --git a/chromium/third_party/lcov/COPYING b/chromium/third_party/lcov/COPYING
deleted file mode 100644
index d511905c164..00000000000
--- a/chromium/third_party/lcov/COPYING
+++ /dev/null
@@ -1,339 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Lesser General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- 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 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.
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) year name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.
diff --git a/chromium/third_party/lcov/Makefile b/chromium/third_party/lcov/Makefile
deleted file mode 100644
index 7cb838acbff..00000000000
--- a/chromium/third_party/lcov/Makefile
+++ /dev/null
@@ -1,99 +0,0 @@
-#
-# Makefile for LCOV
-#
-# Make targets:
-# - install: install LCOV tools and man pages on the system
-# - uninstall: remove tools and man pages from the system
-# - dist: create files required for distribution, i.e. the lcov.tar.gz
-# and the lcov.rpm file. Just make sure to adjust the VERSION
-# and RELEASE variables below - both version and date strings
-# will be updated in all necessary files.
-# - clean: remove all generated files
-#
-
-VERSION := 1.10
-RELEASE := 1
-
-CFG_DIR := $(PREFIX)/etc
-BIN_DIR := $(PREFIX)/usr/bin
-MAN_DIR := $(PREFIX)/usr/share/man
-TMP_DIR := /tmp/lcov-tmp.$(shell echo $$$$)
-FILES := $(wildcard bin/*) $(wildcard man/*) README CHANGES Makefile \
- $(wildcard rpm/*) lcovrc
-
-.PHONY: all info clean install uninstall rpms
-
-all: info
-
-info:
- @echo "Available make targets:"
- @echo " install : install binaries and man pages in PREFIX (default /)"
- @echo " uninstall : delete binaries and man pages from PREFIX (default /)"
- @echo " dist : create packages (RPM, tarball) ready for distribution"
-
-clean:
- rm -f lcov-*.tar.gz
- rm -f lcov-*.rpm
- make -C example clean
-
-install:
- bin/install.sh bin/lcov $(BIN_DIR)/lcov -m 755
- bin/install.sh bin/genhtml $(BIN_DIR)/genhtml -m 755
- bin/install.sh bin/geninfo $(BIN_DIR)/geninfo -m 755
- bin/install.sh bin/genpng $(BIN_DIR)/genpng -m 755
- bin/install.sh bin/gendesc $(BIN_DIR)/gendesc -m 755
- bin/install.sh man/lcov.1 $(MAN_DIR)/man1/lcov.1 -m 644
- bin/install.sh man/genhtml.1 $(MAN_DIR)/man1/genhtml.1 -m 644
- bin/install.sh man/geninfo.1 $(MAN_DIR)/man1/geninfo.1 -m 644
- bin/install.sh man/genpng.1 $(MAN_DIR)/man1/genpng.1 -m 644
- bin/install.sh man/gendesc.1 $(MAN_DIR)/man1/gendesc.1 -m 644
- bin/install.sh man/lcovrc.5 $(MAN_DIR)/man5/lcovrc.5 -m 644
- bin/install.sh lcovrc $(CFG_DIR)/lcovrc -m 644
-
-uninstall:
- bin/install.sh --uninstall bin/lcov $(BIN_DIR)/lcov
- bin/install.sh --uninstall bin/genhtml $(BIN_DIR)/genhtml
- bin/install.sh --uninstall bin/geninfo $(BIN_DIR)/geninfo
- bin/install.sh --uninstall bin/genpng $(BIN_DIR)/genpng
- bin/install.sh --uninstall bin/gendesc $(BIN_DIR)/gendesc
- bin/install.sh --uninstall man/lcov.1 $(MAN_DIR)/man1/lcov.1
- bin/install.sh --uninstall man/genhtml.1 $(MAN_DIR)/man1/genhtml.1
- bin/install.sh --uninstall man/geninfo.1 $(MAN_DIR)/man1/geninfo.1
- bin/install.sh --uninstall man/genpng.1 $(MAN_DIR)/man1/genpng.1
- bin/install.sh --uninstall man/gendesc.1 $(MAN_DIR)/man1/gendesc.1
- bin/install.sh --uninstall man/lcovrc.5 $(MAN_DIR)/man5/lcovrc.5
- bin/install.sh --uninstall lcovrc $(CFG_DIR)/lcovrc
-
-dist: lcov-$(VERSION).tar.gz lcov-$(VERSION)-$(RELEASE).noarch.rpm \
- lcov-$(VERSION)-$(RELEASE).src.rpm
-
-lcov-$(VERSION).tar.gz: $(FILES)
- mkdir $(TMP_DIR)
- mkdir $(TMP_DIR)/lcov-$(VERSION)
- cp -r * $(TMP_DIR)/lcov-$(VERSION)
- find $(TMP_DIR)/lcov-$(VERSION) -name CVS -type d | xargs rm -rf
- make -C $(TMP_DIR)/lcov-$(VERSION) clean
- bin/updateversion.pl $(TMP_DIR)/lcov-$(VERSION) $(VERSION) $(RELEASE)
- cd $(TMP_DIR) ; \
- tar cfz $(TMP_DIR)/lcov-$(VERSION).tar.gz lcov-$(VERSION)
- mv $(TMP_DIR)/lcov-$(VERSION).tar.gz .
- rm -rf $(TMP_DIR)
-
-lcov-$(VERSION)-$(RELEASE).noarch.rpm: rpms
-lcov-$(VERSION)-$(RELEASE).src.rpm: rpms
-
-rpms: lcov-$(VERSION).tar.gz
- mkdir $(TMP_DIR)
- mkdir $(TMP_DIR)/BUILD
- mkdir $(TMP_DIR)/RPMS
- mkdir $(TMP_DIR)/SOURCES
- mkdir $(TMP_DIR)/SRPMS
- cp lcov-$(VERSION).tar.gz $(TMP_DIR)/SOURCES
- cd $(TMP_DIR)/BUILD ; \
- tar xfz $(TMP_DIR)/SOURCES/lcov-$(VERSION).tar.gz \
- lcov-$(VERSION)/rpm/lcov.spec
- rpmbuild --define '_topdir $(TMP_DIR)' \
- -ba $(TMP_DIR)/BUILD/lcov-$(VERSION)/rpm/lcov.spec
- mv $(TMP_DIR)/RPMS/noarch/lcov-$(VERSION)-$(RELEASE).noarch.rpm .
- mv $(TMP_DIR)/SRPMS/lcov-$(VERSION)-$(RELEASE).src.rpm .
- rm -rf $(TMP_DIR)
diff --git a/chromium/third_party/lcov/README b/chromium/third_party/lcov/README
deleted file mode 100644
index 7fcd43828bc..00000000000
--- a/chromium/third_party/lcov/README
+++ /dev/null
@@ -1,137 +0,0 @@
--------------------------------------------------
-- README file for the LTP GCOV extension (LCOV) -
-- Last changes: 2012-10-10 -
--------------------------------------------------
-
-Description
------------
- LCOV is an extension of GCOV, a GNU tool which provides information about
- what parts of a program are actually executed (i.e. "covered") while running
- a particular test case. The extension consists of a set of Perl scripts
- which build on the textual GCOV output to implement the following enhanced
- functionality:
-
- * HTML based output: coverage rates are additionally indicated using bar
- graphs and specific colors.
-
- * Support for large projects: overview pages allow quick browsing of
- coverage data by providing three levels of detail: directory view,
- file view and source code view.
-
- LCOV was initially designed to support Linux kernel coverage measurements,
- but works as well for coverage measurements on standard user space
- applications.
-
-
-Further README contents
------------------------
- 1. Included files
- 2. Installing LCOV
- 3. An example of how to access kernel coverage data
- 4. An example of how to access coverage data for a user space program
- 5. Questions and Comments
-
-
-
-1. Important files
-------------------
- README - This README file
- CHANGES - List of changes between releases
- bin/lcov - Tool for capturing LCOV coverage data
- bin/genhtml - Tool for creating HTML output from LCOV data
- bin/gendesc - Tool for creating description files as used by genhtml
- bin/geninfo - Internal tool (creates LCOV data files)
- bin/genpng - Internal tool (creates png overviews of source files)
- bin/install.sh - Internal tool (takes care of un-/installing)
- descriptions.tests - Test descriptions for the LTP suite, use with gendesc
- man - Directory containing man pages for included tools
- example - Directory containing an example to demonstrate LCOV
- lcovrc - LCOV configuration file
- Makefile - Makefile providing 'install' and 'uninstall' targets
-
-
-2. Installing LCOV
-------------------
-The LCOV package is available as either RPM or tarball from:
-
- http://ltp.sourceforge.net/coverage/lcov.php
-
-To install the tarball, unpack it to a directory and run:
-
- make install
-
-Use anonymous CVS for the most recent (but possibly unstable) version:
-
- cvs -d:pserver:anonymous@ltp.cvs.sourceforge.net:/cvsroot/ltp login
-
-(simply press the ENTER key when asked for a password)
-
- cvs -z3 -d:pserver:anonymous@ltp.cvs.sourceforge.net:/cvsroot/ltp export -D now utils
-
-Change to the utils/analysis/lcov directory and type:
-
- make install
-
-
-3. An example of how to access kernel coverage data
----------------------------------------------------
-Requirements: get and install the gcov-kernel package from
-
- http://sourceforge.net/projects/ltp
-
-Copy the resulting gcov kernel module file to either the system wide modules
-directory or the same directory as the Perl scripts. As root, do the following:
-
- a) Resetting counters
-
- lcov --zerocounters
-
- b) Capturing the current coverage state to a file
-
- lcov --capture --output-file kernel.info
-
- c) Getting HTML output
-
- genhtml kernel.info
-
-Point the web browser of your choice to the resulting index.html file.
-
-
-4. An example of how to access coverage data for a user space program
----------------------------------------------------------------------
-Requirements: compile the program in question using GCC with the options
--fprofile-arcs and -ftest-coverage. During linking, make sure to specify
--lgcov or -coverage.
-
-Assuming the compile directory is called "appdir", do the following:
-
- a) Resetting counters
-
- lcov --directory appdir --zerocounters
-
- b) Capturing the current coverage state to a file (works only after the
- application has been started and stopped at least once)
-
- lcov --directory appdir --capture --output-file app.info
-
- c) Getting HTML output
-
- genhtml app.info
-
-Point the web browser of your choice to the resulting index.html file.
-
-Please note that independently of where the application is installed or
-from which directory it is run, the --directory statement needs to
-point to the directory in which the application was compiled.
-
-For further information on the gcc profiling mechanism, please also
-consult the gcov man page.
-
-
-5. Questions and comments
--------------------------
-See the included man pages for more information on how to use the LCOV tools.
-
-Please email further questions or comments regarding this tool to the
-LTP Mailing list at ltp-coverage@lists.sourceforge.net
-
diff --git a/chromium/third_party/lcov/README.chromium b/chromium/third_party/lcov/README.chromium
deleted file mode 100644
index 03f6af990b9..00000000000
--- a/chromium/third_party/lcov/README.chromium
+++ /dev/null
@@ -1,17 +0,0 @@
-Name: LCOV - the LTP GCOV extension
-Short Name: lcov
-URL: http://ltp.sourceforge.net/coverage/lcov.php
-Version: 1.10
-License: GPL v2
-License file: COPYING
-Security Critical: no
-
-Description:
-This directory contains a stock lcov-1.10 with the following changes:
-
-- Added bin/mcov, an assembly script derived from lcov which is
- particularly useful for dealing with Mac XCode build paths.
-- Added LICENSE file which symlinks to COPYING
-
-N.B.: This code will not be shipped with Chrome.
- It is only part of the build/test infrastructure. \ No newline at end of file
diff --git a/chromium/third_party/lcov/bin/gendesc b/chromium/third_party/lcov/bin/gendesc
deleted file mode 100755
index f4cfcbc52b9..00000000000
--- a/chromium/third_party/lcov/bin/gendesc
+++ /dev/null
@@ -1,226 +0,0 @@
-#!/usr/bin/perl -w
-#
-# Copyright (c) International Business Machines Corp., 2002
-#
-# 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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-#
-# gendesc
-#
-# This script creates a description file as understood by genhtml.
-# Input file format:
-#
-# For each test case:
-# <test name><optional whitespace>
-# <at least one whitespace character (blank/tab)><test description>
-#
-# Actual description may consist of several lines. By default, output is
-# written to stdout. Test names consist of alphanumeric characters
-# including _ and -.
-#
-#
-# History:
-# 2002-09-02: created by Peter Oberparleiter <Peter.Oberparleiter@de.ibm.com>
-#
-
-use strict;
-use File::Basename;
-use Getopt::Long;
-
-
-# Constants
-our $lcov_version = 'LCOV version 1.10';
-our $lcov_url = "http://ltp.sourceforge.net/coverage/lcov.php";
-our $tool_name = basename($0);
-
-
-# Prototypes
-sub print_usage(*);
-sub gen_desc();
-sub warn_handler($);
-sub die_handler($);
-
-
-# Global variables
-our $help;
-our $version;
-our $output_filename;
-our $input_filename;
-
-
-#
-# Code entry point
-#
-
-$SIG{__WARN__} = \&warn_handler;
-$SIG{__DIE__} = \&die_handler;
-
-# Prettify version string
-$lcov_version =~ s/\$\s*Revision\s*:?\s*(\S+)\s*\$/$1/;
-
-# Parse command line options
-if (!GetOptions("output-filename=s" => \$output_filename,
- "version" =>\$version,
- "help|?" => \$help
- ))
-{
- print(STDERR "Use $tool_name --help to get usage information\n");
- exit(1);
-}
-
-$input_filename = $ARGV[0];
-
-# Check for help option
-if ($help)
-{
- print_usage(*STDOUT);
- exit(0);
-}
-
-# Check for version option
-if ($version)
-{
- print("$tool_name: $lcov_version\n");
- exit(0);
-}
-
-
-# Check for input filename
-if (!$input_filename)
-{
- die("No input filename specified\n".
- "Use $tool_name --help to get usage information\n");
-}
-
-# Do something
-gen_desc();
-
-
-#
-# print_usage(handle)
-#
-# Write out command line usage information to given filehandle.
-#
-
-sub print_usage(*)
-{
- local *HANDLE = $_[0];
-
- print(HANDLE <<END_OF_USAGE)
-Usage: $tool_name [OPTIONS] INPUTFILE
-
-Convert a test case description file into a format as understood by genhtml.
-
- -h, --help Print this help, then exit
- -v, --version Print version number, then exit
- -o, --output-filename FILENAME Write description to FILENAME
-
-For more information see: $lcov_url
-END_OF_USAGE
- ;
-}
-
-
-#
-# gen_desc()
-#
-# Read text file INPUT_FILENAME and convert the contained description to a
-# format as understood by genhtml, i.e.
-#
-# TN:<test name>
-# TD:<test description>
-#
-# If defined, write output to OUTPUT_FILENAME, otherwise to stdout.
-#
-# Die on error.
-#
-
-sub gen_desc()
-{
- local *INPUT_HANDLE;
- local *OUTPUT_HANDLE;
- my $empty_line = "ignore";
-
- open(INPUT_HANDLE, "<", $input_filename)
- or die("ERROR: cannot open $input_filename!\n");
-
- # Open output file for writing
- if ($output_filename)
- {
- open(OUTPUT_HANDLE, ">", $output_filename)
- or die("ERROR: cannot create $output_filename!\n");
- }
- else
- {
- *OUTPUT_HANDLE = *STDOUT;
- }
-
- # Process all lines in input file
- while (<INPUT_HANDLE>)
- {
- chomp($_);
-
- if (/^(\w[\w-]*)(\s*)$/)
- {
- # Matched test name
- # Name starts with alphanum or _, continues with
- # alphanum, _ or -
- print(OUTPUT_HANDLE "TN: $1\n");
- $empty_line = "ignore";
- }
- elsif (/^(\s+)(\S.*?)\s*$/)
- {
- # Matched test description
- if ($empty_line eq "insert")
- {
- # Write preserved empty line
- print(OUTPUT_HANDLE "TD: \n");
- }
- print(OUTPUT_HANDLE "TD: $2\n");
- $empty_line = "observe";
- }
- elsif (/^\s*$/)
- {
- # Matched empty line to preserve paragraph separation
- # inside description text
- if ($empty_line eq "observe")
- {
- $empty_line = "insert";
- }
- }
- }
-
- # Close output file if defined
- if ($output_filename)
- {
- close(OUTPUT_HANDLE);
- }
-
- close(INPUT_HANDLE);
-}
-
-sub warn_handler($)
-{
- my ($msg) = @_;
-
- warn("$tool_name: $msg");
-}
-
-sub die_handler($)
-{
- my ($msg) = @_;
-
- die("$tool_name: $msg");
-}
diff --git a/chromium/third_party/lcov/bin/genhtml b/chromium/third_party/lcov/bin/genhtml
deleted file mode 100755
index 8979f8c813d..00000000000
--- a/chromium/third_party/lcov/bin/genhtml
+++ /dev/null
@@ -1,5799 +0,0 @@
-#!/usr/bin/perl -w
-#
-# Copyright (c) International Business Machines Corp., 2002,2012
-#
-# 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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-#
-# genhtml
-#
-# This script generates HTML output from .info files as created by the
-# geninfo script. Call it with --help and refer to the genhtml man page
-# to get information on usage and available options.
-#
-#
-# History:
-# 2002-08-23 created by Peter Oberparleiter <Peter.Oberparleiter@de.ibm.com>
-# IBM Lab Boeblingen
-# based on code by Manoj Iyer <manjo@mail.utexas.edu> and
-# Megan Bock <mbock@us.ibm.com>
-# IBM Austin
-# 2002-08-27 / Peter Oberparleiter: implemented frame view
-# 2002-08-29 / Peter Oberparleiter: implemented test description filtering
-# so that by default only descriptions for test cases which
-# actually hit some source lines are kept
-# 2002-09-05 / Peter Oberparleiter: implemented --no-sourceview
-# 2002-09-05 / Mike Kobler: One of my source file paths includes a "+" in
-# the directory name. I found that genhtml.pl died when it
-# encountered it. I was able to fix the problem by modifying
-# the string with the escape character before parsing it.
-# 2002-10-26 / Peter Oberparleiter: implemented --num-spaces
-# 2003-04-07 / Peter Oberparleiter: fixed bug which resulted in an error
-# when trying to combine .info files containing data without
-# a test name
-# 2003-04-10 / Peter Oberparleiter: extended fix by Mike to also cover
-# other special characters
-# 2003-04-30 / Peter Oberparleiter: made info write to STDERR, not STDOUT
-# 2003-07-10 / Peter Oberparleiter: added line checksum support
-# 2004-08-09 / Peter Oberparleiter: added configuration file support
-# 2005-03-04 / Cal Pierog: added legend to HTML output, fixed coloring of
-# "good coverage" background
-# 2006-03-18 / Marcus Boerger: added --custom-intro, --custom-outro and
-# overwrite --no-prefix if --prefix is present
-# 2006-03-20 / Peter Oberparleiter: changes to custom_* function (rename
-# to html_prolog/_epilog, minor modifications to implementation),
-# changed prefix/noprefix handling to be consistent with current
-# logic
-# 2006-03-20 / Peter Oberparleiter: added --html-extension option
-# 2008-07-14 / Tom Zoerner: added --function-coverage command line option;
-# added function table to source file page
-# 2008-08-13 / Peter Oberparleiter: modified function coverage
-# implementation (now enabled per default),
-# introduced sorting option (enabled per default)
-#
-
-use strict;
-use File::Basename;
-use Getopt::Long;
-use Digest::MD5 qw(md5_base64);
-
-
-# Global constants
-our $title = "LCOV - code coverage report";
-our $lcov_version = 'LCOV version 1.10';
-our $lcov_url = "http://ltp.sourceforge.net/coverage/lcov.php";
-our $tool_name = basename($0);
-
-# Specify coverage rate limits (in %) for classifying file entries
-# HI: $hi_limit <= rate <= 100 graph color: green
-# MED: $med_limit <= rate < $hi_limit graph color: orange
-# LO: 0 <= rate < $med_limit graph color: red
-
-# For line coverage/all coverage types if not specified
-our $hi_limit = 90;
-our $med_limit = 75;
-
-# For function coverage
-our $fn_hi_limit;
-our $fn_med_limit;
-
-# For branch coverage
-our $br_hi_limit;
-our $br_med_limit;
-
-# Width of overview image
-our $overview_width = 80;
-
-# Resolution of overview navigation: this number specifies the maximum
-# difference in lines between the position a user selected from the overview
-# and the position the source code window is scrolled to.
-our $nav_resolution = 4;
-
-# Clicking a line in the overview image should show the source code view at
-# a position a bit further up so that the requested line is not the first
-# line in the window. This number specifies that offset in lines.
-our $nav_offset = 10;
-
-# Clicking on a function name should show the source code at a position a
-# few lines before the first line of code of that function. This number
-# specifies that offset in lines.
-our $func_offset = 2;
-
-our $overview_title = "top level";
-
-# Width for line coverage information in the source code view
-our $line_field_width = 12;
-
-# Width for branch coverage information in the source code view
-our $br_field_width = 16;
-
-# Internal Constants
-
-# Header types
-our $HDR_DIR = 0;
-our $HDR_FILE = 1;
-our $HDR_SOURCE = 2;
-our $HDR_TESTDESC = 3;
-our $HDR_FUNC = 4;
-
-# Sort types
-our $SORT_FILE = 0;
-our $SORT_LINE = 1;
-our $SORT_FUNC = 2;
-our $SORT_BRANCH = 3;
-
-# Fileview heading types
-our $HEAD_NO_DETAIL = 1;
-our $HEAD_DETAIL_HIDDEN = 2;
-our $HEAD_DETAIL_SHOWN = 3;
-
-# Offsets for storing branch coverage data in vectors
-our $BR_BLOCK = 0;
-our $BR_BRANCH = 1;
-our $BR_TAKEN = 2;
-our $BR_VEC_ENTRIES = 3;
-our $BR_VEC_WIDTH = 32;
-
-# Additional offsets used when converting branch coverage data to HTML
-our $BR_LEN = 3;
-our $BR_OPEN = 4;
-our $BR_CLOSE = 5;
-
-# Branch data combination types
-our $BR_SUB = 0;
-our $BR_ADD = 1;
-
-# Error classes which users may specify to ignore during processing
-our $ERROR_SOURCE = 0;
-our %ERROR_ID = (
- "source" => $ERROR_SOURCE,
-);
-
-# Data related prototypes
-sub print_usage(*);
-sub gen_html();
-sub html_create($$);
-sub process_dir($);
-sub process_file($$$);
-sub info(@);
-sub read_info_file($);
-sub get_info_entry($);
-sub set_info_entry($$$$$$$$$;$$$$$$);
-sub get_prefix($@);
-sub shorten_prefix($);
-sub get_dir_list(@);
-sub get_relative_base_path($);
-sub read_testfile($);
-sub get_date_string();
-sub create_sub_dir($);
-sub subtract_counts($$);
-sub add_counts($$);
-sub apply_baseline($$);
-sub remove_unused_descriptions();
-sub get_found_and_hit($);
-sub get_affecting_tests($$$);
-sub combine_info_files($$);
-sub merge_checksums($$$);
-sub combine_info_entries($$$);
-sub apply_prefix($$);
-sub system_no_output($@);
-sub read_config($);
-sub apply_config($);
-sub get_html_prolog($);
-sub get_html_epilog($);
-sub write_dir_page($$$$$$$$$$$$$$$$$);
-sub classify_rate($$$$);
-sub br_taken_add($$);
-sub br_taken_sub($$);
-sub br_ivec_len($);
-sub br_ivec_get($$);
-sub br_ivec_push($$$$);
-sub combine_brcount($$$);
-sub get_br_found_and_hit($);
-sub warn_handler($);
-sub die_handler($);
-sub parse_ignore_errors(@);
-sub rate($$;$$$);
-
-
-# HTML related prototypes
-sub escape_html($);
-sub get_bar_graph_code($$$);
-
-sub write_png_files();
-sub write_htaccess_file();
-sub write_css_file();
-sub write_description_file($$$$$$$);
-sub write_function_table(*$$$$$$$$$$);
-
-sub write_html(*$);
-sub write_html_prolog(*$$);
-sub write_html_epilog(*$;$);
-
-sub write_header(*$$$$$$$$$$);
-sub write_header_prolog(*$);
-sub write_header_line(*@);
-sub write_header_epilog(*$);
-
-sub write_file_table(*$$$$$$$);
-sub write_file_table_prolog(*$@);
-sub write_file_table_entry(*$$$@);
-sub write_file_table_detail_entry(*$@);
-sub write_file_table_epilog(*);
-
-sub write_test_table_prolog(*$);
-sub write_test_table_entry(*$$);
-sub write_test_table_epilog(*);
-
-sub write_source($$$$$$$);
-sub write_source_prolog(*);
-sub write_source_line(*$$$$$$);
-sub write_source_epilog(*);
-
-sub write_frameset(*$$$);
-sub write_overview_line(*$$$);
-sub write_overview(*$$$$);
-
-# External prototype (defined in genpng)
-sub gen_png($$$@);
-
-
-# Global variables & initialization
-our %info_data; # Hash containing all data from .info file
-our $dir_prefix; # Prefix to remove from all sub directories
-our %test_description; # Hash containing test descriptions if available
-our $date = get_date_string();
-
-our @info_filenames; # List of .info files to use as data source
-our $test_title; # Title for output as written to each page header
-our $output_directory; # Name of directory in which to store output
-our $base_filename; # Optional name of file containing baseline data
-our $desc_filename; # Name of file containing test descriptions
-our $css_filename; # Optional name of external stylesheet file to use
-our $quiet; # If set, suppress information messages
-our $help; # Help option flag
-our $version; # Version option flag
-our $show_details; # If set, generate detailed directory view
-our $no_prefix; # If set, do not remove filename prefix
-our $func_coverage; # If set, generate function coverage statistics
-our $no_func_coverage; # Disable func_coverage
-our $br_coverage; # If set, generate branch coverage statistics
-our $no_br_coverage; # Disable br_coverage
-our $sort = 1; # If set, provide directory listings with sorted entries
-our $no_sort; # Disable sort
-our $frames; # If set, use frames for source code view
-our $keep_descriptions; # If set, do not remove unused test case descriptions
-our $no_sourceview; # If set, do not create a source code view for each file
-our $highlight; # If set, highlight lines covered by converted data only
-our $legend; # If set, include legend in output
-our $tab_size = 8; # Number of spaces to use in place of tab
-our $config; # Configuration file contents
-our $html_prolog_file; # Custom HTML prolog file (up to and including <body>)
-our $html_epilog_file; # Custom HTML epilog file (from </body> onwards)
-our $html_prolog; # Actual HTML prolog
-our $html_epilog; # Actual HTML epilog
-our $html_ext = "html"; # Extension for generated HTML files
-our $html_gzip = 0; # Compress with gzip
-our $demangle_cpp = 0; # Demangle C++ function names
-our @opt_ignore_errors; # Ignore certain error classes during processing
-our @ignore;
-our $opt_config_file; # User-specified configuration file location
-our %opt_rc;
-our $charset = "UTF-8"; # Default charset for HTML pages
-our @fileview_sortlist;
-our @fileview_sortname = ("", "-sort-l", "-sort-f", "-sort-b");
-our @funcview_sortlist;
-our @rate_name = ("Lo", "Med", "Hi");
-our @rate_png = ("ruby.png", "amber.png", "emerald.png");
-our $lcov_func_coverage = 1;
-our $lcov_branch_coverage = 0;
-
-our $cwd = `pwd`; # Current working directory
-chomp($cwd);
-our $tool_dir = dirname($0); # Directory where genhtml tool is installed
-
-
-#
-# Code entry point
-#
-
-$SIG{__WARN__} = \&warn_handler;
-$SIG{__DIE__} = \&die_handler;
-
-# Prettify version string
-$lcov_version =~ s/\$\s*Revision\s*:?\s*(\S+)\s*\$/$1/;
-
-# Add current working directory if $tool_dir is not already an absolute path
-if (! ($tool_dir =~ /^\/(.*)$/))
-{
- $tool_dir = "$cwd/$tool_dir";
-}
-
-# Check command line for a configuration file name
-Getopt::Long::Configure("pass_through", "no_auto_abbrev");
-GetOptions("config-file=s" => \$opt_config_file,
- "rc=s%" => \%opt_rc);
-Getopt::Long::Configure("default");
-
-# Read configuration file if available
-if (defined($opt_config_file)) {
- $config = read_config($opt_config_file);
-} elsif (defined($ENV{"HOME"}) && (-r $ENV{"HOME"}."/.lcovrc"))
-{
- $config = read_config($ENV{"HOME"}."/.lcovrc");
-}
-elsif (-r "/etc/lcovrc")
-{
- $config = read_config("/etc/lcovrc");
-}
-
-if ($config || %opt_rc)
-{
- # Copy configuration file and --rc values to variables
- apply_config({
- "genhtml_css_file" => \$css_filename,
- "genhtml_hi_limit" => \$hi_limit,
- "genhtml_med_limit" => \$med_limit,
- "genhtml_line_field_width" => \$line_field_width,
- "genhtml_overview_width" => \$overview_width,
- "genhtml_nav_resolution" => \$nav_resolution,
- "genhtml_nav_offset" => \$nav_offset,
- "genhtml_keep_descriptions" => \$keep_descriptions,
- "genhtml_no_prefix" => \$no_prefix,
- "genhtml_no_source" => \$no_sourceview,
- "genhtml_num_spaces" => \$tab_size,
- "genhtml_highlight" => \$highlight,
- "genhtml_legend" => \$legend,
- "genhtml_html_prolog" => \$html_prolog_file,
- "genhtml_html_epilog" => \$html_epilog_file,
- "genhtml_html_extension" => \$html_ext,
- "genhtml_html_gzip" => \$html_gzip,
- "genhtml_function_hi_limit" => \$fn_hi_limit,
- "genhtml_function_med_limit" => \$fn_med_limit,
- "genhtml_function_coverage" => \$func_coverage,
- "genhtml_branch_hi_limit" => \$br_hi_limit,
- "genhtml_branch_med_limit" => \$br_med_limit,
- "genhtml_branch_coverage" => \$br_coverage,
- "genhtml_branch_field_width" => \$br_field_width,
- "genhtml_sort" => \$sort,
- "genhtml_charset" => \$charset,
- "lcov_function_coverage" => \$lcov_func_coverage,
- "lcov_branch_coverage" => \$lcov_branch_coverage,
- });
-}
-
-# Copy related values if not specified
-$fn_hi_limit = $hi_limit if (!defined($fn_hi_limit));
-$fn_med_limit = $med_limit if (!defined($fn_med_limit));
-$br_hi_limit = $hi_limit if (!defined($br_hi_limit));
-$br_med_limit = $med_limit if (!defined($br_med_limit));
-$func_coverage = $lcov_func_coverage if (!defined($func_coverage));
-$br_coverage = $lcov_branch_coverage if (!defined($br_coverage));
-
-# Parse command line options
-if (!GetOptions("output-directory|o=s" => \$output_directory,
- "title|t=s" => \$test_title,
- "description-file|d=s" => \$desc_filename,
- "keep-descriptions|k" => \$keep_descriptions,
- "css-file|c=s" => \$css_filename,
- "baseline-file|b=s" => \$base_filename,
- "prefix|p=s" => \$dir_prefix,
- "num-spaces=i" => \$tab_size,
- "no-prefix" => \$no_prefix,
- "no-sourceview" => \$no_sourceview,
- "show-details|s" => \$show_details,
- "frames|f" => \$frames,
- "highlight" => \$highlight,
- "legend" => \$legend,
- "quiet|q" => \$quiet,
- "help|h|?" => \$help,
- "version|v" => \$version,
- "html-prolog=s" => \$html_prolog_file,
- "html-epilog=s" => \$html_epilog_file,
- "html-extension=s" => \$html_ext,
- "html-gzip" => \$html_gzip,
- "function-coverage" => \$func_coverage,
- "no-function-coverage" => \$no_func_coverage,
- "branch-coverage" => \$br_coverage,
- "no-branch-coverage" => \$no_br_coverage,
- "sort" => \$sort,
- "no-sort" => \$no_sort,
- "demangle-cpp" => \$demangle_cpp,
- "ignore-errors=s" => \@opt_ignore_errors,
- "config-file=s" => \$opt_config_file,
- "rc=s%" => \%opt_rc,
- ))
-{
- print(STDERR "Use $tool_name --help to get usage information\n");
- exit(1);
-} else {
- # Merge options
- if ($no_func_coverage) {
- $func_coverage = 0;
- }
- if ($no_br_coverage) {
- $br_coverage = 0;
- }
-
- # Merge sort options
- if ($no_sort) {
- $sort = 0;
- }
-}
-
-@info_filenames = @ARGV;
-
-# Check for help option
-if ($help)
-{
- print_usage(*STDOUT);
- exit(0);
-}
-
-# Check for version option
-if ($version)
-{
- print("$tool_name: $lcov_version\n");
- exit(0);
-}
-
-# Determine which errors the user wants us to ignore
-parse_ignore_errors(@opt_ignore_errors);
-
-# Check for info filename
-if (!@info_filenames)
-{
- die("No filename specified\n".
- "Use $tool_name --help to get usage information\n");
-}
-
-# Generate a title if none is specified
-if (!$test_title)
-{
- if (scalar(@info_filenames) == 1)
- {
- # Only one filename specified, use it as title
- $test_title = basename($info_filenames[0]);
- }
- else
- {
- # More than one filename specified, used default title
- $test_title = "unnamed";
- }
-}
-
-# Make sure css_filename is an absolute path (in case we're changing
-# directories)
-if ($css_filename)
-{
- if (!($css_filename =~ /^\/(.*)$/))
- {
- $css_filename = $cwd."/".$css_filename;
- }
-}
-
-# Make sure tab_size is within valid range
-if ($tab_size < 1)
-{
- print(STDERR "ERROR: invalid number of spaces specified: ".
- "$tab_size!\n");
- exit(1);
-}
-
-# Get HTML prolog and epilog
-$html_prolog = get_html_prolog($html_prolog_file);
-$html_epilog = get_html_epilog($html_epilog_file);
-
-# Issue a warning if --no-sourceview is enabled together with --frames
-if ($no_sourceview && defined($frames))
-{
- warn("WARNING: option --frames disabled because --no-sourceview ".
- "was specified!\n");
- $frames = undef;
-}
-
-# Issue a warning if --no-prefix is enabled together with --prefix
-if ($no_prefix && defined($dir_prefix))
-{
- warn("WARNING: option --prefix disabled because --no-prefix was ".
- "specified!\n");
- $dir_prefix = undef;
-}
-
-@fileview_sortlist = ($SORT_FILE);
-@funcview_sortlist = ($SORT_FILE);
-
-if ($sort) {
- push(@fileview_sortlist, $SORT_LINE);
- push(@fileview_sortlist, $SORT_FUNC) if ($func_coverage);
- push(@fileview_sortlist, $SORT_BRANCH) if ($br_coverage);
- push(@funcview_sortlist, $SORT_LINE);
-}
-
-if ($frames)
-{
- # Include genpng code needed for overview image generation
- do("$tool_dir/genpng");
-}
-
-# Ensure that the c++filt tool is available when using --demangle-cpp
-if ($demangle_cpp)
-{
- if (system_no_output(3, "c++filt", "--version")) {
- die("ERROR: could not find c++filt tool needed for ".
- "--demangle-cpp\n");
- }
-}
-
-# Make sure output_directory exists, create it if necessary
-if ($output_directory)
-{
- stat($output_directory);
-
- if (! -e _)
- {
- create_sub_dir($output_directory);
- }
-}
-
-# Do something
-gen_html();
-
-exit(0);
-
-
-
-#
-# print_usage(handle)
-#
-# Print usage information.
-#
-
-sub print_usage(*)
-{
- local *HANDLE = $_[0];
-
- print(HANDLE <<END_OF_USAGE);
-Usage: $tool_name [OPTIONS] INFOFILE(S)
-
-Create HTML output for coverage data found in INFOFILE. Note that INFOFILE
-may also be a list of filenames.
-
-Misc:
- -h, --help Print this help, then exit
- -v, --version Print version number, then exit
- -q, --quiet Do not print progress messages
- --config-file FILENAME Specify configuration file location
- --rc SETTING=VALUE Override configuration file setting
- --ignore-errors ERRORS Continue after ERRORS (source)
-
-Operation:
- -o, --output-directory OUTDIR Write HTML output to OUTDIR
- -s, --show-details Generate detailed directory view
- -d, --description-file DESCFILE Read test case descriptions from DESCFILE
- -k, --keep-descriptions Do not remove unused test descriptions
- -b, --baseline-file BASEFILE Use BASEFILE as baseline file
- -p, --prefix PREFIX Remove PREFIX from all directory names
- --no-prefix Do not remove prefix from directory names
- --(no-)function-coverage Enable (disable) function coverage display
- --(no-)branch-coverage Enable (disable) branch coverage display
-
-HTML output:
- -f, --frames Use HTML frames for source code view
- -t, --title TITLE Display TITLE in header of all pages
- -c, --css-file CSSFILE Use external style sheet file CSSFILE
- --no-source Do not create source code view
- --num-spaces NUM Replace tabs with NUM spaces in source view
- --highlight Highlight lines with converted-only data
- --legend Include color legend in HTML output
- --html-prolog FILE Use FILE as HTML prolog for generated pages
- --html-epilog FILE Use FILE as HTML epilog for generated pages
- --html-extension EXT Use EXT as filename extension for pages
- --html-gzip Use gzip to compress HTML
- --(no-)sort Enable (disable) sorted coverage views
- --demangle-cpp Demangle C++ function names
-
-For more information see: $lcov_url
-END_OF_USAGE
- ;
-}
-
-
-#
-# get_rate(found, hit)
-#
-# Return a relative value for the specified found&hit values
-# which is used for sorting the corresponding entries in a
-# file list.
-#
-
-sub get_rate($$)
-{
- my ($found, $hit) = @_;
-
- if ($found == 0) {
- return 10000;
- }
- return int($hit * 1000 / $found) * 10 + 2 - (1 / $found);
-}
-
-
-#
-# get_overall_line(found, hit, name_singular, name_plural)
-#
-# Return a string containing overall information for the specified
-# found/hit data.
-#
-
-sub get_overall_line($$$$)
-{
- my ($found, $hit, $name_sn, $name_pl) = @_;
- my $name;
-
- return "no data found" if (!defined($found) || $found == 0);
- $name = ($found == 1) ? $name_sn : $name_pl;
- return rate($hit, $found, "% ($hit of $found $name)");
-}
-
-
-#
-# print_overall_rate(ln_do, ln_found, ln_hit, fn_do, fn_found, fn_hit, br_do
-# br_found, br_hit)
-#
-# Print overall coverage rates for the specified coverage types.
-#
-
-sub print_overall_rate($$$$$$$$$)
-{
- my ($ln_do, $ln_found, $ln_hit, $fn_do, $fn_found, $fn_hit,
- $br_do, $br_found, $br_hit) = @_;
-
- info("Overall coverage rate:\n");
- info(" lines......: %s\n",
- get_overall_line($ln_found, $ln_hit, "line", "lines"))
- if ($ln_do);
- info(" functions..: %s\n",
- get_overall_line($fn_found, $fn_hit, "function", "functions"))
- if ($fn_do);
- info(" branches...: %s\n",
- get_overall_line($br_found, $br_hit, "branch", "branches"))
- if ($br_do);
-}
-
-
-#
-# gen_html()
-#
-# Generate a set of HTML pages from contents of .info file INFO_FILENAME.
-# Files will be written to the current directory. If provided, test case
-# descriptions will be read from .tests file TEST_FILENAME and included
-# in ouput.
-#
-# Die on error.
-#
-
-sub gen_html()
-{
- local *HTML_HANDLE;
- my %overview;
- my %base_data;
- my $lines_found;
- my $lines_hit;
- my $fn_found;
- my $fn_hit;
- my $br_found;
- my $br_hit;
- my $overall_found = 0;
- my $overall_hit = 0;
- my $total_fn_found = 0;
- my $total_fn_hit = 0;
- my $total_br_found = 0;
- my $total_br_hit = 0;
- my $dir_name;
- my $link_name;
- my @dir_list;
- my %new_info;
-
- # Read in all specified .info files
- foreach (@info_filenames)
- {
- %new_info = %{read_info_file($_)};
-
- # Combine %new_info with %info_data
- %info_data = %{combine_info_files(\%info_data, \%new_info)};
- }
-
- info("Found %d entries.\n", scalar(keys(%info_data)));
-
- # Read and apply baseline data if specified
- if ($base_filename)
- {
- # Read baseline file
- info("Reading baseline file $base_filename\n");
- %base_data = %{read_info_file($base_filename)};
- info("Found %d entries.\n", scalar(keys(%base_data)));
-
- # Apply baseline
- info("Subtracting baseline data.\n");
- %info_data = %{apply_baseline(\%info_data, \%base_data)};
- }
-
- @dir_list = get_dir_list(keys(%info_data));
-
- if ($no_prefix)
- {
- # User requested that we leave filenames alone
- info("User asked not to remove filename prefix\n");
- }
- elsif (!defined($dir_prefix))
- {
- # Get prefix common to most directories in list
- $dir_prefix = get_prefix(1, keys(%info_data));
-
- if ($dir_prefix)
- {
- info("Found common filename prefix \"$dir_prefix\"\n");
- }
- else
- {
- info("No common filename prefix found!\n");
- $no_prefix=1;
- }
- }
- else
- {
- info("Using user-specified filename prefix \"".
- "$dir_prefix\"\n");
- }
-
- # Read in test description file if specified
- if ($desc_filename)
- {
- info("Reading test description file $desc_filename\n");
- %test_description = %{read_testfile($desc_filename)};
-
- # Remove test descriptions which are not referenced
- # from %info_data if user didn't tell us otherwise
- if (!$keep_descriptions)
- {
- remove_unused_descriptions();
- }
- }
-
- # Change to output directory if specified
- if ($output_directory)
- {
- chdir($output_directory)
- or die("ERROR: cannot change to directory ".
- "$output_directory!\n");
- }
-
- info("Writing .css and .png files.\n");
- write_css_file();
- write_png_files();
-
- if ($html_gzip)
- {
- info("Writing .htaccess file.\n");
- write_htaccess_file();
- }
-
- info("Generating output.\n");
-
- # Process each subdirectory and collect overview information
- foreach $dir_name (@dir_list)
- {
- ($lines_found, $lines_hit, $fn_found, $fn_hit,
- $br_found, $br_hit)
- = process_dir($dir_name);
-
- # Handle files in root directory gracefully
- $dir_name = "root" if ($dir_name eq "");
-
- # Remove prefix if applicable
- if (!$no_prefix && $dir_prefix)
- {
- # Match directory names beginning with $dir_prefix
- $dir_name = apply_prefix($dir_name, $dir_prefix);
- }
-
- # Generate name for directory overview HTML page
- if ($dir_name =~ /^\/(.*)$/)
- {
- $link_name = substr($dir_name, 1)."/index.$html_ext";
- }
- else
- {
- $link_name = $dir_name."/index.$html_ext";
- }
-
- $overview{$dir_name} = [$lines_found, $lines_hit, $fn_found,
- $fn_hit, $br_found, $br_hit, $link_name,
- get_rate($lines_found, $lines_hit),
- get_rate($fn_found, $fn_hit),
- get_rate($br_found, $br_hit)];
- $overall_found += $lines_found;
- $overall_hit += $lines_hit;
- $total_fn_found += $fn_found;
- $total_fn_hit += $fn_hit;
- $total_br_found += $br_found;
- $total_br_hit += $br_hit;
- }
-
- # Generate overview page
- info("Writing directory view page.\n");
-
- # Create sorted pages
- foreach (@fileview_sortlist) {
- write_dir_page($fileview_sortname[$_], ".", "", $test_title,
- undef, $overall_found, $overall_hit,
- $total_fn_found, $total_fn_hit, $total_br_found,
- $total_br_hit, \%overview, {}, {}, {}, 0, $_);
- }
-
- # Check if there are any test case descriptions to write out
- if (%test_description)
- {
- info("Writing test case description file.\n");
- write_description_file( \%test_description,
- $overall_found, $overall_hit,
- $total_fn_found, $total_fn_hit,
- $total_br_found, $total_br_hit);
- }
-
- print_overall_rate(1, $overall_found, $overall_hit,
- $func_coverage, $total_fn_found, $total_fn_hit,
- $br_coverage, $total_br_found, $total_br_hit);
-
- chdir($cwd);
-}
-
-#
-# html_create(handle, filename)
-#
-
-sub html_create($$)
-{
- my $handle = $_[0];
- my $filename = $_[1];
-
- if ($html_gzip)
- {
- open($handle, "|-", "gzip -c >'$filename'")
- or die("ERROR: cannot open $filename for writing ".
- "(gzip)!\n");
- }
- else
- {
- open($handle, ">", $filename)
- or die("ERROR: cannot open $filename for writing!\n");
- }
-}
-
-sub write_dir_page($$$$$$$$$$$$$$$$$)
-{
- my ($name, $rel_dir, $base_dir, $title, $trunc_dir, $overall_found,
- $overall_hit, $total_fn_found, $total_fn_hit, $total_br_found,
- $total_br_hit, $overview, $testhash, $testfnchash, $testbrhash,
- $view_type, $sort_type) = @_;
-
- # Generate directory overview page including details
- html_create(*HTML_HANDLE, "$rel_dir/index$name.$html_ext");
- if (!defined($trunc_dir)) {
- $trunc_dir = "";
- }
- $title .= " - " if ($trunc_dir ne "");
- write_html_prolog(*HTML_HANDLE, $base_dir, "LCOV - $title$trunc_dir");
- write_header(*HTML_HANDLE, $view_type, $trunc_dir, $rel_dir,
- $overall_found, $overall_hit, $total_fn_found,
- $total_fn_hit, $total_br_found, $total_br_hit, $sort_type);
- write_file_table(*HTML_HANDLE, $base_dir, $overview, $testhash,
- $testfnchash, $testbrhash, $view_type, $sort_type);
- write_html_epilog(*HTML_HANDLE, $base_dir);
- close(*HTML_HANDLE);
-}
-
-
-#
-# process_dir(dir_name)
-#
-
-sub process_dir($)
-{
- my $abs_dir = $_[0];
- my $trunc_dir;
- my $rel_dir = $abs_dir;
- my $base_dir;
- my $filename;
- my %overview;
- my $lines_found;
- my $lines_hit;
- my $fn_found;
- my $fn_hit;
- my $br_found;
- my $br_hit;
- my $overall_found=0;
- my $overall_hit=0;
- my $total_fn_found=0;
- my $total_fn_hit=0;
- my $total_br_found = 0;
- my $total_br_hit = 0;
- my $base_name;
- my $extension;
- my $testdata;
- my %testhash;
- my $testfncdata;
- my %testfnchash;
- my $testbrdata;
- my %testbrhash;
- my @sort_list;
- local *HTML_HANDLE;
-
- # Remove prefix if applicable
- if (!$no_prefix)
- {
- # Match directory name beginning with $dir_prefix
- $rel_dir = apply_prefix($rel_dir, $dir_prefix);
- }
-
- $trunc_dir = $rel_dir;
-
- # Remove leading /
- if ($rel_dir =~ /^\/(.*)$/)
- {
- $rel_dir = substr($rel_dir, 1);
- }
-
- # Handle files in root directory gracefully
- $rel_dir = "root" if ($rel_dir eq "");
- $trunc_dir = "root" if ($trunc_dir eq "");
-
- $base_dir = get_relative_base_path($rel_dir);
-
- create_sub_dir($rel_dir);
-
- # Match filenames which specify files in this directory, not including
- # sub-directories
- foreach $filename (grep(/^\Q$abs_dir\E\/[^\/]*$/,keys(%info_data)))
- {
- my $page_link;
- my $func_link;
-
- ($lines_found, $lines_hit, $fn_found, $fn_hit, $br_found,
- $br_hit, $testdata, $testfncdata, $testbrdata) =
- process_file($trunc_dir, $rel_dir, $filename);
-
- $base_name = basename($filename);
-
- if ($no_sourceview) {
- $page_link = "";
- } elsif ($frames) {
- # Link to frameset page
- $page_link = "$base_name.gcov.frameset.$html_ext";
- } else {
- # Link directory to source code view page
- $page_link = "$base_name.gcov.$html_ext";
- }
- $overview{$base_name} = [$lines_found, $lines_hit, $fn_found,
- $fn_hit, $br_found, $br_hit,
- $page_link,
- get_rate($lines_found, $lines_hit),
- get_rate($fn_found, $fn_hit),
- get_rate($br_found, $br_hit)];
-
- $testhash{$base_name} = $testdata;
- $testfnchash{$base_name} = $testfncdata;
- $testbrhash{$base_name} = $testbrdata;
-
- $overall_found += $lines_found;
- $overall_hit += $lines_hit;
-
- $total_fn_found += $fn_found;
- $total_fn_hit += $fn_hit;
-
- $total_br_found += $br_found;
- $total_br_hit += $br_hit;
- }
-
- # Create sorted pages
- foreach (@fileview_sortlist) {
- # Generate directory overview page (without details)
- write_dir_page($fileview_sortname[$_], $rel_dir, $base_dir,
- $test_title, $trunc_dir, $overall_found,
- $overall_hit, $total_fn_found, $total_fn_hit,
- $total_br_found, $total_br_hit, \%overview, {},
- {}, {}, 1, $_);
- if (!$show_details) {
- next;
- }
- # Generate directory overview page including details
- write_dir_page("-detail".$fileview_sortname[$_], $rel_dir,
- $base_dir, $test_title, $trunc_dir,
- $overall_found, $overall_hit, $total_fn_found,
- $total_fn_hit, $total_br_found, $total_br_hit,
- \%overview, \%testhash, \%testfnchash,
- \%testbrhash, 1, $_);
- }
-
- # Calculate resulting line counts
- return ($overall_found, $overall_hit, $total_fn_found, $total_fn_hit,
- $total_br_found, $total_br_hit);
-}
-
-
-#
-# get_converted_lines(testdata)
-#
-# Return hash of line numbers of those lines which were only covered in
-# converted data sets.
-#
-
-sub get_converted_lines($)
-{
- my $testdata = $_[0];
- my $testcount;
- my %converted;
- my %nonconverted;
- my $hash;
- my $testcase;
- my $line;
- my %result;
-
-
- # Get a hash containing line numbers with positive counts both for
- # converted and original data sets
- foreach $testcase (keys(%{$testdata}))
- {
- # Check to see if this is a converted data set
- if ($testcase =~ /,diff$/)
- {
- $hash = \%converted;
- }
- else
- {
- $hash = \%nonconverted;
- }
-
- $testcount = $testdata->{$testcase};
- # Add lines with a positive count to hash
- foreach $line (keys%{$testcount})
- {
- if ($testcount->{$line} > 0)
- {
- $hash->{$line} = 1;
- }
- }
- }
-
- # Combine both hashes to resulting list
- foreach $line (keys(%converted))
- {
- if (!defined($nonconverted{$line}))
- {
- $result{$line} = 1;
- }
- }
-
- return \%result;
-}
-
-
-sub write_function_page($$$$$$$$$$$$$$$$$$)
-{
- my ($base_dir, $rel_dir, $trunc_dir, $base_name, $title,
- $lines_found, $lines_hit, $fn_found, $fn_hit, $br_found, $br_hit,
- $sumcount, $funcdata, $sumfnccount, $testfncdata, $sumbrcount,
- $testbrdata, $sort_type) = @_;
- my $pagetitle;
- my $filename;
-
- # Generate function table for this file
- if ($sort_type == 0) {
- $filename = "$rel_dir/$base_name.func.$html_ext";
- } else {
- $filename = "$rel_dir/$base_name.func-sort-c.$html_ext";
- }
- html_create(*HTML_HANDLE, $filename);
- $pagetitle = "LCOV - $title - $trunc_dir/$base_name - functions";
- write_html_prolog(*HTML_HANDLE, $base_dir, $pagetitle);
- write_header(*HTML_HANDLE, 4, "$trunc_dir/$base_name",
- "$rel_dir/$base_name", $lines_found, $lines_hit,
- $fn_found, $fn_hit, $br_found, $br_hit, $sort_type);
- write_function_table(*HTML_HANDLE, "$base_name.gcov.$html_ext",
- $sumcount, $funcdata,
- $sumfnccount, $testfncdata, $sumbrcount,
- $testbrdata, $base_name,
- $base_dir, $sort_type);
- write_html_epilog(*HTML_HANDLE, $base_dir, 1);
- close(*HTML_HANDLE);
-}
-
-
-#
-# process_file(trunc_dir, rel_dir, filename)
-#
-
-sub process_file($$$)
-{
- info("Processing file ".apply_prefix($_[2], $dir_prefix)."\n");
-
- my $trunc_dir = $_[0];
- my $rel_dir = $_[1];
- my $filename = $_[2];
- my $base_name = basename($filename);
- my $base_dir = get_relative_base_path($rel_dir);
- my $testdata;
- my $testcount;
- my $sumcount;
- my $funcdata;
- my $checkdata;
- my $testfncdata;
- my $sumfnccount;
- my $testbrdata;
- my $sumbrcount;
- my $lines_found;
- my $lines_hit;
- my $fn_found;
- my $fn_hit;
- my $br_found;
- my $br_hit;
- my $converted;
- my @source;
- my $pagetitle;
- local *HTML_HANDLE;
-
- ($testdata, $sumcount, $funcdata, $checkdata, $testfncdata,
- $sumfnccount, $testbrdata, $sumbrcount, $lines_found, $lines_hit,
- $fn_found, $fn_hit, $br_found, $br_hit)
- = get_info_entry($info_data{$filename});
-
- # Return after this point in case user asked us not to generate
- # source code view
- if ($no_sourceview)
- {
- return ($lines_found, $lines_hit, $fn_found, $fn_hit,
- $br_found, $br_hit, $testdata, $testfncdata,
- $testbrdata);
- }
-
- $converted = get_converted_lines($testdata);
- # Generate source code view for this file
- html_create(*HTML_HANDLE, "$rel_dir/$base_name.gcov.$html_ext");
- $pagetitle = "LCOV - $test_title - $trunc_dir/$base_name";
- write_html_prolog(*HTML_HANDLE, $base_dir, $pagetitle);
- write_header(*HTML_HANDLE, 2, "$trunc_dir/$base_name",
- "$rel_dir/$base_name", $lines_found, $lines_hit,
- $fn_found, $fn_hit, $br_found, $br_hit, 0);
- @source = write_source(*HTML_HANDLE, $filename, $sumcount, $checkdata,
- $converted, $funcdata, $sumbrcount);
-
- write_html_epilog(*HTML_HANDLE, $base_dir, 1);
- close(*HTML_HANDLE);
-
- if ($func_coverage) {
- # Create function tables
- foreach (@funcview_sortlist) {
- write_function_page($base_dir, $rel_dir, $trunc_dir,
- $base_name, $test_title,
- $lines_found, $lines_hit,
- $fn_found, $fn_hit, $br_found,
- $br_hit, $sumcount,
- $funcdata, $sumfnccount,
- $testfncdata, $sumbrcount,
- $testbrdata, $_);
- }
- }
-
- # Additional files are needed in case of frame output
- if (!$frames)
- {
- return ($lines_found, $lines_hit, $fn_found, $fn_hit,
- $br_found, $br_hit, $testdata, $testfncdata,
- $testbrdata);
- }
-
- # Create overview png file
- gen_png("$rel_dir/$base_name.gcov.png", $overview_width, $tab_size,
- @source);
-
- # Create frameset page
- html_create(*HTML_HANDLE,
- "$rel_dir/$base_name.gcov.frameset.$html_ext");
- write_frameset(*HTML_HANDLE, $base_dir, $base_name, $pagetitle);
- close(*HTML_HANDLE);
-
- # Write overview frame
- html_create(*HTML_HANDLE,
- "$rel_dir/$base_name.gcov.overview.$html_ext");
- write_overview(*HTML_HANDLE, $base_dir, $base_name, $pagetitle,
- scalar(@source));
- close(*HTML_HANDLE);
-
- return ($lines_found, $lines_hit, $fn_found, $fn_hit, $br_found,
- $br_hit, $testdata, $testfncdata, $testbrdata);
-}
-
-
-#
-# read_info_file(info_filename)
-#
-# Read in the contents of the .info file specified by INFO_FILENAME. Data will
-# be returned as a reference to a hash containing the following mappings:
-#
-# %result: for each filename found in file -> \%data
-#
-# %data: "test" -> \%testdata
-# "sum" -> \%sumcount
-# "func" -> \%funcdata
-# "found" -> $lines_found (number of instrumented lines found in file)
-# "hit" -> $lines_hit (number of executed lines in file)
-# "check" -> \%checkdata
-# "testfnc" -> \%testfncdata
-# "sumfnc" -> \%sumfnccount
-# "testbr" -> \%testbrdata
-# "sumbr" -> \%sumbrcount
-#
-# %testdata : name of test affecting this file -> \%testcount
-# %testfncdata: name of test affecting this file -> \%testfnccount
-# %testbrdata: name of test affecting this file -> \%testbrcount
-#
-# %testcount : line number -> execution count for a single test
-# %testfnccount: function name -> execution count for a single test
-# %testbrcount : line number -> branch coverage data for a single test
-# %sumcount : line number -> execution count for all tests
-# %sumfnccount : function name -> execution count for all tests
-# %sumbrcount : line number -> branch coverage data for all tests
-# %funcdata : function name -> line number
-# %checkdata : line number -> checksum of source code line
-# $brdata : vector of items: block, branch, taken
-#
-# Note that .info file sections referring to the same file and test name
-# will automatically be combined by adding all execution counts.
-#
-# Note that if INFO_FILENAME ends with ".gz", it is assumed that the file
-# is compressed using GZIP. If available, GUNZIP will be used to decompress
-# this file.
-#
-# Die on error.
-#
-
-sub read_info_file($)
-{
- my $tracefile = $_[0]; # Name of tracefile
- my %result; # Resulting hash: file -> data
- my $data; # Data handle for current entry
- my $testdata; # " "
- my $testcount; # " "
- my $sumcount; # " "
- my $funcdata; # " "
- my $checkdata; # " "
- my $testfncdata;
- my $testfnccount;
- my $sumfnccount;
- my $testbrdata;
- my $testbrcount;
- my $sumbrcount;
- my $line; # Current line read from .info file
- my $testname; # Current test name
- my $filename; # Current filename
- my $hitcount; # Count for lines hit
- my $count; # Execution count of current line
- my $negative; # If set, warn about negative counts
- my $changed_testname; # If set, warn about changed testname
- my $line_checksum; # Checksum of current line
- my $br_found;
- my $br_hit;
- local *INFO_HANDLE; # Filehandle for .info file
-
- info("Reading data file $tracefile\n");
-
- # Check if file exists and is readable
- stat($_[0]);
- if (!(-r _))
- {
- die("ERROR: cannot read file $_[0]!\n");
- }
-
- # Check if this is really a plain file
- if (!(-f _))
- {
- die("ERROR: not a plain file: $_[0]!\n");
- }
-
- # Check for .gz extension
- if ($_[0] =~ /\.gz$/)
- {
- # Check for availability of GZIP tool
- system_no_output(1, "gunzip" ,"-h")
- and die("ERROR: gunzip command not available!\n");
-
- # Check integrity of compressed file
- system_no_output(1, "gunzip", "-t", $_[0])
- and die("ERROR: integrity check failed for ".
- "compressed file $_[0]!\n");
-
- # Open compressed file
- open(INFO_HANDLE, "-|", "gunzip -c '$_[0]'")
- or die("ERROR: cannot start gunzip to decompress ".
- "file $_[0]!\n");
- }
- else
- {
- # Open decompressed file
- open(INFO_HANDLE, "<", $_[0])
- or die("ERROR: cannot read file $_[0]!\n");
- }
-
- $testname = "";
- while (<INFO_HANDLE>)
- {
- chomp($_);
- $line = $_;
-
- # Switch statement
- foreach ($line)
- {
- /^TN:([^,]*)(,diff)?/ && do
- {
- # Test name information found
- $testname = defined($1) ? $1 : "";
- if ($testname =~ s/\W/_/g)
- {
- $changed_testname = 1;
- }
- $testname .= $2 if (defined($2));
- last;
- };
-
- /^[SK]F:(.*)/ && do
- {
- # Filename information found
- # Retrieve data for new entry
- $filename = $1;
-
- $data = $result{$filename};
- ($testdata, $sumcount, $funcdata, $checkdata,
- $testfncdata, $sumfnccount, $testbrdata,
- $sumbrcount) =
- get_info_entry($data);
-
- if (defined($testname))
- {
- $testcount = $testdata->{$testname};
- $testfnccount = $testfncdata->{$testname};
- $testbrcount = $testbrdata->{$testname};
- }
- else
- {
- $testcount = {};
- $testfnccount = {};
- $testbrcount = {};
- }
- last;
- };
-
- /^DA:(\d+),(-?\d+)(,[^,\s]+)?/ && do
- {
- # Fix negative counts
- $count = $2 < 0 ? 0 : $2;
- if ($2 < 0)
- {
- $negative = 1;
- }
- # Execution count found, add to structure
- # Add summary counts
- $sumcount->{$1} += $count;
-
- # Add test-specific counts
- if (defined($testname))
- {
- $testcount->{$1} += $count;
- }
-
- # Store line checksum if available
- if (defined($3))
- {
- $line_checksum = substr($3, 1);
-
- # Does it match a previous definition
- if (defined($checkdata->{$1}) &&
- ($checkdata->{$1} ne
- $line_checksum))
- {
- die("ERROR: checksum mismatch ".
- "at $filename:$1\n");
- }
-
- $checkdata->{$1} = $line_checksum;
- }
- last;
- };
-
- /^FN:(\d+),([^,]+)/ && do
- {
- last if (!$func_coverage);
-
- # Function data found, add to structure
- $funcdata->{$2} = $1;
-
- # Also initialize function call data
- if (!defined($sumfnccount->{$2})) {
- $sumfnccount->{$2} = 0;
- }
- if (defined($testname))
- {
- if (!defined($testfnccount->{$2})) {
- $testfnccount->{$2} = 0;
- }
- }
- last;
- };
-
- /^FNDA:(\d+),([^,]+)/ && do
- {
- last if (!$func_coverage);
- # Function call count found, add to structure
- # Add summary counts
- $sumfnccount->{$2} += $1;
-
- # Add test-specific counts
- if (defined($testname))
- {
- $testfnccount->{$2} += $1;
- }
- last;
- };
-
- /^BRDA:(\d+),(\d+),(\d+),(\d+|-)/ && do {
- # Branch coverage data found
- my ($line, $block, $branch, $taken) =
- ($1, $2, $3, $4);
-
- last if (!$br_coverage);
- $sumbrcount->{$line} =
- br_ivec_push($sumbrcount->{$line},
- $block, $branch, $taken);
-
- # Add test-specific counts
- if (defined($testname)) {
- $testbrcount->{$line} =
- br_ivec_push(
- $testbrcount->{$line},
- $block, $branch,
- $taken);
- }
- last;
- };
-
- /^end_of_record/ && do
- {
- # Found end of section marker
- if ($filename)
- {
- # Store current section data
- if (defined($testname))
- {
- $testdata->{$testname} =
- $testcount;
- $testfncdata->{$testname} =
- $testfnccount;
- $testbrdata->{$testname} =
- $testbrcount;
- }
-
- set_info_entry($data, $testdata,
- $sumcount, $funcdata,
- $checkdata, $testfncdata,
- $sumfnccount,
- $testbrdata,
- $sumbrcount);
- $result{$filename} = $data;
- last;
- }
- };
-
- # default
- last;
- }
- }
- close(INFO_HANDLE);
-
- # Calculate lines_found and lines_hit for each file
- foreach $filename (keys(%result))
- {
- $data = $result{$filename};
-
- ($testdata, $sumcount, undef, undef, $testfncdata,
- $sumfnccount, $testbrdata, $sumbrcount) =
- get_info_entry($data);
-
- # Filter out empty files
- if (scalar(keys(%{$sumcount})) == 0)
- {
- delete($result{$filename});
- next;
- }
- # Filter out empty test cases
- foreach $testname (keys(%{$testdata}))
- {
- if (!defined($testdata->{$testname}) ||
- scalar(keys(%{$testdata->{$testname}})) == 0)
- {
- delete($testdata->{$testname});
- delete($testfncdata->{$testname});
- }
- }
-
- $data->{"found"} = scalar(keys(%{$sumcount}));
- $hitcount = 0;
-
- foreach (keys(%{$sumcount}))
- {
- if ($sumcount->{$_} > 0) { $hitcount++; }
- }
-
- $data->{"hit"} = $hitcount;
-
- # Get found/hit values for function call data
- $data->{"f_found"} = scalar(keys(%{$sumfnccount}));
- $hitcount = 0;
-
- foreach (keys(%{$sumfnccount})) {
- if ($sumfnccount->{$_} > 0) {
- $hitcount++;
- }
- }
- $data->{"f_hit"} = $hitcount;
-
- # Get found/hit values for branch data
- ($br_found, $br_hit) = get_br_found_and_hit($sumbrcount);
-
- $data->{"b_found"} = $br_found;
- $data->{"b_hit"} = $br_hit;
- }
-
- if (scalar(keys(%result)) == 0)
- {
- die("ERROR: no valid records found in tracefile $tracefile\n");
- }
- if ($negative)
- {
- warn("WARNING: negative counts found in tracefile ".
- "$tracefile\n");
- }
- if ($changed_testname)
- {
- warn("WARNING: invalid characters removed from testname in ".
- "tracefile $tracefile\n");
- }
-
- return(\%result);
-}
-
-
-#
-# get_info_entry(hash_ref)
-#
-# Retrieve data from an entry of the structure generated by read_info_file().
-# Return a list of references to hashes:
-# (test data hash ref, sum count hash ref, funcdata hash ref, checkdata hash
-# ref, testfncdata hash ref, sumfnccount hash ref, lines found, lines hit,
-# functions found, functions hit)
-#
-
-sub get_info_entry($)
-{
- my $testdata_ref = $_[0]->{"test"};
- my $sumcount_ref = $_[0]->{"sum"};
- my $funcdata_ref = $_[0]->{"func"};
- my $checkdata_ref = $_[0]->{"check"};
- my $testfncdata = $_[0]->{"testfnc"};
- my $sumfnccount = $_[0]->{"sumfnc"};
- my $testbrdata = $_[0]->{"testbr"};
- my $sumbrcount = $_[0]->{"sumbr"};
- my $lines_found = $_[0]->{"found"};
- my $lines_hit = $_[0]->{"hit"};
- my $fn_found = $_[0]->{"f_found"};
- my $fn_hit = $_[0]->{"f_hit"};
- my $br_found = $_[0]->{"b_found"};
- my $br_hit = $_[0]->{"b_hit"};
-
- return ($testdata_ref, $sumcount_ref, $funcdata_ref, $checkdata_ref,
- $testfncdata, $sumfnccount, $testbrdata, $sumbrcount,
- $lines_found, $lines_hit, $fn_found, $fn_hit,
- $br_found, $br_hit);
-}
-
-
-#
-# set_info_entry(hash_ref, testdata_ref, sumcount_ref, funcdata_ref,
-# checkdata_ref, testfncdata_ref, sumfcncount_ref,
-# testbrdata_ref, sumbrcount_ref[,lines_found,
-# lines_hit, f_found, f_hit, $b_found, $b_hit])
-#
-# Update the hash referenced by HASH_REF with the provided data references.
-#
-
-sub set_info_entry($$$$$$$$$;$$$$$$)
-{
- my $data_ref = $_[0];
-
- $data_ref->{"test"} = $_[1];
- $data_ref->{"sum"} = $_[2];
- $data_ref->{"func"} = $_[3];
- $data_ref->{"check"} = $_[4];
- $data_ref->{"testfnc"} = $_[5];
- $data_ref->{"sumfnc"} = $_[6];
- $data_ref->{"testbr"} = $_[7];
- $data_ref->{"sumbr"} = $_[8];
-
- if (defined($_[9])) { $data_ref->{"found"} = $_[9]; }
- if (defined($_[10])) { $data_ref->{"hit"} = $_[10]; }
- if (defined($_[11])) { $data_ref->{"f_found"} = $_[11]; }
- if (defined($_[12])) { $data_ref->{"f_hit"} = $_[12]; }
- if (defined($_[13])) { $data_ref->{"b_found"} = $_[13]; }
- if (defined($_[14])) { $data_ref->{"b_hit"} = $_[14]; }
-}
-
-
-#
-# add_counts(data1_ref, data2_ref)
-#
-# DATA1_REF and DATA2_REF are references to hashes containing a mapping
-#
-# line number -> execution count
-#
-# Return a list (RESULT_REF, LINES_FOUND, LINES_HIT) where RESULT_REF
-# is a reference to a hash containing the combined mapping in which
-# execution counts are added.
-#
-
-sub add_counts($$)
-{
- my %data1 = %{$_[0]}; # Hash 1
- my %data2 = %{$_[1]}; # Hash 2
- my %result; # Resulting hash
- my $line; # Current line iteration scalar
- my $data1_count; # Count of line in hash1
- my $data2_count; # Count of line in hash2
- my $found = 0; # Total number of lines found
- my $hit = 0; # Number of lines with a count > 0
-
- foreach $line (keys(%data1))
- {
- $data1_count = $data1{$line};
- $data2_count = $data2{$line};
-
- # Add counts if present in both hashes
- if (defined($data2_count)) { $data1_count += $data2_count; }
-
- # Store sum in %result
- $result{$line} = $data1_count;
-
- $found++;
- if ($data1_count > 0) { $hit++; }
- }
-
- # Add lines unique to data2
- foreach $line (keys(%data2))
- {
- # Skip lines already in data1
- if (defined($data1{$line})) { next; }
-
- # Copy count from data2
- $result{$line} = $data2{$line};
-
- $found++;
- if ($result{$line} > 0) { $hit++; }
- }
-
- return (\%result, $found, $hit);
-}
-
-
-#
-# merge_checksums(ref1, ref2, filename)
-#
-# REF1 and REF2 are references to hashes containing a mapping
-#
-# line number -> checksum
-#
-# Merge checksum lists defined in REF1 and REF2 and return reference to
-# resulting hash. Die if a checksum for a line is defined in both hashes
-# but does not match.
-#
-
-sub merge_checksums($$$)
-{
- my $ref1 = $_[0];
- my $ref2 = $_[1];
- my $filename = $_[2];
- my %result;
- my $line;
-
- foreach $line (keys(%{$ref1}))
- {
- if (defined($ref2->{$line}) &&
- ($ref1->{$line} ne $ref2->{$line}))
- {
- die("ERROR: checksum mismatch at $filename:$line\n");
- }
- $result{$line} = $ref1->{$line};
- }
-
- foreach $line (keys(%{$ref2}))
- {
- $result{$line} = $ref2->{$line};
- }
-
- return \%result;
-}
-
-
-#
-# merge_func_data(funcdata1, funcdata2, filename)
-#
-
-sub merge_func_data($$$)
-{
- my ($funcdata1, $funcdata2, $filename) = @_;
- my %result;
- my $func;
-
- if (defined($funcdata1)) {
- %result = %{$funcdata1};
- }
-
- foreach $func (keys(%{$funcdata2})) {
- my $line1 = $result{$func};
- my $line2 = $funcdata2->{$func};
-
- if (defined($line1) && ($line1 != $line2)) {
- warn("WARNING: function data mismatch at ".
- "$filename:$line2\n");
- next;
- }
- $result{$func} = $line2;
- }
-
- return \%result;
-}
-
-
-#
-# add_fnccount(fnccount1, fnccount2)
-#
-# Add function call count data. Return list (fnccount_added, f_found, f_hit)
-#
-
-sub add_fnccount($$)
-{
- my ($fnccount1, $fnccount2) = @_;
- my %result;
- my $fn_found;
- my $fn_hit;
- my $function;
-
- if (defined($fnccount1)) {
- %result = %{$fnccount1};
- }
- foreach $function (keys(%{$fnccount2})) {
- $result{$function} += $fnccount2->{$function};
- }
- $fn_found = scalar(keys(%result));
- $fn_hit = 0;
- foreach $function (keys(%result)) {
- if ($result{$function} > 0) {
- $fn_hit++;
- }
- }
-
- return (\%result, $fn_found, $fn_hit);
-}
-
-#
-# add_testfncdata(testfncdata1, testfncdata2)
-#
-# Add function call count data for several tests. Return reference to
-# added_testfncdata.
-#
-
-sub add_testfncdata($$)
-{
- my ($testfncdata1, $testfncdata2) = @_;
- my %result;
- my $testname;
-
- foreach $testname (keys(%{$testfncdata1})) {
- if (defined($testfncdata2->{$testname})) {
- my $fnccount;
-
- # Function call count data for this testname exists
- # in both data sets: add
- ($fnccount) = add_fnccount(
- $testfncdata1->{$testname},
- $testfncdata2->{$testname});
- $result{$testname} = $fnccount;
- next;
- }
- # Function call count data for this testname is unique to
- # data set 1: copy
- $result{$testname} = $testfncdata1->{$testname};
- }
-
- # Add count data for testnames unique to data set 2
- foreach $testname (keys(%{$testfncdata2})) {
- if (!defined($result{$testname})) {
- $result{$testname} = $testfncdata2->{$testname};
- }
- }
- return \%result;
-}
-
-
-#
-# brcount_to_db(brcount)
-#
-# Convert brcount data to the following format:
-#
-# db: line number -> block hash
-# block hash: block number -> branch hash
-# branch hash: branch number -> taken value
-#
-
-sub brcount_to_db($)
-{
- my ($brcount) = @_;
- my $line;
- my $db;
-
- # Add branches from first count to database
- foreach $line (keys(%{$brcount})) {
- my $brdata = $brcount->{$line};
- my $i;
- my $num = br_ivec_len($brdata);
-
- for ($i = 0; $i < $num; $i++) {
- my ($block, $branch, $taken) = br_ivec_get($brdata, $i);
-
- $db->{$line}->{$block}->{$branch} = $taken;
- }
- }
-
- return $db;
-}
-
-
-#
-# db_to_brcount(db)
-#
-# Convert branch coverage data back to brcount format.
-#
-
-sub db_to_brcount($)
-{
- my ($db) = @_;
- my $line;
- my $brcount = {};
- my $br_found = 0;
- my $br_hit = 0;
-
- # Convert database back to brcount format
- foreach $line (sort({$a <=> $b} keys(%{$db}))) {
- my $ldata = $db->{$line};
- my $brdata;
- my $block;
-
- foreach $block (sort({$a <=> $b} keys(%{$ldata}))) {
- my $bdata = $ldata->{$block};
- my $branch;
-
- foreach $branch (sort({$a <=> $b} keys(%{$bdata}))) {
- my $taken = $bdata->{$branch};
-
- $br_found++;
- $br_hit++ if ($taken ne "-" && $taken > 0);
- $brdata = br_ivec_push($brdata, $block,
- $branch, $taken);
- }
- }
- $brcount->{$line} = $brdata;
- }
-
- return ($brcount, $br_found, $br_hit);
-}
-
-
-#
-# combine_brcount(brcount1, brcount2, type)
-#
-# If add is BR_ADD, add branch coverage data and return list (brcount_added,
-# br_found, br_hit). If add is BR_SUB, subtract the taken values of brcount2
-# from brcount1 and return (brcount_sub, br_found, br_hit).
-#
-
-sub combine_brcount($$$)
-{
- my ($brcount1, $brcount2, $type) = @_;
- my $line;
- my $block;
- my $branch;
- my $taken;
- my $db;
- my $br_found = 0;
- my $br_hit = 0;
- my $result;
-
- # Convert branches from first count to database
- $db = brcount_to_db($brcount1);
- # Combine values from database and second count
- foreach $line (keys(%{$brcount2})) {
- my $brdata = $brcount2->{$line};
- my $num = br_ivec_len($brdata);
- my $i;
-
- for ($i = 0; $i < $num; $i++) {
- ($block, $branch, $taken) = br_ivec_get($brdata, $i);
- my $new_taken = $db->{$line}->{$block}->{$branch};
-
- if ($type == $BR_ADD) {
- $new_taken = br_taken_add($new_taken, $taken);
- } elsif ($type == $BR_SUB) {
- $new_taken = br_taken_sub($new_taken, $taken);
- }
- $db->{$line}->{$block}->{$branch} = $new_taken
- if (defined($new_taken));
- }
- }
- # Convert database back to brcount format
- ($result, $br_found, $br_hit) = db_to_brcount($db);
-
- return ($result, $br_found, $br_hit);
-}
-
-
-#
-# add_testbrdata(testbrdata1, testbrdata2)
-#
-# Add branch coverage data for several tests. Return reference to
-# added_testbrdata.
-#
-
-sub add_testbrdata($$)
-{
- my ($testbrdata1, $testbrdata2) = @_;
- my %result;
- my $testname;
-
- foreach $testname (keys(%{$testbrdata1})) {
- if (defined($testbrdata2->{$testname})) {
- my $brcount;
-
- # Branch coverage data for this testname exists
- # in both data sets: add
- ($brcount) = combine_brcount($testbrdata1->{$testname},
- $testbrdata2->{$testname}, $BR_ADD);
- $result{$testname} = $brcount;
- next;
- }
- # Branch coverage data for this testname is unique to
- # data set 1: copy
- $result{$testname} = $testbrdata1->{$testname};
- }
-
- # Add count data for testnames unique to data set 2
- foreach $testname (keys(%{$testbrdata2})) {
- if (!defined($result{$testname})) {
- $result{$testname} = $testbrdata2->{$testname};
- }
- }
- return \%result;
-}
-
-
-#
-# combine_info_entries(entry_ref1, entry_ref2, filename)
-#
-# Combine .info data entry hashes referenced by ENTRY_REF1 and ENTRY_REF2.
-# Return reference to resulting hash.
-#
-
-sub combine_info_entries($$$)
-{
- my $entry1 = $_[0]; # Reference to hash containing first entry
- my $testdata1;
- my $sumcount1;
- my $funcdata1;
- my $checkdata1;
- my $testfncdata1;
- my $sumfnccount1;
- my $testbrdata1;
- my $sumbrcount1;
-
- my $entry2 = $_[1]; # Reference to hash containing second entry
- my $testdata2;
- my $sumcount2;
- my $funcdata2;
- my $checkdata2;
- my $testfncdata2;
- my $sumfnccount2;
- my $testbrdata2;
- my $sumbrcount2;
-
- my %result; # Hash containing combined entry
- my %result_testdata;
- my $result_sumcount = {};
- my $result_funcdata;
- my $result_testfncdata;
- my $result_sumfnccount;
- my $result_testbrdata;
- my $result_sumbrcount;
- my $lines_found;
- my $lines_hit;
- my $fn_found;
- my $fn_hit;
- my $br_found;
- my $br_hit;
-
- my $testname;
- my $filename = $_[2];
-
- # Retrieve data
- ($testdata1, $sumcount1, $funcdata1, $checkdata1, $testfncdata1,
- $sumfnccount1, $testbrdata1, $sumbrcount1) = get_info_entry($entry1);
- ($testdata2, $sumcount2, $funcdata2, $checkdata2, $testfncdata2,
- $sumfnccount2, $testbrdata2, $sumbrcount2) = get_info_entry($entry2);
-
- # Merge checksums
- $checkdata1 = merge_checksums($checkdata1, $checkdata2, $filename);
-
- # Combine funcdata
- $result_funcdata = merge_func_data($funcdata1, $funcdata2, $filename);
-
- # Combine function call count data
- $result_testfncdata = add_testfncdata($testfncdata1, $testfncdata2);
- ($result_sumfnccount, $fn_found, $fn_hit) =
- add_fnccount($sumfnccount1, $sumfnccount2);
-
- # Combine branch coverage data
- $result_testbrdata = add_testbrdata($testbrdata1, $testbrdata2);
- ($result_sumbrcount, $br_found, $br_hit) =
- combine_brcount($sumbrcount1, $sumbrcount2, $BR_ADD);
-
- # Combine testdata
- foreach $testname (keys(%{$testdata1}))
- {
- if (defined($testdata2->{$testname}))
- {
- # testname is present in both entries, requires
- # combination
- ($result_testdata{$testname}) =
- add_counts($testdata1->{$testname},
- $testdata2->{$testname});
- }
- else
- {
- # testname only present in entry1, add to result
- $result_testdata{$testname} = $testdata1->{$testname};
- }
-
- # update sum count hash
- ($result_sumcount, $lines_found, $lines_hit) =
- add_counts($result_sumcount,
- $result_testdata{$testname});
- }
-
- foreach $testname (keys(%{$testdata2}))
- {
- # Skip testnames already covered by previous iteration
- if (defined($testdata1->{$testname})) { next; }
-
- # testname only present in entry2, add to result hash
- $result_testdata{$testname} = $testdata2->{$testname};
-
- # update sum count hash
- ($result_sumcount, $lines_found, $lines_hit) =
- add_counts($result_sumcount,
- $result_testdata{$testname});
- }
-
- # Calculate resulting sumcount
-
- # Store result
- set_info_entry(\%result, \%result_testdata, $result_sumcount,
- $result_funcdata, $checkdata1, $result_testfncdata,
- $result_sumfnccount, $result_testbrdata,
- $result_sumbrcount, $lines_found, $lines_hit,
- $fn_found, $fn_hit, $br_found, $br_hit);
-
- return(\%result);
-}
-
-
-#
-# combine_info_files(info_ref1, info_ref2)
-#
-# Combine .info data in hashes referenced by INFO_REF1 and INFO_REF2. Return
-# reference to resulting hash.
-#
-
-sub combine_info_files($$)
-{
- my %hash1 = %{$_[0]};
- my %hash2 = %{$_[1]};
- my $filename;
-
- foreach $filename (keys(%hash2))
- {
- if ($hash1{$filename})
- {
- # Entry already exists in hash1, combine them
- $hash1{$filename} =
- combine_info_entries($hash1{$filename},
- $hash2{$filename},
- $filename);
- }
- else
- {
- # Entry is unique in both hashes, simply add to
- # resulting hash
- $hash1{$filename} = $hash2{$filename};
- }
- }
-
- return(\%hash1);
-}
-
-
-#
-# get_prefix(min_dir, filename_list)
-#
-# Search FILENAME_LIST for a directory prefix which is common to as many
-# list entries as possible, so that removing this prefix will minimize the
-# sum of the lengths of all resulting shortened filenames while observing
-# that no filename has less than MIN_DIR parent directories.
-#
-
-sub get_prefix($@)
-{
- my ($min_dir, @filename_list) = @_;
- my %prefix; # mapping: prefix -> sum of lengths
- my $current; # Temporary iteration variable
-
- # Find list of prefixes
- foreach (@filename_list)
- {
- # Need explicit assignment to get a copy of $_ so that
- # shortening the contained prefix does not affect the list
- $current = $_;
- while ($current = shorten_prefix($current))
- {
- $current .= "/";
-
- # Skip rest if the remaining prefix has already been
- # added to hash
- if (exists($prefix{$current})) { last; }
-
- # Initialize with 0
- $prefix{$current}="0";
- }
-
- }
-
- # Remove all prefixes that would cause filenames to have less than
- # the minimum number of parent directories
- foreach my $filename (@filename_list) {
- my $dir = dirname($filename);
-
- for (my $i = 0; $i < $min_dir; $i++) {
- delete($prefix{$dir."/"});
- $dir = shorten_prefix($dir);
- }
- }
-
- # Check if any prefix remains
- return undef if (!%prefix);
-
- # Calculate sum of lengths for all prefixes
- foreach $current (keys(%prefix))
- {
- foreach (@filename_list)
- {
- # Add original length
- $prefix{$current} += length($_);
-
- # Check whether prefix matches
- if (substr($_, 0, length($current)) eq $current)
- {
- # Subtract prefix length for this filename
- $prefix{$current} -= length($current);
- }
- }
- }
-
- # Find and return prefix with minimal sum
- $current = (keys(%prefix))[0];
-
- foreach (keys(%prefix))
- {
- if ($prefix{$_} < $prefix{$current})
- {
- $current = $_;
- }
- }
-
- $current =~ s/\/$//;
-
- return($current);
-}
-
-
-#
-# shorten_prefix(prefix)
-#
-# Return PREFIX shortened by last directory component.
-#
-
-sub shorten_prefix($)
-{
- my @list = split("/", $_[0]);
-
- pop(@list);
- return join("/", @list);
-}
-
-
-
-#
-# get_dir_list(filename_list)
-#
-# Return sorted list of directories for each entry in given FILENAME_LIST.
-#
-
-sub get_dir_list(@)
-{
- my %result;
-
- foreach (@_)
- {
- $result{shorten_prefix($_)} = "";
- }
-
- return(sort(keys(%result)));
-}
-
-
-#
-# get_relative_base_path(subdirectory)
-#
-# Return a relative path string which references the base path when applied
-# in SUBDIRECTORY.
-#
-# Example: get_relative_base_path("fs/mm") -> "../../"
-#
-
-sub get_relative_base_path($)
-{
- my $result = "";
- my $index;
-
- # Make an empty directory path a special case
- if (!$_[0]) { return(""); }
-
- # Count number of /s in path
- $index = ($_[0] =~ s/\//\//g);
-
- # Add a ../ to $result for each / in the directory path + 1
- for (; $index>=0; $index--)
- {
- $result .= "../";
- }
-
- return $result;
-}
-
-
-#
-# read_testfile(test_filename)
-#
-# Read in file TEST_FILENAME which contains test descriptions in the format:
-#
-# TN:<whitespace><test name>
-# TD:<whitespace><test description>
-#
-# for each test case. Return a reference to a hash containing a mapping
-#
-# test name -> test description.
-#
-# Die on error.
-#
-
-sub read_testfile($)
-{
- my %result;
- my $test_name;
- my $changed_testname;
- local *TEST_HANDLE;
-
- open(TEST_HANDLE, "<", $_[0])
- or die("ERROR: cannot open $_[0]!\n");
-
- while (<TEST_HANDLE>)
- {
- chomp($_);
-
- # Match lines beginning with TN:<whitespace(s)>
- if (/^TN:\s+(.*?)\s*$/)
- {
- # Store name for later use
- $test_name = $1;
- if ($test_name =~ s/\W/_/g)
- {
- $changed_testname = 1;
- }
- }
-
- # Match lines beginning with TD:<whitespace(s)>
- if (/^TD:\s+(.*?)\s*$/)
- {
- # Check for empty line
- if ($1)
- {
- # Add description to hash
- $result{$test_name} .= " $1";
- }
- else
- {
- # Add empty line
- $result{$test_name} .= "\n\n";
- }
- }
- }
-
- close(TEST_HANDLE);
-
- if ($changed_testname)
- {
- warn("WARNING: invalid characters removed from testname in ".
- "descriptions file $_[0]\n");
- }
-
- return \%result;
-}
-
-
-#
-# escape_html(STRING)
-#
-# Return a copy of STRING in which all occurrences of HTML special characters
-# are escaped.
-#
-
-sub escape_html($)
-{
- my $string = $_[0];
-
- if (!$string) { return ""; }
-
- $string =~ s/&/&amp;/g; # & -> &amp;
- $string =~ s/</&lt;/g; # < -> &lt;
- $string =~ s/>/&gt;/g; # > -> &gt;
- $string =~ s/\"/&quot;/g; # " -> &quot;
-
- while ($string =~ /^([^\t]*)(\t)/)
- {
- my $replacement = " "x($tab_size - (length($1) % $tab_size));
- $string =~ s/^([^\t]*)(\t)/$1$replacement/;
- }
-
- $string =~ s/\n/<br>/g; # \n -> <br>
-
- return $string;
-}
-
-
-#
-# get_date_string()
-#
-# Return the current date in the form: yyyy-mm-dd
-#
-
-sub get_date_string()
-{
- my $year;
- my $month;
- my $day;
-
- ($year, $month, $day) = (localtime())[5, 4, 3];
-
- return sprintf("%d-%02d-%02d", $year+1900, $month+1, $day);
-}
-
-
-#
-# create_sub_dir(dir_name)
-#
-# Create subdirectory DIR_NAME if it does not already exist, including all its
-# parent directories.
-#
-# Die on error.
-#
-
-sub create_sub_dir($)
-{
- my ($dir) = @_;
-
- system("mkdir", "-p" ,$dir)
- and die("ERROR: cannot create directory $dir!\n");
-}
-
-
-#
-# write_description_file(descriptions, overall_found, overall_hit,
-# total_fn_found, total_fn_hit, total_br_found,
-# total_br_hit)
-#
-# Write HTML file containing all test case descriptions. DESCRIPTIONS is a
-# reference to a hash containing a mapping
-#
-# test case name -> test case description
-#
-# Die on error.
-#
-
-sub write_description_file($$$$$$$)
-{
- my %description = %{$_[0]};
- my $found = $_[1];
- my $hit = $_[2];
- my $fn_found = $_[3];
- my $fn_hit = $_[4];
- my $br_found = $_[5];
- my $br_hit = $_[6];
- my $test_name;
- local *HTML_HANDLE;
-
- html_create(*HTML_HANDLE,"descriptions.$html_ext");
- write_html_prolog(*HTML_HANDLE, "", "LCOV - test case descriptions");
- write_header(*HTML_HANDLE, 3, "", "", $found, $hit, $fn_found,
- $fn_hit, $br_found, $br_hit, 0);
-
- write_test_table_prolog(*HTML_HANDLE,
- "Test case descriptions - alphabetical list");
-
- foreach $test_name (sort(keys(%description)))
- {
- write_test_table_entry(*HTML_HANDLE, $test_name,
- escape_html($description{$test_name}));
- }
-
- write_test_table_epilog(*HTML_HANDLE);
- write_html_epilog(*HTML_HANDLE, "");
-
- close(*HTML_HANDLE);
-}
-
-
-
-#
-# write_png_files()
-#
-# Create all necessary .png files for the HTML-output in the current
-# directory. .png-files are used as bar graphs.
-#
-# Die on error.
-#
-
-sub write_png_files()
-{
- my %data;
- local *PNG_HANDLE;
-
- $data{"ruby.png"} =
- [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00,
- 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x01, 0x01, 0x03, 0x00, 0x00, 0x00, 0x25,
- 0xdb, 0x56, 0xca, 0x00, 0x00, 0x00, 0x07, 0x74, 0x49, 0x4d,
- 0x45, 0x07, 0xd2, 0x07, 0x11, 0x0f, 0x18, 0x10, 0x5d, 0x57,
- 0x34, 0x6e, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73,
- 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, 0x12, 0x01, 0xd2,
- 0xdd, 0x7e, 0xfc, 0x00, 0x00, 0x00, 0x04, 0x67, 0x41, 0x4d,
- 0x41, 0x00, 0x00, 0xb1, 0x8f, 0x0b, 0xfc, 0x61, 0x05, 0x00,
- 0x00, 0x00, 0x06, 0x50, 0x4c, 0x54, 0x45, 0xff, 0x35, 0x2f,
- 0x00, 0x00, 0x00, 0xd0, 0x33, 0x9a, 0x9d, 0x00, 0x00, 0x00,
- 0x0a, 0x49, 0x44, 0x41, 0x54, 0x78, 0xda, 0x63, 0x60, 0x00,
- 0x00, 0x00, 0x02, 0x00, 0x01, 0xe5, 0x27, 0xde, 0xfc, 0x00,
- 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60,
- 0x82];
- $data{"amber.png"} =
- [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00,
- 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x01, 0x01, 0x03, 0x00, 0x00, 0x00, 0x25,
- 0xdb, 0x56, 0xca, 0x00, 0x00, 0x00, 0x07, 0x74, 0x49, 0x4d,
- 0x45, 0x07, 0xd2, 0x07, 0x11, 0x0f, 0x28, 0x04, 0x98, 0xcb,
- 0xd6, 0xe0, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73,
- 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, 0x12, 0x01, 0xd2,
- 0xdd, 0x7e, 0xfc, 0x00, 0x00, 0x00, 0x04, 0x67, 0x41, 0x4d,
- 0x41, 0x00, 0x00, 0xb1, 0x8f, 0x0b, 0xfc, 0x61, 0x05, 0x00,
- 0x00, 0x00, 0x06, 0x50, 0x4c, 0x54, 0x45, 0xff, 0xe0, 0x50,
- 0x00, 0x00, 0x00, 0xa2, 0x7a, 0xda, 0x7e, 0x00, 0x00, 0x00,
- 0x0a, 0x49, 0x44, 0x41, 0x54, 0x78, 0xda, 0x63, 0x60, 0x00,
- 0x00, 0x00, 0x02, 0x00, 0x01, 0xe5, 0x27, 0xde, 0xfc, 0x00,
- 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60,
- 0x82];
- $data{"emerald.png"} =
- [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00,
- 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x01, 0x01, 0x03, 0x00, 0x00, 0x00, 0x25,
- 0xdb, 0x56, 0xca, 0x00, 0x00, 0x00, 0x07, 0x74, 0x49, 0x4d,
- 0x45, 0x07, 0xd2, 0x07, 0x11, 0x0f, 0x22, 0x2b, 0xc9, 0xf5,
- 0x03, 0x33, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73,
- 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, 0x12, 0x01, 0xd2,
- 0xdd, 0x7e, 0xfc, 0x00, 0x00, 0x00, 0x04, 0x67, 0x41, 0x4d,
- 0x41, 0x00, 0x00, 0xb1, 0x8f, 0x0b, 0xfc, 0x61, 0x05, 0x00,
- 0x00, 0x00, 0x06, 0x50, 0x4c, 0x54, 0x45, 0x1b, 0xea, 0x59,
- 0x0a, 0x0a, 0x0a, 0x0f, 0xba, 0x50, 0x83, 0x00, 0x00, 0x00,
- 0x0a, 0x49, 0x44, 0x41, 0x54, 0x78, 0xda, 0x63, 0x60, 0x00,
- 0x00, 0x00, 0x02, 0x00, 0x01, 0xe5, 0x27, 0xde, 0xfc, 0x00,
- 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60,
- 0x82];
- $data{"snow.png"} =
- [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00,
- 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x01, 0x01, 0x03, 0x00, 0x00, 0x00, 0x25,
- 0xdb, 0x56, 0xca, 0x00, 0x00, 0x00, 0x07, 0x74, 0x49, 0x4d,
- 0x45, 0x07, 0xd2, 0x07, 0x11, 0x0f, 0x1e, 0x1d, 0x75, 0xbc,
- 0xef, 0x55, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73,
- 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, 0x12, 0x01, 0xd2,
- 0xdd, 0x7e, 0xfc, 0x00, 0x00, 0x00, 0x04, 0x67, 0x41, 0x4d,
- 0x41, 0x00, 0x00, 0xb1, 0x8f, 0x0b, 0xfc, 0x61, 0x05, 0x00,
- 0x00, 0x00, 0x06, 0x50, 0x4c, 0x54, 0x45, 0xff, 0xff, 0xff,
- 0x00, 0x00, 0x00, 0x55, 0xc2, 0xd3, 0x7e, 0x00, 0x00, 0x00,
- 0x0a, 0x49, 0x44, 0x41, 0x54, 0x78, 0xda, 0x63, 0x60, 0x00,
- 0x00, 0x00, 0x02, 0x00, 0x01, 0xe5, 0x27, 0xde, 0xfc, 0x00,
- 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60,
- 0x82];
- $data{"glass.png"} =
- [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00,
- 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x01, 0x01, 0x03, 0x00, 0x00, 0x00, 0x25,
- 0xdb, 0x56, 0xca, 0x00, 0x00, 0x00, 0x04, 0x67, 0x41, 0x4d,
- 0x41, 0x00, 0x00, 0xb1, 0x8f, 0x0b, 0xfc, 0x61, 0x05, 0x00,
- 0x00, 0x00, 0x06, 0x50, 0x4c, 0x54, 0x45, 0xff, 0xff, 0xff,
- 0x00, 0x00, 0x00, 0x55, 0xc2, 0xd3, 0x7e, 0x00, 0x00, 0x00,
- 0x01, 0x74, 0x52, 0x4e, 0x53, 0x00, 0x40, 0xe6, 0xd8, 0x66,
- 0x00, 0x00, 0x00, 0x01, 0x62, 0x4b, 0x47, 0x44, 0x00, 0x88,
- 0x05, 0x1d, 0x48, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59,
- 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, 0x12, 0x01,
- 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, 0x00, 0x07, 0x74, 0x49,
- 0x4d, 0x45, 0x07, 0xd2, 0x07, 0x13, 0x0f, 0x08, 0x19, 0xc4,
- 0x40, 0x56, 0x10, 0x00, 0x00, 0x00, 0x0a, 0x49, 0x44, 0x41,
- 0x54, 0x78, 0x9c, 0x63, 0x60, 0x00, 0x00, 0x00, 0x02, 0x00,
- 0x01, 0x48, 0xaf, 0xa4, 0x71, 0x00, 0x00, 0x00, 0x00, 0x49,
- 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82];
- $data{"updown.png"} =
- [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00,
- 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x0a,
- 0x00, 0x00, 0x00, 0x0e, 0x08, 0x06, 0x00, 0x00, 0x00, 0x16,
- 0xa3, 0x8d, 0xab, 0x00, 0x00, 0x00, 0x3c, 0x49, 0x44, 0x41,
- 0x54, 0x28, 0xcf, 0x63, 0x60, 0x40, 0x03, 0xff, 0xa1, 0x00,
- 0x5d, 0x9c, 0x11, 0x5d, 0x11, 0x8a, 0x24, 0x23, 0x23, 0x23,
- 0x86, 0x42, 0x6c, 0xa6, 0x20, 0x2b, 0x66, 0xc4, 0xa7, 0x08,
- 0x59, 0x31, 0x23, 0x21, 0x45, 0x30, 0xc0, 0xc4, 0x30, 0x60,
- 0x80, 0xfa, 0x6e, 0x24, 0x3e, 0x78, 0x48, 0x0a, 0x70, 0x62,
- 0xa2, 0x90, 0x81, 0xd8, 0x44, 0x01, 0x00, 0xe9, 0x5c, 0x2f,
- 0xf5, 0xe2, 0x9d, 0x0f, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x49,
- 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82] if ($sort);
- foreach (keys(%data))
- {
- open(PNG_HANDLE, ">", $_)
- or die("ERROR: cannot create $_!\n");
- binmode(PNG_HANDLE);
- print(PNG_HANDLE map(chr,@{$data{$_}}));
- close(PNG_HANDLE);
- }
-}
-
-
-#
-# write_htaccess_file()
-#
-
-sub write_htaccess_file()
-{
- local *HTACCESS_HANDLE;
- my $htaccess_data;
-
- open(*HTACCESS_HANDLE, ">", ".htaccess")
- or die("ERROR: cannot open .htaccess for writing!\n");
-
- $htaccess_data = (<<"END_OF_HTACCESS")
-AddEncoding x-gzip .html
-END_OF_HTACCESS
- ;
-
- print(HTACCESS_HANDLE $htaccess_data);
- close(*HTACCESS_HANDLE);
-}
-
-
-#
-# write_css_file()
-#
-# Write the cascading style sheet file gcov.css to the current directory.
-# This file defines basic layout attributes of all generated HTML pages.
-#
-
-sub write_css_file()
-{
- local *CSS_HANDLE;
-
- # Check for a specified external style sheet file
- if ($css_filename)
- {
- # Simply copy that file
- system("cp", $css_filename, "gcov.css")
- and die("ERROR: cannot copy file $css_filename!\n");
- return;
- }
-
- open(CSS_HANDLE, ">", "gcov.css")
- or die ("ERROR: cannot open gcov.css for writing!\n");
-
-
- # *************************************************************
-
- my $css_data = ($_=<<"END_OF_CSS")
- /* All views: initial background and text color */
- body
- {
- color: #000000;
- background-color: #FFFFFF;
- }
-
- /* All views: standard link format*/
- a:link
- {
- color: #284FA8;
- text-decoration: underline;
- }
-
- /* All views: standard link - visited format */
- a:visited
- {
- color: #00CB40;
- text-decoration: underline;
- }
-
- /* All views: standard link - activated format */
- a:active
- {
- color: #FF0040;
- text-decoration: underline;
- }
-
- /* All views: main title format */
- td.title
- {
- text-align: center;
- padding-bottom: 10px;
- font-family: sans-serif;
- font-size: 20pt;
- font-style: italic;
- font-weight: bold;
- }
-
- /* All views: header item format */
- td.headerItem
- {
- text-align: right;
- padding-right: 6px;
- font-family: sans-serif;
- font-weight: bold;
- vertical-align: top;
- white-space: nowrap;
- }
-
- /* All views: header item value format */
- td.headerValue
- {
- text-align: left;
- color: #284FA8;
- font-family: sans-serif;
- font-weight: bold;
- white-space: nowrap;
- }
-
- /* All views: header item coverage table heading */
- td.headerCovTableHead
- {
- text-align: center;
- padding-right: 6px;
- padding-left: 6px;
- padding-bottom: 0px;
- font-family: sans-serif;
- font-size: 80%;
- white-space: nowrap;
- }
-
- /* All views: header item coverage table entry */
- td.headerCovTableEntry
- {
- text-align: right;
- color: #284FA8;
- font-family: sans-serif;
- font-weight: bold;
- white-space: nowrap;
- padding-left: 12px;
- padding-right: 4px;
- background-color: #DAE7FE;
- }
-
- /* All views: header item coverage table entry for high coverage rate */
- td.headerCovTableEntryHi
- {
- text-align: right;
- color: #000000;
- font-family: sans-serif;
- font-weight: bold;
- white-space: nowrap;
- padding-left: 12px;
- padding-right: 4px;
- background-color: #A7FC9D;
- }
-
- /* All views: header item coverage table entry for medium coverage rate */
- td.headerCovTableEntryMed
- {
- text-align: right;
- color: #000000;
- font-family: sans-serif;
- font-weight: bold;
- white-space: nowrap;
- padding-left: 12px;
- padding-right: 4px;
- background-color: #FFEA20;
- }
-
- /* All views: header item coverage table entry for ow coverage rate */
- td.headerCovTableEntryLo
- {
- text-align: right;
- color: #000000;
- font-family: sans-serif;
- font-weight: bold;
- white-space: nowrap;
- padding-left: 12px;
- padding-right: 4px;
- background-color: #FF0000;
- }
-
- /* All views: header legend value for legend entry */
- td.headerValueLeg
- {
- text-align: left;
- color: #000000;
- font-family: sans-serif;
- font-size: 80%;
- white-space: nowrap;
- padding-top: 4px;
- }
-
- /* All views: color of horizontal ruler */
- td.ruler
- {
- background-color: #6688D4;
- }
-
- /* All views: version string format */
- td.versionInfo
- {
- text-align: center;
- padding-top: 2px;
- font-family: sans-serif;
- font-style: italic;
- }
-
- /* Directory view/File view (all)/Test case descriptions:
- table headline format */
- td.tableHead
- {
- text-align: center;
- color: #FFFFFF;
- background-color: #6688D4;
- font-family: sans-serif;
- font-size: 120%;
- font-weight: bold;
- white-space: nowrap;
- padding-left: 4px;
- padding-right: 4px;
- }
-
- span.tableHeadSort
- {
- padding-right: 4px;
- }
-
- /* Directory view/File view (all): filename entry format */
- td.coverFile
- {
- text-align: left;
- padding-left: 10px;
- padding-right: 20px;
- color: #284FA8;
- background-color: #DAE7FE;
- font-family: monospace;
- }
-
- /* Directory view/File view (all): bar-graph entry format*/
- td.coverBar
- {
- padding-left: 10px;
- padding-right: 10px;
- background-color: #DAE7FE;
- }
-
- /* Directory view/File view (all): bar-graph outline color */
- td.coverBarOutline
- {
- background-color: #000000;
- }
-
- /* Directory view/File view (all): percentage entry for files with
- high coverage rate */
- td.coverPerHi
- {
- text-align: right;
- padding-left: 10px;
- padding-right: 10px;
- background-color: #A7FC9D;
- font-weight: bold;
- font-family: sans-serif;
- }
-
- /* Directory view/File view (all): line count entry for files with
- high coverage rate */
- td.coverNumHi
- {
- text-align: right;
- padding-left: 10px;
- padding-right: 10px;
- background-color: #A7FC9D;
- white-space: nowrap;
- font-family: sans-serif;
- }
-
- /* Directory view/File view (all): percentage entry for files with
- medium coverage rate */
- td.coverPerMed
- {
- text-align: right;
- padding-left: 10px;
- padding-right: 10px;
- background-color: #FFEA20;
- font-weight: bold;
- font-family: sans-serif;
- }
-
- /* Directory view/File view (all): line count entry for files with
- medium coverage rate */
- td.coverNumMed
- {
- text-align: right;
- padding-left: 10px;
- padding-right: 10px;
- background-color: #FFEA20;
- white-space: nowrap;
- font-family: sans-serif;
- }
-
- /* Directory view/File view (all): percentage entry for files with
- low coverage rate */
- td.coverPerLo
- {
- text-align: right;
- padding-left: 10px;
- padding-right: 10px;
- background-color: #FF0000;
- font-weight: bold;
- font-family: sans-serif;
- }
-
- /* Directory view/File view (all): line count entry for files with
- low coverage rate */
- td.coverNumLo
- {
- text-align: right;
- padding-left: 10px;
- padding-right: 10px;
- background-color: #FF0000;
- white-space: nowrap;
- font-family: sans-serif;
- }
-
- /* File view (all): "show/hide details" link format */
- a.detail:link
- {
- color: #B8D0FF;
- font-size:80%;
- }
-
- /* File view (all): "show/hide details" link - visited format */
- a.detail:visited
- {
- color: #B8D0FF;
- font-size:80%;
- }
-
- /* File view (all): "show/hide details" link - activated format */
- a.detail:active
- {
- color: #FFFFFF;
- font-size:80%;
- }
-
- /* File view (detail): test name entry */
- td.testName
- {
- text-align: right;
- padding-right: 10px;
- background-color: #DAE7FE;
- font-family: sans-serif;
- }
-
- /* File view (detail): test percentage entry */
- td.testPer
- {
- text-align: right;
- padding-left: 10px;
- padding-right: 10px;
- background-color: #DAE7FE;
- font-family: sans-serif;
- }
-
- /* File view (detail): test lines count entry */
- td.testNum
- {
- text-align: right;
- padding-left: 10px;
- padding-right: 10px;
- background-color: #DAE7FE;
- font-family: sans-serif;
- }
-
- /* Test case descriptions: test name format*/
- dt
- {
- font-family: sans-serif;
- font-weight: bold;
- }
-
- /* Test case descriptions: description table body */
- td.testDescription
- {
- padding-top: 10px;
- padding-left: 30px;
- padding-bottom: 10px;
- padding-right: 30px;
- background-color: #DAE7FE;
- }
-
- /* Source code view: function entry */
- td.coverFn
- {
- text-align: left;
- padding-left: 10px;
- padding-right: 20px;
- color: #284FA8;
- background-color: #DAE7FE;
- font-family: monospace;
- }
-
- /* Source code view: function entry zero count*/
- td.coverFnLo
- {
- text-align: right;
- padding-left: 10px;
- padding-right: 10px;
- background-color: #FF0000;
- font-weight: bold;
- font-family: sans-serif;
- }
-
- /* Source code view: function entry nonzero count*/
- td.coverFnHi
- {
- text-align: right;
- padding-left: 10px;
- padding-right: 10px;
- background-color: #DAE7FE;
- font-weight: bold;
- font-family: sans-serif;
- }
-
- /* Source code view: source code format */
- pre.source
- {
- font-family: monospace;
- white-space: pre;
- margin-top: 2px;
- }
-
- /* Source code view: line number format */
- span.lineNum
- {
- background-color: #EFE383;
- }
-
- /* Source code view: format for lines which were executed */
- td.lineCov,
- span.lineCov
- {
- background-color: #CAD7FE;
- }
-
- /* Source code view: format for Cov legend */
- span.coverLegendCov
- {
- padding-left: 10px;
- padding-right: 10px;
- padding-bottom: 2px;
- background-color: #CAD7FE;
- }
-
- /* Source code view: format for lines which were not executed */
- td.lineNoCov,
- span.lineNoCov
- {
- background-color: #FF6230;
- }
-
- /* Source code view: format for NoCov legend */
- span.coverLegendNoCov
- {
- padding-left: 10px;
- padding-right: 10px;
- padding-bottom: 2px;
- background-color: #FF6230;
- }
-
- /* Source code view (function table): standard link - visited format */
- td.lineNoCov > a:visited,
- td.lineCov > a:visited
- {
- color: black;
- text-decoration: underline;
- }
-
- /* Source code view: format for lines which were executed only in a
- previous version */
- span.lineDiffCov
- {
- background-color: #B5F7AF;
- }
-
- /* Source code view: format for branches which were executed
- * and taken */
- span.branchCov
- {
- background-color: #CAD7FE;
- }
-
- /* Source code view: format for branches which were executed
- * but not taken */
- span.branchNoCov
- {
- background-color: #FF6230;
- }
-
- /* Source code view: format for branches which were not executed */
- span.branchNoExec
- {
- background-color: #FF6230;
- }
-
- /* Source code view: format for the source code heading line */
- pre.sourceHeading
- {
- white-space: pre;
- font-family: monospace;
- font-weight: bold;
- margin: 0px;
- }
-
- /* All views: header legend value for low rate */
- td.headerValueLegL
- {
- font-family: sans-serif;
- text-align: center;
- white-space: nowrap;
- padding-left: 4px;
- padding-right: 2px;
- background-color: #FF0000;
- font-size: 80%;
- }
-
- /* All views: header legend value for med rate */
- td.headerValueLegM
- {
- font-family: sans-serif;
- text-align: center;
- white-space: nowrap;
- padding-left: 2px;
- padding-right: 2px;
- background-color: #FFEA20;
- font-size: 80%;
- }
-
- /* All views: header legend value for hi rate */
- td.headerValueLegH
- {
- font-family: sans-serif;
- text-align: center;
- white-space: nowrap;
- padding-left: 2px;
- padding-right: 4px;
- background-color: #A7FC9D;
- font-size: 80%;
- }
-
- /* All views except source code view: legend format for low coverage */
- span.coverLegendCovLo
- {
- padding-left: 10px;
- padding-right: 10px;
- padding-top: 2px;
- background-color: #FF0000;
- }
-
- /* All views except source code view: legend format for med coverage */
- span.coverLegendCovMed
- {
- padding-left: 10px;
- padding-right: 10px;
- padding-top: 2px;
- background-color: #FFEA20;
- }
-
- /* All views except source code view: legend format for hi coverage */
- span.coverLegendCovHi
- {
- padding-left: 10px;
- padding-right: 10px;
- padding-top: 2px;
- background-color: #A7FC9D;
- }
-END_OF_CSS
- ;
-
- # *************************************************************
-
-
- # Remove leading tab from all lines
- $css_data =~ s/^\t//gm;
-
- print(CSS_HANDLE $css_data);
-
- close(CSS_HANDLE);
-}
-
-
-#
-# get_bar_graph_code(base_dir, cover_found, cover_hit)
-#
-# Return a string containing HTML code which implements a bar graph display
-# for a coverage rate of cover_hit * 100 / cover_found.
-#
-
-sub get_bar_graph_code($$$)
-{
- my ($base_dir, $found, $hit) = @_;
- my $rate;
- my $alt;
- my $width;
- my $remainder;
- my $png_name;
- my $graph_code;
-
- # Check number of instrumented lines
- if ($_[1] == 0) { return ""; }
-
- $alt = rate($hit, $found, "%");
- $width = rate($hit, $found, undef, 0);
- $remainder = 100 - $width;
-
- # Decide which .png file to use
- $png_name = $rate_png[classify_rate($found, $hit, $med_limit,
- $hi_limit)];
-
- if ($width == 0)
- {
- # Zero coverage
- $graph_code = (<<END_OF_HTML)
- <table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="$_[0]snow.png" width=100 height=10 alt="$alt"></td></tr></table>
-END_OF_HTML
- ;
- }
- elsif ($width == 100)
- {
- # Full coverage
- $graph_code = (<<END_OF_HTML)
- <table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="$_[0]$png_name" width=100 height=10 alt="$alt"></td></tr></table>
-END_OF_HTML
- ;
- }
- else
- {
- # Positive coverage
- $graph_code = (<<END_OF_HTML)
- <table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="$_[0]$png_name" width=$width height=10 alt="$alt"><img src="$_[0]snow.png" width=$remainder height=10 alt="$alt"></td></tr></table>
-END_OF_HTML
- ;
- }
-
- # Remove leading tabs from all lines
- $graph_code =~ s/^\t+//gm;
- chomp($graph_code);
-
- return($graph_code);
-}
-
-#
-# sub classify_rate(found, hit, med_limit, high_limit)
-#
-# Return 0 for low rate, 1 for medium rate and 2 for hi rate.
-#
-
-sub classify_rate($$$$)
-{
- my ($found, $hit, $med, $hi) = @_;
- my $rate;
-
- if ($found == 0) {
- return 2;
- }
- $rate = rate($hit, $found);
- if ($rate < $med) {
- return 0;
- } elsif ($rate < $hi) {
- return 1;
- }
- return 2;
-}
-
-
-#
-# write_html(filehandle, html_code)
-#
-# Write out HTML_CODE to FILEHANDLE while removing a leading tabulator mark
-# in each line of HTML_CODE.
-#
-
-sub write_html(*$)
-{
- local *HTML_HANDLE = $_[0];
- my $html_code = $_[1];
-
- # Remove leading tab from all lines
- $html_code =~ s/^\t//gm;
-
- print(HTML_HANDLE $html_code)
- or die("ERROR: cannot write HTML data ($!)\n");
-}
-
-
-#
-# write_html_prolog(filehandle, base_dir, pagetitle)
-#
-# Write an HTML prolog common to all HTML files to FILEHANDLE. PAGETITLE will
-# be used as HTML page title. BASE_DIR contains a relative path which points
-# to the base directory.
-#
-
-sub write_html_prolog(*$$)
-{
- my $basedir = $_[1];
- my $pagetitle = $_[2];
- my $prolog;
-
- $prolog = $html_prolog;
- $prolog =~ s/\@pagetitle\@/$pagetitle/g;
- $prolog =~ s/\@basedir\@/$basedir/g;
-
- write_html($_[0], $prolog);
-}
-
-
-#
-# write_header_prolog(filehandle, base_dir)
-#
-# Write beginning of page header HTML code.
-#
-
-sub write_header_prolog(*$)
-{
- # *************************************************************
-
- write_html($_[0], <<END_OF_HTML)
- <table width="100%" border=0 cellspacing=0 cellpadding=0>
- <tr><td class="title">$title</td></tr>
- <tr><td class="ruler"><img src="$_[1]glass.png" width=3 height=3 alt=""></td></tr>
-
- <tr>
- <td width="100%">
- <table cellpadding=1 border=0 width="100%">
-END_OF_HTML
- ;
-
- # *************************************************************
-}
-
-
-#
-# write_header_line(handle, content)
-#
-# Write a header line with the specified table contents.
-#
-
-sub write_header_line(*@)
-{
- my ($handle, @content) = @_;
- my $entry;
-
- write_html($handle, " <tr>\n");
- foreach $entry (@content) {
- my ($width, $class, $text, $colspan) = @{$entry};
-
- if (defined($width)) {
- $width = " width=\"$width\"";
- } else {
- $width = "";
- }
- if (defined($class)) {
- $class = " class=\"$class\"";
- } else {
- $class = "";
- }
- if (defined($colspan)) {
- $colspan = " colspan=\"$colspan\"";
- } else {
- $colspan = "";
- }
- $text = "" if (!defined($text));
- write_html($handle,
- " <td$width$class$colspan>$text</td>\n");
- }
- write_html($handle, " </tr>\n");
-}
-
-
-#
-# write_header_epilog(filehandle, base_dir)
-#
-# Write end of page header HTML code.
-#
-
-sub write_header_epilog(*$)
-{
- # *************************************************************
-
- write_html($_[0], <<END_OF_HTML)
- <tr><td><img src="$_[1]glass.png" width=3 height=3 alt=""></td></tr>
- </table>
- </td>
- </tr>
-
- <tr><td class="ruler"><img src="$_[1]glass.png" width=3 height=3 alt=""></td></tr>
- </table>
-
-END_OF_HTML
- ;
-
- # *************************************************************
-}
-
-
-#
-# write_file_table_prolog(handle, file_heading, ([heading, num_cols], ...))
-#
-# Write heading for file table.
-#
-
-sub write_file_table_prolog(*$@)
-{
- my ($handle, $file_heading, @columns) = @_;
- my $num_columns = 0;
- my $file_width;
- my $col;
- my $width;
-
- $width = 20 if (scalar(@columns) == 1);
- $width = 10 if (scalar(@columns) == 2);
- $width = 8 if (scalar(@columns) > 2);
-
- foreach $col (@columns) {
- my ($heading, $cols) = @{$col};
-
- $num_columns += $cols;
- }
- $file_width = 100 - $num_columns * $width;
-
- # Table definition
- write_html($handle, <<END_OF_HTML);
- <center>
- <table width="80%" cellpadding=1 cellspacing=1 border=0>
-
- <tr>
- <td width="$file_width%"><br></td>
-END_OF_HTML
- # Empty first row
- foreach $col (@columns) {
- my ($heading, $cols) = @{$col};
-
- while ($cols-- > 0) {
- write_html($handle, <<END_OF_HTML);
- <td width="$width%"></td>
-END_OF_HTML
- }
- }
- # Next row
- write_html($handle, <<END_OF_HTML);
- </tr>
-
- <tr>
- <td class="tableHead">$file_heading</td>
-END_OF_HTML
- # Heading row
- foreach $col (@columns) {
- my ($heading, $cols) = @{$col};
- my $colspan = "";
-
- $colspan = " colspan=$cols" if ($cols > 1);
- write_html($handle, <<END_OF_HTML);
- <td class="tableHead"$colspan>$heading</td>
-END_OF_HTML
- }
- write_html($handle, <<END_OF_HTML);
- </tr>
-END_OF_HTML
-}
-
-
-# write_file_table_entry(handle, base_dir, filename, page_link,
-# ([ found, hit, med_limit, hi_limit, graph ], ..)
-#
-# Write an entry of the file table.
-#
-
-sub write_file_table_entry(*$$$@)
-{
- my ($handle, $base_dir, $filename, $page_link, @entries) = @_;
- my $file_code;
- my $entry;
- my $esc_filename = escape_html($filename);
-
- # Add link to source if provided
- if (defined($page_link) && $page_link ne "") {
- $file_code = "<a href=\"$page_link\">$esc_filename</a>";
- } else {
- $file_code = $esc_filename;
- }
-
- # First column: filename
- write_html($handle, <<END_OF_HTML);
- <tr>
- <td class="coverFile">$file_code</td>
-END_OF_HTML
- # Columns as defined
- foreach $entry (@entries) {
- my ($found, $hit, $med, $hi, $graph) = @{$entry};
- my $bar_graph;
- my $class;
- my $rate;
-
- # Generate bar graph if requested
- if ($graph) {
- $bar_graph = get_bar_graph_code($base_dir, $found,
- $hit);
- write_html($handle, <<END_OF_HTML);
- <td class="coverBar" align="center">
- $bar_graph
- </td>
-END_OF_HTML
- }
- # Get rate color and text
- if ($found == 0) {
- $rate = "-";
- $class = "Hi";
- } else {
- $rate = rate($hit, $found, "&nbsp;%");
- $class = $rate_name[classify_rate($found, $hit,
- $med, $hi)];
- }
- write_html($handle, <<END_OF_HTML);
- <td class="coverPer$class">$rate</td>
- <td class="coverNum$class">$hit / $found</td>
-END_OF_HTML
- }
- # End of row
- write_html($handle, <<END_OF_HTML);
- </tr>
-END_OF_HTML
-}
-
-
-#
-# write_file_table_detail_entry(filehandle, test_name, ([found, hit], ...))
-#
-# Write entry for detail section in file table.
-#
-
-sub write_file_table_detail_entry(*$@)
-{
- my ($handle, $test, @entries) = @_;
- my $entry;
-
- if ($test eq "") {
- $test = "<span style=\"font-style:italic\">&lt;unnamed&gt;</span>";
- } elsif ($test =~ /^(.*),diff$/) {
- $test = $1." (converted)";
- }
- # Testname
- write_html($handle, <<END_OF_HTML);
- <tr>
- <td class="testName" colspan=2>$test</td>
-END_OF_HTML
- # Test data
- foreach $entry (@entries) {
- my ($found, $hit) = @{$entry};
- my $rate = rate($hit, $found, "&nbsp;%");
-
- write_html($handle, <<END_OF_HTML);
- <td class="testPer">$rate</td>
- <td class="testNum">$hit&nbsp;/&nbsp;$found</td>
-END_OF_HTML
- }
-
- write_html($handle, <<END_OF_HTML);
- </tr>
-
-END_OF_HTML
-
- # *************************************************************
-}
-
-
-#
-# write_file_table_epilog(filehandle)
-#
-# Write end of file table HTML code.
-#
-
-sub write_file_table_epilog(*)
-{
- # *************************************************************
-
- write_html($_[0], <<END_OF_HTML)
- </table>
- </center>
- <br>
-
-END_OF_HTML
- ;
-
- # *************************************************************
-}
-
-
-#
-# write_test_table_prolog(filehandle, table_heading)
-#
-# Write heading for test case description table.
-#
-
-sub write_test_table_prolog(*$)
-{
- # *************************************************************
-
- write_html($_[0], <<END_OF_HTML)
- <center>
- <table width="80%" cellpadding=2 cellspacing=1 border=0>
-
- <tr>
- <td><br></td>
- </tr>
-
- <tr>
- <td class="tableHead">$_[1]</td>
- </tr>
-
- <tr>
- <td class="testDescription">
- <dl>
-END_OF_HTML
- ;
-
- # *************************************************************
-}
-
-
-#
-# write_test_table_entry(filehandle, test_name, test_description)
-#
-# Write entry for the test table.
-#
-
-sub write_test_table_entry(*$$)
-{
- # *************************************************************
-
- write_html($_[0], <<END_OF_HTML)
- <dt>$_[1]<a name="$_[1]">&nbsp;</a></dt>
- <dd>$_[2]<br><br></dd>
-END_OF_HTML
- ;
-
- # *************************************************************
-}
-
-
-#
-# write_test_table_epilog(filehandle)
-#
-# Write end of test description table HTML code.
-#
-
-sub write_test_table_epilog(*)
-{
- # *************************************************************
-
- write_html($_[0], <<END_OF_HTML)
- </dl>
- </td>
- </tr>
- </table>
- </center>
- <br>
-
-END_OF_HTML
- ;
-
- # *************************************************************
-}
-
-
-sub fmt_centered($$)
-{
- my ($width, $text) = @_;
- my $w0 = length($text);
- my $w1 = int(($width - $w0) / 2);
- my $w2 = $width - $w0 - $w1;
-
- return (" "x$w1).$text.(" "x$w2);
-}
-
-
-#
-# write_source_prolog(filehandle)
-#
-# Write start of source code table.
-#
-
-sub write_source_prolog(*)
-{
- my $lineno_heading = " ";
- my $branch_heading = "";
- my $line_heading = fmt_centered($line_field_width, "Line data");
- my $source_heading = " Source code";
-
- if ($br_coverage) {
- $branch_heading = fmt_centered($br_field_width, "Branch data").
- " ";
- }
- # *************************************************************
-
- write_html($_[0], <<END_OF_HTML)
- <table cellpadding=0 cellspacing=0 border=0>
- <tr>
- <td><br></td>
- </tr>
- <tr>
- <td>
-<pre class="sourceHeading">${lineno_heading}${branch_heading}${line_heading} ${source_heading}</pre>
-<pre class="source">
-END_OF_HTML
- ;
-
- # *************************************************************
-}
-
-
-#
-# get_branch_blocks(brdata)
-#
-# Group branches that belong to the same basic block.
-#
-# Returns: [block1, block2, ...]
-# block: [branch1, branch2, ...]
-# branch: [block_num, branch_num, taken_count, text_length, open, close]
-#
-
-sub get_branch_blocks($)
-{
- my ($brdata) = @_;
- my $last_block_num;
- my $block = [];
- my @blocks;
- my $i;
- my $num = br_ivec_len($brdata);
-
- # Group branches
- for ($i = 0; $i < $num; $i++) {
- my ($block_num, $branch, $taken) = br_ivec_get($brdata, $i);
- my $br;
-
- if (defined($last_block_num) && $block_num != $last_block_num) {
- push(@blocks, $block);
- $block = [];
- }
- $br = [$block_num, $branch, $taken, 3, 0, 0];
- push(@{$block}, $br);
- $last_block_num = $block_num;
- }
- push(@blocks, $block) if (scalar(@{$block}) > 0);
-
- # Add braces to first and last branch in group
- foreach $block (@blocks) {
- $block->[0]->[$BR_OPEN] = 1;
- $block->[0]->[$BR_LEN]++;
- $block->[scalar(@{$block}) - 1]->[$BR_CLOSE] = 1;
- $block->[scalar(@{$block}) - 1]->[$BR_LEN]++;
- }
-
- return @blocks;
-}
-
-#
-# get_block_len(block)
-#
-# Calculate total text length of all branches in a block of branches.
-#
-
-sub get_block_len($)
-{
- my ($block) = @_;
- my $len = 0;
- my $branch;
-
- foreach $branch (@{$block}) {
- $len += $branch->[$BR_LEN];
- }
-
- return $len;
-}
-
-
-#
-# get_branch_html(brdata)
-#
-# Return a list of HTML lines which represent the specified branch coverage
-# data in source code view.
-#
-
-sub get_branch_html($)
-{
- my ($brdata) = @_;
- my @blocks = get_branch_blocks($brdata);
- my $block;
- my $branch;
- my $line_len = 0;
- my $line = []; # [branch2|" ", branch|" ", ...]
- my @lines; # [line1, line2, ...]
- my @result;
-
- # Distribute blocks to lines
- foreach $block (@blocks) {
- my $block_len = get_block_len($block);
-
- # Does this block fit into the current line?
- if ($line_len + $block_len <= $br_field_width) {
- # Add it
- $line_len += $block_len;
- push(@{$line}, @{$block});
- next;
- } elsif ($block_len <= $br_field_width) {
- # It would fit if the line was empty - add it to new
- # line
- push(@lines, $line);
- $line_len = $block_len;
- $line = [ @{$block} ];
- next;
- }
- # Split the block into several lines
- foreach $branch (@{$block}) {
- if ($line_len + $branch->[$BR_LEN] >= $br_field_width) {
- # Start a new line
- if (($line_len + 1 <= $br_field_width) &&
- scalar(@{$line}) > 0 &&
- !$line->[scalar(@$line) - 1]->[$BR_CLOSE]) {
- # Try to align branch symbols to be in
- # one # row
- push(@{$line}, " ");
- }
- push(@lines, $line);
- $line_len = 0;
- $line = [];
- }
- push(@{$line}, $branch);
- $line_len += $branch->[$BR_LEN];
- }
- }
- push(@lines, $line);
-
- # Convert to HTML
- foreach $line (@lines) {
- my $current = "";
- my $current_len = 0;
-
- foreach $branch (@$line) {
- # Skip alignment space
- if ($branch eq " ") {
- $current .= " ";
- $current_len++;
- next;
- }
-
- my ($block_num, $br_num, $taken, $len, $open, $close) =
- @{$branch};
- my $class;
- my $title;
- my $text;
-
- if ($taken eq '-') {
- $class = "branchNoExec";
- $text = " # ";
- $title = "Branch $br_num was not executed";
- } elsif ($taken == 0) {
- $class = "branchNoCov";
- $text = " - ";
- $title = "Branch $br_num was not taken";
- } else {
- $class = "branchCov";
- $text = " + ";
- $title = "Branch $br_num was taken $taken ".
- "time";
- $title .= "s" if ($taken > 1);
- }
- $current .= "[" if ($open);
- $current .= "<span class=\"$class\" title=\"$title\">";
- $current .= $text."</span>";
- $current .= "]" if ($close);
- $current_len += $len;
- }
-
- # Right-align result text
- if ($current_len < $br_field_width) {
- $current = (" "x($br_field_width - $current_len)).
- $current;
- }
- push(@result, $current);
- }
-
- return @result;
-}
-
-
-#
-# format_count(count, width)
-#
-# Return a right-aligned representation of count that fits in width characters.
-#
-
-sub format_count($$)
-{
- my ($count, $width) = @_;
- my $result;
- my $exp;
-
- $result = sprintf("%*.0f", $width, $count);
- while (length($result) > $width) {
- last if ($count < 10);
- $exp++;
- $count = int($count/10);
- $result = sprintf("%*s", $width, ">$count*10^$exp");
- }
- return $result;
-}
-
-#
-# write_source_line(filehandle, line_num, source, hit_count, converted,
-# brdata, add_anchor)
-#
-# Write formatted source code line. Return a line in a format as needed
-# by gen_png()
-#
-
-sub write_source_line(*$$$$$$)
-{
- my ($handle, $line, $source, $count, $converted, $brdata,
- $add_anchor) = @_;
- my $source_format;
- my $count_format;
- my $result;
- my $anchor_start = "";
- my $anchor_end = "";
- my $count_field_width = $line_field_width - 1;
- my @br_html;
- my $html;
-
- # Get branch HTML data for this line
- @br_html = get_branch_html($brdata) if ($br_coverage);
-
- if (!defined($count)) {
- $result = "";
- $source_format = "";
- $count_format = " "x$count_field_width;
- }
- elsif ($count == 0) {
- $result = $count;
- $source_format = '<span class="lineNoCov">';
- $count_format = format_count($count, $count_field_width);
- }
- elsif ($converted && defined($highlight)) {
- $result = "*".$count;
- $source_format = '<span class="lineDiffCov">';
- $count_format = format_count($count, $count_field_width);
- }
- else {
- $result = $count;
- $source_format = '<span class="lineCov">';
- $count_format = format_count($count, $count_field_width);
- }
- $result .= ":".$source;
-
- # Write out a line number navigation anchor every $nav_resolution
- # lines if necessary
- if ($add_anchor)
- {
- $anchor_start = "<a name=\"$_[1]\">";
- $anchor_end = "</a>";
- }
-
-
- # *************************************************************
-
- $html = $anchor_start;
- $html .= "<span class=\"lineNum\">".sprintf("%8d", $line)." </span>";
- $html .= shift(@br_html).":" if ($br_coverage);
- $html .= "$source_format$count_format : ";
- $html .= escape_html($source);
- $html .= "</span>" if ($source_format);
- $html .= $anchor_end."\n";
-
- write_html($handle, $html);
-
- if ($br_coverage) {
- # Add lines for overlong branch information
- foreach (@br_html) {
- write_html($handle, "<span class=\"lineNum\">".
- " </span>$_\n");
- }
- }
- # *************************************************************
-
- return($result);
-}
-
-
-#
-# write_source_epilog(filehandle)
-#
-# Write end of source code table.
-#
-
-sub write_source_epilog(*)
-{
- # *************************************************************
-
- write_html($_[0], <<END_OF_HTML)
- </pre>
- </td>
- </tr>
- </table>
- <br>
-
-END_OF_HTML
- ;
-
- # *************************************************************
-}
-
-
-#
-# write_html_epilog(filehandle, base_dir[, break_frames])
-#
-# Write HTML page footer to FILEHANDLE. BREAK_FRAMES should be set when
-# this page is embedded in a frameset, clicking the URL link will then
-# break this frameset.
-#
-
-sub write_html_epilog(*$;$)
-{
- my $basedir = $_[1];
- my $break_code = "";
- my $epilog;
-
- if (defined($_[2]))
- {
- $break_code = " target=\"_parent\"";
- }
-
- # *************************************************************
-
- write_html($_[0], <<END_OF_HTML)
- <table width="100%" border=0 cellspacing=0 cellpadding=0>
- <tr><td class="ruler"><img src="$_[1]glass.png" width=3 height=3 alt=""></td></tr>
- <tr><td class="versionInfo">Generated by: <a href="$lcov_url"$break_code>$lcov_version</a></td></tr>
- </table>
- <br>
-END_OF_HTML
- ;
-
- $epilog = $html_epilog;
- $epilog =~ s/\@basedir\@/$basedir/g;
-
- write_html($_[0], $epilog);
-}
-
-
-#
-# write_frameset(filehandle, basedir, basename, pagetitle)
-#
-#
-
-sub write_frameset(*$$$)
-{
- my $frame_width = $overview_width + 40;
-
- # *************************************************************
-
- write_html($_[0], <<END_OF_HTML)
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
-
- <html lang="en">
-
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=$charset">
- <title>$_[3]</title>
- <link rel="stylesheet" type="text/css" href="$_[1]gcov.css">
- </head>
-
- <frameset cols="$frame_width,*">
- <frame src="$_[2].gcov.overview.$html_ext" name="overview">
- <frame src="$_[2].gcov.$html_ext" name="source">
- <noframes>
- <center>Frames not supported by your browser!<br></center>
- </noframes>
- </frameset>
-
- </html>
-END_OF_HTML
- ;
-
- # *************************************************************
-}
-
-
-#
-# sub write_overview_line(filehandle, basename, line, link)
-#
-#
-
-sub write_overview_line(*$$$)
-{
- my $y1 = $_[2] - 1;
- my $y2 = $y1 + $nav_resolution - 1;
- my $x2 = $overview_width - 1;
-
- # *************************************************************
-
- write_html($_[0], <<END_OF_HTML)
- <area shape="rect" coords="0,$y1,$x2,$y2" href="$_[1].gcov.$html_ext#$_[3]" target="source" alt="overview">
-END_OF_HTML
- ;
-
- # *************************************************************
-}
-
-
-#
-# write_overview(filehandle, basedir, basename, pagetitle, lines)
-#
-#
-
-sub write_overview(*$$$$)
-{
- my $index;
- my $max_line = $_[4] - 1;
- my $offset;
-
- # *************************************************************
-
- write_html($_[0], <<END_OF_HTML)
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-
- <html lang="en">
-
- <head>
- <title>$_[3]</title>
- <meta http-equiv="Content-Type" content="text/html; charset=$charset">
- <link rel="stylesheet" type="text/css" href="$_[1]gcov.css">
- </head>
-
- <body>
- <map name="overview">
-END_OF_HTML
- ;
-
- # *************************************************************
-
- # Make $offset the next higher multiple of $nav_resolution
- $offset = ($nav_offset + $nav_resolution - 1) / $nav_resolution;
- $offset = sprintf("%d", $offset ) * $nav_resolution;
-
- # Create image map for overview image
- for ($index = 1; $index <= $_[4]; $index += $nav_resolution)
- {
- # Enforce nav_offset
- if ($index < $offset + 1)
- {
- write_overview_line($_[0], $_[2], $index, 1);
- }
- else
- {
- write_overview_line($_[0], $_[2], $index, $index - $offset);
- }
- }
-
- # *************************************************************
-
- write_html($_[0], <<END_OF_HTML)
- </map>
-
- <center>
- <a href="$_[2].gcov.$html_ext#top" target="source">Top</a><br><br>
- <img src="$_[2].gcov.png" width=$overview_width height=$max_line alt="Overview" border=0 usemap="#overview">
- </center>
- </body>
- </html>
-END_OF_HTML
- ;
-
- # *************************************************************
-}
-
-
-sub max($$)
-{
- my ($a, $b) = @_;
-
- return $a if ($a > $b);
- return $b;
-}
-
-
-#
-# write_header(filehandle, type, trunc_file_name, rel_file_name, lines_found,
-# lines_hit, funcs_found, funcs_hit, sort_type)
-#
-# Write a complete standard page header. TYPE may be (0, 1, 2, 3, 4)
-# corresponding to (directory view header, file view header, source view
-# header, test case description header, function view header)
-#
-
-sub write_header(*$$$$$$$$$$)
-{
- local *HTML_HANDLE = $_[0];
- my $type = $_[1];
- my $trunc_name = $_[2];
- my $rel_filename = $_[3];
- my $lines_found = $_[4];
- my $lines_hit = $_[5];
- my $fn_found = $_[6];
- my $fn_hit = $_[7];
- my $br_found = $_[8];
- my $br_hit = $_[9];
- my $sort_type = $_[10];
- my $base_dir;
- my $view;
- my $test;
- my $base_name;
- my $style;
- my $rate;
- my @row_left;
- my @row_right;
- my $num_rows;
- my $i;
- my $esc_trunc_name = escape_html($trunc_name);
-
- $base_name = basename($rel_filename);
-
- # Prepare text for "current view" field
- if ($type == $HDR_DIR)
- {
- # Main overview
- $base_dir = "";
- $view = $overview_title;
- }
- elsif ($type == $HDR_FILE)
- {
- # Directory overview
- $base_dir = get_relative_base_path($rel_filename);
- $view = "<a href=\"$base_dir"."index.$html_ext\">".
- "$overview_title</a> - $esc_trunc_name";
- }
- elsif ($type == $HDR_SOURCE || $type == $HDR_FUNC)
- {
- # File view
- my $dir_name = dirname($rel_filename);
- my $esc_base_name = escape_html($base_name);
- my $esc_dir_name = escape_html($dir_name);
-
- $base_dir = get_relative_base_path($dir_name);
- if ($frames)
- {
- # Need to break frameset when clicking any of these
- # links
- $view = "<a href=\"$base_dir"."index.$html_ext\" ".
- "target=\"_parent\">$overview_title</a> - ".
- "<a href=\"index.$html_ext\" target=\"_parent\">".
- "$esc_dir_name</a> - $esc_base_name";
- }
- else
- {
- $view = "<a href=\"$base_dir"."index.$html_ext\">".
- "$overview_title</a> - ".
- "<a href=\"index.$html_ext\">".
- "$esc_dir_name</a> - $esc_base_name";
- }
-
- # Add function suffix
- if ($func_coverage) {
- $view .= "<span style=\"font-size: 80%;\">";
- if ($type == $HDR_SOURCE) {
- $view .= " (source / <a href=\"$base_name.func.$html_ext\">functions</a>)";
- } elsif ($type == $HDR_FUNC) {
- $view .= " (<a href=\"$base_name.gcov.$html_ext\">source</a> / functions)";
- }
- $view .= "</span>";
- }
- }
- elsif ($type == $HDR_TESTDESC)
- {
- # Test description header
- $base_dir = "";
- $view = "<a href=\"$base_dir"."index.$html_ext\">".
- "$overview_title</a> - test case descriptions";
- }
-
- # Prepare text for "test" field
- $test = escape_html($test_title);
-
- # Append link to test description page if available
- if (%test_description && ($type != $HDR_TESTDESC))
- {
- if ($frames && ($type == $HDR_SOURCE || $type == $HDR_FUNC))
- {
- # Need to break frameset when clicking this link
- $test .= " ( <span style=\"font-size:80%;\">".
- "<a href=\"$base_dir".
- "descriptions.$html_ext\" target=\"_parent\">".
- "view descriptions</a></span> )";
- }
- else
- {
- $test .= " ( <span style=\"font-size:80%;\">".
- "<a href=\"$base_dir".
- "descriptions.$html_ext\">".
- "view descriptions</a></span> )";
- }
- }
-
- # Write header
- write_header_prolog(*HTML_HANDLE, $base_dir);
-
- # Left row
- push(@row_left, [[ "10%", "headerItem", "Current view:" ],
- [ "35%", "headerValue", $view ]]);
- push(@row_left, [[undef, "headerItem", "Test:"],
- [undef, "headerValue", $test]]);
- push(@row_left, [[undef, "headerItem", "Date:"],
- [undef, "headerValue", $date]]);
-
- # Right row
- if ($legend && ($type == $HDR_SOURCE || $type == $HDR_FUNC)) {
- my $text = <<END_OF_HTML;
- Lines:
- <span class="coverLegendCov">hit</span>
- <span class="coverLegendNoCov">not hit</span>
-END_OF_HTML
- if ($br_coverage) {
- $text .= <<END_OF_HTML;
- | Branches:
- <span class="coverLegendCov">+</span> taken
- <span class="coverLegendNoCov">-</span> not taken
- <span class="coverLegendNoCov">#</span> not executed
-END_OF_HTML
- }
- push(@row_left, [[undef, "headerItem", "Legend:"],
- [undef, "headerValueLeg", $text]]);
- } elsif ($legend && ($type != $HDR_TESTDESC)) {
- my $text = <<END_OF_HTML;
- Rating:
- <span class="coverLegendCovLo" title="Coverage rates below $med_limit % are classified as low">low: &lt; $med_limit %</span>
- <span class="coverLegendCovMed" title="Coverage rates between $med_limit % and $hi_limit % are classified as medium">medium: &gt;= $med_limit %</span>
- <span class="coverLegendCovHi" title="Coverage rates of $hi_limit % and more are classified as high">high: &gt;= $hi_limit %</span>
-END_OF_HTML
- push(@row_left, [[undef, "headerItem", "Legend:"],
- [undef, "headerValueLeg", $text]]);
- }
- if ($type == $HDR_TESTDESC) {
- push(@row_right, [[ "55%" ]]);
- } else {
- push(@row_right, [["15%", undef, undef ],
- ["10%", "headerCovTableHead", "Hit" ],
- ["10%", "headerCovTableHead", "Total" ],
- ["15%", "headerCovTableHead", "Coverage"]]);
- }
- # Line coverage
- $style = $rate_name[classify_rate($lines_found, $lines_hit,
- $med_limit, $hi_limit)];
- $rate = rate($lines_hit, $lines_found, " %");
- push(@row_right, [[undef, "headerItem", "Lines:"],
- [undef, "headerCovTableEntry", $lines_hit],
- [undef, "headerCovTableEntry", $lines_found],
- [undef, "headerCovTableEntry$style", $rate]])
- if ($type != $HDR_TESTDESC);
- # Function coverage
- if ($func_coverage) {
- $style = $rate_name[classify_rate($fn_found, $fn_hit,
- $fn_med_limit, $fn_hi_limit)];
- $rate = rate($fn_hit, $fn_found, " %");
- push(@row_right, [[undef, "headerItem", "Functions:"],
- [undef, "headerCovTableEntry", $fn_hit],
- [undef, "headerCovTableEntry", $fn_found],
- [undef, "headerCovTableEntry$style", $rate]])
- if ($type != $HDR_TESTDESC);
- }
- # Branch coverage
- if ($br_coverage) {
- $style = $rate_name[classify_rate($br_found, $br_hit,
- $br_med_limit, $br_hi_limit)];
- $rate = rate($br_hit, $br_found, " %");
- push(@row_right, [[undef, "headerItem", "Branches:"],
- [undef, "headerCovTableEntry", $br_hit],
- [undef, "headerCovTableEntry", $br_found],
- [undef, "headerCovTableEntry$style", $rate]])
- if ($type != $HDR_TESTDESC);
- }
-
- # Print rows
- $num_rows = max(scalar(@row_left), scalar(@row_right));
- for ($i = 0; $i < $num_rows; $i++) {
- my $left = $row_left[$i];
- my $right = $row_right[$i];
-
- if (!defined($left)) {
- $left = [[undef, undef, undef], [undef, undef, undef]];
- }
- if (!defined($right)) {
- $right = [];
- }
- write_header_line(*HTML_HANDLE, @{$left},
- [ $i == 0 ? "5%" : undef, undef, undef],
- @{$right});
- }
-
- # Fourth line
- write_header_epilog(*HTML_HANDLE, $base_dir);
-}
-
-
-#
-# get_sorted_keys(hash_ref, sort_type)
-#
-
-sub get_sorted_keys($$)
-{
- my ($hash, $type) = @_;
-
- if ($type == $SORT_FILE) {
- # Sort by name
- return sort(keys(%{$hash}));
- } elsif ($type == $SORT_LINE) {
- # Sort by line coverage
- return sort({$hash->{$a}[7] <=> $hash->{$b}[7]} keys(%{$hash}));
- } elsif ($type == $SORT_FUNC) {
- # Sort by function coverage;
- return sort({$hash->{$a}[8] <=> $hash->{$b}[8]} keys(%{$hash}));
- } elsif ($type == $SORT_BRANCH) {
- # Sort by br coverage;
- return sort({$hash->{$a}[9] <=> $hash->{$b}[9]} keys(%{$hash}));
- }
-}
-
-sub get_sort_code($$$)
-{
- my ($link, $alt, $base) = @_;
- my $png;
- my $link_start;
- my $link_end;
-
- if (!defined($link)) {
- $png = "glass.png";
- $link_start = "";
- $link_end = "";
- } else {
- $png = "updown.png";
- $link_start = '<a href="'.$link.'">';
- $link_end = "</a>";
- }
-
- return ' <span class="tableHeadSort">'.$link_start.
- '<img src="'.$base.$png.'" width=10 height=14 '.
- 'alt="'.$alt.'" title="'.$alt.'" border=0>'.$link_end.'</span>';
-}
-
-sub get_file_code($$$$)
-{
- my ($type, $text, $sort_button, $base) = @_;
- my $result = $text;
- my $link;
-
- if ($sort_button) {
- if ($type == $HEAD_NO_DETAIL) {
- $link = "index.$html_ext";
- } else {
- $link = "index-detail.$html_ext";
- }
- }
- $result .= get_sort_code($link, "Sort by name", $base);
-
- return $result;
-}
-
-sub get_line_code($$$$$)
-{
- my ($type, $sort_type, $text, $sort_button, $base) = @_;
- my $result = $text;
- my $sort_link;
-
- if ($type == $HEAD_NO_DETAIL) {
- # Just text
- if ($sort_button) {
- $sort_link = "index-sort-l.$html_ext";
- }
- } elsif ($type == $HEAD_DETAIL_HIDDEN) {
- # Text + link to detail view
- $result .= ' ( <a class="detail" href="index-detail'.
- $fileview_sortname[$sort_type].'.'.$html_ext.
- '">show details</a> )';
- if ($sort_button) {
- $sort_link = "index-sort-l.$html_ext";
- }
- } else {
- # Text + link to standard view
- $result .= ' ( <a class="detail" href="index'.
- $fileview_sortname[$sort_type].'.'.$html_ext.
- '">hide details</a> )';
- if ($sort_button) {
- $sort_link = "index-detail-sort-l.$html_ext";
- }
- }
- # Add sort button
- $result .= get_sort_code($sort_link, "Sort by line coverage", $base);
-
- return $result;
-}
-
-sub get_func_code($$$$)
-{
- my ($type, $text, $sort_button, $base) = @_;
- my $result = $text;
- my $link;
-
- if ($sort_button) {
- if ($type == $HEAD_NO_DETAIL) {
- $link = "index-sort-f.$html_ext";
- } else {
- $link = "index-detail-sort-f.$html_ext";
- }
- }
- $result .= get_sort_code($link, "Sort by function coverage", $base);
- return $result;
-}
-
-sub get_br_code($$$$)
-{
- my ($type, $text, $sort_button, $base) = @_;
- my $result = $text;
- my $link;
-
- if ($sort_button) {
- if ($type == $HEAD_NO_DETAIL) {
- $link = "index-sort-b.$html_ext";
- } else {
- $link = "index-detail-sort-b.$html_ext";
- }
- }
- $result .= get_sort_code($link, "Sort by branch coverage", $base);
- return $result;
-}
-
-#
-# write_file_table(filehandle, base_dir, overview, testhash, testfnchash,
-# testbrhash, fileview, sort_type)
-#
-# Write a complete file table. OVERVIEW is a reference to a hash containing
-# the following mapping:
-#
-# filename -> "lines_found,lines_hit,funcs_found,funcs_hit,page_link,
-# func_link"
-#
-# TESTHASH is a reference to the following hash:
-#
-# filename -> \%testdata
-# %testdata: name of test affecting this file -> \%testcount
-# %testcount: line number -> execution count for a single test
-#
-# Heading of first column is "Filename" if FILEVIEW is true, "Directory name"
-# otherwise.
-#
-
-sub write_file_table(*$$$$$$$)
-{
- local *HTML_HANDLE = $_[0];
- my $base_dir = $_[1];
- my $overview = $_[2];
- my $testhash = $_[3];
- my $testfnchash = $_[4];
- my $testbrhash = $_[5];
- my $fileview = $_[6];
- my $sort_type = $_[7];
- my $filename;
- my $bar_graph;
- my $hit;
- my $found;
- my $fn_found;
- my $fn_hit;
- my $br_found;
- my $br_hit;
- my $page_link;
- my $testname;
- my $testdata;
- my $testfncdata;
- my $testbrdata;
- my %affecting_tests;
- my $line_code = "";
- my $func_code;
- my $br_code;
- my $file_code;
- my @head_columns;
-
- # Determine HTML code for column headings
- if (($base_dir ne "") && $show_details)
- {
- my $detailed = keys(%{$testhash});
-
- $file_code = get_file_code($detailed ? $HEAD_DETAIL_HIDDEN :
- $HEAD_NO_DETAIL,
- $fileview ? "Filename" : "Directory",
- $sort && $sort_type != $SORT_FILE,
- $base_dir);
- $line_code = get_line_code($detailed ? $HEAD_DETAIL_SHOWN :
- $HEAD_DETAIL_HIDDEN,
- $sort_type,
- "Line Coverage",
- $sort && $sort_type != $SORT_LINE,
- $base_dir);
- $func_code = get_func_code($detailed ? $HEAD_DETAIL_HIDDEN :
- $HEAD_NO_DETAIL,
- "Functions",
- $sort && $sort_type != $SORT_FUNC,
- $base_dir);
- $br_code = get_br_code($detailed ? $HEAD_DETAIL_HIDDEN :
- $HEAD_NO_DETAIL,
- "Branches",
- $sort && $sort_type != $SORT_BRANCH,
- $base_dir);
- } else {
- $file_code = get_file_code($HEAD_NO_DETAIL,
- $fileview ? "Filename" : "Directory",
- $sort && $sort_type != $SORT_FILE,
- $base_dir);
- $line_code = get_line_code($HEAD_NO_DETAIL, $sort_type, "Line Coverage",
- $sort && $sort_type != $SORT_LINE,
- $base_dir);
- $func_code = get_func_code($HEAD_NO_DETAIL, "Functions",
- $sort && $sort_type != $SORT_FUNC,
- $base_dir);
- $br_code = get_br_code($HEAD_NO_DETAIL, "Branches",
- $sort && $sort_type != $SORT_BRANCH,
- $base_dir);
- }
- push(@head_columns, [ $line_code, 3 ]);
- push(@head_columns, [ $func_code, 2]) if ($func_coverage);
- push(@head_columns, [ $br_code, 2]) if ($br_coverage);
-
- write_file_table_prolog(*HTML_HANDLE, $file_code, @head_columns);
-
- foreach $filename (get_sorted_keys($overview, $sort_type))
- {
- my @columns;
- ($found, $hit, $fn_found, $fn_hit, $br_found, $br_hit,
- $page_link) = @{$overview->{$filename}};
-
- # Line coverage
- push(@columns, [$found, $hit, $med_limit, $hi_limit, 1]);
- # Function coverage
- if ($func_coverage) {
- push(@columns, [$fn_found, $fn_hit, $fn_med_limit,
- $fn_hi_limit, 0]);
- }
- # Branch coverage
- if ($br_coverage) {
- push(@columns, [$br_found, $br_hit, $br_med_limit,
- $br_hi_limit, 0]);
- }
- write_file_table_entry(*HTML_HANDLE, $base_dir, $filename,
- $page_link, @columns);
-
- $testdata = $testhash->{$filename};
- $testfncdata = $testfnchash->{$filename};
- $testbrdata = $testbrhash->{$filename};
-
- # Check whether we should write test specific coverage
- # as well
- if (!($show_details && $testdata)) { next; }
-
- # Filter out those tests that actually affect this file
- %affecting_tests = %{ get_affecting_tests($testdata,
- $testfncdata, $testbrdata) };
-
- # Does any of the tests affect this file at all?
- if (!%affecting_tests) { next; }
-
- foreach $testname (keys(%affecting_tests))
- {
- my @results;
- ($found, $hit, $fn_found, $fn_hit, $br_found, $br_hit) =
- split(",", $affecting_tests{$testname});
-
- # Insert link to description of available
- if ($test_description{$testname})
- {
- $testname = "<a href=\"$base_dir".
- "descriptions.$html_ext#$testname\">".
- "$testname</a>";
- }
-
- push(@results, [$found, $hit]);
- push(@results, [$fn_found, $fn_hit]) if ($func_coverage);
- push(@results, [$br_found, $br_hit]) if ($br_coverage);
- write_file_table_detail_entry(*HTML_HANDLE, $testname,
- @results);
- }
- }
-
- write_file_table_epilog(*HTML_HANDLE);
-}
-
-
-#
-# get_found_and_hit(hash)
-#
-# Return the count for entries (found) and entries with an execution count
-# greater than zero (hit) in a hash (linenumber -> execution count) as
-# a list (found, hit)
-#
-
-sub get_found_and_hit($)
-{
- my %hash = %{$_[0]};
- my $found = 0;
- my $hit = 0;
-
- # Calculate sum
- $found = 0;
- $hit = 0;
-
- foreach (keys(%hash))
- {
- $found++;
- if ($hash{$_}>0) { $hit++; }
- }
-
- return ($found, $hit);
-}
-
-
-#
-# get_func_found_and_hit(sumfnccount)
-#
-# Return (f_found, f_hit) for sumfnccount
-#
-
-sub get_func_found_and_hit($)
-{
- my ($sumfnccount) = @_;
- my $function;
- my $fn_found;
- my $fn_hit;
-
- $fn_found = scalar(keys(%{$sumfnccount}));
- $fn_hit = 0;
- foreach $function (keys(%{$sumfnccount})) {
- if ($sumfnccount->{$function} > 0) {
- $fn_hit++;
- }
- }
- return ($fn_found, $fn_hit);
-}
-
-
-#
-# br_taken_to_num(taken)
-#
-# Convert a branch taken value .info format to number format.
-#
-
-sub br_taken_to_num($)
-{
- my ($taken) = @_;
-
- return 0 if ($taken eq '-');
- return $taken + 1;
-}
-
-
-#
-# br_num_to_taken(taken)
-#
-# Convert a branch taken value in number format to .info format.
-#
-
-sub br_num_to_taken($)
-{
- my ($taken) = @_;
-
- return '-' if ($taken == 0);
- return $taken - 1;
-}
-
-
-#
-# br_taken_add(taken1, taken2)
-#
-# Return the result of taken1 + taken2 for 'branch taken' values.
-#
-
-sub br_taken_add($$)
-{
- my ($t1, $t2) = @_;
-
- return $t1 if (!defined($t2));
- return $t2 if (!defined($t1));
- return $t1 if ($t2 eq '-');
- return $t2 if ($t1 eq '-');
- return $t1 + $t2;
-}
-
-
-#
-# br_taken_sub(taken1, taken2)
-#
-# Return the result of taken1 - taken2 for 'branch taken' values. Return 0
-# if the result would become negative.
-#
-
-sub br_taken_sub($$)
-{
- my ($t1, $t2) = @_;
-
- return $t1 if (!defined($t2));
- return undef if (!defined($t1));
- return $t1 if ($t1 eq '-');
- return $t1 if ($t2 eq '-');
- return 0 if $t2 > $t1;
- return $t1 - $t2;
-}
-
-
-#
-# br_ivec_len(vector)
-#
-# Return the number of entries in the branch coverage vector.
-#
-
-sub br_ivec_len($)
-{
- my ($vec) = @_;
-
- return 0 if (!defined($vec));
- return (length($vec) * 8 / $BR_VEC_WIDTH) / $BR_VEC_ENTRIES;
-}
-
-
-#
-# br_ivec_get(vector, number)
-#
-# Return an entry from the branch coverage vector.
-#
-
-sub br_ivec_get($$)
-{
- my ($vec, $num) = @_;
- my $block;
- my $branch;
- my $taken;
- my $offset = $num * $BR_VEC_ENTRIES;
-
- # Retrieve data from vector
- $block = vec($vec, $offset + $BR_BLOCK, $BR_VEC_WIDTH);
- $branch = vec($vec, $offset + $BR_BRANCH, $BR_VEC_WIDTH);
- $taken = vec($vec, $offset + $BR_TAKEN, $BR_VEC_WIDTH);
-
- # Decode taken value from an integer
- $taken = br_num_to_taken($taken);
-
- return ($block, $branch, $taken);
-}
-
-
-#
-# br_ivec_push(vector, block, branch, taken)
-#
-# Add an entry to the branch coverage vector. If an entry with the same
-# branch ID already exists, add the corresponding taken values.
-#
-
-sub br_ivec_push($$$$)
-{
- my ($vec, $block, $branch, $taken) = @_;
- my $offset;
- my $num = br_ivec_len($vec);
- my $i;
-
- $vec = "" if (!defined($vec));
-
- # Check if branch already exists in vector
- for ($i = 0; $i < $num; $i++) {
- my ($v_block, $v_branch, $v_taken) = br_ivec_get($vec, $i);
-
- next if ($v_block != $block || $v_branch != $branch);
-
- # Add taken counts
- $taken = br_taken_add($taken, $v_taken);
- last;
- }
-
- $offset = $i * $BR_VEC_ENTRIES;
- $taken = br_taken_to_num($taken);
-
- # Add to vector
- vec($vec, $offset + $BR_BLOCK, $BR_VEC_WIDTH) = $block;
- vec($vec, $offset + $BR_BRANCH, $BR_VEC_WIDTH) = $branch;
- vec($vec, $offset + $BR_TAKEN, $BR_VEC_WIDTH) = $taken;
-
- return $vec;
-}
-
-
-#
-# get_br_found_and_hit(sumbrcount)
-#
-# Return (br_found, br_hit) for sumbrcount
-#
-
-sub get_br_found_and_hit($)
-{
- my ($sumbrcount) = @_;
- my $line;
- my $br_found = 0;
- my $br_hit = 0;
-
- foreach $line (keys(%{$sumbrcount})) {
- my $brdata = $sumbrcount->{$line};
- my $i;
- my $num = br_ivec_len($brdata);
-
- for ($i = 0; $i < $num; $i++) {
- my $taken;
-
- (undef, undef, $taken) = br_ivec_get($brdata, $i);
-
- $br_found++;
- $br_hit++ if ($taken ne "-" && $taken > 0);
- }
- }
-
- return ($br_found, $br_hit);
-}
-
-
-#
-# get_affecting_tests(testdata, testfncdata, testbrdata)
-#
-# HASHREF contains a mapping filename -> (linenumber -> exec count). Return
-# a hash containing mapping filename -> "lines found, lines hit" for each
-# filename which has a nonzero hit count.
-#
-
-sub get_affecting_tests($$$)
-{
- my ($testdata, $testfncdata, $testbrdata) = @_;
- my $testname;
- my $testcount;
- my $testfnccount;
- my $testbrcount;
- my %result;
- my $found;
- my $hit;
- my $fn_found;
- my $fn_hit;
- my $br_found;
- my $br_hit;
-
- foreach $testname (keys(%{$testdata}))
- {
- # Get (line number -> count) hash for this test case
- $testcount = $testdata->{$testname};
- $testfnccount = $testfncdata->{$testname};
- $testbrcount = $testbrdata->{$testname};
-
- # Calculate sum
- ($found, $hit) = get_found_and_hit($testcount);
- ($fn_found, $fn_hit) = get_func_found_and_hit($testfnccount);
- ($br_found, $br_hit) = get_br_found_and_hit($testbrcount);
-
- if ($hit>0)
- {
- $result{$testname} = "$found,$hit,$fn_found,$fn_hit,".
- "$br_found,$br_hit";
- }
- }
-
- return(\%result);
-}
-
-
-sub get_hash_reverse($)
-{
- my ($hash) = @_;
- my %result;
-
- foreach (keys(%{$hash})) {
- $result{$hash->{$_}} = $_;
- }
-
- return \%result;
-}
-
-#
-# write_source(filehandle, source_filename, count_data, checksum_data,
-# converted_data, func_data, sumbrcount)
-#
-# Write an HTML view of a source code file. Returns a list containing
-# data as needed by gen_png().
-#
-# Die on error.
-#
-
-sub write_source($$$$$$$)
-{
- local *HTML_HANDLE = $_[0];
- local *SOURCE_HANDLE;
- my $source_filename = $_[1];
- my %count_data;
- my $line_number;
- my @result;
- my $checkdata = $_[3];
- my $converted = $_[4];
- my $funcdata = $_[5];
- my $sumbrcount = $_[6];
- my $datafunc = get_hash_reverse($funcdata);
- my $add_anchor;
- my @file;
-
- if ($_[2])
- {
- %count_data = %{$_[2]};
- }
-
- if (!open(SOURCE_HANDLE, "<", $source_filename)) {
- my @lines;
- my $last_line = 0;
-
- if (!$ignore[$ERROR_SOURCE]) {
- die("ERROR: cannot read $source_filename\n");
- }
-
- # Continue without source file
- warn("WARNING: cannot read $source_filename!\n");
-
- @lines = sort( { $a <=> $b } keys(%count_data));
- if (@lines) {
- $last_line = $lines[scalar(@lines) - 1];
- }
- return ( ":" ) if ($last_line < 1);
-
- # Simulate gcov behavior
- for ($line_number = 1; $line_number <= $last_line;
- $line_number++) {
- push(@file, "/* EOF */");
- }
- } else {
- @file = <SOURCE_HANDLE>;
- }
-
- write_source_prolog(*HTML_HANDLE);
- $line_number = 0;
- foreach (@file) {
- $line_number++;
- chomp($_);
-
- # Also remove CR from line-end
- s/\015$//;
-
- # Source code matches coverage data?
- if (defined($checkdata->{$line_number}) &&
- ($checkdata->{$line_number} ne md5_base64($_)))
- {
- die("ERROR: checksum mismatch at $source_filename:".
- "$line_number\n");
- }
-
- $add_anchor = 0;
- if ($frames) {
- if (($line_number - 1) % $nav_resolution == 0) {
- $add_anchor = 1;
- }
- }
- if ($func_coverage) {
- if ($line_number == 1) {
- $add_anchor = 1;
- } elsif (defined($datafunc->{$line_number +
- $func_offset})) {
- $add_anchor = 1;
- }
- }
- push (@result,
- write_source_line(HTML_HANDLE, $line_number,
- $_, $count_data{$line_number},
- $converted->{$line_number},
- $sumbrcount->{$line_number}, $add_anchor));
- }
-
- close(SOURCE_HANDLE);
- write_source_epilog(*HTML_HANDLE);
- return(@result);
-}
-
-
-sub funcview_get_func_code($$$)
-{
- my ($name, $base, $type) = @_;
- my $result;
- my $link;
-
- if ($sort && $type == 1) {
- $link = "$name.func.$html_ext";
- }
- $result = "Function Name";
- $result .= get_sort_code($link, "Sort by function name", $base);
-
- return $result;
-}
-
-sub funcview_get_count_code($$$)
-{
- my ($name, $base, $type) = @_;
- my $result;
- my $link;
-
- if ($sort && $type == 0) {
- $link = "$name.func-sort-c.$html_ext";
- }
- $result = "Hit count";
- $result .= get_sort_code($link, "Sort by hit count", $base);
-
- return $result;
-}
-
-#
-# funcview_get_sorted(funcdata, sumfncdata, sort_type)
-#
-# Depending on the value of sort_type, return a list of functions sorted
-# by name (type 0) or by the associated call count (type 1).
-#
-
-sub funcview_get_sorted($$$)
-{
- my ($funcdata, $sumfncdata, $type) = @_;
-
- if ($type == 0) {
- return sort(keys(%{$funcdata}));
- }
- return sort({$sumfncdata->{$b} <=> $sumfncdata->{$a}}
- keys(%{$sumfncdata}));
-}
-
-#
-# write_function_table(filehandle, source_file, sumcount, funcdata,
-# sumfnccount, testfncdata, sumbrcount, testbrdata,
-# base_name, base_dir, sort_type)
-#
-# Write an HTML table listing all functions in a source file, including
-# also function call counts and line coverages inside of each function.
-#
-# Die on error.
-#
-
-sub write_function_table(*$$$$$$$$$$)
-{
- local *HTML_HANDLE = $_[0];
- my $source = $_[1];
- my $sumcount = $_[2];
- my $funcdata = $_[3];
- my $sumfncdata = $_[4];
- my $testfncdata = $_[5];
- my $sumbrcount = $_[6];
- my $testbrdata = $_[7];
- my $name = $_[8];
- my $base = $_[9];
- my $type = $_[10];
- my $func;
- my $func_code;
- my $count_code;
-
- # Get HTML code for headings
- $func_code = funcview_get_func_code($name, $base, $type);
- $count_code = funcview_get_count_code($name, $base, $type);
- write_html(*HTML_HANDLE, <<END_OF_HTML)
- <center>
- <table width="60%" cellpadding=1 cellspacing=1 border=0>
- <tr><td><br></td></tr>
- <tr>
- <td width="80%" class="tableHead">$func_code</td>
- <td width="20%" class="tableHead">$count_code</td>
- </tr>
-END_OF_HTML
- ;
-
- # Get a sorted table
- foreach $func (funcview_get_sorted($funcdata, $sumfncdata, $type)) {
- if (!defined($funcdata->{$func}))
- {
- next;
- }
-
- my $startline = $funcdata->{$func} - $func_offset;
- my $name = $func;
- my $count = $sumfncdata->{$name};
- my $countstyle;
-
- # Demangle C++ function names if requested
- if ($demangle_cpp) {
- $name = `c++filt "$name"`;
- chomp($name);
- }
- # Escape any remaining special characters
- $name = escape_html($name);
- if ($startline < 1) {
- $startline = 1;
- }
- if ($count == 0) {
- $countstyle = "coverFnLo";
- } else {
- $countstyle = "coverFnHi";
- }
-
- write_html(*HTML_HANDLE, <<END_OF_HTML)
- <tr>
- <td class="coverFn"><a href="$source#$startline">$name</a></td>
- <td class="$countstyle">$count</td>
- </tr>
-END_OF_HTML
- ;
- }
- write_html(*HTML_HANDLE, <<END_OF_HTML)
- </table>
- <br>
- </center>
-END_OF_HTML
- ;
-}
-
-
-#
-# info(printf_parameter)
-#
-# Use printf to write PRINTF_PARAMETER to stdout only when the $quiet flag
-# is not set.
-#
-
-sub info(@)
-{
- if (!$quiet)
- {
- # Print info string
- printf(@_);
- }
-}
-
-
-#
-# subtract_counts(data_ref, base_ref)
-#
-
-sub subtract_counts($$)
-{
- my %data = %{$_[0]};
- my %base = %{$_[1]};
- my $line;
- my $data_count;
- my $base_count;
- my $hit = 0;
- my $found = 0;
-
- foreach $line (keys(%data))
- {
- $found++;
- $data_count = $data{$line};
- $base_count = $base{$line};
-
- if (defined($base_count))
- {
- $data_count -= $base_count;
-
- # Make sure we don't get negative numbers
- if ($data_count<0) { $data_count = 0; }
- }
-
- $data{$line} = $data_count;
- if ($data_count > 0) { $hit++; }
- }
-
- return (\%data, $found, $hit);
-}
-
-
-#
-# subtract_fnccounts(data, base)
-#
-# Subtract function call counts found in base from those in data.
-# Return (data, f_found, f_hit).
-#
-
-sub subtract_fnccounts($$)
-{
- my %data;
- my %base;
- my $func;
- my $data_count;
- my $base_count;
- my $fn_hit = 0;
- my $fn_found = 0;
-
- %data = %{$_[0]} if (defined($_[0]));
- %base = %{$_[1]} if (defined($_[1]));
- foreach $func (keys(%data)) {
- $fn_found++;
- $data_count = $data{$func};
- $base_count = $base{$func};
-
- if (defined($base_count)) {
- $data_count -= $base_count;
-
- # Make sure we don't get negative numbers
- if ($data_count < 0) {
- $data_count = 0;
- }
- }
-
- $data{$func} = $data_count;
- if ($data_count > 0) {
- $fn_hit++;
- }
- }
-
- return (\%data, $fn_found, $fn_hit);
-}
-
-
-#
-# apply_baseline(data_ref, baseline_ref)
-#
-# Subtract the execution counts found in the baseline hash referenced by
-# BASELINE_REF from actual data in DATA_REF.
-#
-
-sub apply_baseline($$)
-{
- my %data_hash = %{$_[0]};
- my %base_hash = %{$_[1]};
- my $filename;
- my $testname;
- my $data;
- my $data_testdata;
- my $data_funcdata;
- my $data_checkdata;
- my $data_testfncdata;
- my $data_testbrdata;
- my $data_count;
- my $data_testfnccount;
- my $data_testbrcount;
- my $base;
- my $base_checkdata;
- my $base_sumfnccount;
- my $base_sumbrcount;
- my $base_count;
- my $sumcount;
- my $sumfnccount;
- my $sumbrcount;
- my $found;
- my $hit;
- my $fn_found;
- my $fn_hit;
- my $br_found;
- my $br_hit;
-
- foreach $filename (keys(%data_hash))
- {
- # Get data set for data and baseline
- $data = $data_hash{$filename};
- $base = $base_hash{$filename};
-
- # Skip data entries for which no base entry exists
- if (!defined($base))
- {
- next;
- }
-
- # Get set entries for data and baseline
- ($data_testdata, undef, $data_funcdata, $data_checkdata,
- $data_testfncdata, undef, $data_testbrdata) =
- get_info_entry($data);
- (undef, $base_count, undef, $base_checkdata, undef,
- $base_sumfnccount, undef, $base_sumbrcount) =
- get_info_entry($base);
-
- # Check for compatible checksums
- merge_checksums($data_checkdata, $base_checkdata, $filename);
-
- # sumcount has to be calculated anew
- $sumcount = {};
- $sumfnccount = {};
- $sumbrcount = {};
-
- # For each test case, subtract test specific counts
- foreach $testname (keys(%{$data_testdata}))
- {
- # Get counts of both data and baseline
- $data_count = $data_testdata->{$testname};
- $data_testfnccount = $data_testfncdata->{$testname};
- $data_testbrcount = $data_testbrdata->{$testname};
-
- ($data_count, undef, $hit) =
- subtract_counts($data_count, $base_count);
- ($data_testfnccount) =
- subtract_fnccounts($data_testfnccount,
- $base_sumfnccount);
- ($data_testbrcount) =
- combine_brcount($data_testbrcount,
- $base_sumbrcount, $BR_SUB);
-
-
- # Check whether this test case did hit any line at all
- if ($hit > 0)
- {
- # Write back resulting hash
- $data_testdata->{$testname} = $data_count;
- $data_testfncdata->{$testname} =
- $data_testfnccount;
- $data_testbrdata->{$testname} =
- $data_testbrcount;
- }
- else
- {
- # Delete test case which did not impact this
- # file
- delete($data_testdata->{$testname});
- delete($data_testfncdata->{$testname});
- delete($data_testbrdata->{$testname});
- }
-
- # Add counts to sum of counts
- ($sumcount, $found, $hit) =
- add_counts($sumcount, $data_count);
- ($sumfnccount, $fn_found, $fn_hit) =
- add_fnccount($sumfnccount, $data_testfnccount);
- ($sumbrcount, $br_found, $br_hit) =
- combine_brcount($sumbrcount, $data_testbrcount,
- $BR_ADD);
- }
-
- # Write back resulting entry
- set_info_entry($data, $data_testdata, $sumcount, $data_funcdata,
- $data_checkdata, $data_testfncdata, $sumfnccount,
- $data_testbrdata, $sumbrcount, $found, $hit,
- $fn_found, $fn_hit, $br_found, $br_hit);
-
- $data_hash{$filename} = $data;
- }
-
- return (\%data_hash);
-}
-
-
-#
-# remove_unused_descriptions()
-#
-# Removes all test descriptions from the global hash %test_description which
-# are not present in %info_data.
-#
-
-sub remove_unused_descriptions()
-{
- my $filename; # The current filename
- my %test_list; # Hash containing found test names
- my $test_data; # Reference to hash test_name -> count_data
- my $before; # Initial number of descriptions
- my $after; # Remaining number of descriptions
-
- $before = scalar(keys(%test_description));
-
- foreach $filename (keys(%info_data))
- {
- ($test_data) = get_info_entry($info_data{$filename});
- foreach (keys(%{$test_data}))
- {
- $test_list{$_} = "";
- }
- }
-
- # Remove descriptions for tests which are not in our list
- foreach (keys(%test_description))
- {
- if (!defined($test_list{$_}))
- {
- delete($test_description{$_});
- }
- }
-
- $after = scalar(keys(%test_description));
- if ($after < $before)
- {
- info("Removed ".($before - $after).
- " unused descriptions, $after remaining.\n");
- }
-}
-
-
-#
-# apply_prefix(filename, prefix)
-#
-# If FILENAME begins with PREFIX, remove PREFIX from FILENAME and return
-# resulting string, otherwise return FILENAME.
-#
-
-sub apply_prefix($$)
-{
- my $filename = $_[0];
- my $prefix = $_[1];
-
- if (defined($prefix) && ($prefix ne ""))
- {
- if ($filename =~ /^\Q$prefix\E\/(.*)$/)
- {
- return substr($filename, length($prefix) + 1);
- }
- }
-
- return $filename;
-}
-
-
-#
-# system_no_output(mode, parameters)
-#
-# Call an external program using PARAMETERS while suppressing depending on
-# the value of MODE:
-#
-# MODE & 1: suppress STDOUT
-# MODE & 2: suppress STDERR
-#
-# Return 0 on success, non-zero otherwise.
-#
-
-sub system_no_output($@)
-{
- my $mode = shift;
- my $result;
- local *OLD_STDERR;
- local *OLD_STDOUT;
-
- # Save old stdout and stderr handles
- ($mode & 1) && open(OLD_STDOUT, ">>&", "STDOUT");
- ($mode & 2) && open(OLD_STDERR, ">>&", "STDERR");
-
- # Redirect to /dev/null
- ($mode & 1) && open(STDOUT, ">", "/dev/null");
- ($mode & 2) && open(STDERR, ">", "/dev/null");
-
- system(@_);
- $result = $?;
-
- # Close redirected handles
- ($mode & 1) && close(STDOUT);
- ($mode & 2) && close(STDERR);
-
- # Restore old handles
- ($mode & 1) && open(STDOUT, ">>&", "OLD_STDOUT");
- ($mode & 2) && open(STDERR, ">>&", "OLD_STDERR");
-
- return $result;
-}
-
-
-#
-# read_config(filename)
-#
-# Read configuration file FILENAME and return a reference to a hash containing
-# all valid key=value pairs found.
-#
-
-sub read_config($)
-{
- my $filename = $_[0];
- my %result;
- my $key;
- my $value;
- local *HANDLE;
-
- if (!open(HANDLE, "<", $filename))
- {
- warn("WARNING: cannot read configuration file $filename\n");
- return undef;
- }
- while (<HANDLE>)
- {
- chomp;
- # Skip comments
- s/#.*//;
- # Remove leading blanks
- s/^\s+//;
- # Remove trailing blanks
- s/\s+$//;
- next unless length;
- ($key, $value) = split(/\s*=\s*/, $_, 2);
- if (defined($key) && defined($value))
- {
- $result{$key} = $value;
- }
- else
- {
- warn("WARNING: malformed statement in line $. ".
- "of configuration file $filename\n");
- }
- }
- close(HANDLE);
- return \%result;
-}
-
-
-#
-# apply_config(REF)
-#
-# REF is a reference to a hash containing the following mapping:
-#
-# key_string => var_ref
-#
-# where KEY_STRING is a keyword and VAR_REF is a reference to an associated
-# variable. If the global configuration hashes CONFIG or OPT_RC contain a value
-# for keyword KEY_STRING, VAR_REF will be assigned the value for that keyword.
-#
-
-sub apply_config($)
-{
- my $ref = $_[0];
-
- foreach (keys(%{$ref}))
- {
- if (defined($opt_rc{$_})) {
- ${$ref->{$_}} = $opt_rc{$_};
- } elsif (defined($config->{$_})) {
- ${$ref->{$_}} = $config->{$_};
- }
- }
-}
-
-
-#
-# get_html_prolog(FILENAME)
-#
-# If FILENAME is defined, return contents of file. Otherwise return default
-# HTML prolog. Die on error.
-#
-
-sub get_html_prolog($)
-{
- my $filename = $_[0];
- my $result = "";
-
- if (defined($filename))
- {
- local *HANDLE;
-
- open(HANDLE, "<", $filename)
- or die("ERROR: cannot open html prolog $filename!\n");
- while (<HANDLE>)
- {
- $result .= $_;
- }
- close(HANDLE);
- }
- else
- {
- $result = <<END_OF_HTML
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-
-<html lang="en">
-
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=$charset">
- <title>\@pagetitle\@</title>
- <link rel="stylesheet" type="text/css" href="\@basedir\@gcov.css">
-</head>
-
-<body>
-
-END_OF_HTML
- ;
- }
-
- return $result;
-}
-
-
-#
-# get_html_epilog(FILENAME)
-#
-# If FILENAME is defined, return contents of file. Otherwise return default
-# HTML epilog. Die on error.
-#
-sub get_html_epilog($)
-{
- my $filename = $_[0];
- my $result = "";
-
- if (defined($filename))
- {
- local *HANDLE;
-
- open(HANDLE, "<", $filename)
- or die("ERROR: cannot open html epilog $filename!\n");
- while (<HANDLE>)
- {
- $result .= $_;
- }
- close(HANDLE);
- }
- else
- {
- $result = <<END_OF_HTML
-
-</body>
-</html>
-END_OF_HTML
- ;
- }
-
- return $result;
-
-}
-
-sub warn_handler($)
-{
- my ($msg) = @_;
-
- warn("$tool_name: $msg");
-}
-
-sub die_handler($)
-{
- my ($msg) = @_;
-
- die("$tool_name: $msg");
-}
-
-#
-# parse_ignore_errors(@ignore_errors)
-#
-# Parse user input about which errors to ignore.
-#
-
-sub parse_ignore_errors(@)
-{
- my (@ignore_errors) = @_;
- my @items;
- my $item;
-
- return if (!@ignore_errors);
-
- foreach $item (@ignore_errors) {
- $item =~ s/\s//g;
- if ($item =~ /,/) {
- # Split and add comma-separated parameters
- push(@items, split(/,/, $item));
- } else {
- # Add single parameter
- push(@items, $item);
- }
- }
- foreach $item (@items) {
- my $item_id = $ERROR_ID{lc($item)};
-
- if (!defined($item_id)) {
- die("ERROR: unknown argument for --ignore-errors: ".
- "$item\n");
- }
- $ignore[$item_id] = 1;
- }
-}
-
-#
-# rate(hit, found[, suffix, precision, width])
-#
-# Return the coverage rate [0..100] for HIT and FOUND values. 0 is only
-# returned when HIT is 0. 100 is only returned when HIT equals FOUND.
-# PRECISION specifies the precision of the result. SUFFIX defines a
-# string that is appended to the result if FOUND is non-zero. Spaces
-# are added to the start of the resulting string until it is at least WIDTH
-# characters wide.
-#
-
-sub rate($$;$$$)
-{
- my ($hit, $found, $suffix, $precision, $width) = @_;
- my $rate;
-
- # Assign defaults if necessary
- $precision = 1 if (!defined($precision));
- $suffix = "" if (!defined($suffix));
- $width = 0 if (!defined($width));
-
- return sprintf("%*s", $width, "-") if (!defined($found) || $found == 0);
- $rate = sprintf("%.*f", $precision, $hit * 100 / $found);
-
- # Adjust rates if necessary
- if ($rate == 0 && $hit > 0) {
- $rate = sprintf("%.*f", $precision, 1 / 10 ** $precision);
- } elsif ($rate == 100 && $hit != $found) {
- $rate = sprintf("%.*f", $precision, 100 - 1 / 10 ** $precision);
- }
-
- return sprintf("%*s", $width, $rate.$suffix);
-}
diff --git a/chromium/third_party/lcov/bin/geninfo b/chromium/third_party/lcov/bin/geninfo
deleted file mode 100755
index 9325f9d68c2..00000000000
--- a/chromium/third_party/lcov/bin/geninfo
+++ /dev/null
@@ -1,3657 +0,0 @@
-#!/usr/bin/perl -w
-#
-# Copyright (c) International Business Machines Corp., 2002,2012
-#
-# 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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-#
-# geninfo
-#
-# This script generates .info files from data files as created by code
-# instrumented with gcc's built-in profiling mechanism. Call it with
-# --help and refer to the geninfo man page to get information on usage
-# and available options.
-#
-#
-# Authors:
-# 2002-08-23 created by Peter Oberparleiter <Peter.Oberparleiter@de.ibm.com>
-# IBM Lab Boeblingen
-# based on code by Manoj Iyer <manjo@mail.utexas.edu> and
-# Megan Bock <mbock@us.ibm.com>
-# IBM Austin
-# 2002-09-05 / Peter Oberparleiter: implemented option that allows file list
-# 2003-04-16 / Peter Oberparleiter: modified read_gcov so that it can also
-# parse the new gcov format which is to be introduced in gcc 3.3
-# 2003-04-30 / Peter Oberparleiter: made info write to STDERR, not STDOUT
-# 2003-07-03 / Peter Oberparleiter: added line checksum support, added
-# --no-checksum
-# 2003-09-18 / Nigel Hinds: capture branch coverage data from GCOV
-# 2003-12-11 / Laurent Deniel: added --follow option
-# workaround gcov (<= 3.2.x) bug with empty .da files
-# 2004-01-03 / Laurent Deniel: Ignore empty .bb files
-# 2004-02-16 / Andreas Krebbel: Added support for .gcno/.gcda files and
-# gcov versioning
-# 2004-08-09 / Peter Oberparleiter: added configuration file support
-# 2008-07-14 / Tom Zoerner: added --function-coverage command line option
-# 2008-08-13 / Peter Oberparleiter: modified function coverage
-# implementation (now enabled per default)
-#
-
-use strict;
-use File::Basename;
-use File::Spec::Functions qw /abs2rel catdir file_name_is_absolute splitdir
- splitpath catpath/;
-use Getopt::Long;
-use Digest::MD5 qw(md5_base64);
-if( $^O eq "msys" )
-{
- require File::Spec::Win32;
-}
-
-# Constants
-our $lcov_version = 'LCOV version 1.10';
-our $lcov_url = "http://ltp.sourceforge.net/coverage/lcov.php";
-our $gcov_tool = "gcov";
-our $tool_name = basename($0);
-
-our $GCOV_VERSION_4_7_0 = 0x40700;
-our $GCOV_VERSION_3_4_0 = 0x30400;
-our $GCOV_VERSION_3_3_0 = 0x30300;
-our $GCNO_FUNCTION_TAG = 0x01000000;
-our $GCNO_LINES_TAG = 0x01450000;
-our $GCNO_FILE_MAGIC = 0x67636e6f;
-our $BBG_FILE_MAGIC = 0x67626267;
-
-# Error classes which users may specify to ignore during processing
-our $ERROR_GCOV = 0;
-our $ERROR_SOURCE = 1;
-our $ERROR_GRAPH = 2;
-our %ERROR_ID = (
- "gcov" => $ERROR_GCOV,
- "source" => $ERROR_SOURCE,
- "graph" => $ERROR_GRAPH,
-);
-
-our $EXCL_START = "LCOV_EXCL_START";
-our $EXCL_STOP = "LCOV_EXCL_STOP";
-our $EXCL_LINE = "LCOV_EXCL_LINE";
-
-# Compatibility mode values
-our $COMPAT_VALUE_OFF = 0;
-our $COMPAT_VALUE_ON = 1;
-our $COMPAT_VALUE_AUTO = 2;
-
-# Compatibility mode value names
-our %COMPAT_NAME_TO_VALUE = (
- "off" => $COMPAT_VALUE_OFF,
- "on" => $COMPAT_VALUE_ON,
- "auto" => $COMPAT_VALUE_AUTO,
-);
-
-# Compatiblity modes
-our $COMPAT_MODE_LIBTOOL = 1 << 0;
-our $COMPAT_MODE_HAMMER = 1 << 1;
-our $COMPAT_MODE_SPLIT_CRC = 1 << 2;
-
-# Compatibility mode names
-our %COMPAT_NAME_TO_MODE = (
- "libtool" => $COMPAT_MODE_LIBTOOL,
- "hammer" => $COMPAT_MODE_HAMMER,
- "split_crc" => $COMPAT_MODE_SPLIT_CRC,
- "android_4_4_0" => $COMPAT_MODE_SPLIT_CRC,
-);
-
-# Map modes to names
-our %COMPAT_MODE_TO_NAME = (
- $COMPAT_MODE_LIBTOOL => "libtool",
- $COMPAT_MODE_HAMMER => "hammer",
- $COMPAT_MODE_SPLIT_CRC => "split_crc",
-);
-
-# Compatibility mode default values
-our %COMPAT_MODE_DEFAULTS = (
- $COMPAT_MODE_LIBTOOL => $COMPAT_VALUE_ON,
- $COMPAT_MODE_HAMMER => $COMPAT_VALUE_AUTO,
- $COMPAT_MODE_SPLIT_CRC => $COMPAT_VALUE_AUTO,
-);
-
-# Compatibility mode auto-detection routines
-sub compat_hammer_autodetect();
-our %COMPAT_MODE_AUTO = (
- $COMPAT_MODE_HAMMER => \&compat_hammer_autodetect,
- $COMPAT_MODE_SPLIT_CRC => 1, # will be done later
-);
-
-our $BR_LINE = 0;
-our $BR_BLOCK = 1;
-our $BR_BRANCH = 2;
-our $BR_TAKEN = 3;
-our $BR_VEC_ENTRIES = 4;
-our $BR_VEC_WIDTH = 32;
-
-our $UNNAMED_BLOCK = 9999;
-
-# Prototypes
-sub print_usage(*);
-sub gen_info($);
-sub process_dafile($$);
-sub match_filename($@);
-sub solve_ambiguous_match($$$);
-sub split_filename($);
-sub solve_relative_path($$);
-sub read_gcov_header($);
-sub read_gcov_file($);
-sub info(@);
-sub get_gcov_version();
-sub system_no_output($@);
-sub read_config($);
-sub apply_config($);
-sub get_exclusion_data($);
-sub apply_exclusion_data($$);
-sub process_graphfile($$);
-sub filter_fn_name($);
-sub warn_handler($);
-sub die_handler($);
-sub graph_error($$);
-sub graph_expect($);
-sub graph_read(*$;$$);
-sub graph_skip(*$;$);
-sub sort_uniq(@);
-sub sort_uniq_lex(@);
-sub graph_cleanup($);
-sub graph_find_base($);
-sub graph_from_bb($$$);
-sub graph_add_order($$$);
-sub read_bb_word(*;$);
-sub read_bb_value(*;$);
-sub read_bb_string(*$);
-sub read_bb($);
-sub read_bbg_word(*;$);
-sub read_bbg_value(*;$);
-sub read_bbg_string(*);
-sub read_bbg_lines_record(*$$$$$);
-sub read_bbg($);
-sub read_gcno_word(*;$$);
-sub read_gcno_value(*$;$$);
-sub read_gcno_string(*$);
-sub read_gcno_lines_record(*$$$$$$);
-sub determine_gcno_split_crc($$$);
-sub read_gcno_function_record(*$$$$);
-sub read_gcno($);
-sub get_gcov_capabilities();
-sub get_overall_line($$$$);
-sub print_overall_rate($$$$$$$$$);
-sub br_gvec_len($);
-sub br_gvec_get($$);
-sub debug($);
-sub int_handler();
-sub parse_ignore_errors(@);
-sub is_external($);
-sub compat_name($);
-sub parse_compat_modes($);
-sub is_compat($);
-sub is_compat_auto($);
-
-
-# Global variables
-our $gcov_version;
-our $gcov_version_string;
-our $graph_file_extension;
-our $data_file_extension;
-our @data_directory;
-our $test_name = "";
-our $quiet;
-our $help;
-our $output_filename;
-our $base_directory;
-our $version;
-our $follow;
-our $checksum;
-our $no_checksum;
-our $opt_compat_libtool;
-our $opt_no_compat_libtool;
-our $rc_adjust_src_path;# Regexp specifying parts to remove from source path
-our $adjust_src_pattern;
-our $adjust_src_replace;
-our $adjust_testname;
-our $config; # Configuration file contents
-our @ignore_errors; # List of errors to ignore (parameter)
-our @ignore; # List of errors to ignore (array)
-our $initial;
-our $no_recursion = 0;
-our $maxdepth;
-our $no_markers = 0;
-our $opt_derive_func_data = 0;
-our $opt_external = 1;
-our $opt_no_external;
-our $debug = 0;
-our $gcov_caps;
-our @gcov_options;
-our @internal_dirs;
-our $opt_config_file;
-our $opt_gcov_all_blocks = 1;
-our $opt_compat;
-our %opt_rc;
-our %compat_value;
-our $gcno_split_crc;
-our $func_coverage = 1;
-our $br_coverage = 0;
-our $rc_auto_base = 1;
-
-our $cwd = `pwd`;
-chomp($cwd);
-
-
-#
-# Code entry point
-#
-
-# Register handler routine to be called when interrupted
-$SIG{"INT"} = \&int_handler;
-$SIG{__WARN__} = \&warn_handler;
-$SIG{__DIE__} = \&die_handler;
-
-# Prettify version string
-$lcov_version =~ s/\$\s*Revision\s*:?\s*(\S+)\s*\$/$1/;
-
-# Set LANG so that gcov output will be in a unified format
-$ENV{"LANG"} = "C";
-
-# Check command line for a configuration file name
-Getopt::Long::Configure("pass_through", "no_auto_abbrev");
-GetOptions("config-file=s" => \$opt_config_file,
- "rc=s%" => \%opt_rc);
-Getopt::Long::Configure("default");
-
-# Read configuration file if available
-if (defined($opt_config_file)) {
- $config = read_config($opt_config_file);
-} elsif (defined($ENV{"HOME"}) && (-r $ENV{"HOME"}."/.lcovrc"))
-{
- $config = read_config($ENV{"HOME"}."/.lcovrc");
-}
-elsif (-r "/etc/lcovrc")
-{
- $config = read_config("/etc/lcovrc");
-}
-
-if ($config || %opt_rc)
-{
- # Copy configuration file and --rc values to variables
- apply_config({
- "geninfo_gcov_tool" => \$gcov_tool,
- "geninfo_adjust_testname" => \$adjust_testname,
- "geninfo_checksum" => \$checksum,
- "geninfo_no_checksum" => \$no_checksum, # deprecated
- "geninfo_compat_libtool" => \$opt_compat_libtool,
- "geninfo_external" => \$opt_external,
- "geninfo_gcov_all_blocks" => \$opt_gcov_all_blocks,
- "geninfo_compat" => \$opt_compat,
- "geninfo_adjust_src_path" => \$rc_adjust_src_path,
- "geninfo_auto_base" => \$rc_auto_base,
- "lcov_function_coverage" => \$func_coverage,
- "lcov_branch_coverage" => \$br_coverage,
- });
-
- # Merge options
- if (defined($no_checksum))
- {
- $checksum = ($no_checksum ? 0 : 1);
- $no_checksum = undef;
- }
-
- # Check regexp
- if (defined($rc_adjust_src_path)) {
- my ($pattern, $replace) = split(/\s*=>\s*/,
- $rc_adjust_src_path);
- local $SIG{__DIE__};
- eval '$adjust_src_pattern = qr>'.$pattern.'>;';
- if (!defined($adjust_src_pattern)) {
- my $msg = $@;
-
- chomp($msg);
- $msg =~ s/at \(eval.*$//;
- warn("WARNING: invalid pattern in ".
- "geninfo_adjust_src_path: $msg\n");
- } elsif (!defined($replace)) {
- # If no replacement is specified, simply remove pattern
- $adjust_src_replace = "";
- } else {
- $adjust_src_replace = $replace;
- }
- }
-}
-
-# Parse command line options
-if (!GetOptions("test-name|t=s" => \$test_name,
- "output-filename|o=s" => \$output_filename,
- "checksum" => \$checksum,
- "no-checksum" => \$no_checksum,
- "base-directory|b=s" => \$base_directory,
- "version|v" =>\$version,
- "quiet|q" => \$quiet,
- "help|h|?" => \$help,
- "follow|f" => \$follow,
- "compat-libtool" => \$opt_compat_libtool,
- "no-compat-libtool" => \$opt_no_compat_libtool,
- "gcov-tool=s" => \$gcov_tool,
- "ignore-errors=s" => \@ignore_errors,
- "initial|i" => \$initial,
- "no-recursion" => \$no_recursion,
- "no-markers" => \$no_markers,
- "derive-func-data" => \$opt_derive_func_data,
- "debug" => \$debug,
- "external" => \$opt_external,
- "no-external" => \$opt_no_external,
- "compat=s" => \$opt_compat,
- "config-file=s" => \$opt_config_file,
- "rc=s%" => \%opt_rc,
- ))
-{
- print(STDERR "Use $tool_name --help to get usage information\n");
- exit(1);
-}
-else
-{
- # Merge options
- if (defined($no_checksum))
- {
- $checksum = ($no_checksum ? 0 : 1);
- $no_checksum = undef;
- }
-
- if (defined($opt_no_compat_libtool))
- {
- $opt_compat_libtool = ($opt_no_compat_libtool ? 0 : 1);
- $opt_no_compat_libtool = undef;
- }
-
- if (defined($opt_no_external)) {
- $opt_external = 0;
- $opt_no_external = undef;
- }
-}
-
-@data_directory = @ARGV;
-
-# Check for help option
-if ($help)
-{
- print_usage(*STDOUT);
- exit(0);
-}
-
-# Check for version option
-if ($version)
-{
- print("$tool_name: $lcov_version\n");
- exit(0);
-}
-
-# Check gcov tool
-if (system_no_output(3, $gcov_tool, "--help") == -1)
-{
- die("ERROR: need tool $gcov_tool!\n");
-}
-
-($gcov_version, $gcov_version_string) = get_gcov_version();
-
-# Determine gcov options
-$gcov_caps = get_gcov_capabilities();
-push(@gcov_options, "-b") if ($gcov_caps->{'branch-probabilities'} &&
- ($br_coverage || $func_coverage));
-push(@gcov_options, "-c") if ($gcov_caps->{'branch-counts'} &&
- $br_coverage);
-push(@gcov_options, "-a") if ($gcov_caps->{'all-blocks'} &&
- $opt_gcov_all_blocks && $br_coverage);
-push(@gcov_options, "-p") if ($gcov_caps->{'preserve-paths'});
-
-# Determine compatibility modes
-parse_compat_modes($opt_compat);
-
-# Determine which errors the user wants us to ignore
-parse_ignore_errors(@ignore_errors);
-
-# Make sure test names only contain valid characters
-if ($test_name =~ s/\W/_/g)
-{
- warn("WARNING: invalid characters removed from testname!\n");
-}
-
-# Adjust test name to include uname output if requested
-if ($adjust_testname)
-{
- $test_name .= "__".`uname -a`;
- $test_name =~ s/\W/_/g;
-}
-
-# Make sure base_directory contains an absolute path specification
-if ($base_directory)
-{
- $base_directory = solve_relative_path($cwd, $base_directory);
-}
-
-# Check for follow option
-if ($follow)
-{
- $follow = "-follow"
-}
-else
-{
- $follow = "";
-}
-
-# Determine checksum mode
-if (defined($checksum))
-{
- # Normalize to boolean
- $checksum = ($checksum ? 1 : 0);
-}
-else
-{
- # Default is off
- $checksum = 0;
-}
-
-# Determine max depth for recursion
-if ($no_recursion)
-{
- $maxdepth = "-maxdepth 1";
-}
-else
-{
- $maxdepth = "";
-}
-
-# Check for directory name
-if (!@data_directory)
-{
- die("No directory specified\n".
- "Use $tool_name --help to get usage information\n");
-}
-else
-{
- foreach (@data_directory)
- {
- stat($_);
- if (!-r _)
- {
- die("ERROR: cannot read $_!\n");
- }
- }
-}
-
-if ($gcov_version < $GCOV_VERSION_3_4_0)
-{
- if (is_compat($COMPAT_MODE_HAMMER))
- {
- $data_file_extension = ".da";
- $graph_file_extension = ".bbg";
- }
- else
- {
- $data_file_extension = ".da";
- $graph_file_extension = ".bb";
- }
-}
-else
-{
- $data_file_extension = ".gcda";
- $graph_file_extension = ".gcno";
-}
-
-# Check output filename
-if (defined($output_filename) && ($output_filename ne "-"))
-{
- # Initially create output filename, data is appended
- # for each data file processed
- local *DUMMY_HANDLE;
- open(DUMMY_HANDLE, ">", $output_filename)
- or die("ERROR: cannot create $output_filename!\n");
- close(DUMMY_HANDLE);
-
- # Make $output_filename an absolute path because we're going
- # to change directories while processing files
- if (!($output_filename =~ /^\/(.*)$/))
- {
- $output_filename = $cwd."/".$output_filename;
- }
-}
-
-# Build list of directories to identify external files
-foreach my $entry(@data_directory, $base_directory) {
- next if (!defined($entry));
- push(@internal_dirs, solve_relative_path($cwd, $entry));
-}
-
-# Do something
-foreach my $entry (@data_directory) {
- gen_info($entry);
-}
-
-if ($initial && $br_coverage) {
- warn("Note: --initial does not generate branch coverage ".
- "data\n");
-}
-info("Finished .info-file creation\n");
-
-exit(0);
-
-
-
-#
-# print_usage(handle)
-#
-# Print usage information.
-#
-
-sub print_usage(*)
-{
- local *HANDLE = $_[0];
-
- print(HANDLE <<END_OF_USAGE);
-Usage: $tool_name [OPTIONS] DIRECTORY
-
-Traverse DIRECTORY and create a .info file for each data file found. Note
-that you may specify more than one directory, all of which are then processed
-sequentially.
-
- -h, --help Print this help, then exit
- -v, --version Print version number, then exit
- -q, --quiet Do not print progress messages
- -i, --initial Capture initial zero coverage data
- -t, --test-name NAME Use test case name NAME for resulting data
- -o, --output-filename OUTFILE Write data only to OUTFILE
- -f, --follow Follow links when searching .da/.gcda files
- -b, --base-directory DIR Use DIR as base directory for relative paths
- --(no-)checksum Enable (disable) line checksumming
- --(no-)compat-libtool Enable (disable) libtool compatibility mode
- --gcov-tool TOOL Specify gcov tool location
- --ignore-errors ERROR Continue after ERROR (gcov, source, graph)
- --no-recursion Exclude subdirectories from processing
- --no-markers Ignore exclusion markers in source code
- --derive-func-data Generate function data from line data
- --(no-)external Include (ignore) data for external files
- --config-file FILENAME Specify configuration file location
- --rc SETTING=VALUE Override configuration file setting
- --compat MODE=on|off|auto Set compat MODE (libtool, hammer, split_crc)
-
-For more information see: $lcov_url
-END_OF_USAGE
- ;
-}
-
-#
-# get_common_prefix(min_dir, filenames)
-#
-# Return the longest path prefix shared by all filenames. MIN_DIR specifies
-# the minimum number of directories that a filename may have after removing
-# the prefix.
-#
-
-sub get_common_prefix($@)
-{
- my ($min_dir, @files) = @_;
- my $file;
- my @prefix;
- my $i;
-
- foreach $file (@files) {
- my ($v, $d, $f) = splitpath($file);
- my @comp = splitdir($d);
-
- if (!@prefix) {
- @prefix = @comp;
- next;
- }
- for ($i = 0; $i < scalar(@comp) && $i < scalar(@prefix); $i++) {
- if ($comp[$i] ne $prefix[$i] ||
- ((scalar(@comp) - ($i + 1)) <= $min_dir)) {
- delete(@prefix[$i..scalar(@prefix)]);
- last;
- }
- }
- }
-
- return catdir(@prefix);
-}
-
-#
-# gen_info(directory)
-#
-# Traverse DIRECTORY and create a .info file for each data file found.
-# The .info file contains TEST_NAME in the following format:
-#
-# TN:<test name>
-#
-# For each source file name referenced in the data file, there is a section
-# containing source code and coverage data:
-#
-# SF:<absolute path to the source file>
-# FN:<line number of function start>,<function name> for each function
-# DA:<line number>,<execution count> for each instrumented line
-# LH:<number of lines with an execution count> greater than 0
-# LF:<number of instrumented lines>
-#
-# Sections are separated by:
-#
-# end_of_record
-#
-# In addition to the main source code file there are sections for each
-# #included file containing executable code. Note that the absolute path
-# of a source file is generated by interpreting the contents of the respective
-# graph file. Relative filenames are prefixed with the directory in which the
-# graph file is found. Note also that symbolic links to the graph file will be
-# resolved so that the actual file path is used instead of the path to a link.
-# This approach is necessary for the mechanism to work with the /proc/gcov
-# files.
-#
-# Die on error.
-#
-
-sub gen_info($)
-{
- my $directory = $_[0];
- my @file_list;
- my $file;
- my $prefix;
- my $type;
- my $ext;
-
- if ($initial) {
- $type = "graph";
- $ext = $graph_file_extension;
- } else {
- $type = "data";
- $ext = $data_file_extension;
- }
-
- if (-d $directory)
- {
- info("Scanning $directory for $ext files ...\n");
-
- @file_list = `find "$directory" $maxdepth $follow -name \\*$ext -type f 2>/dev/null`;
- chomp(@file_list);
- @file_list or
- die("ERROR: no $ext files found in $directory!\n");
- $prefix = get_common_prefix(1, @file_list);
- info("Found %d %s files in %s\n", $#file_list+1, $type,
- $directory);
- }
- else
- {
- @file_list = ($directory);
- $prefix = "";
- }
-
- # Process all files in list
- foreach $file (@file_list) {
- # Process file
- if ($initial) {
- process_graphfile($file, $prefix);
- } else {
- process_dafile($file, $prefix);
- }
- }
-}
-
-
-#
-# derive_data(contentdata, funcdata, bbdata)
-#
-# Calculate function coverage data by combining line coverage data and the
-# list of lines belonging to a function.
-#
-# contentdata: [ instr1, count1, source1, instr2, count2, source2, ... ]
-# instr<n>: Instrumentation flag for line n
-# count<n>: Execution count for line n
-# source<n>: Source code for line n
-#
-# funcdata: [ count1, func1, count2, func2, ... ]
-# count<n>: Execution count for function number n
-# func<n>: Function name for function number n
-#
-# bbdata: function_name -> [ line1, line2, ... ]
-# line<n>: Line number belonging to the corresponding function
-#
-
-sub derive_data($$$)
-{
- my ($contentdata, $funcdata, $bbdata) = @_;
- my @gcov_content = @{$contentdata};
- my @gcov_functions = @{$funcdata};
- my %fn_count;
- my %ln_fn;
- my $line;
- my $maxline;
- my %fn_name;
- my $fn;
- my $count;
-
- if (!defined($bbdata)) {
- return @gcov_functions;
- }
-
- # First add existing function data
- while (@gcov_functions) {
- $count = shift(@gcov_functions);
- $fn = shift(@gcov_functions);
-
- $fn_count{$fn} = $count;
- }
-
- # Convert line coverage data to function data
- foreach $fn (keys(%{$bbdata})) {
- my $line_data = $bbdata->{$fn};
- my $line;
- my $fninstr = 0;
-
- if ($fn eq "") {
- next;
- }
- # Find the lowest line count for this function
- $count = 0;
- foreach $line (@$line_data) {
- my $linstr = $gcov_content[ ( $line - 1 ) * 3 + 0 ];
- my $lcount = $gcov_content[ ( $line - 1 ) * 3 + 1 ];
-
- next if (!$linstr);
- $fninstr = 1;
- if (($lcount > 0) &&
- (($count == 0) || ($lcount < $count))) {
- $count = $lcount;
- }
- }
- next if (!$fninstr);
- $fn_count{$fn} = $count;
- }
-
-
- # Check if we got data for all functions
- foreach $fn (keys(%fn_name)) {
- if ($fn eq "") {
- next;
- }
- if (defined($fn_count{$fn})) {
- next;
- }
- warn("WARNING: no derived data found for function $fn\n");
- }
-
- # Convert hash to list in @gcov_functions format
- foreach $fn (sort(keys(%fn_count))) {
- push(@gcov_functions, $fn_count{$fn}, $fn);
- }
-
- return @gcov_functions;
-}
-
-#
-# get_filenames(directory, pattern)
-#
-# Return a list of filenames found in directory which match the specified
-# pattern.
-#
-# Die on error.
-#
-
-sub get_filenames($$)
-{
- my ($dirname, $pattern) = @_;
- my @result;
- my $directory;
- local *DIR;
-
- opendir(DIR, $dirname) or
- die("ERROR: cannot read directory $dirname\n");
- while ($directory = readdir(DIR)) {
- push(@result, $directory) if ($directory =~ /$pattern/);
- }
- closedir(DIR);
-
- return @result;
-}
-
-#
-# process_dafile(da_filename, dir)
-#
-# Create a .info file for a single data file.
-#
-# Die on error.
-#
-
-sub process_dafile($$)
-{
- my ($file, $dir) = @_;
- my $da_filename; # Name of data file to process
- my $da_dir; # Directory of data file
- my $source_dir; # Directory of source file
- my $da_basename; # data filename without ".da/.gcda" extension
- my $bb_filename; # Name of respective graph file
- my $bb_basename; # Basename of the original graph file
- my $graph; # Contents of graph file
- my $instr; # Contents of graph file part 2
- my $gcov_error; # Error code of gcov tool
- my $object_dir; # Directory containing all object files
- my $source_filename; # Name of a source code file
- my $gcov_file; # Name of a .gcov file
- my @gcov_content; # Content of a .gcov file
- my $gcov_branches; # Branch content of a .gcov file
- my @gcov_functions; # Function calls of a .gcov file
- my @gcov_list; # List of generated .gcov files
- my $line_number; # Line number count
- my $lines_hit; # Number of instrumented lines hit
- my $lines_found; # Number of instrumented lines found
- my $funcs_hit; # Number of instrumented functions hit
- my $funcs_found; # Number of instrumented functions found
- my $br_hit;
- my $br_found;
- my $source; # gcov source header information
- my $object; # gcov object header information
- my @matches; # List of absolute paths matching filename
- my @unprocessed; # List of unprocessed source code files
- my $base_dir; # Base directory for current file
- my @tmp_links; # Temporary links to be cleaned up
- my @result;
- my $index;
- my $da_renamed; # If data file is to be renamed
- local *INFO_HANDLE;
-
- info("Processing %s\n", abs2rel($file, $dir));
- # Get path to data file in absolute and normalized form (begins with /,
- # contains no more ../ or ./)
- $da_filename = solve_relative_path($cwd, $file);
-
- # Get directory and basename of data file
- ($da_dir, $da_basename) = split_filename($da_filename);
-
- $source_dir = $da_dir;
- if (is_compat($COMPAT_MODE_LIBTOOL)) {
- # Avoid files from .libs dirs
- $source_dir =~ s/\.libs$//;
- }
-
- if (-z $da_filename)
- {
- $da_renamed = 1;
- }
- else
- {
- $da_renamed = 0;
- }
-
- # Construct base_dir for current file
- if ($base_directory)
- {
- $base_dir = $base_directory;
- }
- else
- {
- $base_dir = $source_dir;
- }
-
- # Check for writable $base_dir (gcov will try to write files there)
- stat($base_dir);
- if (!-w _)
- {
- die("ERROR: cannot write to directory $base_dir!\n");
- }
-
- # Construct name of graph file
- $bb_basename = $da_basename.$graph_file_extension;
- $bb_filename = "$da_dir/$bb_basename";
-
- # Find out the real location of graph file in case we're just looking at
- # a link
- while (readlink($bb_filename))
- {
- my $last_dir = dirname($bb_filename);
-
- $bb_filename = readlink($bb_filename);
- $bb_filename = solve_relative_path($last_dir, $bb_filename);
- }
-
- # Ignore empty graph file (e.g. source file with no statement)
- if (-z $bb_filename)
- {
- warn("WARNING: empty $bb_filename (skipped)\n");
- return;
- }
-
- # Read contents of graph file into hash. We need it later to find out
- # the absolute path to each .gcov file created as well as for
- # information about functions and their source code positions.
- if ($gcov_version < $GCOV_VERSION_3_4_0)
- {
- if (is_compat($COMPAT_MODE_HAMMER))
- {
- ($instr, $graph) = read_bbg($bb_filename);
- }
- else
- {
- ($instr, $graph) = read_bb($bb_filename);
- }
- }
- else
- {
- ($instr, $graph) = read_gcno($bb_filename);
- }
-
- # Try to find base directory automatically if requested by user
- if ($rc_auto_base) {
- $base_dir = find_base_from_graph($base_dir, $instr, $graph);
- }
-
- ($instr, $graph) = adjust_graph_filenames($base_dir, $instr, $graph);
-
- # Set $object_dir to real location of object files. This may differ
- # from $da_dir if the graph file is just a link to the "real" object
- # file location.
- $object_dir = dirname($bb_filename);
-
- # Is the data file in a different directory? (this happens e.g. with
- # the gcov-kernel patch)
- if ($object_dir ne $da_dir)
- {
- # Need to create link to data file in $object_dir
- system("ln", "-s", $da_filename,
- "$object_dir/$da_basename$data_file_extension")
- and die ("ERROR: cannot create link $object_dir/".
- "$da_basename$data_file_extension!\n");
- push(@tmp_links,
- "$object_dir/$da_basename$data_file_extension");
- # Need to create link to graph file if basename of link
- # and file are different (CONFIG_MODVERSION compat)
- if ((basename($bb_filename) ne $bb_basename) &&
- (! -e "$object_dir/$bb_basename")) {
- symlink($bb_filename, "$object_dir/$bb_basename") or
- warn("WARNING: cannot create link ".
- "$object_dir/$bb_basename\n");
- push(@tmp_links, "$object_dir/$bb_basename");
- }
- }
-
- # Change to directory containing data files and apply GCOV
- debug("chdir($base_dir)\n");
- chdir($base_dir);
-
- if ($da_renamed)
- {
- # Need to rename empty data file to workaround
- # gcov <= 3.2.x bug (Abort)
- system_no_output(3, "mv", "$da_filename", "$da_filename.ori")
- and die ("ERROR: cannot rename $da_filename\n");
- }
-
- # Execute gcov command and suppress standard output
- $gcov_error = system_no_output(1, $gcov_tool, $da_filename,
- "-o", $object_dir, @gcov_options);
-
- if ($da_renamed)
- {
- system_no_output(3, "mv", "$da_filename.ori", "$da_filename")
- and die ("ERROR: cannot rename $da_filename.ori");
- }
-
- # Clean up temporary links
- foreach (@tmp_links) {
- unlink($_);
- }
-
- if ($gcov_error)
- {
- if ($ignore[$ERROR_GCOV])
- {
- warn("WARNING: GCOV failed for $da_filename!\n");
- return;
- }
- die("ERROR: GCOV failed for $da_filename!\n");
- }
-
- # Collect data from resulting .gcov files and create .info file
- @gcov_list = get_filenames('.', '\.gcov$');
-
- # Check for files
- if (!@gcov_list)
- {
- warn("WARNING: gcov did not create any files for ".
- "$da_filename!\n");
- }
-
- # Check whether we're writing to a single file
- if ($output_filename)
- {
- if ($output_filename eq "-")
- {
- *INFO_HANDLE = *STDOUT;
- }
- else
- {
- # Append to output file
- open(INFO_HANDLE, ">>", $output_filename)
- or die("ERROR: cannot write to ".
- "$output_filename!\n");
- }
- }
- else
- {
- # Open .info file for output
- open(INFO_HANDLE, ">", "$da_filename.info")
- or die("ERROR: cannot create $da_filename.info!\n");
- }
-
- # Write test name
- printf(INFO_HANDLE "TN:%s\n", $test_name);
-
- # Traverse the list of generated .gcov files and combine them into a
- # single .info file
- @unprocessed = keys(%{$instr});
- foreach $gcov_file (sort(@gcov_list))
- {
- my $i;
- my $num;
-
- # Skip gcov file for gcc built-in code
- next if ($gcov_file eq "<built-in>.gcov");
-
- ($source, $object) = read_gcov_header($gcov_file);
-
- if (!defined($source)) {
- # Derive source file name from gcov file name if
- # header format could not be parsed
- $source = $gcov_file;
- $source =~ s/\.gcov$//;
- }
-
- $source = solve_relative_path($base_dir, $source);
-
- if (defined($adjust_src_pattern)) {
- # Apply transformation as specified by user
- $source =~ s/$adjust_src_pattern/$adjust_src_replace/g;
- }
-
- # gcov will happily create output even if there's no source code
- # available - this interferes with checksum creation so we need
- # to pull the emergency brake here.
- if (! -r $source && $checksum)
- {
- if ($ignore[$ERROR_SOURCE])
- {
- warn("WARNING: could not read source file ".
- "$source\n");
- next;
- }
- die("ERROR: could not read source file $source\n");
- }
-
- @matches = match_filename($source, keys(%{$instr}));
-
- # Skip files that are not mentioned in the graph file
- if (!@matches)
- {
- warn("WARNING: cannot find an entry for ".$gcov_file.
- " in $graph_file_extension file, skipping ".
- "file!\n");
- unlink($gcov_file);
- next;
- }
-
- # Read in contents of gcov file
- @result = read_gcov_file($gcov_file);
- if (!defined($result[0])) {
- warn("WARNING: skipping unreadable file ".
- $gcov_file."\n");
- unlink($gcov_file);
- next;
- }
- @gcov_content = @{$result[0]};
- $gcov_branches = $result[1];
- @gcov_functions = @{$result[2]};
-
- # Skip empty files
- if (!@gcov_content)
- {
- warn("WARNING: skipping empty file ".$gcov_file."\n");
- unlink($gcov_file);
- next;
- }
-
- if (scalar(@matches) == 1)
- {
- # Just one match
- $source_filename = $matches[0];
- }
- else
- {
- # Try to solve the ambiguity
- $source_filename = solve_ambiguous_match($gcov_file,
- \@matches, \@gcov_content);
- }
-
- # Remove processed file from list
- for ($index = scalar(@unprocessed) - 1; $index >= 0; $index--)
- {
- if ($unprocessed[$index] eq $source_filename)
- {
- splice(@unprocessed, $index, 1);
- last;
- }
- }
-
- # Skip external files if requested
- if (!$opt_external) {
- if (is_external($source_filename)) {
- info(" ignoring data for external file ".
- "$source_filename\n");
- unlink($gcov_file);
- next;
- }
- }
-
- # Write absolute path of source file
- printf(INFO_HANDLE "SF:%s\n", $source_filename);
-
- # If requested, derive function coverage data from
- # line coverage data of the first line of a function
- if ($opt_derive_func_data) {
- @gcov_functions =
- derive_data(\@gcov_content, \@gcov_functions,
- $graph->{$source_filename});
- }
-
- # Write function-related information
- if (defined($graph->{$source_filename}))
- {
- my $fn_data = $graph->{$source_filename};
- my $fn;
-
- foreach $fn (sort
- {$fn_data->{$a}->[0] <=> $fn_data->{$b}->[0]}
- keys(%{$fn_data})) {
- my $ln_data = $fn_data->{$fn};
- my $line = $ln_data->[0];
-
- # Skip empty function
- if ($fn eq "") {
- next;
- }
- # Remove excluded functions
- if (!$no_markers) {
- my $gfn;
- my $found = 0;
-
- foreach $gfn (@gcov_functions) {
- if ($gfn eq $fn) {
- $found = 1;
- last;
- }
- }
- if (!$found) {
- next;
- }
- }
-
- # Normalize function name
- $fn = filter_fn_name($fn);
-
- print(INFO_HANDLE "FN:$line,$fn\n");
- }
- }
-
- #--
- #-- FNDA: <call-count>, <function-name>
- #-- FNF: overall count of functions
- #-- FNH: overall count of functions with non-zero call count
- #--
- $funcs_found = 0;
- $funcs_hit = 0;
- while (@gcov_functions)
- {
- my $count = shift(@gcov_functions);
- my $fn = shift(@gcov_functions);
-
- $fn = filter_fn_name($fn);
- printf(INFO_HANDLE "FNDA:$count,$fn\n");
- $funcs_found++;
- $funcs_hit++ if ($count > 0);
- }
- if ($funcs_found > 0) {
- printf(INFO_HANDLE "FNF:%s\n", $funcs_found);
- printf(INFO_HANDLE "FNH:%s\n", $funcs_hit);
- }
-
- # Write coverage information for each instrumented branch:
- #
- # BRDA:<line number>,<block number>,<branch number>,<taken>
- #
- # where 'taken' is the number of times the branch was taken
- # or '-' if the block to which the branch belongs was never
- # executed
- $br_found = 0;
- $br_hit = 0;
- $num = br_gvec_len($gcov_branches);
- for ($i = 0; $i < $num; $i++) {
- my ($line, $block, $branch, $taken) =
- br_gvec_get($gcov_branches, $i);
-
- print(INFO_HANDLE "BRDA:$line,$block,$branch,$taken\n");
- $br_found++;
- $br_hit++ if ($taken ne '-' && $taken > 0);
- }
- if ($br_found > 0) {
- printf(INFO_HANDLE "BRF:%s\n", $br_found);
- printf(INFO_HANDLE "BRH:%s\n", $br_hit);
- }
-
- # Reset line counters
- $line_number = 0;
- $lines_found = 0;
- $lines_hit = 0;
-
- # Write coverage information for each instrumented line
- # Note: @gcov_content contains a list of (flag, count, source)
- # tuple for each source code line
- while (@gcov_content)
- {
- $line_number++;
-
- # Check for instrumented line
- if ($gcov_content[0])
- {
- $lines_found++;
- printf(INFO_HANDLE "DA:".$line_number.",".
- $gcov_content[1].($checksum ?
- ",". md5_base64($gcov_content[2]) : "").
- "\n");
-
- # Increase $lines_hit in case of an execution
- # count>0
- if ($gcov_content[1] > 0) { $lines_hit++; }
- }
-
- # Remove already processed data from array
- splice(@gcov_content,0,3);
- }
-
- # Write line statistics and section separator
- printf(INFO_HANDLE "LF:%s\n", $lines_found);
- printf(INFO_HANDLE "LH:%s\n", $lines_hit);
- print(INFO_HANDLE "end_of_record\n");
-
- # Remove .gcov file after processing
- unlink($gcov_file);
- }
-
- # Check for files which show up in the graph file but were never
- # processed
- if (@unprocessed && @gcov_list)
- {
- foreach (@unprocessed)
- {
- warn("WARNING: no data found for $_\n");
- }
- }
-
- if (!($output_filename && ($output_filename eq "-")))
- {
- close(INFO_HANDLE);
- }
-
- # Change back to initial directory
- chdir($cwd);
-}
-
-
-#
-# solve_relative_path(path, dir)
-#
-# Solve relative path components of DIR which, if not absolute, resides in PATH.
-#
-
-sub solve_relative_path($$)
-{
- my $path = $_[0];
- my $dir = $_[1];
- my $volume;
- my $directories;
- my $filename;
- my @dirs; # holds path elements
- my $result;
-
- # Convert from Windows path to msys path
- if( $^O eq "msys" )
- {
- # search for a windows drive letter at the beginning
- ($volume, $directories, $filename) = File::Spec::Win32->splitpath( $dir );
- if( $volume ne '' )
- {
- my $uppercase_volume;
- # transform c/d\../e/f\g to Windows style c\d\..\e\f\g
- $dir = File::Spec::Win32->canonpath( $dir );
- # use Win32 module to retrieve path components
- # $uppercase_volume is not used any further
- ( $uppercase_volume, $directories, $filename ) = File::Spec::Win32->splitpath( $dir );
- @dirs = File::Spec::Win32->splitdir( $directories );
-
- # prepend volume, since in msys C: is always mounted to /c
- $volume =~ s|^([a-zA-Z]+):|/\L$1\E|;
- unshift( @dirs, $volume );
-
- # transform to Unix style '/' path
- $directories = File::Spec->catdir( @dirs );
- $dir = File::Spec->catpath( '', $directories, $filename );
- } else {
- # eliminate '\' path separators
- $dir = File::Spec->canonpath( $dir );
- }
- }
-
- $result = $dir;
- # Prepend path if not absolute
- if ($dir =~ /^[^\/]/)
- {
- $result = "$path/$result";
- }
-
- # Remove //
- $result =~ s/\/\//\//g;
-
- # Remove .
- $result =~ s/\/\.\//\//g;
- $result =~ s/\/\.$/\//g;
-
- # Remove trailing /
- $result =~ s/\/$//g;
-
- # Solve ..
- while ($result =~ s/\/[^\/]+\/\.\.\//\//)
- {
- }
-
- # Remove preceding ..
- $result =~ s/^\/\.\.\//\//g;
-
- return $result;
-}
-
-
-#
-# match_filename(gcov_filename, list)
-#
-# Return a list of those entries of LIST which match the relative filename
-# GCOV_FILENAME.
-#
-
-sub match_filename($@)
-{
- my ($filename, @list) = @_;
- my ($vol, $dir, $file) = splitpath($filename);
- my @comp = splitdir($dir);
- my $comps = scalar(@comp);
- my $entry;
- my @result;
-
-entry:
- foreach $entry (@list) {
- my ($evol, $edir, $efile) = splitpath($entry);
- my @ecomp;
- my $ecomps;
- my $i;
-
- # Filename component must match
- if ($efile ne $file) {
- next;
- }
- # Check directory components last to first for match
- @ecomp = splitdir($edir);
- $ecomps = scalar(@ecomp);
- if ($ecomps < $comps) {
- next;
- }
- for ($i = 0; $i < $comps; $i++) {
- if ($comp[$comps - $i - 1] ne
- $ecomp[$ecomps - $i - 1]) {
- next entry;
- }
- }
- push(@result, $entry),
- }
-
- return @result;
-}
-
-#
-# solve_ambiguous_match(rel_filename, matches_ref, gcov_content_ref)
-#
-# Try to solve ambiguous matches of mapping (gcov file) -> (source code) file
-# by comparing source code provided in the GCOV file with that of the files
-# in MATCHES. REL_FILENAME identifies the relative filename of the gcov
-# file.
-#
-# Return the one real match or die if there is none.
-#
-
-sub solve_ambiguous_match($$$)
-{
- my $rel_name = $_[0];
- my $matches = $_[1];
- my $content = $_[2];
- my $filename;
- my $index;
- my $no_match;
- local *SOURCE;
-
- # Check the list of matches
- foreach $filename (@$matches)
- {
-
- # Compare file contents
- open(SOURCE, "<", $filename)
- or die("ERROR: cannot read $filename!\n");
-
- $no_match = 0;
- for ($index = 2; <SOURCE>; $index += 3)
- {
- chomp;
-
- # Also remove CR from line-end
- s/\015$//;
-
- if ($_ ne @$content[$index])
- {
- $no_match = 1;
- last;
- }
- }
-
- close(SOURCE);
-
- if (!$no_match)
- {
- info("Solved source file ambiguity for $rel_name\n");
- return $filename;
- }
- }
-
- die("ERROR: could not match gcov data for $rel_name!\n");
-}
-
-
-#
-# split_filename(filename)
-#
-# Return (path, filename, extension) for a given FILENAME.
-#
-
-sub split_filename($)
-{
- my @path_components = split('/', $_[0]);
- my @file_components = split('\.', pop(@path_components));
- my $extension = pop(@file_components);
-
- return (join("/",@path_components), join(".",@file_components),
- $extension);
-}
-
-
-#
-# read_gcov_header(gcov_filename)
-#
-# Parse file GCOV_FILENAME and return a list containing the following
-# information:
-#
-# (source, object)
-#
-# where:
-#
-# source: complete relative path of the source code file (gcc >= 3.3 only)
-# object: name of associated graph file
-#
-# Die on error.
-#
-
-sub read_gcov_header($)
-{
- my $source;
- my $object;
- local *INPUT;
-
- if (!open(INPUT, "<", $_[0]))
- {
- if ($ignore_errors[$ERROR_GCOV])
- {
- warn("WARNING: cannot read $_[0]!\n");
- return (undef,undef);
- }
- die("ERROR: cannot read $_[0]!\n");
- }
-
- while (<INPUT>)
- {
- chomp($_);
-
- # Also remove CR from line-end
- s/\015$//;
-
- if (/^\s+-:\s+0:Source:(.*)$/)
- {
- # Source: header entry
- $source = $1;
- }
- elsif (/^\s+-:\s+0:Object:(.*)$/)
- {
- # Object: header entry
- $object = $1;
- }
- else
- {
- last;
- }
- }
-
- close(INPUT);
-
- return ($source, $object);
-}
-
-
-#
-# br_gvec_len(vector)
-#
-# Return the number of entries in the branch coverage vector.
-#
-
-sub br_gvec_len($)
-{
- my ($vec) = @_;
-
- return 0 if (!defined($vec));
- return (length($vec) * 8 / $BR_VEC_WIDTH) / $BR_VEC_ENTRIES;
-}
-
-
-#
-# br_gvec_get(vector, number)
-#
-# Return an entry from the branch coverage vector.
-#
-
-sub br_gvec_get($$)
-{
- my ($vec, $num) = @_;
- my $line;
- my $block;
- my $branch;
- my $taken;
- my $offset = $num * $BR_VEC_ENTRIES;
-
- # Retrieve data from vector
- $line = vec($vec, $offset + $BR_LINE, $BR_VEC_WIDTH);
- $block = vec($vec, $offset + $BR_BLOCK, $BR_VEC_WIDTH);
- $branch = vec($vec, $offset + $BR_BRANCH, $BR_VEC_WIDTH);
- $taken = vec($vec, $offset + $BR_TAKEN, $BR_VEC_WIDTH);
-
- # Decode taken value from an integer
- if ($taken == 0) {
- $taken = "-";
- } else {
- $taken--;
- }
-
- return ($line, $block, $branch, $taken);
-}
-
-
-#
-# br_gvec_push(vector, line, block, branch, taken)
-#
-# Add an entry to the branch coverage vector.
-#
-
-sub br_gvec_push($$$$$)
-{
- my ($vec, $line, $block, $branch, $taken) = @_;
- my $offset;
-
- $vec = "" if (!defined($vec));
- $offset = br_gvec_len($vec) * $BR_VEC_ENTRIES;
-
- # Encode taken value into an integer
- if ($taken eq "-") {
- $taken = 0;
- } else {
- $taken++;
- }
-
- # Add to vector
- vec($vec, $offset + $BR_LINE, $BR_VEC_WIDTH) = $line;
- vec($vec, $offset + $BR_BLOCK, $BR_VEC_WIDTH) = $block;
- vec($vec, $offset + $BR_BRANCH, $BR_VEC_WIDTH) = $branch;
- vec($vec, $offset + $BR_TAKEN, $BR_VEC_WIDTH) = $taken;
-
- return $vec;
-}
-
-
-#
-# read_gcov_file(gcov_filename)
-#
-# Parse file GCOV_FILENAME (.gcov file format) and return the list:
-# (reference to gcov_content, reference to gcov_branch, reference to gcov_func)
-#
-# gcov_content is a list of 3 elements
-# (flag, count, source) for each source code line:
-#
-# $result[($line_number-1)*3+0] = instrumentation flag for line $line_number
-# $result[($line_number-1)*3+1] = execution count for line $line_number
-# $result[($line_number-1)*3+2] = source code text for line $line_number
-#
-# gcov_branch is a vector of 4 4-byte long elements for each branch:
-# line number, block number, branch number, count + 1 or 0
-#
-# gcov_func is a list of 2 elements
-# (number of calls, function name) for each function
-#
-# Die on error.
-#
-
-sub read_gcov_file($)
-{
- my $filename = $_[0];
- my @result = ();
- my $branches = "";
- my @functions = ();
- my $number;
- my $exclude_flag = 0;
- my $exclude_line = 0;
- my $last_block = $UNNAMED_BLOCK;
- my $last_line = 0;
- local *INPUT;
-
- if (!open(INPUT, "<", $filename)) {
- if ($ignore_errors[$ERROR_GCOV])
- {
- warn("WARNING: cannot read $filename!\n");
- return (undef, undef, undef);
- }
- die("ERROR: cannot read $filename!\n");
- }
-
- if ($gcov_version < $GCOV_VERSION_3_3_0)
- {
- # Expect gcov format as used in gcc < 3.3
- while (<INPUT>)
- {
- chomp($_);
-
- # Also remove CR from line-end
- s/\015$//;
-
- if (/^branch\s+(\d+)\s+taken\s+=\s+(\d+)/) {
- next if (!$br_coverage);
- next if ($exclude_line);
- $branches = br_gvec_push($branches, $last_line,
- $last_block, $1, $2);
- } elsif (/^branch\s+(\d+)\s+never\s+executed/) {
- next if (!$br_coverage);
- next if ($exclude_line);
- $branches = br_gvec_push($branches, $last_line,
- $last_block, $1, '-');
- }
- elsif (/^call/ || /^function/)
- {
- # Function call return data
- }
- else
- {
- $last_line++;
- # Check for exclusion markers
- if (!$no_markers) {
- if (/$EXCL_STOP/) {
- $exclude_flag = 0;
- } elsif (/$EXCL_START/) {
- $exclude_flag = 1;
- }
- if (/$EXCL_LINE/ || $exclude_flag) {
- $exclude_line = 1;
- } else {
- $exclude_line = 0;
- }
- }
- # Source code execution data
- if (/^\t\t(.*)$/)
- {
- # Uninstrumented line
- push(@result, 0);
- push(@result, 0);
- push(@result, $1);
- next;
- }
- $number = (split(" ",substr($_, 0, 16)))[0];
-
- # Check for zero count which is indicated
- # by ######
- if ($number eq "######") { $number = 0; }
-
- if ($exclude_line) {
- # Register uninstrumented line instead
- push(@result, 0);
- push(@result, 0);
- } else {
- push(@result, 1);
- push(@result, $number);
- }
- push(@result, substr($_, 16));
- }
- }
- }
- else
- {
- # Expect gcov format as used in gcc >= 3.3
- while (<INPUT>)
- {
- chomp($_);
-
- # Also remove CR from line-end
- s/\015$//;
-
- if (/^\s*(\d+|\$+):\s*(\d+)-block\s+(\d+)\s*$/) {
- # Block information - used to group related
- # branches
- $last_line = $2;
- $last_block = $3;
- } elsif (/^branch\s+(\d+)\s+taken\s+(\d+)/) {
- next if (!$br_coverage);
- next if ($exclude_line);
- $branches = br_gvec_push($branches, $last_line,
- $last_block, $1, $2);
- } elsif (/^branch\s+(\d+)\s+never\s+executed/) {
- next if (!$br_coverage);
- next if ($exclude_line);
- $branches = br_gvec_push($branches, $last_line,
- $last_block, $1, '-');
- }
- elsif (/^function\s+(.+)\s+called\s+(\d+)\s+/)
- {
- next if (!$func_coverage);
- if ($exclude_line) {
- next;
- }
- push(@functions, $2, $1);
- }
- elsif (/^call/)
- {
- # Function call return data
- }
- elsif (/^\s*([^:]+):\s*([^:]+):(.*)$/)
- {
- my ($count, $line, $code) = ($1, $2, $3);
-
- $last_line = $line;
- $last_block = $UNNAMED_BLOCK;
- # Check for exclusion markers
- if (!$no_markers) {
- if (/$EXCL_STOP/) {
- $exclude_flag = 0;
- } elsif (/$EXCL_START/) {
- $exclude_flag = 1;
- }
- if (/$EXCL_LINE/ || $exclude_flag) {
- $exclude_line = 1;
- } else {
- $exclude_line = 0;
- }
- }
- # <exec count>:<line number>:<source code>
- if ($line eq "0")
- {
- # Extra data
- }
- elsif ($count eq "-")
- {
- # Uninstrumented line
- push(@result, 0);
- push(@result, 0);
- push(@result, $code);
- }
- else
- {
- if ($exclude_line) {
- push(@result, 0);
- push(@result, 0);
- } else {
- # Check for zero count
- if ($count eq "#####") {
- $count = 0;
- }
- push(@result, 1);
- push(@result, $count);
- }
- push(@result, $code);
- }
- }
- }
- }
-
- close(INPUT);
- if ($exclude_flag) {
- warn("WARNING: unterminated exclusion section in $filename\n");
- }
- return(\@result, $branches, \@functions);
-}
-
-
-#
-# Get the GCOV tool version. Return an integer number which represents the
-# GCOV version. Version numbers can be compared using standard integer
-# operations.
-#
-
-sub get_gcov_version()
-{
- local *HANDLE;
- my $version_string;
- my $result;
-
- open(GCOV_PIPE, "-|", "$gcov_tool -v")
- or die("ERROR: cannot retrieve gcov version!\n");
- $version_string = <GCOV_PIPE>;
- close(GCOV_PIPE);
-
- $result = 0;
- if ($version_string =~ /(\d+)\.(\d+)(\.(\d+))?/)
- {
- if (defined($4))
- {
- info("Found gcov version: $1.$2.$4\n");
- $result = $1 << 16 | $2 << 8 | $4;
- }
- else
- {
- info("Found gcov version: $1.$2\n");
- $result = $1 << 16 | $2 << 8;
- }
- }
- return ($result, $version_string);
-}
-
-
-#
-# info(printf_parameter)
-#
-# Use printf to write PRINTF_PARAMETER to stdout only when the $quiet flag
-# is not set.
-#
-
-sub info(@)
-{
- if (!$quiet)
- {
- # Print info string
- if (defined($output_filename) && ($output_filename eq "-"))
- {
- # Don't interfere with the .info output to STDOUT
- printf(STDERR @_);
- }
- else
- {
- printf(@_);
- }
- }
-}
-
-
-#
-# int_handler()
-#
-# Called when the script was interrupted by an INT signal (e.g. CTRl-C)
-#
-
-sub int_handler()
-{
- if ($cwd) { chdir($cwd); }
- info("Aborted.\n");
- exit(1);
-}
-
-
-#
-# system_no_output(mode, parameters)
-#
-# Call an external program using PARAMETERS while suppressing depending on
-# the value of MODE:
-#
-# MODE & 1: suppress STDOUT
-# MODE & 2: suppress STDERR
-#
-# Return 0 on success, non-zero otherwise.
-#
-
-sub system_no_output($@)
-{
- my $mode = shift;
- my $result;
- local *OLD_STDERR;
- local *OLD_STDOUT;
-
- # Save old stdout and stderr handles
- ($mode & 1) && open(OLD_STDOUT, ">>&", "STDOUT");
- ($mode & 2) && open(OLD_STDERR, ">>&", "STDERR");
-
- # Redirect to /dev/null
- ($mode & 1) && open(STDOUT, ">", "/dev/null");
- ($mode & 2) && open(STDERR, ">", "/dev/null");
-
- debug("system(".join(' ', @_).")\n");
- system(@_);
- $result = $?;
-
- # Close redirected handles
- ($mode & 1) && close(STDOUT);
- ($mode & 2) && close(STDERR);
-
- # Restore old handles
- ($mode & 1) && open(STDOUT, ">>&", "OLD_STDOUT");
- ($mode & 2) && open(STDERR, ">>&", "OLD_STDERR");
-
- return $result;
-}
-
-
-#
-# read_config(filename)
-#
-# Read configuration file FILENAME and return a reference to a hash containing
-# all valid key=value pairs found.
-#
-
-sub read_config($)
-{
- my $filename = $_[0];
- my %result;
- my $key;
- my $value;
- local *HANDLE;
-
- if (!open(HANDLE, "<", $filename))
- {
- warn("WARNING: cannot read configuration file $filename\n");
- return undef;
- }
- while (<HANDLE>)
- {
- chomp;
- # Skip comments
- s/#.*//;
- # Remove leading blanks
- s/^\s+//;
- # Remove trailing blanks
- s/\s+$//;
- next unless length;
- ($key, $value) = split(/\s*=\s*/, $_, 2);
- if (defined($key) && defined($value))
- {
- $result{$key} = $value;
- }
- else
- {
- warn("WARNING: malformed statement in line $. ".
- "of configuration file $filename\n");
- }
- }
- close(HANDLE);
- return \%result;
-}
-
-
-#
-# apply_config(REF)
-#
-# REF is a reference to a hash containing the following mapping:
-#
-# key_string => var_ref
-#
-# where KEY_STRING is a keyword and VAR_REF is a reference to an associated
-# variable. If the global configuration hashes CONFIG or OPT_RC contain a value
-# for keyword KEY_STRING, VAR_REF will be assigned the value for that keyword.
-#
-
-sub apply_config($)
-{
- my $ref = $_[0];
-
- foreach (keys(%{$ref}))
- {
- if (defined($opt_rc{$_})) {
- ${$ref->{$_}} = $opt_rc{$_};
- } elsif (defined($config->{$_})) {
- ${$ref->{$_}} = $config->{$_};
- }
- }
-}
-
-
-#
-# get_exclusion_data(filename)
-#
-# Scan specified source code file for exclusion markers and return
-# linenumber -> 1
-# for all lines which should be excluded.
-#
-
-sub get_exclusion_data($)
-{
- my ($filename) = @_;
- my %list;
- my $flag = 0;
- local *HANDLE;
-
- if (!open(HANDLE, "<", $filename)) {
- warn("WARNING: could not open $filename\n");
- return undef;
- }
- while (<HANDLE>) {
- if (/$EXCL_STOP/) {
- $flag = 0;
- } elsif (/$EXCL_START/) {
- $flag = 1;
- }
- if (/$EXCL_LINE/ || $flag) {
- $list{$.} = 1;
- }
- }
- close(HANDLE);
-
- if ($flag) {
- warn("WARNING: unterminated exclusion section in $filename\n");
- }
-
- return \%list;
-}
-
-
-#
-# apply_exclusion_data(instr, graph)
-#
-# Remove lines from instr and graph data structures which are marked
-# for exclusion in the source code file.
-#
-# Return adjusted (instr, graph).
-#
-# graph : file name -> function data
-# function data : function name -> line data
-# line data : [ line1, line2, ... ]
-#
-# instr : filename -> line data
-# line data : [ line1, line2, ... ]
-#
-
-sub apply_exclusion_data($$)
-{
- my ($instr, $graph) = @_;
- my $filename;
- my %excl_data;
- my $excl_read_failed = 0;
-
- # Collect exclusion marker data
- foreach $filename (sort_uniq_lex(keys(%{$graph}), keys(%{$instr}))) {
- my $excl = get_exclusion_data($filename);
-
- # Skip and note if file could not be read
- if (!defined($excl)) {
- $excl_read_failed = 1;
- next;
- }
-
- # Add to collection if there are markers
- $excl_data{$filename} = $excl if (keys(%{$excl}) > 0);
- }
-
- # Warn if not all source files could be read
- if ($excl_read_failed) {
- warn("WARNING: some exclusion markers may be ignored\n");
- }
-
- # Skip if no markers were found
- return ($instr, $graph) if (keys(%excl_data) == 0);
-
- # Apply exclusion marker data to graph
- foreach $filename (keys(%excl_data)) {
- my $function_data = $graph->{$filename};
- my $excl = $excl_data{$filename};
- my $function;
-
- next if (!defined($function_data));
-
- foreach $function (keys(%{$function_data})) {
- my $line_data = $function_data->{$function};
- my $line;
- my @new_data;
-
- # To be consistent with exclusion parser in non-initial
- # case we need to remove a function if the first line
- # was excluded
- if ($excl->{$line_data->[0]}) {
- delete($function_data->{$function});
- next;
- }
- # Copy only lines which are not excluded
- foreach $line (@{$line_data}) {
- push(@new_data, $line) if (!$excl->{$line});
- }
-
- # Store modified list
- if (scalar(@new_data) > 0) {
- $function_data->{$function} = \@new_data;
- } else {
- # All of this function was excluded
- delete($function_data->{$function});
- }
- }
-
- # Check if all functions of this file were excluded
- if (keys(%{$function_data}) == 0) {
- delete($graph->{$filename});
- }
- }
-
- # Apply exclusion marker data to instr
- foreach $filename (keys(%excl_data)) {
- my $line_data = $instr->{$filename};
- my $excl = $excl_data{$filename};
- my $line;
- my @new_data;
-
- next if (!defined($line_data));
-
- # Copy only lines which are not excluded
- foreach $line (@{$line_data}) {
- push(@new_data, $line) if (!$excl->{$line});
- }
-
- # Store modified list
- $instr->{$filename} = \@new_data;
- }
-
- return ($instr, $graph);
-}
-
-
-sub process_graphfile($$)
-{
- my ($file, $dir) = @_;
- my $graph_filename = $file;
- my $graph_dir;
- my $graph_basename;
- my $source_dir;
- my $base_dir;
- my $graph;
- my $instr;
- my $filename;
- local *INFO_HANDLE;
-
- info("Processing %s\n", abs2rel($file, $dir));
-
- # Get path to data file in absolute and normalized form (begins with /,
- # contains no more ../ or ./)
- $graph_filename = solve_relative_path($cwd, $graph_filename);
-
- # Get directory and basename of data file
- ($graph_dir, $graph_basename) = split_filename($graph_filename);
-
- $source_dir = $graph_dir;
- if (is_compat($COMPAT_MODE_LIBTOOL)) {
- # Avoid files from .libs dirs
- $source_dir =~ s/\.libs$//;
- }
-
- # Construct base_dir for current file
- if ($base_directory)
- {
- $base_dir = $base_directory;
- }
- else
- {
- $base_dir = $source_dir;
- }
-
- if ($gcov_version < $GCOV_VERSION_3_4_0)
- {
- if (is_compat($COMPAT_MODE_HAMMER))
- {
- ($instr, $graph) = read_bbg($graph_filename);
- }
- else
- {
- ($instr, $graph) = read_bb($graph_filename);
- }
- }
- else
- {
- ($instr, $graph) = read_gcno($graph_filename);
- }
-
- # Try to find base directory automatically if requested by user
- if ($rc_auto_base) {
- $base_dir = find_base_from_graph($base_dir, $instr, $graph);
- }
-
- ($instr, $graph) = adjust_graph_filenames($base_dir, $instr, $graph);
-
- if (!$no_markers) {
- # Apply exclusion marker data to graph file data
- ($instr, $graph) = apply_exclusion_data($instr, $graph);
- }
-
- # Check whether we're writing to a single file
- if ($output_filename)
- {
- if ($output_filename eq "-")
- {
- *INFO_HANDLE = *STDOUT;
- }
- else
- {
- # Append to output file
- open(INFO_HANDLE, ">>", $output_filename)
- or die("ERROR: cannot write to ".
- "$output_filename!\n");
- }
- }
- else
- {
- # Open .info file for output
- open(INFO_HANDLE, ">", "$graph_filename.info")
- or die("ERROR: cannot create $graph_filename.info!\n");
- }
-
- # Write test name
- printf(INFO_HANDLE "TN:%s\n", $test_name);
- foreach $filename (sort(keys(%{$instr})))
- {
- my $funcdata = $graph->{$filename};
- my $line;
- my $linedata;
-
- print(INFO_HANDLE "SF:$filename\n");
-
- if (defined($funcdata) && $func_coverage) {
- my @functions = sort {$funcdata->{$a}->[0] <=>
- $funcdata->{$b}->[0]}
- keys(%{$funcdata});
- my $func;
-
- # Gather list of instrumented lines and functions
- foreach $func (@functions) {
- $linedata = $funcdata->{$func};
-
- # Print function name and starting line
- print(INFO_HANDLE "FN:".$linedata->[0].
- ",".filter_fn_name($func)."\n");
- }
- # Print zero function coverage data
- foreach $func (@functions) {
- print(INFO_HANDLE "FNDA:0,".
- filter_fn_name($func)."\n");
- }
- # Print function summary
- print(INFO_HANDLE "FNF:".scalar(@functions)."\n");
- print(INFO_HANDLE "FNH:0\n");
- }
- # Print zero line coverage data
- foreach $line (@{$instr->{$filename}}) {
- print(INFO_HANDLE "DA:$line,0\n");
- }
- # Print line summary
- print(INFO_HANDLE "LF:".scalar(@{$instr->{$filename}})."\n");
- print(INFO_HANDLE "LH:0\n");
-
- print(INFO_HANDLE "end_of_record\n");
- }
- if (!($output_filename && ($output_filename eq "-")))
- {
- close(INFO_HANDLE);
- }
-}
-
-sub filter_fn_name($)
-{
- my ($fn) = @_;
-
- # Remove characters used internally as function name delimiters
- $fn =~ s/[,=]/_/g;
-
- return $fn;
-}
-
-sub warn_handler($)
-{
- my ($msg) = @_;
-
- warn("$tool_name: $msg");
-}
-
-sub die_handler($)
-{
- my ($msg) = @_;
-
- die("$tool_name: $msg");
-}
-
-
-#
-# graph_error(filename, message)
-#
-# Print message about error in graph file. If ignore_graph_error is set, return.
-# Otherwise abort.
-#
-
-sub graph_error($$)
-{
- my ($filename, $msg) = @_;
-
- if ($ignore[$ERROR_GRAPH]) {
- warn("WARNING: $filename: $msg - skipping\n");
- return;
- }
- die("ERROR: $filename: $msg\n");
-}
-
-#
-# graph_expect(description)
-#
-# If debug is set to a non-zero value, print the specified description of what
-# is expected to be read next from the graph file.
-#
-
-sub graph_expect($)
-{
- my ($msg) = @_;
-
- if (!$debug || !defined($msg)) {
- return;
- }
-
- print(STDERR "DEBUG: expecting $msg\n");
-}
-
-#
-# graph_read(handle, bytes[, description, peek])
-#
-# Read and return the specified number of bytes from handle. Return undef
-# if the number of bytes could not be read. If PEEK is non-zero, reset
-# file position after read.
-#
-
-sub graph_read(*$;$$)
-{
- my ($handle, $length, $desc, $peek) = @_;
- my $data;
- my $result;
- my $pos;
-
- graph_expect($desc);
- if ($peek) {
- $pos = tell($handle);
- if ($pos == -1) {
- warn("Could not get current file position: $!\n");
- return undef;
- }
- }
- $result = read($handle, $data, $length);
- if ($debug) {
- my $op = $peek ? "peek" : "read";
- my $ascii = "";
- my $hex = "";
- my $i;
-
- print(STDERR "DEBUG: $op($length)=$result: ");
- for ($i = 0; $i < length($data); $i++) {
- my $c = substr($data, $i, 1);;
- my $n = ord($c);
-
- $hex .= sprintf("%02x ", $n);
- if ($n >= 32 && $n <= 127) {
- $ascii .= $c;
- } else {
- $ascii .= ".";
- }
- }
- print(STDERR "$hex |$ascii|");
- print(STDERR "\n");
- }
- if ($peek) {
- if (!seek($handle, $pos, 0)) {
- warn("Could not set file position: $!\n");
- return undef;
- }
- }
- if ($result != $length) {
- return undef;
- }
- return $data;
-}
-
-#
-# graph_skip(handle, bytes[, description])
-#
-# Read and discard the specified number of bytes from handle. Return non-zero
-# if bytes could be read, zero otherwise.
-#
-
-sub graph_skip(*$;$)
-{
- my ($handle, $length, $desc) = @_;
-
- if (defined(graph_read($handle, $length, $desc))) {
- return 1;
- }
- return 0;
-}
-
-#
-# sort_uniq(list)
-#
-# Return list in numerically ascending order and without duplicate entries.
-#
-
-sub sort_uniq(@)
-{
- my (@list) = @_;
- my %hash;
-
- foreach (@list) {
- $hash{$_} = 1;
- }
- return sort { $a <=> $b } keys(%hash);
-}
-
-#
-# sort_uniq_lex(list)
-#
-# Return list in lexically ascending order and without duplicate entries.
-#
-
-sub sort_uniq_lex(@)
-{
- my (@list) = @_;
- my %hash;
-
- foreach (@list) {
- $hash{$_} = 1;
- }
- return sort keys(%hash);
-}
-
-#
-# parent_dir(dir)
-#
-# Return parent directory for DIR. DIR must not contain relative path
-# components.
-#
-
-sub parent_dir($)
-{
- my ($dir) = @_;
- my ($v, $d, $f) = splitpath($dir, 1);
- my @dirs = splitdir($d);
-
- pop(@dirs);
-
- return catpath($v, catdir(@dirs), $f);
-}
-
-#
-# find_base_from_graph(base_dir, instr, graph)
-#
-# Try to determine the base directory of the graph file specified by INSTR
-# and GRAPH. The base directory is the base for all relative filenames in
-# the graph file. It is defined by the current working directory at time
-# of compiling the source file.
-#
-# This function implements a heuristic which relies on the following
-# assumptions:
-# - all files used for compilation are still present at their location
-# - the base directory is either BASE_DIR or one of its parent directories
-# - files by the same name are not present in multiple parent directories
-#
-
-sub find_base_from_graph($$$)
-{
- my ($base_dir, $instr, $graph) = @_;
- my $old_base;
- my $best_miss;
- my $best_base;
- my %rel_files;
-
- # Determine list of relative paths
- foreach my $filename (keys(%{$instr}), keys(%{$graph})) {
- next if (file_name_is_absolute($filename));
-
- $rel_files{$filename} = 1;
- }
-
- # Early exit if there are no relative paths
- return $base_dir if (!%rel_files);
-
- do {
- my $miss = 0;
-
- foreach my $filename (keys(%rel_files)) {
- if (!-e solve_relative_path($base_dir, $filename)) {
- $miss++;
- }
- }
-
- debug("base_dir=$base_dir miss=$miss\n");
-
- # Exit if we find an exact match with no misses
- return $base_dir if ($miss == 0);
-
- # No exact match, aim for the one with the least source file
- # misses
- if (!defined($best_base) || $miss < $best_miss) {
- $best_base = $base_dir;
- $best_miss = $miss;
- }
-
- # Repeat until there's no more parent directory
- $old_base = $base_dir;
- $base_dir = parent_dir($base_dir);
- } while ($old_base ne $base_dir);
-
- return $best_base;
-}
-
-#
-# adjust_graph_filenames(base_dir, instr, graph)
-#
-# Make relative paths in INSTR and GRAPH absolute and apply
-# geninfo_adjust_src_path setting to graph file data.
-#
-
-sub adjust_graph_filenames($$$)
-{
- my ($base_dir, $instr, $graph) = @_;
-
- foreach my $filename (keys(%{$instr})) {
- my $old_filename = $filename;
-
- # Convert to absolute canonical form
- $filename = solve_relative_path($base_dir, $filename);
-
- # Apply adjustment
- if (defined($adjust_src_pattern)) {
- $filename =~ s/$adjust_src_pattern/$adjust_src_replace/g;
- }
-
- if ($filename ne $old_filename) {
- $instr->{$filename} = delete($instr->{$old_filename});
- }
- }
-
- foreach my $filename (keys(%{$graph})) {
- my $old_filename = $filename;
-
- # Make absolute
- # Convert to absolute canonical form
- $filename = solve_relative_path($base_dir, $filename);
-
- # Apply adjustment
- if (defined($adjust_src_pattern)) {
- $filename =~ s/$adjust_src_pattern/$adjust_src_replace/g;
- }
-
- if ($filename ne $old_filename) {
- $graph->{$filename} = delete($graph->{$old_filename});
- }
- }
-
- return ($instr, $graph);
-}
-
-#
-# graph_cleanup(graph)
-#
-# Remove entries for functions with no lines. Remove duplicate line numbers.
-# Sort list of line numbers numerically ascending.
-#
-
-sub graph_cleanup($)
-{
- my ($graph) = @_;
- my $filename;
-
- foreach $filename (keys(%{$graph})) {
- my $per_file = $graph->{$filename};
- my $function;
-
- foreach $function (keys(%{$per_file})) {
- my $lines = $per_file->{$function};
-
- if (scalar(@$lines) == 0) {
- # Remove empty function
- delete($per_file->{$function});
- next;
- }
- # Normalize list
- $per_file->{$function} = [ sort_uniq(@$lines) ];
- }
- if (scalar(keys(%{$per_file})) == 0) {
- # Remove empty file
- delete($graph->{$filename});
- }
- }
-}
-
-#
-# graph_find_base(bb)
-#
-# Try to identify the filename which is the base source file for the
-# specified bb data.
-#
-
-sub graph_find_base($)
-{
- my ($bb) = @_;
- my %file_count;
- my $basefile;
- my $file;
- my $func;
- my $filedata;
- my $count;
- my $num;
-
- # Identify base name for this bb data.
- foreach $func (keys(%{$bb})) {
- $filedata = $bb->{$func};
-
- foreach $file (keys(%{$filedata})) {
- $count = $file_count{$file};
-
- # Count file occurrence
- $file_count{$file} = defined($count) ? $count + 1 : 1;
- }
- }
- $count = 0;
- $num = 0;
- foreach $file (keys(%file_count)) {
- if ($file_count{$file} > $count) {
- # The file that contains code for the most functions
- # is likely the base file
- $count = $file_count{$file};
- $num = 1;
- $basefile = $file;
- } elsif ($file_count{$file} == $count) {
- # If more than one file could be the basefile, we
- # don't have a basefile
- $basefile = undef;
- }
- }
-
- return $basefile;
-}
-
-#
-# graph_from_bb(bb, fileorder, bb_filename)
-#
-# Convert data from bb to the graph format and list of instrumented lines.
-# Returns (instr, graph).
-#
-# bb : function name -> file data
-# : undef -> file order
-# file data : filename -> line data
-# line data : [ line1, line2, ... ]
-#
-# file order : function name -> [ filename1, filename2, ... ]
-#
-# graph : file name -> function data
-# function data : function name -> line data
-# line data : [ line1, line2, ... ]
-#
-# instr : filename -> line data
-# line data : [ line1, line2, ... ]
-#
-
-sub graph_from_bb($$$)
-{
- my ($bb, $fileorder, $bb_filename) = @_;
- my $graph = {};
- my $instr = {};
- my $basefile;
- my $file;
- my $func;
- my $filedata;
- my $linedata;
- my $order;
-
- $basefile = graph_find_base($bb);
- # Create graph structure
- foreach $func (keys(%{$bb})) {
- $filedata = $bb->{$func};
- $order = $fileorder->{$func};
-
- # Account for lines in functions
- if (defined($basefile) && defined($filedata->{$basefile})) {
- # If the basefile contributes to this function,
- # account this function to the basefile.
- $graph->{$basefile}->{$func} = $filedata->{$basefile};
- } else {
- # If the basefile does not contribute to this function,
- # account this function to the first file contributing
- # lines.
- $graph->{$order->[0]}->{$func} =
- $filedata->{$order->[0]};
- }
-
- foreach $file (keys(%{$filedata})) {
- # Account for instrumented lines
- $linedata = $filedata->{$file};
- push(@{$instr->{$file}}, @$linedata);
- }
- }
- # Clean up array of instrumented lines
- foreach $file (keys(%{$instr})) {
- $instr->{$file} = [ sort_uniq(@{$instr->{$file}}) ];
- }
-
- return ($instr, $graph);
-}
-
-#
-# graph_add_order(fileorder, function, filename)
-#
-# Add an entry for filename to the fileorder data set for function.
-#
-
-sub graph_add_order($$$)
-{
- my ($fileorder, $function, $filename) = @_;
- my $item;
- my $list;
-
- $list = $fileorder->{$function};
- foreach $item (@$list) {
- if ($item eq $filename) {
- return;
- }
- }
- push(@$list, $filename);
- $fileorder->{$function} = $list;
-}
-
-#
-# read_bb_word(handle[, description])
-#
-# Read and return a word in .bb format from handle.
-#
-
-sub read_bb_word(*;$)
-{
- my ($handle, $desc) = @_;
-
- return graph_read($handle, 4, $desc);
-}
-
-#
-# read_bb_value(handle[, description])
-#
-# Read a word in .bb format from handle and return the word and its integer
-# value.
-#
-
-sub read_bb_value(*;$)
-{
- my ($handle, $desc) = @_;
- my $word;
-
- $word = read_bb_word($handle, $desc);
- return undef if (!defined($word));
-
- return ($word, unpack("V", $word));
-}
-
-#
-# read_bb_string(handle, delimiter)
-#
-# Read and return a string in .bb format from handle up to the specified
-# delimiter value.
-#
-
-sub read_bb_string(*$)
-{
- my ($handle, $delimiter) = @_;
- my $word;
- my $value;
- my $string = "";
-
- graph_expect("string");
- do {
- ($word, $value) = read_bb_value($handle, "string or delimiter");
- return undef if (!defined($value));
- if ($value != $delimiter) {
- $string .= $word;
- }
- } while ($value != $delimiter);
- $string =~ s/\0//g;
-
- return $string;
-}
-
-#
-# read_bb(filename)
-#
-# Read the contents of the specified .bb file and return (instr, graph), where:
-#
-# instr : filename -> line data
-# line data : [ line1, line2, ... ]
-#
-# graph : filename -> file_data
-# file_data : function name -> line_data
-# line_data : [ line1, line2, ... ]
-#
-# See the gcov info pages of gcc 2.95 for a description of the .bb file format.
-#
-
-sub read_bb($)
-{
- my ($bb_filename) = @_;
- my $minus_one = 0x80000001;
- my $minus_two = 0x80000002;
- my $value;
- my $filename;
- my $function;
- my $bb = {};
- my $fileorder = {};
- my $instr;
- my $graph;
- local *HANDLE;
-
- open(HANDLE, "<", $bb_filename) or goto open_error;
- binmode(HANDLE);
- while (!eof(HANDLE)) {
- $value = read_bb_value(*HANDLE, "data word");
- goto incomplete if (!defined($value));
- if ($value == $minus_one) {
- # Source file name
- graph_expect("filename");
- $filename = read_bb_string(*HANDLE, $minus_one);
- goto incomplete if (!defined($filename));
- } elsif ($value == $minus_two) {
- # Function name
- graph_expect("function name");
- $function = read_bb_string(*HANDLE, $minus_two);
- goto incomplete if (!defined($function));
- } elsif ($value > 0) {
- # Line number
- if (!defined($filename) || !defined($function)) {
- warn("WARNING: unassigned line number ".
- "$value\n");
- next;
- }
- push(@{$bb->{$function}->{$filename}}, $value);
- graph_add_order($fileorder, $function, $filename);
- }
- }
- close(HANDLE);
- ($instr, $graph) = graph_from_bb($bb, $fileorder, $bb_filename);
- graph_cleanup($graph);
-
- return ($instr, $graph);
-
-open_error:
- graph_error($bb_filename, "could not open file");
- return undef;
-incomplete:
- graph_error($bb_filename, "reached unexpected end of file");
- return undef;
-}
-
-#
-# read_bbg_word(handle[, description])
-#
-# Read and return a word in .bbg format.
-#
-
-sub read_bbg_word(*;$)
-{
- my ($handle, $desc) = @_;
-
- return graph_read($handle, 4, $desc);
-}
-
-#
-# read_bbg_value(handle[, description])
-#
-# Read a word in .bbg format from handle and return its integer value.
-#
-
-sub read_bbg_value(*;$)
-{
- my ($handle, $desc) = @_;
- my $word;
-
- $word = read_bbg_word($handle, $desc);
- return undef if (!defined($word));
-
- return unpack("N", $word);
-}
-
-#
-# read_bbg_string(handle)
-#
-# Read and return a string in .bbg format.
-#
-
-sub read_bbg_string(*)
-{
- my ($handle, $desc) = @_;
- my $length;
- my $string;
-
- graph_expect("string");
- # Read string length
- $length = read_bbg_value($handle, "string length");
- return undef if (!defined($length));
- if ($length == 0) {
- return "";
- }
- # Read string
- $string = graph_read($handle, $length, "string");
- return undef if (!defined($string));
- # Skip padding
- graph_skip($handle, 4 - $length % 4, "string padding") or return undef;
-
- return $string;
-}
-
-#
-# read_bbg_lines_record(handle, bbg_filename, bb, fileorder, filename,
-# function)
-#
-# Read a bbg format lines record from handle and add the relevant data to
-# bb and fileorder. Return filename on success, undef on error.
-#
-
-sub read_bbg_lines_record(*$$$$$)
-{
- my ($handle, $bbg_filename, $bb, $fileorder, $filename, $function) = @_;
- my $string;
- my $lineno;
-
- graph_expect("lines record");
- # Skip basic block index
- graph_skip($handle, 4, "basic block index") or return undef;
- while (1) {
- # Read line number
- $lineno = read_bbg_value($handle, "line number");
- return undef if (!defined($lineno));
- if ($lineno == 0) {
- # Got a marker for a new filename
- graph_expect("filename");
- $string = read_bbg_string($handle);
- return undef if (!defined($string));
- # Check for end of record
- if ($string eq "") {
- return $filename;
- }
- $filename = $string;
- if (!exists($bb->{$function}->{$filename})) {
- $bb->{$function}->{$filename} = [];
- }
- next;
- }
- # Got an actual line number
- if (!defined($filename)) {
- warn("WARNING: unassigned line number in ".
- "$bbg_filename\n");
- next;
- }
- push(@{$bb->{$function}->{$filename}}, $lineno);
- graph_add_order($fileorder, $function, $filename);
- }
-}
-
-#
-# read_bbg(filename)
-#
-# Read the contents of the specified .bbg file and return the following mapping:
-# graph: filename -> file_data
-# file_data: function name -> line_data
-# line_data: [ line1, line2, ... ]
-#
-# See the gcov-io.h file in the SLES 9 gcc 3.3.3 source code for a description
-# of the .bbg format.
-#
-
-sub read_bbg($)
-{
- my ($bbg_filename) = @_;
- my $file_magic = 0x67626267;
- my $tag_function = 0x01000000;
- my $tag_lines = 0x01450000;
- my $word;
- my $tag;
- my $length;
- my $function;
- my $filename;
- my $bb = {};
- my $fileorder = {};
- my $instr;
- my $graph;
- local *HANDLE;
-
- open(HANDLE, "<", $bbg_filename) or goto open_error;
- binmode(HANDLE);
- # Read magic
- $word = read_bbg_value(*HANDLE, "file magic");
- goto incomplete if (!defined($word));
- # Check magic
- if ($word != $file_magic) {
- goto magic_error;
- }
- # Skip version
- graph_skip(*HANDLE, 4, "version") or goto incomplete;
- while (!eof(HANDLE)) {
- # Read record tag
- $tag = read_bbg_value(*HANDLE, "record tag");
- goto incomplete if (!defined($tag));
- # Read record length
- $length = read_bbg_value(*HANDLE, "record length");
- goto incomplete if (!defined($tag));
- if ($tag == $tag_function) {
- graph_expect("function record");
- # Read function name
- graph_expect("function name");
- $function = read_bbg_string(*HANDLE);
- goto incomplete if (!defined($function));
- $filename = undef;
- # Skip function checksum
- graph_skip(*HANDLE, 4, "function checksum")
- or goto incomplete;
- } elsif ($tag == $tag_lines) {
- # Read lines record
- $filename = read_bbg_lines_record(HANDLE, $bbg_filename,
- $bb, $fileorder, $filename,
- $function);
- goto incomplete if (!defined($filename));
- } else {
- # Skip record contents
- graph_skip(*HANDLE, $length, "unhandled record")
- or goto incomplete;
- }
- }
- close(HANDLE);
- ($instr, $graph) = graph_from_bb($bb, $fileorder, $bbg_filename);
- graph_cleanup($graph);
-
- return ($instr, $graph);
-
-open_error:
- graph_error($bbg_filename, "could not open file");
- return undef;
-incomplete:
- graph_error($bbg_filename, "reached unexpected end of file");
- return undef;
-magic_error:
- graph_error($bbg_filename, "found unrecognized bbg file magic");
- return undef;
-}
-
-#
-# read_gcno_word(handle[, description, peek])
-#
-# Read and return a word in .gcno format.
-#
-
-sub read_gcno_word(*;$$)
-{
- my ($handle, $desc, $peek) = @_;
-
- return graph_read($handle, 4, $desc, $peek);
-}
-
-#
-# read_gcno_value(handle, big_endian[, description, peek])
-#
-# Read a word in .gcno format from handle and return its integer value
-# according to the specified endianness. If PEEK is non-zero, reset file
-# position after read.
-#
-
-sub read_gcno_value(*$;$$)
-{
- my ($handle, $big_endian, $desc, $peek) = @_;
- my $word;
- my $pos;
-
- $word = read_gcno_word($handle, $desc, $peek);
- return undef if (!defined($word));
- if ($big_endian) {
- return unpack("N", $word);
- } else {
- return unpack("V", $word);
- }
-}
-
-#
-# read_gcno_string(handle, big_endian)
-#
-# Read and return a string in .gcno format.
-#
-
-sub read_gcno_string(*$)
-{
- my ($handle, $big_endian) = @_;
- my $length;
- my $string;
-
- graph_expect("string");
- # Read string length
- $length = read_gcno_value($handle, $big_endian, "string length");
- return undef if (!defined($length));
- if ($length == 0) {
- return "";
- }
- $length *= 4;
- # Read string
- $string = graph_read($handle, $length, "string and padding");
- return undef if (!defined($string));
- $string =~ s/\0//g;
-
- return $string;
-}
-
-#
-# read_gcno_lines_record(handle, gcno_filename, bb, fileorder, filename,
-# function, big_endian)
-#
-# Read a gcno format lines record from handle and add the relevant data to
-# bb and fileorder. Return filename on success, undef on error.
-#
-
-sub read_gcno_lines_record(*$$$$$$)
-{
- my ($handle, $gcno_filename, $bb, $fileorder, $filename, $function,
- $big_endian) = @_;
- my $string;
- my $lineno;
-
- graph_expect("lines record");
- # Skip basic block index
- graph_skip($handle, 4, "basic block index") or return undef;
- while (1) {
- # Read line number
- $lineno = read_gcno_value($handle, $big_endian, "line number");
- return undef if (!defined($lineno));
- if ($lineno == 0) {
- # Got a marker for a new filename
- graph_expect("filename");
- $string = read_gcno_string($handle, $big_endian);
- return undef if (!defined($string));
- # Check for end of record
- if ($string eq "") {
- return $filename;
- }
- $filename = $string;
- if (!exists($bb->{$function}->{$filename})) {
- $bb->{$function}->{$filename} = [];
- }
- next;
- }
- # Got an actual line number
- if (!defined($filename)) {
- warn("WARNING: unassigned line number in ".
- "$gcno_filename\n");
- next;
- }
- # Add to list
- push(@{$bb->{$function}->{$filename}}, $lineno);
- graph_add_order($fileorder, $function, $filename);
- }
-}
-
-#
-# determine_gcno_split_crc(handle, big_endian, rec_length)
-#
-# Determine if HANDLE refers to a .gcno file with a split checksum function
-# record format. Return non-zero in case of split checksum format, zero
-# otherwise, undef in case of read error.
-#
-
-sub determine_gcno_split_crc($$$)
-{
- my ($handle, $big_endian, $rec_length) = @_;
- my $strlen;
- my $overlong_string;
-
- return 1 if ($gcov_version >= $GCOV_VERSION_4_7_0);
- return 1 if (is_compat($COMPAT_MODE_SPLIT_CRC));
-
- # Heuristic:
- # Decide format based on contents of next word in record:
- # - pre-gcc 4.7
- # This is the function name length / 4 which should be
- # less than the remaining record length
- # - gcc 4.7
- # This is a checksum, likely with high-order bits set,
- # resulting in a large number
- $strlen = read_gcno_value($handle, $big_endian, undef, 1);
- return undef if (!defined($strlen));
- $overlong_string = 1 if ($strlen * 4 >= $rec_length - 12);
-
- if ($overlong_string) {
- if (is_compat_auto($COMPAT_MODE_SPLIT_CRC)) {
- info("Auto-detected compatibility mode for split ".
- "checksum .gcno file format\n");
-
- return 1;
- } else {
- # Sanity check
- warn("Found overlong string in function record: ".
- "try '--compat split_crc'\n");
- }
- }
-
- return 0;
-}
-
-#
-# read_gcno_function_record(handle, graph, big_endian, rec_length)
-#
-# Read a gcno format function record from handle and add the relevant data
-# to graph. Return (filename, function) on success, undef on error.
-#
-
-sub read_gcno_function_record(*$$$$)
-{
- my ($handle, $bb, $fileorder, $big_endian, $rec_length) = @_;
- my $filename;
- my $function;
- my $lineno;
- my $lines;
-
- graph_expect("function record");
- # Skip ident and checksum
- graph_skip($handle, 8, "function ident and checksum") or return undef;
- # Determine if this is a function record with split checksums
- if (!defined($gcno_split_crc)) {
- $gcno_split_crc = determine_gcno_split_crc($handle, $big_endian,
- $rec_length);
- return undef if (!defined($gcno_split_crc));
- }
- # Skip cfg checksum word in case of split checksums
- graph_skip($handle, 4, "function cfg checksum") if ($gcno_split_crc);
- # Read function name
- graph_expect("function name");
- $function = read_gcno_string($handle, $big_endian);
- return undef if (!defined($function));
- # Read filename
- graph_expect("filename");
- $filename = read_gcno_string($handle, $big_endian);
- return undef if (!defined($filename));
- # Read first line number
- $lineno = read_gcno_value($handle, $big_endian, "initial line number");
- return undef if (!defined($lineno));
- # Add to list
- push(@{$bb->{$function}->{$filename}}, $lineno);
- graph_add_order($fileorder, $function, $filename);
-
- return ($filename, $function);
-}
-
-#
-# read_gcno(filename)
-#
-# Read the contents of the specified .gcno file and return the following
-# mapping:
-# graph: filename -> file_data
-# file_data: function name -> line_data
-# line_data: [ line1, line2, ... ]
-#
-# See the gcov-io.h file in the gcc 3.3 source code for a description of
-# the .gcno format.
-#
-
-sub read_gcno($)
-{
- my ($gcno_filename) = @_;
- my $file_magic = 0x67636e6f;
- my $tag_function = 0x01000000;
- my $tag_lines = 0x01450000;
- my $big_endian;
- my $word;
- my $tag;
- my $length;
- my $filename;
- my $function;
- my $bb = {};
- my $fileorder = {};
- my $instr;
- my $graph;
- local *HANDLE;
-
- open(HANDLE, "<", $gcno_filename) or goto open_error;
- binmode(HANDLE);
- # Read magic
- $word = read_gcno_word(*HANDLE, "file magic");
- goto incomplete if (!defined($word));
- # Determine file endianness
- if (unpack("N", $word) == $file_magic) {
- $big_endian = 1;
- } elsif (unpack("V", $word) == $file_magic) {
- $big_endian = 0;
- } else {
- goto magic_error;
- }
- # Skip version and stamp
- graph_skip(*HANDLE, 8, "version and stamp") or goto incomplete;
- while (!eof(HANDLE)) {
- my $next_pos;
- my $curr_pos;
-
- # Read record tag
- $tag = read_gcno_value(*HANDLE, $big_endian, "record tag");
- goto incomplete if (!defined($tag));
- # Read record length
- $length = read_gcno_value(*HANDLE, $big_endian,
- "record length");
- goto incomplete if (!defined($length));
- # Convert length to bytes
- $length *= 4;
- # Calculate start of next record
- $next_pos = tell(HANDLE);
- goto tell_error if ($next_pos == -1);
- $next_pos += $length;
- # Process record
- if ($tag == $tag_function) {
- ($filename, $function) = read_gcno_function_record(
- *HANDLE, $bb, $fileorder, $big_endian,
- $length);
- goto incomplete if (!defined($function));
- } elsif ($tag == $tag_lines) {
- # Read lines record
- $filename = read_gcno_lines_record(*HANDLE,
- $gcno_filename, $bb, $fileorder,
- $filename, $function,
- $big_endian);
- goto incomplete if (!defined($filename));
- } else {
- # Skip record contents
- graph_skip(*HANDLE, $length, "unhandled record")
- or goto incomplete;
- }
- # Ensure that we are at the start of the next record
- $curr_pos = tell(HANDLE);
- goto tell_error if ($curr_pos == -1);
- next if ($curr_pos == $next_pos);
- goto record_error if ($curr_pos > $next_pos);
- graph_skip(*HANDLE, $next_pos - $curr_pos,
- "unhandled record content")
- or goto incomplete;
- }
- close(HANDLE);
- ($instr, $graph) = graph_from_bb($bb, $fileorder, $gcno_filename);
- graph_cleanup($graph);
-
- return ($instr, $graph);
-
-open_error:
- graph_error($gcno_filename, "could not open file");
- return undef;
-incomplete:
- graph_error($gcno_filename, "reached unexpected end of file");
- return undef;
-magic_error:
- graph_error($gcno_filename, "found unrecognized gcno file magic");
- return undef;
-tell_error:
- graph_error($gcno_filename, "could not determine file position");
- return undef;
-record_error:
- graph_error($gcno_filename, "found unrecognized record format");
- return undef;
-}
-
-sub debug($)
-{
- my ($msg) = @_;
-
- return if (!$debug);
- print(STDERR "DEBUG: $msg");
-}
-
-#
-# get_gcov_capabilities
-#
-# Determine the list of available gcov options.
-#
-
-sub get_gcov_capabilities()
-{
- my $help = `$gcov_tool --help`;
- my %capabilities;
-
- foreach (split(/\n/, $help)) {
- next if (!/--(\S+)/);
- next if ($1 eq 'help');
- next if ($1 eq 'version');
- next if ($1 eq 'object-directory');
-
- $capabilities{$1} = 1;
- debug("gcov has capability '$1'\n");
- }
-
- return \%capabilities;
-}
-
-#
-# parse_ignore_errors(@ignore_errors)
-#
-# Parse user input about which errors to ignore.
-#
-
-sub parse_ignore_errors(@)
-{
- my (@ignore_errors) = @_;
- my @items;
- my $item;
-
- return if (!@ignore_errors);
-
- foreach $item (@ignore_errors) {
- $item =~ s/\s//g;
- if ($item =~ /,/) {
- # Split and add comma-separated parameters
- push(@items, split(/,/, $item));
- } else {
- # Add single parameter
- push(@items, $item);
- }
- }
- foreach $item (@items) {
- my $item_id = $ERROR_ID{lc($item)};
-
- if (!defined($item_id)) {
- die("ERROR: unknown argument for --ignore-errors: ".
- "$item\n");
- }
- $ignore[$item_id] = 1;
- }
-}
-
-#
-# is_external(filename)
-#
-# Determine if a file is located outside of the specified data directories.
-#
-
-sub is_external($)
-{
- my ($filename) = @_;
- my $dir;
-
- foreach $dir (@internal_dirs) {
- return 0 if ($filename =~ /^\Q$dir\/\E/);
- }
- return 1;
-}
-
-#
-# compat_name(mode)
-#
-# Return the name of compatibility mode MODE.
-#
-
-sub compat_name($)
-{
- my ($mode) = @_;
- my $name = $COMPAT_MODE_TO_NAME{$mode};
-
- return $name if (defined($name));
-
- return "<unknown>";
-}
-
-#
-# parse_compat_modes(opt)
-#
-# Determine compatibility mode settings.
-#
-
-sub parse_compat_modes($)
-{
- my ($opt) = @_;
- my @opt_list;
- my %specified;
-
- # Initialize with defaults
- %compat_value = %COMPAT_MODE_DEFAULTS;
-
- # Add old style specifications
- if (defined($opt_compat_libtool)) {
- $compat_value{$COMPAT_MODE_LIBTOOL} =
- $opt_compat_libtool ? $COMPAT_VALUE_ON
- : $COMPAT_VALUE_OFF;
- }
-
- # Parse settings
- if (defined($opt)) {
- @opt_list = split(/\s*,\s*/, $opt);
- }
- foreach my $directive (@opt_list) {
- my ($mode, $value);
-
- # Either
- # mode=off|on|auto or
- # mode (implies on)
- if ($directive !~ /^(\w+)=(\w+)$/ &&
- $directive !~ /^(\w+)$/) {
- die("ERROR: Unknown compatibility mode specification: ".
- "$directive!\n");
- }
- # Determine mode
- $mode = $COMPAT_NAME_TO_MODE{lc($1)};
- if (!defined($mode)) {
- die("ERROR: Unknown compatibility mode '$1'!\n");
- }
- $specified{$mode} = 1;
- # Determine value
- if (defined($2)) {
- $value = $COMPAT_NAME_TO_VALUE{lc($2)};
- if (!defined($value)) {
- die("ERROR: Unknown compatibility mode ".
- "value '$2'!\n");
- }
- } else {
- $value = $COMPAT_VALUE_ON;
- }
- $compat_value{$mode} = $value;
- }
- # Perform auto-detection
- foreach my $mode (sort(keys(%compat_value))) {
- my $value = $compat_value{$mode};
- my $is_autodetect = "";
- my $name = compat_name($mode);
-
- if ($value == $COMPAT_VALUE_AUTO) {
- my $autodetect = $COMPAT_MODE_AUTO{$mode};
-
- if (!defined($autodetect)) {
- die("ERROR: No auto-detection for ".
- "mode '$name' available!\n");
- }
-
- if (ref($autodetect) eq "CODE") {
- $value = &$autodetect();
- $compat_value{$mode} = $value;
- $is_autodetect = " (auto-detected)";
- }
- }
-
- if ($specified{$mode}) {
- if ($value == $COMPAT_VALUE_ON) {
- info("Enabling compatibility mode ".
- "'$name'$is_autodetect\n");
- } elsif ($value == $COMPAT_VALUE_OFF) {
- info("Disabling compatibility mode ".
- "'$name'$is_autodetect\n");
- } else {
- info("Using delayed auto-detection for ".
- "compatibility mode ".
- "'$name'\n");
- }
- }
- }
-}
-
-sub compat_hammer_autodetect()
-{
- if ($gcov_version_string =~ /suse/i && $gcov_version == 0x30303 ||
- $gcov_version_string =~ /mandrake/i && $gcov_version == 0x30302)
- {
- info("Auto-detected compatibility mode for GCC 3.3 (hammer)\n");
- return $COMPAT_VALUE_ON;
- }
- return $COMPAT_VALUE_OFF;
-}
-
-#
-# is_compat(mode)
-#
-# Return non-zero if compatibility mode MODE is enabled.
-#
-
-sub is_compat($)
-{
- my ($mode) = @_;
-
- return 1 if ($compat_value{$mode} == $COMPAT_VALUE_ON);
- return 0;
-}
-
-#
-# is_compat_auto(mode)
-#
-# Return non-zero if compatibility mode MODE is set to auto-detect.
-#
-
-sub is_compat_auto($)
-{
- my ($mode) = @_;
-
- return 1 if ($compat_value{$mode} == $COMPAT_VALUE_AUTO);
- return 0;
-}
diff --git a/chromium/third_party/lcov/bin/genpng b/chromium/third_party/lcov/bin/genpng
deleted file mode 100755
index 5f3084c9839..00000000000
--- a/chromium/third_party/lcov/bin/genpng
+++ /dev/null
@@ -1,389 +0,0 @@
-#!/usr/bin/perl -w
-#
-# Copyright (c) International Business Machines Corp., 2002
-#
-# 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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-#
-# genpng
-#
-# This script creates an overview PNG image of a source code file by
-# representing each source code character by a single pixel.
-#
-# Note that the Perl module GD.pm is required for this script to work.
-# It may be obtained from http://www.cpan.org
-#
-# History:
-# 2002-08-26: created by Peter Oberparleiter <Peter.Oberparleiter@de.ibm.com>
-#
-
-use strict;
-use File::Basename;
-use Getopt::Long;
-
-
-# Constants
-our $lcov_version = 'LCOV version 1.10';
-our $lcov_url = "http://ltp.sourceforge.net/coverage/lcov.php";
-our $tool_name = basename($0);
-
-
-# Prototypes
-sub gen_png($$$@);
-sub check_and_load_module($);
-sub genpng_print_usage(*);
-sub genpng_process_file($$$$);
-sub genpng_warn_handler($);
-sub genpng_die_handler($);
-
-
-#
-# Code entry point
-#
-
-# Prettify version string
-$lcov_version =~ s/\$\s*Revision\s*:?\s*(\S+)\s*\$/$1/;
-
-# Check whether required module GD.pm is installed
-if (check_and_load_module("GD"))
-{
- # Note: cannot use die() to print this message because inserting this
- # code into another script via do() would not fail as required!
- print(STDERR <<END_OF_TEXT)
-ERROR: required module GD.pm not found on this system (see www.cpan.org).
-END_OF_TEXT
- ;
- exit(2);
-}
-
-# Check whether we're called from the command line or from another script
-if (!caller)
-{
- my $filename;
- my $tab_size = 4;
- my $width = 80;
- my $out_filename;
- my $help;
- my $version;
-
- $SIG{__WARN__} = \&genpng_warn_handler;
- $SIG{__DIE__} = \&genpng_die_handler;
-
- # Parse command line options
- if (!GetOptions("tab-size=i" => \$tab_size,
- "width=i" => \$width,
- "output-filename=s" => \$out_filename,
- "help" => \$help,
- "version" => \$version))
- {
- print(STDERR "Use $tool_name --help to get usage ".
- "information\n");
- exit(1);
- }
-
- $filename = $ARGV[0];
-
- # Check for help flag
- if ($help)
- {
- genpng_print_usage(*STDOUT);
- exit(0);
- }
-
- # Check for version flag
- if ($version)
- {
- print("$tool_name: $lcov_version\n");
- exit(0);
- }
-
- # Check options
- if (!$filename)
- {
- die("No filename specified\n");
- }
-
- # Check for output filename
- if (!$out_filename)
- {
- $out_filename = "$filename.png";
- }
-
- genpng_process_file($filename, $out_filename, $width, $tab_size);
- exit(0);
-}
-
-
-#
-# genpng_print_usage(handle)
-#
-# Write out command line usage information to given filehandle.
-#
-
-sub genpng_print_usage(*)
-{
- local *HANDLE = $_[0];
-
- print(HANDLE <<END_OF_USAGE)
-Usage: $tool_name [OPTIONS] SOURCEFILE
-
-Create an overview image for a given source code file of either plain text
-or .gcov file format.
-
- -h, --help Print this help, then exit
- -v, --version Print version number, then exit
- -t, --tab-size TABSIZE Use TABSIZE spaces in place of tab
- -w, --width WIDTH Set width of output image to WIDTH pixel
- -o, --output-filename FILENAME Write image to FILENAME
-
-For more information see: $lcov_url
-END_OF_USAGE
- ;
-}
-
-
-#
-# check_and_load_module(module_name)
-#
-# Check whether a module by the given name is installed on this system
-# and make it known to the interpreter if available. Return undefined if it
-# is installed, an error message otherwise.
-#
-
-sub check_and_load_module($)
-{
- eval("use $_[0];");
- return $@;
-}
-
-
-#
-# genpng_process_file(filename, out_filename, width, tab_size)
-#
-
-sub genpng_process_file($$$$)
-{
- my $filename = $_[0];
- my $out_filename = $_[1];
- my $width = $_[2];
- my $tab_size = $_[3];
- local *HANDLE;
- my @source;
-
- open(HANDLE, "<", $filename)
- or die("ERROR: cannot open $filename!\n");
-
- # Check for .gcov filename extension
- if ($filename =~ /^(.*).gcov$/)
- {
- # Assume gcov text format
- while (<HANDLE>)
- {
- if (/^\t\t(.*)$/)
- {
- # Uninstrumented line
- push(@source, ":$1");
- }
- elsif (/^ ###### (.*)$/)
- {
- # Line with zero execution count
- push(@source, "0:$1");
- }
- elsif (/^( *)(\d*) (.*)$/)
- {
- # Line with positive execution count
- push(@source, "$2:$3");
- }
- }
- }
- else
- {
- # Plain text file
- while (<HANDLE>) { push(@source, ":$_"); }
- }
- close(HANDLE);
-
- gen_png($out_filename, $width, $tab_size, @source);
-}
-
-
-#
-# gen_png(filename, width, tab_size, source)
-#
-# Write an overview PNG file to FILENAME. Source code is defined by SOURCE
-# which is a list of lines <count>:<source code> per source code line.
-# The output image will be made up of one pixel per character of source,
-# coloring will be done according to execution counts. WIDTH defines the
-# image width. TAB_SIZE specifies the number of spaces to use as replacement
-# string for tabulator signs in source code text.
-#
-# Die on error.
-#
-
-sub gen_png($$$@)
-{
- my $filename = shift(@_); # Filename for PNG file
- my $overview_width = shift(@_); # Imagewidth for image
- my $tab_size = shift(@_); # Replacement string for tab signs
- my @source = @_; # Source code as passed via argument 2
- my $height; # Height as define by source size
- my $overview; # Source code overview image data
- my $col_plain_back; # Color for overview background
- my $col_plain_text; # Color for uninstrumented text
- my $col_cov_back; # Color for background of covered lines
- my $col_cov_text; # Color for text of covered lines
- my $col_nocov_back; # Color for background of lines which
- # were not covered (count == 0)
- my $col_nocov_text; # Color for test of lines which were not
- # covered (count == 0)
- my $col_hi_back; # Color for background of highlighted lines
- my $col_hi_text; # Color for text of highlighted lines
- my $line; # Current line during iteration
- my $row = 0; # Current row number during iteration
- my $column; # Current column number during iteration
- my $color_text; # Current text color during iteration
- my $color_back; # Current background color during iteration
- my $last_count; # Count of last processed line
- my $count; # Count of current line
- my $source; # Source code of current line
- my $replacement; # Replacement string for tabulator chars
- local *PNG_HANDLE; # Handle for output PNG file
-
- # Handle empty source files
- if (!@source) {
- @source = ( "" );
- }
- $height = scalar(@source);
- # Create image
- $overview = new GD::Image($overview_width, $height)
- or die("ERROR: cannot allocate overview image!\n");
-
- # Define colors
- $col_plain_back = $overview->colorAllocate(0xff, 0xff, 0xff);
- $col_plain_text = $overview->colorAllocate(0xaa, 0xaa, 0xaa);
- $col_cov_back = $overview->colorAllocate(0xaa, 0xa7, 0xef);
- $col_cov_text = $overview->colorAllocate(0x5d, 0x5d, 0xea);
- $col_nocov_back = $overview->colorAllocate(0xff, 0x00, 0x00);
- $col_nocov_text = $overview->colorAllocate(0xaa, 0x00, 0x00);
- $col_hi_back = $overview->colorAllocate(0x00, 0xff, 0x00);
- $col_hi_text = $overview->colorAllocate(0x00, 0xaa, 0x00);
-
- # Visualize each line
- foreach $line (@source)
- {
- # Replace tabs with spaces to keep consistent with source
- # code view
- while ($line =~ /^([^\t]*)(\t)/)
- {
- $replacement = " "x($tab_size - ((length($1) - 1) %
- $tab_size));
- $line =~ s/^([^\t]*)(\t)/$1$replacement/;
- }
-
- # Skip lines which do not follow the <count>:<line>
- # specification, otherwise $1 = count, $2 = source code
- if (!($line =~ /(\*?)(\d*):(.*)$/)) { next; }
- $count = $2;
- $source = $3;
-
- # Decide which color pair to use
-
- # If this line was not instrumented but the one before was,
- # take the color of that line to widen color areas in
- # resulting image
- if (($count eq "") && defined($last_count) &&
- ($last_count ne ""))
- {
- $count = $last_count;
- }
-
- if ($count eq "")
- {
- # Line was not instrumented
- $color_text = $col_plain_text;
- $color_back = $col_plain_back;
- }
- elsif ($count == 0)
- {
- # Line was instrumented but not executed
- $color_text = $col_nocov_text;
- $color_back = $col_nocov_back;
- }
- elsif ($1 eq "*")
- {
- # Line was highlighted
- $color_text = $col_hi_text;
- $color_back = $col_hi_back;
- }
- else
- {
- # Line was instrumented and executed
- $color_text = $col_cov_text;
- $color_back = $col_cov_back;
- }
-
- # Write one pixel for each source character
- $column = 0;
- foreach (split("", $source))
- {
- # Check for width
- if ($column >= $overview_width) { last; }
-
- if ($_ eq " ")
- {
- # Space
- $overview->setPixel($column++, $row,
- $color_back);
- }
- else
- {
- # Text
- $overview->setPixel($column++, $row,
- $color_text);
- }
- }
-
- # Fill rest of line
- while ($column < $overview_width)
- {
- $overview->setPixel($column++, $row, $color_back);
- }
-
- $last_count = $2;
-
- $row++;
- }
-
- # Write PNG file
- open (PNG_HANDLE, ">", $filename)
- or die("ERROR: cannot write png file $filename!\n");
- binmode(*PNG_HANDLE);
- print(PNG_HANDLE $overview->png());
- close(PNG_HANDLE);
-}
-
-sub genpng_warn_handler($)
-{
- my ($msg) = @_;
-
- warn("$tool_name: $msg");
-}
-
-sub genpng_die_handler($)
-{
- my ($msg) = @_;
-
- die("$tool_name: $msg");
-}
diff --git a/chromium/third_party/lcov/bin/install.sh b/chromium/third_party/lcov/bin/install.sh
deleted file mode 100755
index 27140f91dd1..00000000000
--- a/chromium/third_party/lcov/bin/install.sh
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/bin/bash
-#
-# install.sh [--uninstall] sourcefile targetfile [install options]
-#
-
-
-# Check for uninstall option
-if test "x$1" == "x--uninstall" ; then
- UNINSTALL=true
- SOURCE=$2
- TARGET=$3
- shift 3
-else
- UNINSTALL=false
- SOURCE=$1
- TARGET=$2
- shift 2
-fi
-
-# Check usage
-if test -z "$SOURCE" || test -z "$TARGET" ; then
- echo Usage: install.sh [--uninstall] source target [install options] >&2
- exit 1
-fi
-
-
-#
-# do_install(SOURCE_FILE, TARGET_FILE)
-#
-
-do_install()
-{
- local SOURCE=$1
- local TARGET=$2
- local PARAMS=$3
-
- install -p -D $PARAMS $SOURCE $TARGET
-}
-
-
-#
-# do_uninstall(SOURCE_FILE, TARGET_FILE)
-#
-
-do_uninstall()
-{
- local SOURCE=$1
- local TARGET=$2
-
- # Does target exist?
- if test -r $TARGET ; then
- # Is target of the same version as this package?
- if diff $SOURCE $TARGET >/dev/null; then
- rm -f $TARGET
- else
- echo WARNING: Skipping uninstall for $TARGET - versions differ! >&2
- fi
- else
- echo WARNING: Skipping uninstall for $TARGET - not installed! >&2
- fi
-}
-
-
-# Call sub routine
-if $UNINSTALL ; then
- do_uninstall $SOURCE $TARGET
-else
- do_install $SOURCE $TARGET "$*"
-fi
-
-exit 0
diff --git a/chromium/third_party/lcov/bin/lcov b/chromium/third_party/lcov/bin/lcov
deleted file mode 100755
index 1a7f525fb2e..00000000000
--- a/chromium/third_party/lcov/bin/lcov
+++ /dev/null
@@ -1,4303 +0,0 @@
-#!/usr/bin/perl -w
-#
-# Copyright (c) International Business Machines Corp., 2002,2012
-#
-# 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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-#
-# lcov
-#
-# This is a wrapper script which provides a single interface for accessing
-# LCOV coverage data.
-#
-#
-# History:
-# 2002-08-29 created by Peter Oberparleiter <Peter.Oberparleiter@de.ibm.com>
-# IBM Lab Boeblingen
-# 2002-09-05 / Peter Oberparleiter: implemented --kernel-directory +
-# multiple directories
-# 2002-10-16 / Peter Oberparleiter: implemented --add-tracefile option
-# 2002-10-17 / Peter Oberparleiter: implemented --extract option
-# 2002-11-04 / Peter Oberparleiter: implemented --list option
-# 2003-03-07 / Paul Larson: Changed to make it work with the latest gcov
-# kernel patch. This will break it with older gcov-kernel
-# patches unless you change the value of $gcovmod in this script
-# 2003-04-07 / Peter Oberparleiter: fixed bug which resulted in an error
-# when trying to combine .info files containing data without
-# a test name
-# 2003-04-10 / Peter Oberparleiter: extended Paul's change so that LCOV
-# works both with the new and the old gcov-kernel patch
-# 2003-04-10 / Peter Oberparleiter: added $gcov_dir constant in anticipation
-# of a possible move of the gcov kernel directory to another
-# file system in a future version of the gcov-kernel patch
-# 2003-04-15 / Paul Larson: make info write to STDERR, not STDOUT
-# 2003-04-15 / Paul Larson: added --remove option
-# 2003-04-30 / Peter Oberparleiter: renamed --reset to --zerocounters
-# to remove naming ambiguity with --remove
-# 2003-04-30 / Peter Oberparleiter: adjusted help text to include --remove
-# 2003-06-27 / Peter Oberparleiter: implemented --diff
-# 2003-07-03 / Peter Oberparleiter: added line checksum support, added
-# --no-checksum
-# 2003-12-11 / Laurent Deniel: added --follow option
-# 2004-03-29 / Peter Oberparleiter: modified --diff option to better cope with
-# ambiguous patch file entries, modified --capture option to use
-# modprobe before insmod (needed for 2.6)
-# 2004-03-30 / Peter Oberparleiter: added --path option
-# 2004-08-09 / Peter Oberparleiter: added configuration file support
-# 2008-08-13 / Peter Oberparleiter: added function coverage support
-#
-
-use strict;
-use File::Basename;
-use File::Path;
-use File::Find;
-use File::Temp qw /tempdir/;
-use File::Spec::Functions qw /abs2rel canonpath catdir catfile catpath
- file_name_is_absolute rootdir splitdir splitpath/;
-use Getopt::Long;
-use Cwd qw /abs_path getcwd/;
-
-
-# Global constants
-our $lcov_version = 'LCOV version 1.10';
-our $lcov_url = "http://ltp.sourceforge.net/coverage/lcov.php";
-our $tool_name = basename($0);
-
-# Directory containing gcov kernel files
-our $gcov_dir;
-
-# Where to create temporary directories
-our $tmp_dir;
-
-# Internal constants
-our $GKV_PROC = 0; # gcov-kernel data in /proc via external patch
-our $GKV_SYS = 1; # gcov-kernel data in /sys via vanilla 2.6.31+
-our @GKV_NAME = ( "external", "upstream" );
-our $pkg_gkv_file = ".gcov_kernel_version";
-our $pkg_build_file = ".build_directory";
-
-our $BR_BLOCK = 0;
-our $BR_BRANCH = 1;
-our $BR_TAKEN = 2;
-our $BR_VEC_ENTRIES = 3;
-our $BR_VEC_WIDTH = 32;
-
-# Branch data combination types
-our $BR_SUB = 0;
-our $BR_ADD = 1;
-
-# Prototypes
-sub print_usage(*);
-sub check_options();
-sub userspace_reset();
-sub userspace_capture();
-sub kernel_reset();
-sub kernel_capture();
-sub kernel_capture_initial();
-sub package_capture();
-sub add_traces();
-sub read_info_file($);
-sub get_info_entry($);
-sub set_info_entry($$$$$$$$$;$$$$$$);
-sub add_counts($$);
-sub merge_checksums($$$);
-sub combine_info_entries($$$);
-sub combine_info_files($$);
-sub write_info_file(*$);
-sub extract();
-sub remove();
-sub list();
-sub get_common_filename($$);
-sub read_diff($);
-sub diff();
-sub system_no_output($@);
-sub read_config($);
-sub apply_config($);
-sub info(@);
-sub create_temp_dir();
-sub transform_pattern($);
-sub warn_handler($);
-sub die_handler($);
-sub abort_handler($);
-sub temp_cleanup();
-sub setup_gkv();
-sub get_overall_line($$$$);
-sub print_overall_rate($$$$$$$$$);
-sub lcov_geninfo(@);
-sub create_package($$$;$);
-sub get_func_found_and_hit($);
-sub br_ivec_get($$);
-sub summary();
-sub rate($$;$$$);
-
-# Global variables & initialization
-our @directory; # Specifies where to get coverage data from
-our @kernel_directory; # If set, captures only from specified kernel subdirs
-our @add_tracefile; # If set, reads in and combines all files in list
-our $list; # If set, list contents of tracefile
-our $extract; # If set, extracts parts of tracefile
-our $remove; # If set, removes parts of tracefile
-our $diff; # If set, modifies tracefile according to diff
-our $reset; # If set, reset all coverage data to zero
-our $capture; # If set, capture data
-our $output_filename; # Name for file to write coverage data to
-our $test_name = ""; # Test case name
-our $quiet = ""; # If set, suppress information messages
-our $help; # Help option flag
-our $version; # Version option flag
-our $convert_filenames; # If set, convert filenames when applying diff
-our $strip; # If set, strip leading directories when applying diff
-our $temp_dir_name; # Name of temporary directory
-our $cwd = `pwd`; # Current working directory
-our $to_file; # If set, indicates that output is written to a file
-our $follow; # If set, indicates that find shall follow links
-our $diff_path = ""; # Path removed from tracefile when applying diff
-our $base_directory; # Base directory (cwd of gcc during compilation)
-our $checksum; # If set, calculate a checksum for each line
-our $no_checksum; # If set, don't calculate a checksum for each line
-our $compat_libtool; # If set, indicates that libtool mode is to be enabled
-our $no_compat_libtool; # If set, indicates that libtool mode is to be disabled
-our $gcov_tool;
-our @opt_ignore_errors;
-our $initial;
-our $no_recursion = 0;
-our $to_package;
-our $from_package;
-our $maxdepth;
-our $no_markers;
-our $config; # Configuration file contents
-chomp($cwd);
-our $tool_dir = dirname($0); # Directory where genhtml tool is installed
-our @temp_dirs;
-our $gcov_gkv; # gcov kernel support version found on machine
-our $opt_derive_func_data;
-our $opt_debug;
-our $opt_list_full_path;
-our $opt_no_list_full_path;
-our $opt_list_width = 80;
-our $opt_list_truncate_max = 20;
-our $opt_external;
-our $opt_no_external;
-our $opt_config_file;
-our %opt_rc;
-our @opt_summary;
-our $opt_compat;
-our $ln_overall_found;
-our $ln_overall_hit;
-our $fn_overall_found;
-our $fn_overall_hit;
-our $br_overall_found;
-our $br_overall_hit;
-our $func_coverage = 1;
-our $br_coverage = 0;
-
-
-#
-# Code entry point
-#
-
-$SIG{__WARN__} = \&warn_handler;
-$SIG{__DIE__} = \&die_handler;
-$SIG{'INT'} = \&abort_handler;
-$SIG{'QUIT'} = \&abort_handler;
-
-# Prettify version string
-$lcov_version =~ s/\$\s*Revision\s*:?\s*(\S+)\s*\$/$1/;
-
-# Add current working directory if $tool_dir is not already an absolute path
-if (! ($tool_dir =~ /^\/(.*)$/))
-{
- $tool_dir = "$cwd/$tool_dir";
-}
-
-# Check command line for a configuration file name
-Getopt::Long::Configure("pass_through", "no_auto_abbrev");
-GetOptions("config-file=s" => \$opt_config_file,
- "rc=s%" => \%opt_rc);
-Getopt::Long::Configure("default");
-
-# Read configuration file if available
-if (defined($opt_config_file)) {
- $config = read_config($opt_config_file);
-} elsif (defined($ENV{"HOME"}) && (-r $ENV{"HOME"}."/.lcovrc"))
-{
- $config = read_config($ENV{"HOME"}."/.lcovrc");
-}
-elsif (-r "/etc/lcovrc")
-{
- $config = read_config("/etc/lcovrc");
-}
-
-if ($config || %opt_rc)
-{
- # Copy configuration file and --rc values to variables
- apply_config({
- "lcov_gcov_dir" => \$gcov_dir,
- "lcov_tmp_dir" => \$tmp_dir,
- "lcov_list_full_path" => \$opt_list_full_path,
- "lcov_list_width" => \$opt_list_width,
- "lcov_list_truncate_max"=> \$opt_list_truncate_max,
- "lcov_branch_coverage" => \$br_coverage,
- "lcov_function_coverage"=> \$func_coverage,
- });
-}
-
-# Parse command line options
-if (!GetOptions("directory|d|di=s" => \@directory,
- "add-tracefile|a=s" => \@add_tracefile,
- "list|l=s" => \$list,
- "kernel-directory|k=s" => \@kernel_directory,
- "extract|e=s" => \$extract,
- "remove|r=s" => \$remove,
- "diff=s" => \$diff,
- "convert-filenames" => \$convert_filenames,
- "strip=i" => \$strip,
- "capture|c" => \$capture,
- "output-file|o=s" => \$output_filename,
- "test-name|t=s" => \$test_name,
- "zerocounters|z" => \$reset,
- "quiet|q" => \$quiet,
- "help|h|?" => \$help,
- "version|v" => \$version,
- "follow|f" => \$follow,
- "path=s" => \$diff_path,
- "base-directory|b=s" => \$base_directory,
- "checksum" => \$checksum,
- "no-checksum" => \$no_checksum,
- "compat-libtool" => \$compat_libtool,
- "no-compat-libtool" => \$no_compat_libtool,
- "gcov-tool=s" => \$gcov_tool,
- "ignore-errors=s" => \@opt_ignore_errors,
- "initial|i" => \$initial,
- "no-recursion" => \$no_recursion,
- "to-package=s" => \$to_package,
- "from-package=s" => \$from_package,
- "no-markers" => \$no_markers,
- "derive-func-data" => \$opt_derive_func_data,
- "debug" => \$opt_debug,
- "list-full-path" => \$opt_list_full_path,
- "no-list-full-path" => \$opt_no_list_full_path,
- "external" => \$opt_external,
- "no-external" => \$opt_no_external,
- "summary=s" => \@opt_summary,
- "compat=s" => \$opt_compat,
- "config-file=s" => \$opt_config_file,
- "rc=s%" => \%opt_rc,
- ))
-{
- print(STDERR "Use $tool_name --help to get usage information\n");
- exit(1);
-}
-else
-{
- # Merge options
- if (defined($no_checksum))
- {
- $checksum = ($no_checksum ? 0 : 1);
- $no_checksum = undef;
- }
-
- if (defined($no_compat_libtool))
- {
- $compat_libtool = ($no_compat_libtool ? 0 : 1);
- $no_compat_libtool = undef;
- }
-
- if (defined($opt_no_list_full_path))
- {
- $opt_list_full_path = ($opt_no_list_full_path ? 0 : 1);
- $opt_no_list_full_path = undef;
- }
-
- if (defined($opt_no_external)) {
- $opt_external = 0;
- $opt_no_external = undef;
- }
-}
-
-# Check for help option
-if ($help)
-{
- print_usage(*STDOUT);
- exit(0);
-}
-
-# Check for version option
-if ($version)
-{
- print("$tool_name: $lcov_version\n");
- exit(0);
-}
-
-# Check list width option
-if ($opt_list_width <= 40) {
- die("ERROR: lcov_list_width parameter out of range (needs to be ".
- "larger than 40)\n");
-}
-
-# Normalize --path text
-$diff_path =~ s/\/$//;
-
-if ($follow)
-{
- $follow = "-follow";
-}
-else
-{
- $follow = "";
-}
-
-if ($no_recursion)
-{
- $maxdepth = "-maxdepth 1";
-}
-else
-{
- $maxdepth = "";
-}
-
-# Check for valid options
-check_options();
-
-# Only --extract, --remove and --diff allow unnamed parameters
-if (@ARGV && !($extract || $remove || $diff || @opt_summary))
-{
- die("Extra parameter found: '".join(" ", @ARGV)."'\n".
- "Use $tool_name --help to get usage information\n");
-}
-
-# Check for output filename
-$to_file = ($output_filename && ($output_filename ne "-"));
-
-if ($capture)
-{
- if (!$to_file)
- {
- # Option that tells geninfo to write to stdout
- $output_filename = "-";
- }
-}
-
-# Determine kernel directory for gcov data
-if (!$from_package && !@directory && ($capture || $reset)) {
- ($gcov_gkv, $gcov_dir) = setup_gkv();
-}
-
-# Check for requested functionality
-if ($reset)
-{
- # Differentiate between user space and kernel reset
- if (@directory)
- {
- userspace_reset();
- }
- else
- {
- kernel_reset();
- }
-}
-elsif ($capture)
-{
- # Capture source can be user space, kernel or package
- if ($from_package) {
- package_capture();
- } elsif (@directory) {
- userspace_capture();
- } else {
- if ($initial) {
- if (defined($to_package)) {
- die("ERROR: --initial cannot be used together ".
- "with --to-package\n");
- }
- kernel_capture_initial();
- } else {
- kernel_capture();
- }
- }
-}
-elsif (@add_tracefile)
-{
- ($ln_overall_found, $ln_overall_hit,
- $fn_overall_found, $fn_overall_hit,
- $br_overall_found, $br_overall_hit) = add_traces();
-}
-elsif ($remove)
-{
- ($ln_overall_found, $ln_overall_hit,
- $fn_overall_found, $fn_overall_hit,
- $br_overall_found, $br_overall_hit) = remove();
-}
-elsif ($extract)
-{
- ($ln_overall_found, $ln_overall_hit,
- $fn_overall_found, $fn_overall_hit,
- $br_overall_found, $br_overall_hit) = extract();
-}
-elsif ($list)
-{
- list();
-}
-elsif ($diff)
-{
- if (scalar(@ARGV) != 1)
- {
- die("ERROR: option --diff requires one additional argument!\n".
- "Use $tool_name --help to get usage information\n");
- }
- ($ln_overall_found, $ln_overall_hit,
- $fn_overall_found, $fn_overall_hit,
- $br_overall_found, $br_overall_hit) = diff();
-}
-elsif (@opt_summary)
-{
- ($ln_overall_found, $ln_overall_hit,
- $fn_overall_found, $fn_overall_hit,
- $br_overall_found, $br_overall_hit) = summary();
-}
-
-temp_cleanup();
-
-if (defined($ln_overall_found)) {
- print_overall_rate(1, $ln_overall_found, $ln_overall_hit,
- 1, $fn_overall_found, $fn_overall_hit,
- 1, $br_overall_found, $br_overall_hit);
-} else {
- info("Done.\n") if (!$list && !$capture);
-}
-exit(0);
-
-#
-# print_usage(handle)
-#
-# Print usage information.
-#
-
-sub print_usage(*)
-{
- local *HANDLE = $_[0];
-
- print(HANDLE <<END_OF_USAGE);
-Usage: $tool_name [OPTIONS]
-
-Use lcov to collect coverage data from either the currently running Linux
-kernel or from a user space application. Specify the --directory option to
-get coverage data for a user space program.
-
-Misc:
- -h, --help Print this help, then exit
- -v, --version Print version number, then exit
- -q, --quiet Do not print progress messages
-
-Operation:
- -z, --zerocounters Reset all execution counts to zero
- -c, --capture Capture coverage data
- -a, --add-tracefile FILE Add contents of tracefiles
- -e, --extract FILE PATTERN Extract files matching PATTERN from FILE
- -r, --remove FILE PATTERN Remove files matching PATTERN from FILE
- -l, --list FILE List contents of tracefile FILE
- --diff FILE DIFF Transform tracefile FILE according to DIFF
- --summary FILE Show summary coverage data for tracefiles
-
-Options:
- -i, --initial Capture initial zero coverage data
- -t, --test-name NAME Specify test name to be stored with data
- -o, --output-file FILENAME Write data to FILENAME instead of stdout
- -d, --directory DIR Use .da files in DIR instead of kernel
- -f, --follow Follow links when searching .da files
- -k, --kernel-directory KDIR Capture kernel coverage data only from KDIR
- -b, --base-directory DIR Use DIR as base directory for relative paths
- --convert-filenames Convert filenames when applying diff
- --strip DEPTH Strip initial DEPTH directory levels in diff
- --path PATH Strip PATH from tracefile when applying diff
- --(no-)checksum Enable (disable) line checksumming
- --(no-)compat-libtool Enable (disable) libtool compatibility mode
- --gcov-tool TOOL Specify gcov tool location
- --ignore-errors ERRORS Continue after ERRORS (gcov, source, graph)
- --no-recursion Exclude subdirectories from processing
- --to-package FILENAME Store unprocessed coverage data in FILENAME
- --from-package FILENAME Capture from unprocessed data in FILENAME
- --no-markers Ignore exclusion markers in source code
- --derive-func-data Generate function data from line data
- --list-full-path Print full path during a list operation
- --(no-)external Include (ignore) data for external files
- --config-file FILENAME Specify configuration file location
- --rc SETTING=VALUE Override configuration file setting
- --compat MODE=on|off|auto Set compat MODE (libtool, hammer, split_crc)
-
-For more information see: $lcov_url
-END_OF_USAGE
- ;
-}
-
-
-#
-# check_options()
-#
-# Check for valid combination of command line options. Die on error.
-#
-
-sub check_options()
-{
- my $i = 0;
-
- # Count occurrence of mutually exclusive options
- $reset && $i++;
- $capture && $i++;
- @add_tracefile && $i++;
- $extract && $i++;
- $remove && $i++;
- $list && $i++;
- $diff && $i++;
- @opt_summary && $i++;
-
- if ($i == 0)
- {
- die("Need one of options -z, -c, -a, -e, -r, -l, ".
- "--diff or --summary\n".
- "Use $tool_name --help to get usage information\n");
- }
- elsif ($i > 1)
- {
- die("ERROR: only one of -z, -c, -a, -e, -r, -l, ".
- "--diff or --summary allowed!\n".
- "Use $tool_name --help to get usage information\n");
- }
-}
-
-
-#
-# userspace_reset()
-#
-# Reset coverage data found in DIRECTORY by deleting all contained .da files.
-#
-# Die on error.
-#
-
-sub userspace_reset()
-{
- my $current_dir;
- my @file_list;
-
- foreach $current_dir (@directory)
- {
- info("Deleting all .da files in $current_dir".
- ($no_recursion?"\n":" and subdirectories\n"));
- @file_list = `find "$current_dir" $maxdepth $follow -name \\*\\.da -o -name \\*\\.gcda -type f 2>/dev/null`;
- chomp(@file_list);
- foreach (@file_list)
- {
- unlink($_) or die("ERROR: cannot remove file $_!\n");
- }
- }
-}
-
-
-#
-# userspace_capture()
-#
-# Capture coverage data found in DIRECTORY and write it to a package (if
-# TO_PACKAGE specified) or to OUTPUT_FILENAME or STDOUT.
-#
-# Die on error.
-#
-
-sub userspace_capture()
-{
- my $dir;
- my $build;
-
- if (!defined($to_package)) {
- lcov_geninfo(@directory);
- return;
- }
- if (scalar(@directory) != 1) {
- die("ERROR: -d may be specified only once with --to-package\n");
- }
- $dir = $directory[0];
- if (defined($base_directory)) {
- $build = $base_directory;
- } else {
- $build = $dir;
- }
- create_package($to_package, $dir, $build);
-}
-
-
-#
-# kernel_reset()
-#
-# Reset kernel coverage.
-#
-# Die on error.
-#
-
-sub kernel_reset()
-{
- local *HANDLE;
- my $reset_file;
-
- info("Resetting kernel execution counters\n");
- if (-e "$gcov_dir/vmlinux") {
- $reset_file = "$gcov_dir/vmlinux";
- } elsif (-e "$gcov_dir/reset") {
- $reset_file = "$gcov_dir/reset";
- } else {
- die("ERROR: no reset control found in $gcov_dir\n");
- }
- open(HANDLE, ">", $reset_file) or
- die("ERROR: cannot write to $reset_file!\n");
- print(HANDLE "0");
- close(HANDLE);
-}
-
-
-#
-# lcov_copy_single(from, to)
-#
-# Copy single regular file FROM to TO without checking its size. This is
-# required to work with special files generated by the kernel
-# seq_file-interface.
-#
-#
-sub lcov_copy_single($$)
-{
- my ($from, $to) = @_;
- my $content;
- local $/;
- local *HANDLE;
-
- open(HANDLE, "<", $from) or die("ERROR: cannot read $from: $!\n");
- $content = <HANDLE>;
- close(HANDLE);
- open(HANDLE, ">", $to) or die("ERROR: cannot write $from: $!\n");
- if (defined($content)) {
- print(HANDLE $content);
- }
- close(HANDLE);
-}
-
-#
-# lcov_find(dir, function, data[, extension, ...)])
-#
-# Search DIR for files and directories whose name matches PATTERN and run
-# FUNCTION for each match. If not pattern is specified, match all names.
-#
-# FUNCTION has the following prototype:
-# function(dir, relative_name, data)
-#
-# Where:
-# dir: the base directory for this search
-# relative_name: the name relative to the base directory of this entry
-# data: the DATA variable passed to lcov_find
-#
-sub lcov_find($$$;@)
-{
- my ($dir, $fn, $data, @pattern) = @_;
- my $result;
- my $_fn = sub {
- my $filename = $File::Find::name;
-
- if (defined($result)) {
- return;
- }
- $filename = abs2rel($filename, $dir);
- foreach (@pattern) {
- if ($filename =~ /$_/) {
- goto ok;
- }
- }
- return;
- ok:
- $result = &$fn($dir, $filename, $data);
- };
- if (scalar(@pattern) == 0) {
- @pattern = ".*";
- }
- find( { wanted => $_fn, no_chdir => 1 }, $dir);
-
- return $result;
-}
-
-#
-# lcov_copy_fn(from, rel, to)
-#
-# Copy directories, files and links from/rel to to/rel.
-#
-
-sub lcov_copy_fn($$$)
-{
- my ($from, $rel, $to) = @_;
- my $absfrom = canonpath(catfile($from, $rel));
- my $absto = canonpath(catfile($to, $rel));
-
- if (-d) {
- if (! -d $absto) {
- mkpath($absto) or
- die("ERROR: cannot create directory $absto\n");
- chmod(0700, $absto);
- }
- } elsif (-l) {
- # Copy symbolic link
- my $link = readlink($absfrom);
-
- if (!defined($link)) {
- die("ERROR: cannot read link $absfrom: $!\n");
- }
- symlink($link, $absto) or
- die("ERROR: cannot create link $absto: $!\n");
- } else {
- lcov_copy_single($absfrom, $absto);
- chmod(0600, $absto);
- }
- return undef;
-}
-
-#
-# lcov_copy(from, to, subdirs)
-#
-# Copy all specified SUBDIRS and files from directory FROM to directory TO. For
-# regular files, copy file contents without checking its size. This is required
-# to work with seq_file-generated files.
-#
-
-sub lcov_copy($$;@)
-{
- my ($from, $to, @subdirs) = @_;
- my @pattern;
-
- foreach (@subdirs) {
- push(@pattern, "^$_");
- }
- lcov_find($from, \&lcov_copy_fn, $to, @pattern);
-}
-
-#
-# lcov_geninfo(directory)
-#
-# Call geninfo for the specified directory and with the parameters specified
-# at the command line.
-#
-
-sub lcov_geninfo(@)
-{
- my (@dir) = @_;
- my @param;
-
- # Capture data
- info("Capturing coverage data from ".join(" ", @dir)."\n");
- @param = ("$tool_dir/geninfo", @dir);
- if ($output_filename)
- {
- @param = (@param, "--output-filename", $output_filename);
- }
- if ($test_name)
- {
- @param = (@param, "--test-name", $test_name);
- }
- if ($follow)
- {
- @param = (@param, "--follow");
- }
- if ($quiet)
- {
- @param = (@param, "--quiet");
- }
- if (defined($checksum))
- {
- if ($checksum)
- {
- @param = (@param, "--checksum");
- }
- else
- {
- @param = (@param, "--no-checksum");
- }
- }
- if ($base_directory)
- {
- @param = (@param, "--base-directory", $base_directory);
- }
- if ($no_compat_libtool)
- {
- @param = (@param, "--no-compat-libtool");
- }
- elsif ($compat_libtool)
- {
- @param = (@param, "--compat-libtool");
- }
- if ($gcov_tool)
- {
- @param = (@param, "--gcov-tool", $gcov_tool);
- }
- foreach (@opt_ignore_errors) {
- @param = (@param, "--ignore-errors", $_);
- }
- if ($no_recursion) {
- @param = (@param, "--no-recursion");
- }
- if ($initial)
- {
- @param = (@param, "--initial");
- }
- if ($no_markers)
- {
- @param = (@param, "--no-markers");
- }
- if ($opt_derive_func_data)
- {
- @param = (@param, "--derive-func-data");
- }
- if ($opt_debug)
- {
- @param = (@param, "--debug");
- }
- if (defined($opt_external) && $opt_external)
- {
- @param = (@param, "--external");
- }
- if (defined($opt_external) && !$opt_external)
- {
- @param = (@param, "--no-external");
- }
- if (defined($opt_compat)) {
- @param = (@param, "--compat", $opt_compat);
- }
- if (%opt_rc) {
- foreach my $key (keys(%opt_rc)) {
- @param = (@param, "--rc", "$key=".$opt_rc{$key});
- }
- }
-
- system(@param) and exit($? >> 8);
-}
-
-#
-# read_file(filename)
-#
-# Return the contents of the file defined by filename.
-#
-
-sub read_file($)
-{
- my ($filename) = @_;
- my $content;
- local $\;
- local *HANDLE;
-
- open(HANDLE, "<", $filename) || return undef;
- $content = <HANDLE>;
- close(HANDLE);
-
- return $content;
-}
-
-#
-# get_package(package_file)
-#
-# Unpack unprocessed coverage data files from package_file to a temporary
-# directory and return directory name, build directory and gcov kernel version
-# as found in package.
-#
-
-sub get_package($)
-{
- my ($file) = @_;
- my $dir = create_temp_dir();
- my $gkv;
- my $build;
- my $cwd = getcwd();
- my $count;
- local *HANDLE;
-
- info("Reading package $file:\n");
- info(" data directory .......: $dir\n");
- $file = abs_path($file);
- chdir($dir);
- open(HANDLE, "-|", "tar xvfz '$file' 2>/dev/null")
- or die("ERROR: could not process package $file\n");
- while (<HANDLE>) {
- if (/\.da$/ || /\.gcda$/) {
- $count++;
- }
- }
- close(HANDLE);
- $build = read_file("$dir/$pkg_build_file");
- if (defined($build)) {
- info(" build directory ......: $build\n");
- }
- $gkv = read_file("$dir/$pkg_gkv_file");
- if (defined($gkv)) {
- $gkv = int($gkv);
- if ($gkv != $GKV_PROC && $gkv != $GKV_SYS) {
- die("ERROR: unsupported gcov kernel version found ".
- "($gkv)\n");
- }
- info(" content type .........: kernel data\n");
- info(" gcov kernel version ..: %s\n", $GKV_NAME[$gkv]);
- } else {
- info(" content type .........: application data\n");
- }
- info(" data files ...........: $count\n");
- chdir($cwd);
-
- return ($dir, $build, $gkv);
-}
-
-#
-# write_file(filename, $content)
-#
-# Create a file named filename and write the specified content to it.
-#
-
-sub write_file($$)
-{
- my ($filename, $content) = @_;
- local *HANDLE;
-
- open(HANDLE, ">", $filename) || return 0;
- print(HANDLE $content);
- close(HANDLE) || return 0;
-
- return 1;
-}
-
-# count_package_data(filename)
-#
-# Count the number of coverage data files in the specified package file.
-#
-
-sub count_package_data($)
-{
- my ($filename) = @_;
- local *HANDLE;
- my $count = 0;
-
- open(HANDLE, "-|", "tar tfz '$filename'") or return undef;
- while (<HANDLE>) {
- if (/\.da$/ || /\.gcda$/) {
- $count++;
- }
- }
- close(HANDLE);
- return $count;
-}
-
-#
-# create_package(package_file, source_directory, build_directory[,
-# kernel_gcov_version])
-#
-# Store unprocessed coverage data files from source_directory to package_file.
-#
-
-sub create_package($$$;$)
-{
- my ($file, $dir, $build, $gkv) = @_;
- my $cwd = getcwd();
-
- # Print information about the package
- info("Creating package $file:\n");
- info(" data directory .......: $dir\n");
-
- # Handle build directory
- if (defined($build)) {
- info(" build directory ......: $build\n");
- write_file("$dir/$pkg_build_file", $build)
- or die("ERROR: could not write to ".
- "$dir/$pkg_build_file\n");
- }
-
- # Handle gcov kernel version data
- if (defined($gkv)) {
- info(" content type .........: kernel data\n");
- info(" gcov kernel version ..: %s\n", $GKV_NAME[$gkv]);
- write_file("$dir/$pkg_gkv_file", $gkv)
- or die("ERROR: could not write to ".
- "$dir/$pkg_gkv_file\n");
- } else {
- info(" content type .........: application data\n");
- }
-
- # Create package
- $file = abs_path($file);
- chdir($dir);
- system("tar cfz $file .")
- and die("ERROR: could not create package $file\n");
-
- # Remove temporary files
- unlink("$dir/$pkg_build_file");
- unlink("$dir/$pkg_gkv_file");
-
- # Show number of data files
- if (!$quiet) {
- my $count = count_package_data($file);
-
- if (defined($count)) {
- info(" data files ...........: $count\n");
- }
- }
- chdir($cwd);
-}
-
-sub find_link_fn($$$)
-{
- my ($from, $rel, $filename) = @_;
- my $absfile = catfile($from, $rel, $filename);
-
- if (-l $absfile) {
- return $absfile;
- }
- return undef;
-}
-
-#
-# get_base(dir)
-#
-# Return (BASE, OBJ), where
-# - BASE: is the path to the kernel base directory relative to dir
-# - OBJ: is the absolute path to the kernel build directory
-#
-
-sub get_base($)
-{
- my ($dir) = @_;
- my $marker = "kernel/gcov/base.gcno";
- my $markerfile;
- my $sys;
- my $obj;
- my $link;
-
- $markerfile = lcov_find($dir, \&find_link_fn, $marker);
- if (!defined($markerfile)) {
- return (undef, undef);
- }
-
- # sys base is parent of parent of markerfile.
- $sys = abs2rel(dirname(dirname(dirname($markerfile))), $dir);
-
- # obj base is parent of parent of markerfile link target.
- $link = readlink($markerfile);
- if (!defined($link)) {
- die("ERROR: could not read $markerfile\n");
- }
- $obj = dirname(dirname(dirname($link)));
-
- return ($sys, $obj);
-}
-
-#
-# apply_base_dir(data_dir, base_dir, build_dir, @directories)
-#
-# Make entries in @directories relative to data_dir.
-#
-
-sub apply_base_dir($$$@)
-{
- my ($data, $base, $build, @dirs) = @_;
- my $dir;
- my @result;
-
- foreach $dir (@dirs) {
- # Is directory path relative to data directory?
- if (-d catdir($data, $dir)) {
- push(@result, $dir);
- next;
- }
- # Relative to the auto-detected base-directory?
- if (defined($base)) {
- if (-d catdir($data, $base, $dir)) {
- push(@result, catdir($base, $dir));
- next;
- }
- }
- # Relative to the specified base-directory?
- if (defined($base_directory)) {
- if (file_name_is_absolute($base_directory)) {
- $base = abs2rel($base_directory, rootdir());
- } else {
- $base = $base_directory;
- }
- if (-d catdir($data, $base, $dir)) {
- push(@result, catdir($base, $dir));
- next;
- }
- }
- # Relative to the build directory?
- if (defined($build)) {
- if (file_name_is_absolute($build)) {
- $base = abs2rel($build, rootdir());
- } else {
- $base = $build;
- }
- if (-d catdir($data, $base, $dir)) {
- push(@result, catdir($base, $dir));
- next;
- }
- }
- die("ERROR: subdirectory $dir not found\n".
- "Please use -b to specify the correct directory\n");
- }
- return @result;
-}
-
-#
-# copy_gcov_dir(dir, [@subdirectories])
-#
-# Create a temporary directory and copy all or, if specified, only some
-# subdirectories from dir to that directory. Return the name of the temporary
-# directory.
-#
-
-sub copy_gcov_dir($;@)
-{
- my ($data, @dirs) = @_;
- my $tempdir = create_temp_dir();
-
- info("Copying data to temporary directory $tempdir\n");
- lcov_copy($data, $tempdir, @dirs);
-
- return $tempdir;
-}
-
-#
-# kernel_capture_initial
-#
-# Capture initial kernel coverage data, i.e. create a coverage data file from
-# static graph files which contains zero coverage data for all instrumented
-# lines.
-#
-
-sub kernel_capture_initial()
-{
- my $build;
- my $source;
- my @params;
-
- if (defined($base_directory)) {
- $build = $base_directory;
- $source = "specified";
- } else {
- (undef, $build) = get_base($gcov_dir);
- if (!defined($build)) {
- die("ERROR: could not auto-detect build directory.\n".
- "Please use -b to specify the build directory\n");
- }
- $source = "auto-detected";
- }
- info("Using $build as kernel build directory ($source)\n");
- # Build directory needs to be passed to geninfo
- $base_directory = $build;
- if (@kernel_directory) {
- foreach my $dir (@kernel_directory) {
- push(@params, "$build/$dir");
- }
- } else {
- push(@params, $build);
- }
- lcov_geninfo(@params);
-}
-
-#
-# kernel_capture_from_dir(directory, gcov_kernel_version, build)
-#
-# Perform the actual kernel coverage capturing from the specified directory
-# assuming that the data was copied from the specified gcov kernel version.
-#
-
-sub kernel_capture_from_dir($$$)
-{
- my ($dir, $gkv, $build) = @_;
-
- # Create package or coverage file
- if (defined($to_package)) {
- create_package($to_package, $dir, $build, $gkv);
- } else {
- # Build directory needs to be passed to geninfo
- $base_directory = $build;
- lcov_geninfo($dir);
- }
-}
-
-#
-# adjust_kernel_dir(dir, build)
-#
-# Adjust directories specified with -k so that they point to the directory
-# relative to DIR. Return the build directory if specified or the auto-
-# detected build-directory.
-#
-
-sub adjust_kernel_dir($$)
-{
- my ($dir, $build) = @_;
- my ($sys_base, $build_auto) = get_base($dir);
-
- if (!defined($build)) {
- $build = $build_auto;
- }
- if (!defined($build)) {
- die("ERROR: could not auto-detect build directory.\n".
- "Please use -b to specify the build directory\n");
- }
- # Make @kernel_directory relative to sysfs base
- if (@kernel_directory) {
- @kernel_directory = apply_base_dir($dir, $sys_base, $build,
- @kernel_directory);
- }
- return $build;
-}
-
-sub kernel_capture()
-{
- my $data_dir;
- my $build = $base_directory;
-
- if ($gcov_gkv == $GKV_SYS) {
- $build = adjust_kernel_dir($gcov_dir, $build);
- }
- $data_dir = copy_gcov_dir($gcov_dir, @kernel_directory);
- kernel_capture_from_dir($data_dir, $gcov_gkv, $build);
-}
-
-#
-# package_capture()
-#
-# Capture coverage data from a package of unprocessed coverage data files
-# as generated by lcov --to-package.
-#
-
-sub package_capture()
-{
- my $dir;
- my $build;
- my $gkv;
-
- ($dir, $build, $gkv) = get_package($from_package);
-
- # Check for build directory
- if (defined($base_directory)) {
- if (defined($build)) {
- info("Using build directory specified by -b.\n");
- }
- $build = $base_directory;
- }
-
- # Do the actual capture
- if (defined($gkv)) {
- if ($gkv == $GKV_SYS) {
- $build = adjust_kernel_dir($dir, $build);
- }
- if (@kernel_directory) {
- $dir = copy_gcov_dir($dir, @kernel_directory);
- }
- kernel_capture_from_dir($dir, $gkv, $build);
- } else {
- # Build directory needs to be passed to geninfo
- $base_directory = $build;
- lcov_geninfo($dir);
- }
-}
-
-
-#
-# info(printf_parameter)
-#
-# Use printf to write PRINTF_PARAMETER to stdout only when the $quiet flag
-# is not set.
-#
-
-sub info(@)
-{
- if (!$quiet)
- {
- # Print info string
- if ($to_file)
- {
- printf(@_)
- }
- else
- {
- # Don't interfere with the .info output to STDOUT
- printf(STDERR @_);
- }
- }
-}
-
-
-#
-# create_temp_dir()
-#
-# Create a temporary directory and return its path.
-#
-# Die on error.
-#
-
-sub create_temp_dir()
-{
- my $dir;
-
- if (defined($tmp_dir)) {
- $dir = tempdir(DIR => $tmp_dir, CLEANUP => 1);
- } else {
- $dir = tempdir(CLEANUP => 1);
- }
- if (!defined($dir)) {
- die("ERROR: cannot create temporary directory\n");
- }
- push(@temp_dirs, $dir);
-
- return $dir;
-}
-
-
-#
-# br_taken_to_num(taken)
-#
-# Convert a branch taken value .info format to number format.
-#
-
-sub br_taken_to_num($)
-{
- my ($taken) = @_;
-
- return 0 if ($taken eq '-');
- return $taken + 1;
-}
-
-
-#
-# br_num_to_taken(taken)
-#
-# Convert a branch taken value in number format to .info format.
-#
-
-sub br_num_to_taken($)
-{
- my ($taken) = @_;
-
- return '-' if ($taken == 0);
- return $taken - 1;
-}
-
-
-#
-# br_taken_add(taken1, taken2)
-#
-# Return the result of taken1 + taken2 for 'branch taken' values.
-#
-
-sub br_taken_add($$)
-{
- my ($t1, $t2) = @_;
-
- return $t1 if (!defined($t2));
- return $t2 if (!defined($t1));
- return $t1 if ($t2 eq '-');
- return $t2 if ($t1 eq '-');
- return $t1 + $t2;
-}
-
-
-#
-# br_taken_sub(taken1, taken2)
-#
-# Return the result of taken1 - taken2 for 'branch taken' values. Return 0
-# if the result would become negative.
-#
-
-sub br_taken_sub($$)
-{
- my ($t1, $t2) = @_;
-
- return $t1 if (!defined($t2));
- return undef if (!defined($t1));
- return $t1 if ($t1 eq '-');
- return $t1 if ($t2 eq '-');
- return 0 if $t2 > $t1;
- return $t1 - $t2;
-}
-
-
-#
-#
-# br_ivec_len(vector)
-#
-# Return the number of entries in the branch coverage vector.
-#
-
-sub br_ivec_len($)
-{
- my ($vec) = @_;
-
- return 0 if (!defined($vec));
- return (length($vec) * 8 / $BR_VEC_WIDTH) / $BR_VEC_ENTRIES;
-}
-
-
-#
-# br_ivec_push(vector, block, branch, taken)
-#
-# Add an entry to the branch coverage vector. If an entry with the same
-# branch ID already exists, add the corresponding taken values.
-#
-
-sub br_ivec_push($$$$)
-{
- my ($vec, $block, $branch, $taken) = @_;
- my $offset;
- my $num = br_ivec_len($vec);
- my $i;
-
- $vec = "" if (!defined($vec));
-
- # Check if branch already exists in vector
- for ($i = 0; $i < $num; $i++) {
- my ($v_block, $v_branch, $v_taken) = br_ivec_get($vec, $i);
-
- next if ($v_block != $block || $v_branch != $branch);
-
- # Add taken counts
- $taken = br_taken_add($taken, $v_taken);
- last;
- }
-
- $offset = $i * $BR_VEC_ENTRIES;
- $taken = br_taken_to_num($taken);
-
- # Add to vector
- vec($vec, $offset + $BR_BLOCK, $BR_VEC_WIDTH) = $block;
- vec($vec, $offset + $BR_BRANCH, $BR_VEC_WIDTH) = $branch;
- vec($vec, $offset + $BR_TAKEN, $BR_VEC_WIDTH) = $taken;
-
- return $vec;
-}
-
-
-#
-# br_ivec_get(vector, number)
-#
-# Return an entry from the branch coverage vector.
-#
-
-sub br_ivec_get($$)
-{
- my ($vec, $num) = @_;
- my $block;
- my $branch;
- my $taken;
- my $offset = $num * $BR_VEC_ENTRIES;
-
- # Retrieve data from vector
- $block = vec($vec, $offset + $BR_BLOCK, $BR_VEC_WIDTH);
- $branch = vec($vec, $offset + $BR_BRANCH, $BR_VEC_WIDTH);
- $taken = vec($vec, $offset + $BR_TAKEN, $BR_VEC_WIDTH);
-
- # Decode taken value from an integer
- $taken = br_num_to_taken($taken);
-
- return ($block, $branch, $taken);
-}
-
-
-#
-# get_br_found_and_hit(brcount)
-#
-# Return (br_found, br_hit) for brcount
-#
-
-sub get_br_found_and_hit($)
-{
- my ($brcount) = @_;
- my $line;
- my $br_found = 0;
- my $br_hit = 0;
-
- foreach $line (keys(%{$brcount})) {
- my $brdata = $brcount->{$line};
- my $i;
- my $num = br_ivec_len($brdata);
-
- for ($i = 0; $i < $num; $i++) {
- my $taken;
-
- (undef, undef, $taken) = br_ivec_get($brdata, $i);
-
- $br_found++;
- $br_hit++ if ($taken ne "-" && $taken > 0);
- }
- }
-
- return ($br_found, $br_hit);
-}
-
-
-#
-# read_info_file(info_filename)
-#
-# Read in the contents of the .info file specified by INFO_FILENAME. Data will
-# be returned as a reference to a hash containing the following mappings:
-#
-# %result: for each filename found in file -> \%data
-#
-# %data: "test" -> \%testdata
-# "sum" -> \%sumcount
-# "func" -> \%funcdata
-# "found" -> $lines_found (number of instrumented lines found in file)
-# "hit" -> $lines_hit (number of executed lines in file)
-# "check" -> \%checkdata
-# "testfnc" -> \%testfncdata
-# "sumfnc" -> \%sumfnccount
-# "testbr" -> \%testbrdata
-# "sumbr" -> \%sumbrcount
-#
-# %testdata : name of test affecting this file -> \%testcount
-# %testfncdata: name of test affecting this file -> \%testfnccount
-# %testbrdata: name of test affecting this file -> \%testbrcount
-#
-# %testcount : line number -> execution count for a single test
-# %testfnccount: function name -> execution count for a single test
-# %testbrcount : line number -> branch coverage data for a single test
-# %sumcount : line number -> execution count for all tests
-# %sumfnccount : function name -> execution count for all tests
-# %sumbrcount : line number -> branch coverage data for all tests
-# %funcdata : function name -> line number
-# %checkdata : line number -> checksum of source code line
-# $brdata : vector of items: block, branch, taken
-#
-# Note that .info file sections referring to the same file and test name
-# will automatically be combined by adding all execution counts.
-#
-# Note that if INFO_FILENAME ends with ".gz", it is assumed that the file
-# is compressed using GZIP. If available, GUNZIP will be used to decompress
-# this file.
-#
-# Die on error.
-#
-
-sub read_info_file($)
-{
- my $tracefile = $_[0]; # Name of tracefile
- my %result; # Resulting hash: file -> data
- my $data; # Data handle for current entry
- my $testdata; # " "
- my $testcount; # " "
- my $sumcount; # " "
- my $funcdata; # " "
- my $checkdata; # " "
- my $testfncdata;
- my $testfnccount;
- my $sumfnccount;
- my $testbrdata;
- my $testbrcount;
- my $sumbrcount;
- my $line; # Current line read from .info file
- my $testname; # Current test name
- my $filename; # Current filename
- my $hitcount; # Count for lines hit
- my $count; # Execution count of current line
- my $negative; # If set, warn about negative counts
- my $changed_testname; # If set, warn about changed testname
- my $line_checksum; # Checksum of current line
- local *INFO_HANDLE; # Filehandle for .info file
-
- info("Reading tracefile $tracefile\n");
-
- # Check if file exists and is readable
- stat($_[0]);
- if (!(-r _))
- {
- die("ERROR: cannot read file $_[0]!\n");
- }
-
- # Check if this is really a plain file
- if (!(-f _))
- {
- die("ERROR: not a plain file: $_[0]!\n");
- }
-
- # Check for .gz extension
- if ($_[0] =~ /\.gz$/)
- {
- # Check for availability of GZIP tool
- system_no_output(1, "gunzip" ,"-h")
- and die("ERROR: gunzip command not available!\n");
-
- # Check integrity of compressed file
- system_no_output(1, "gunzip", "-t", $_[0])
- and die("ERROR: integrity check failed for ".
- "compressed file $_[0]!\n");
-
- # Open compressed file
- open(INFO_HANDLE, "-|", "gunzip -c '$_[0]'")
- or die("ERROR: cannot start gunzip to decompress ".
- "file $_[0]!\n");
- }
- else
- {
- # Open decompressed file
- open(INFO_HANDLE, "<", $_[0])
- or die("ERROR: cannot read file $_[0]!\n");
- }
-
- $testname = "";
- while (<INFO_HANDLE>)
- {
- chomp($_);
- $line = $_;
-
- # Switch statement
- foreach ($line)
- {
- /^TN:([^,]*)(,diff)?/ && do
- {
- # Test name information found
- $testname = defined($1) ? $1 : "";
- if ($testname =~ s/\W/_/g)
- {
- $changed_testname = 1;
- }
- $testname .= $2 if (defined($2));
- last;
- };
-
- /^[SK]F:(.*)/ && do
- {
- # Filename information found
- # Retrieve data for new entry
- $filename = $1;
-
- $data = $result{$filename};
- ($testdata, $sumcount, $funcdata, $checkdata,
- $testfncdata, $sumfnccount, $testbrdata,
- $sumbrcount) =
- get_info_entry($data);
-
- if (defined($testname))
- {
- $testcount = $testdata->{$testname};
- $testfnccount = $testfncdata->{$testname};
- $testbrcount = $testbrdata->{$testname};
- }
- else
- {
- $testcount = {};
- $testfnccount = {};
- $testbrcount = {};
- }
- last;
- };
-
- /^DA:(\d+),(-?\d+)(,[^,\s]+)?/ && do
- {
- # Fix negative counts
- $count = $2 < 0 ? 0 : $2;
- if ($2 < 0)
- {
- $negative = 1;
- }
- # Execution count found, add to structure
- # Add summary counts
- $sumcount->{$1} += $count;
-
- # Add test-specific counts
- if (defined($testname))
- {
- $testcount->{$1} += $count;
- }
-
- # Store line checksum if available
- if (defined($3))
- {
- $line_checksum = substr($3, 1);
-
- # Does it match a previous definition
- if (defined($checkdata->{$1}) &&
- ($checkdata->{$1} ne
- $line_checksum))
- {
- die("ERROR: checksum mismatch ".
- "at $filename:$1\n");
- }
-
- $checkdata->{$1} = $line_checksum;
- }
- last;
- };
-
- /^FN:(\d+),([^,]+)/ && do
- {
- last if (!$func_coverage);
-
- # Function data found, add to structure
- $funcdata->{$2} = $1;
-
- # Also initialize function call data
- if (!defined($sumfnccount->{$2})) {
- $sumfnccount->{$2} = 0;
- }
- if (defined($testname))
- {
- if (!defined($testfnccount->{$2})) {
- $testfnccount->{$2} = 0;
- }
- }
- last;
- };
-
- /^FNDA:(\d+),([^,]+)/ && do
- {
- last if (!$func_coverage);
-
- # Function call count found, add to structure
- # Add summary counts
- $sumfnccount->{$2} += $1;
-
- # Add test-specific counts
- if (defined($testname))
- {
- $testfnccount->{$2} += $1;
- }
- last;
- };
-
- /^BRDA:(\d+),(\d+),(\d+),(\d+|-)/ && do {
- # Branch coverage data found
- my ($line, $block, $branch, $taken) =
- ($1, $2, $3, $4);
-
- last if (!$br_coverage);
- $sumbrcount->{$line} =
- br_ivec_push($sumbrcount->{$line},
- $block, $branch, $taken);
-
- # Add test-specific counts
- if (defined($testname)) {
- $testbrcount->{$line} =
- br_ivec_push(
- $testbrcount->{$line},
- $block, $branch,
- $taken);
- }
- last;
- };
-
- /^end_of_record/ && do
- {
- # Found end of section marker
- if ($filename)
- {
- # Store current section data
- if (defined($testname))
- {
- $testdata->{$testname} =
- $testcount;
- $testfncdata->{$testname} =
- $testfnccount;
- $testbrdata->{$testname} =
- $testbrcount;
- }
-
- set_info_entry($data, $testdata,
- $sumcount, $funcdata,
- $checkdata, $testfncdata,
- $sumfnccount,
- $testbrdata,
- $sumbrcount);
- $result{$filename} = $data;
- last;
- }
- };
-
- # default
- last;
- }
- }
- close(INFO_HANDLE);
-
- # Calculate hit and found values for lines and functions of each file
- foreach $filename (keys(%result))
- {
- $data = $result{$filename};
-
- ($testdata, $sumcount, undef, undef, $testfncdata,
- $sumfnccount, $testbrdata, $sumbrcount) =
- get_info_entry($data);
-
- # Filter out empty files
- if (scalar(keys(%{$sumcount})) == 0)
- {
- delete($result{$filename});
- next;
- }
- # Filter out empty test cases
- foreach $testname (keys(%{$testdata}))
- {
- if (!defined($testdata->{$testname}) ||
- scalar(keys(%{$testdata->{$testname}})) == 0)
- {
- delete($testdata->{$testname});
- delete($testfncdata->{$testname});
- }
- }
-
- $data->{"found"} = scalar(keys(%{$sumcount}));
- $hitcount = 0;
-
- foreach (keys(%{$sumcount}))
- {
- if ($sumcount->{$_} > 0) { $hitcount++; }
- }
-
- $data->{"hit"} = $hitcount;
-
- # Get found/hit values for function call data
- $data->{"f_found"} = scalar(keys(%{$sumfnccount}));
- $hitcount = 0;
-
- foreach (keys(%{$sumfnccount})) {
- if ($sumfnccount->{$_} > 0) {
- $hitcount++;
- }
- }
- $data->{"f_hit"} = $hitcount;
-
- # Get found/hit values for branch data
- {
- my ($br_found, $br_hit) = get_br_found_and_hit($sumbrcount);
-
- $data->{"b_found"} = $br_found;
- $data->{"b_hit"} = $br_hit;
- }
- }
-
- if (scalar(keys(%result)) == 0)
- {
- die("ERROR: no valid records found in tracefile $tracefile\n");
- }
- if ($negative)
- {
- warn("WARNING: negative counts found in tracefile ".
- "$tracefile\n");
- }
- if ($changed_testname)
- {
- warn("WARNING: invalid characters removed from testname in ".
- "tracefile $tracefile\n");
- }
-
- return(\%result);
-}
-
-
-#
-# get_info_entry(hash_ref)
-#
-# Retrieve data from an entry of the structure generated by read_info_file().
-# Return a list of references to hashes:
-# (test data hash ref, sum count hash ref, funcdata hash ref, checkdata hash
-# ref, testfncdata hash ref, sumfnccount hash ref, testbrdata hash ref,
-# sumbrcount hash ref, lines found, lines hit, functions found,
-# functions hit, branches found, branches hit)
-#
-
-sub get_info_entry($)
-{
- my $testdata_ref = $_[0]->{"test"};
- my $sumcount_ref = $_[0]->{"sum"};
- my $funcdata_ref = $_[0]->{"func"};
- my $checkdata_ref = $_[0]->{"check"};
- my $testfncdata = $_[0]->{"testfnc"};
- my $sumfnccount = $_[0]->{"sumfnc"};
- my $testbrdata = $_[0]->{"testbr"};
- my $sumbrcount = $_[0]->{"sumbr"};
- my $lines_found = $_[0]->{"found"};
- my $lines_hit = $_[0]->{"hit"};
- my $f_found = $_[0]->{"f_found"};
- my $f_hit = $_[0]->{"f_hit"};
- my $br_found = $_[0]->{"b_found"};
- my $br_hit = $_[0]->{"b_hit"};
-
- return ($testdata_ref, $sumcount_ref, $funcdata_ref, $checkdata_ref,
- $testfncdata, $sumfnccount, $testbrdata, $sumbrcount,
- $lines_found, $lines_hit, $f_found, $f_hit,
- $br_found, $br_hit);
-}
-
-
-#
-# set_info_entry(hash_ref, testdata_ref, sumcount_ref, funcdata_ref,
-# checkdata_ref, testfncdata_ref, sumfcncount_ref,
-# testbrdata_ref, sumbrcount_ref[,lines_found,
-# lines_hit, f_found, f_hit, $b_found, $b_hit])
-#
-# Update the hash referenced by HASH_REF with the provided data references.
-#
-
-sub set_info_entry($$$$$$$$$;$$$$$$)
-{
- my $data_ref = $_[0];
-
- $data_ref->{"test"} = $_[1];
- $data_ref->{"sum"} = $_[2];
- $data_ref->{"func"} = $_[3];
- $data_ref->{"check"} = $_[4];
- $data_ref->{"testfnc"} = $_[5];
- $data_ref->{"sumfnc"} = $_[6];
- $data_ref->{"testbr"} = $_[7];
- $data_ref->{"sumbr"} = $_[8];
-
- if (defined($_[9])) { $data_ref->{"found"} = $_[9]; }
- if (defined($_[10])) { $data_ref->{"hit"} = $_[10]; }
- if (defined($_[11])) { $data_ref->{"f_found"} = $_[11]; }
- if (defined($_[12])) { $data_ref->{"f_hit"} = $_[12]; }
- if (defined($_[13])) { $data_ref->{"b_found"} = $_[13]; }
- if (defined($_[14])) { $data_ref->{"b_hit"} = $_[14]; }
-}
-
-
-#
-# add_counts(data1_ref, data2_ref)
-#
-# DATA1_REF and DATA2_REF are references to hashes containing a mapping
-#
-# line number -> execution count
-#
-# Return a list (RESULT_REF, LINES_FOUND, LINES_HIT) where RESULT_REF
-# is a reference to a hash containing the combined mapping in which
-# execution counts are added.
-#
-
-sub add_counts($$)
-{
- my %data1 = %{$_[0]}; # Hash 1
- my %data2 = %{$_[1]}; # Hash 2
- my %result; # Resulting hash
- my $line; # Current line iteration scalar
- my $data1_count; # Count of line in hash1
- my $data2_count; # Count of line in hash2
- my $found = 0; # Total number of lines found
- my $hit = 0; # Number of lines with a count > 0
-
- foreach $line (keys(%data1))
- {
- $data1_count = $data1{$line};
- $data2_count = $data2{$line};
-
- # Add counts if present in both hashes
- if (defined($data2_count)) { $data1_count += $data2_count; }
-
- # Store sum in %result
- $result{$line} = $data1_count;
-
- $found++;
- if ($data1_count > 0) { $hit++; }
- }
-
- # Add lines unique to data2
- foreach $line (keys(%data2))
- {
- # Skip lines already in data1
- if (defined($data1{$line})) { next; }
-
- # Copy count from data2
- $result{$line} = $data2{$line};
-
- $found++;
- if ($result{$line} > 0) { $hit++; }
- }
-
- return (\%result, $found, $hit);
-}
-
-
-#
-# merge_checksums(ref1, ref2, filename)
-#
-# REF1 and REF2 are references to hashes containing a mapping
-#
-# line number -> checksum
-#
-# Merge checksum lists defined in REF1 and REF2 and return reference to
-# resulting hash. Die if a checksum for a line is defined in both hashes
-# but does not match.
-#
-
-sub merge_checksums($$$)
-{
- my $ref1 = $_[0];
- my $ref2 = $_[1];
- my $filename = $_[2];
- my %result;
- my $line;
-
- foreach $line (keys(%{$ref1}))
- {
- if (defined($ref2->{$line}) &&
- ($ref1->{$line} ne $ref2->{$line}))
- {
- die("ERROR: checksum mismatch at $filename:$line\n");
- }
- $result{$line} = $ref1->{$line};
- }
-
- foreach $line (keys(%{$ref2}))
- {
- $result{$line} = $ref2->{$line};
- }
-
- return \%result;
-}
-
-
-#
-# merge_func_data(funcdata1, funcdata2, filename)
-#
-
-sub merge_func_data($$$)
-{
- my ($funcdata1, $funcdata2, $filename) = @_;
- my %result;
- my $func;
-
- if (defined($funcdata1)) {
- %result = %{$funcdata1};
- }
-
- foreach $func (keys(%{$funcdata2})) {
- my $line1 = $result{$func};
- my $line2 = $funcdata2->{$func};
-
- if (defined($line1) && ($line1 != $line2)) {
- warn("WARNING: function data mismatch at ".
- "$filename:$line2\n");
- next;
- }
- $result{$func} = $line2;
- }
-
- return \%result;
-}
-
-
-#
-# add_fnccount(fnccount1, fnccount2)
-#
-# Add function call count data. Return list (fnccount_added, f_found, f_hit)
-#
-
-sub add_fnccount($$)
-{
- my ($fnccount1, $fnccount2) = @_;
- my %result;
- my $f_found;
- my $f_hit;
- my $function;
-
- if (defined($fnccount1)) {
- %result = %{$fnccount1};
- }
- foreach $function (keys(%{$fnccount2})) {
- $result{$function} += $fnccount2->{$function};
- }
- $f_found = scalar(keys(%result));
- $f_hit = 0;
- foreach $function (keys(%result)) {
- if ($result{$function} > 0) {
- $f_hit++;
- }
- }
-
- return (\%result, $f_found, $f_hit);
-}
-
-#
-# add_testfncdata(testfncdata1, testfncdata2)
-#
-# Add function call count data for several tests. Return reference to
-# added_testfncdata.
-#
-
-sub add_testfncdata($$)
-{
- my ($testfncdata1, $testfncdata2) = @_;
- my %result;
- my $testname;
-
- foreach $testname (keys(%{$testfncdata1})) {
- if (defined($testfncdata2->{$testname})) {
- my $fnccount;
-
- # Function call count data for this testname exists
- # in both data sets: merge
- ($fnccount) = add_fnccount(
- $testfncdata1->{$testname},
- $testfncdata2->{$testname});
- $result{$testname} = $fnccount;
- next;
- }
- # Function call count data for this testname is unique to
- # data set 1: copy
- $result{$testname} = $testfncdata1->{$testname};
- }
-
- # Add count data for testnames unique to data set 2
- foreach $testname (keys(%{$testfncdata2})) {
- if (!defined($result{$testname})) {
- $result{$testname} = $testfncdata2->{$testname};
- }
- }
- return \%result;
-}
-
-
-#
-# brcount_to_db(brcount)
-#
-# Convert brcount data to the following format:
-#
-# db: line number -> block hash
-# block hash: block number -> branch hash
-# branch hash: branch number -> taken value
-#
-
-sub brcount_to_db($)
-{
- my ($brcount) = @_;
- my $line;
- my $db;
-
- # Add branches from first count to database
- foreach $line (keys(%{$brcount})) {
- my $brdata = $brcount->{$line};
- my $i;
- my $num = br_ivec_len($brdata);
-
- for ($i = 0; $i < $num; $i++) {
- my ($block, $branch, $taken) = br_ivec_get($brdata, $i);
-
- $db->{$line}->{$block}->{$branch} = $taken;
- }
- }
-
- return $db;
-}
-
-
-#
-# db_to_brcount(db)
-#
-# Convert branch coverage data back to brcount format.
-#
-
-sub db_to_brcount($)
-{
- my ($db) = @_;
- my $line;
- my $brcount = {};
- my $br_found = 0;
- my $br_hit = 0;
-
- # Convert database back to brcount format
- foreach $line (sort({$a <=> $b} keys(%{$db}))) {
- my $ldata = $db->{$line};
- my $brdata;
- my $block;
-
- foreach $block (sort({$a <=> $b} keys(%{$ldata}))) {
- my $bdata = $ldata->{$block};
- my $branch;
-
- foreach $branch (sort({$a <=> $b} keys(%{$bdata}))) {
- my $taken = $bdata->{$branch};
-
- $br_found++;
- $br_hit++ if ($taken ne "-" && $taken > 0);
- $brdata = br_ivec_push($brdata, $block,
- $branch, $taken);
- }
- }
- $brcount->{$line} = $brdata;
- }
-
- return ($brcount, $br_found, $br_hit);
-}
-
-
-# combine_brcount(brcount1, brcount2, type)
-#
-# If add is BR_ADD, add branch coverage data and return list (brcount_added,
-# br_found, br_hit). If add is BR_SUB, subtract the taken values of brcount2
-# from brcount1 and return (brcount_sub, br_found, br_hit).
-#
-
-sub combine_brcount($$$)
-{
- my ($brcount1, $brcount2, $type) = @_;
- my $line;
- my $block;
- my $branch;
- my $taken;
- my $db;
- my $br_found = 0;
- my $br_hit = 0;
- my $result;
-
- # Convert branches from first count to database
- $db = brcount_to_db($brcount1);
- # Combine values from database and second count
- foreach $line (keys(%{$brcount2})) {
- my $brdata = $brcount2->{$line};
- my $num = br_ivec_len($brdata);
- my $i;
-
- for ($i = 0; $i < $num; $i++) {
- ($block, $branch, $taken) = br_ivec_get($brdata, $i);
- my $new_taken = $db->{$line}->{$block}->{$branch};
-
- if ($type == $BR_ADD) {
- $new_taken = br_taken_add($new_taken, $taken);
- } elsif ($type == $BR_SUB) {
- $new_taken = br_taken_sub($new_taken, $taken);
- }
- $db->{$line}->{$block}->{$branch} = $new_taken
- if (defined($new_taken));
- }
- }
- # Convert database back to brcount format
- ($result, $br_found, $br_hit) = db_to_brcount($db);
-
- return ($result, $br_found, $br_hit);
-}
-
-
-#
-# add_testbrdata(testbrdata1, testbrdata2)
-#
-# Add branch coverage data for several tests. Return reference to
-# added_testbrdata.
-#
-
-sub add_testbrdata($$)
-{
- my ($testbrdata1, $testbrdata2) = @_;
- my %result;
- my $testname;
-
- foreach $testname (keys(%{$testbrdata1})) {
- if (defined($testbrdata2->{$testname})) {
- my $brcount;
-
- # Branch coverage data for this testname exists
- # in both data sets: add
- ($brcount) = combine_brcount(
- $testbrdata1->{$testname},
- $testbrdata2->{$testname}, $BR_ADD);
- $result{$testname} = $brcount;
- next;
- }
- # Branch coverage data for this testname is unique to
- # data set 1: copy
- $result{$testname} = $testbrdata1->{$testname};
- }
-
- # Add count data for testnames unique to data set 2
- foreach $testname (keys(%{$testbrdata2})) {
- if (!defined($result{$testname})) {
- $result{$testname} = $testbrdata2->{$testname};
- }
- }
- return \%result;
-}
-
-
-#
-# combine_info_entries(entry_ref1, entry_ref2, filename)
-#
-# Combine .info data entry hashes referenced by ENTRY_REF1 and ENTRY_REF2.
-# Return reference to resulting hash.
-#
-
-sub combine_info_entries($$$)
-{
- my $entry1 = $_[0]; # Reference to hash containing first entry
- my $testdata1;
- my $sumcount1;
- my $funcdata1;
- my $checkdata1;
- my $testfncdata1;
- my $sumfnccount1;
- my $testbrdata1;
- my $sumbrcount1;
-
- my $entry2 = $_[1]; # Reference to hash containing second entry
- my $testdata2;
- my $sumcount2;
- my $funcdata2;
- my $checkdata2;
- my $testfncdata2;
- my $sumfnccount2;
- my $testbrdata2;
- my $sumbrcount2;
-
- my %result; # Hash containing combined entry
- my %result_testdata;
- my $result_sumcount = {};
- my $result_funcdata;
- my $result_testfncdata;
- my $result_sumfnccount;
- my $result_testbrdata;
- my $result_sumbrcount;
- my $lines_found;
- my $lines_hit;
- my $f_found;
- my $f_hit;
- my $br_found;
- my $br_hit;
-
- my $testname;
- my $filename = $_[2];
-
- # Retrieve data
- ($testdata1, $sumcount1, $funcdata1, $checkdata1, $testfncdata1,
- $sumfnccount1, $testbrdata1, $sumbrcount1) = get_info_entry($entry1);
- ($testdata2, $sumcount2, $funcdata2, $checkdata2, $testfncdata2,
- $sumfnccount2, $testbrdata2, $sumbrcount2) = get_info_entry($entry2);
-
- # Merge checksums
- $checkdata1 = merge_checksums($checkdata1, $checkdata2, $filename);
-
- # Combine funcdata
- $result_funcdata = merge_func_data($funcdata1, $funcdata2, $filename);
-
- # Combine function call count data
- $result_testfncdata = add_testfncdata($testfncdata1, $testfncdata2);
- ($result_sumfnccount, $f_found, $f_hit) =
- add_fnccount($sumfnccount1, $sumfnccount2);
-
- # Combine branch coverage data
- $result_testbrdata = add_testbrdata($testbrdata1, $testbrdata2);
- ($result_sumbrcount, $br_found, $br_hit) =
- combine_brcount($sumbrcount1, $sumbrcount2, $BR_ADD);
-
- # Combine testdata
- foreach $testname (keys(%{$testdata1}))
- {
- if (defined($testdata2->{$testname}))
- {
- # testname is present in both entries, requires
- # combination
- ($result_testdata{$testname}) =
- add_counts($testdata1->{$testname},
- $testdata2->{$testname});
- }
- else
- {
- # testname only present in entry1, add to result
- $result_testdata{$testname} = $testdata1->{$testname};
- }
-
- # update sum count hash
- ($result_sumcount, $lines_found, $lines_hit) =
- add_counts($result_sumcount,
- $result_testdata{$testname});
- }
-
- foreach $testname (keys(%{$testdata2}))
- {
- # Skip testnames already covered by previous iteration
- if (defined($testdata1->{$testname})) { next; }
-
- # testname only present in entry2, add to result hash
- $result_testdata{$testname} = $testdata2->{$testname};
-
- # update sum count hash
- ($result_sumcount, $lines_found, $lines_hit) =
- add_counts($result_sumcount,
- $result_testdata{$testname});
- }
-
- # Calculate resulting sumcount
-
- # Store result
- set_info_entry(\%result, \%result_testdata, $result_sumcount,
- $result_funcdata, $checkdata1, $result_testfncdata,
- $result_sumfnccount, $result_testbrdata,
- $result_sumbrcount, $lines_found, $lines_hit,
- $f_found, $f_hit, $br_found, $br_hit);
-
- return(\%result);
-}
-
-
-#
-# combine_info_files(info_ref1, info_ref2)
-#
-# Combine .info data in hashes referenced by INFO_REF1 and INFO_REF2. Return
-# reference to resulting hash.
-#
-
-sub combine_info_files($$)
-{
- my %hash1 = %{$_[0]};
- my %hash2 = %{$_[1]};
- my $filename;
-
- foreach $filename (keys(%hash2))
- {
- if ($hash1{$filename})
- {
- # Entry already exists in hash1, combine them
- $hash1{$filename} =
- combine_info_entries($hash1{$filename},
- $hash2{$filename},
- $filename);
- }
- else
- {
- # Entry is unique in both hashes, simply add to
- # resulting hash
- $hash1{$filename} = $hash2{$filename};
- }
- }
-
- return(\%hash1);
-}
-
-
-#
-# add_traces()
-#
-
-sub add_traces()
-{
- my $total_trace;
- my $current_trace;
- my $tracefile;
- my @result;
- local *INFO_HANDLE;
-
- info("Combining tracefiles.\n");
-
- foreach $tracefile (@add_tracefile)
- {
- $current_trace = read_info_file($tracefile);
- if ($total_trace)
- {
- $total_trace = combine_info_files($total_trace,
- $current_trace);
- }
- else
- {
- $total_trace = $current_trace;
- }
- }
-
- # Write combined data
- if ($to_file)
- {
- info("Writing data to $output_filename\n");
- open(INFO_HANDLE, ">", $output_filename)
- or die("ERROR: cannot write to $output_filename!\n");
- @result = write_info_file(*INFO_HANDLE, $total_trace);
- close(*INFO_HANDLE);
- }
- else
- {
- @result = write_info_file(*STDOUT, $total_trace);
- }
-
- return @result;
-}
-
-
-#
-# write_info_file(filehandle, data)
-#
-
-sub write_info_file(*$)
-{
- local *INFO_HANDLE = $_[0];
- my %data = %{$_[1]};
- my $source_file;
- my $entry;
- my $testdata;
- my $sumcount;
- my $funcdata;
- my $checkdata;
- my $testfncdata;
- my $sumfnccount;
- my $testbrdata;
- my $sumbrcount;
- my $testname;
- my $line;
- my $func;
- my $testcount;
- my $testfnccount;
- my $testbrcount;
- my $found;
- my $hit;
- my $f_found;
- my $f_hit;
- my $br_found;
- my $br_hit;
- my $ln_total_found = 0;
- my $ln_total_hit = 0;
- my $fn_total_found = 0;
- my $fn_total_hit = 0;
- my $br_total_found = 0;
- my $br_total_hit = 0;
-
- foreach $source_file (sort(keys(%data)))
- {
- $entry = $data{$source_file};
- ($testdata, $sumcount, $funcdata, $checkdata, $testfncdata,
- $sumfnccount, $testbrdata, $sumbrcount, $found, $hit,
- $f_found, $f_hit, $br_found, $br_hit) =
- get_info_entry($entry);
-
- # Add to totals
- $ln_total_found += $found;
- $ln_total_hit += $hit;
- $fn_total_found += $f_found;
- $fn_total_hit += $f_hit;
- $br_total_found += $br_found;
- $br_total_hit += $br_hit;
-
- foreach $testname (sort(keys(%{$testdata})))
- {
- $testcount = $testdata->{$testname};
- $testfnccount = $testfncdata->{$testname};
- $testbrcount = $testbrdata->{$testname};
- $found = 0;
- $hit = 0;
-
- print(INFO_HANDLE "TN:$testname\n");
- print(INFO_HANDLE "SF:$source_file\n");
-
- # Write function related data
- foreach $func (
- sort({$funcdata->{$a} <=> $funcdata->{$b}}
- keys(%{$funcdata})))
- {
- print(INFO_HANDLE "FN:".$funcdata->{$func}.
- ",$func\n");
- }
- foreach $func (keys(%{$testfnccount})) {
- print(INFO_HANDLE "FNDA:".
- $testfnccount->{$func}.
- ",$func\n");
- }
- ($f_found, $f_hit) =
- get_func_found_and_hit($testfnccount);
- print(INFO_HANDLE "FNF:$f_found\n");
- print(INFO_HANDLE "FNH:$f_hit\n");
-
- # Write branch related data
- $br_found = 0;
- $br_hit = 0;
- foreach $line (sort({$a <=> $b}
- keys(%{$testbrcount}))) {
- my $brdata = $testbrcount->{$line};
- my $num = br_ivec_len($brdata);
- my $i;
-
- for ($i = 0; $i < $num; $i++) {
- my ($block, $branch, $taken) =
- br_ivec_get($brdata, $i);
-
- print(INFO_HANDLE "BRDA:$line,$block,".
- "$branch,$taken\n");
- $br_found++;
- $br_hit++ if ($taken ne '-' &&
- $taken > 0);
- }
- }
- if ($br_found > 0) {
- print(INFO_HANDLE "BRF:$br_found\n");
- print(INFO_HANDLE "BRH:$br_hit\n");
- }
-
- # Write line related data
- foreach $line (sort({$a <=> $b} keys(%{$testcount})))
- {
- print(INFO_HANDLE "DA:$line,".
- $testcount->{$line}.
- (defined($checkdata->{$line}) &&
- $checksum ?
- ",".$checkdata->{$line} : "")."\n");
- $found++;
- if ($testcount->{$line} > 0)
- {
- $hit++;
- }
-
- }
- print(INFO_HANDLE "LF:$found\n");
- print(INFO_HANDLE "LH:$hit\n");
- print(INFO_HANDLE "end_of_record\n");
- }
- }
-
- return ($ln_total_found, $ln_total_hit, $fn_total_found, $fn_total_hit,
- $br_total_found, $br_total_hit);
-}
-
-
-#
-# transform_pattern(pattern)
-#
-# Transform shell wildcard expression to equivalent Perl regular expression.
-# Return transformed pattern.
-#
-
-sub transform_pattern($)
-{
- my $pattern = $_[0];
-
- # Escape special chars
-
- $pattern =~ s/\\/\\\\/g;
- $pattern =~ s/\//\\\//g;
- $pattern =~ s/\^/\\\^/g;
- $pattern =~ s/\$/\\\$/g;
- $pattern =~ s/\(/\\\(/g;
- $pattern =~ s/\)/\\\)/g;
- $pattern =~ s/\[/\\\[/g;
- $pattern =~ s/\]/\\\]/g;
- $pattern =~ s/\{/\\\{/g;
- $pattern =~ s/\}/\\\}/g;
- $pattern =~ s/\./\\\./g;
- $pattern =~ s/\,/\\\,/g;
- $pattern =~ s/\|/\\\|/g;
- $pattern =~ s/\+/\\\+/g;
- $pattern =~ s/\!/\\\!/g;
-
- # Transform ? => (.) and * => (.*)
-
- $pattern =~ s/\*/\(\.\*\)/g;
- $pattern =~ s/\?/\(\.\)/g;
-
- return $pattern;
-}
-
-
-#
-# extract()
-#
-
-sub extract()
-{
- my $data = read_info_file($extract);
- my $filename;
- my $keep;
- my $pattern;
- my @pattern_list;
- my $extracted = 0;
- my @result;
- local *INFO_HANDLE;
-
- # Need perlreg expressions instead of shell pattern
- @pattern_list = map({ transform_pattern($_); } @ARGV);
-
- # Filter out files which do not match any pattern
- foreach $filename (sort(keys(%{$data})))
- {
- $keep = 0;
-
- foreach $pattern (@pattern_list)
- {
- $keep ||= ($filename =~ (/^$pattern$/));
- }
-
-
- if (!$keep)
- {
- delete($data->{$filename});
- }
- else
- {
- info("Extracting $filename\n"),
- $extracted++;
- }
- }
-
- # Write extracted data
- if ($to_file)
- {
- info("Extracted $extracted files\n");
- info("Writing data to $output_filename\n");
- open(INFO_HANDLE, ">", $output_filename)
- or die("ERROR: cannot write to $output_filename!\n");
- @result = write_info_file(*INFO_HANDLE, $data);
- close(*INFO_HANDLE);
- }
- else
- {
- @result = write_info_file(*STDOUT, $data);
- }
-
- return @result;
-}
-
-
-#
-# remove()
-#
-
-sub remove()
-{
- my $data = read_info_file($remove);
- my $filename;
- my $match_found;
- my $pattern;
- my @pattern_list;
- my $removed = 0;
- my @result;
- local *INFO_HANDLE;
-
- # Need perlreg expressions instead of shell pattern
- @pattern_list = map({ transform_pattern($_); } @ARGV);
-
- # Filter out files that match the pattern
- foreach $filename (sort(keys(%{$data})))
- {
- $match_found = 0;
-
- foreach $pattern (@pattern_list)
- {
- $match_found ||= ($filename =~ (/$pattern$/));
- }
-
-
- if ($match_found)
- {
- delete($data->{$filename});
- info("Removing $filename\n"),
- $removed++;
- }
- }
-
- # Write data
- if ($to_file)
- {
- info("Deleted $removed files\n");
- info("Writing data to $output_filename\n");
- open(INFO_HANDLE, ">", $output_filename)
- or die("ERROR: cannot write to $output_filename!\n");
- @result = write_info_file(*INFO_HANDLE, $data);
- close(*INFO_HANDLE);
- }
- else
- {
- @result = write_info_file(*STDOUT, $data);
- }
-
- return @result;
-}
-
-
-# get_prefix(max_width, max_percentage_too_long, path_list)
-#
-# Return a path prefix that satisfies the following requirements:
-# - is shared by more paths in path_list than any other prefix
-# - the percentage of paths which would exceed the given max_width length
-# after applying the prefix does not exceed max_percentage_too_long
-#
-# If multiple prefixes satisfy all requirements, the longest prefix is
-# returned. Return an empty string if no prefix could be found.
-
-sub get_prefix($$@)
-{
- my ($max_width, $max_long, @path_list) = @_;
- my $path;
- my $ENTRY_NUM = 0;
- my $ENTRY_LONG = 1;
- my %prefix;
-
- # Build prefix hash
- foreach $path (@path_list) {
- my ($v, $d, $f) = splitpath($path);
- my @dirs = splitdir($d);
- my $p_len = length($path);
- my $i;
-
- # Remove trailing '/'
- pop(@dirs) if ($dirs[scalar(@dirs) - 1] eq '');
- for ($i = 0; $i < scalar(@dirs); $i++) {
- my $subpath = catpath($v, catdir(@dirs[0..$i]), '');
- my $entry = $prefix{$subpath};
-
- $entry = [ 0, 0 ] if (!defined($entry));
- $entry->[$ENTRY_NUM]++;
- if (($p_len - length($subpath) - 1) > $max_width) {
- $entry->[$ENTRY_LONG]++;
- }
- $prefix{$subpath} = $entry;
- }
- }
- # Find suitable prefix (sort descending by two keys: 1. number of
- # entries covered by a prefix, 2. length of prefix)
- foreach $path (sort {($prefix{$a}->[$ENTRY_NUM] ==
- $prefix{$b}->[$ENTRY_NUM]) ?
- length($b) <=> length($a) :
- $prefix{$b}->[$ENTRY_NUM] <=>
- $prefix{$a}->[$ENTRY_NUM]}
- keys(%prefix)) {
- my ($num, $long) = @{$prefix{$path}};
-
- # Check for additional requirement: number of filenames
- # that would be too long may not exceed a certain percentage
- if ($long <= $num * $max_long / 100) {
- return $path;
- }
- }
-
- return "";
-}
-
-
-#
-# shorten_filename(filename, width)
-#
-# Truncate filename if it is longer than width characters.
-#
-
-sub shorten_filename($$)
-{
- my ($filename, $width) = @_;
- my $l = length($filename);
- my $s;
- my $e;
-
- return $filename if ($l <= $width);
- $e = int(($width - 3) / 2);
- $s = $width - 3 - $e;
-
- return substr($filename, 0, $s).'...'.substr($filename, $l - $e);
-}
-
-
-sub shorten_number($$)
-{
- my ($number, $width) = @_;
- my $result = sprintf("%*d", $width, $number);
-
- return $result if (length($result) <= $width);
- $number = $number / 1000;
- return $result if (length($result) <= $width);
- $result = sprintf("%*dk", $width - 1, $number);
- return $result if (length($result) <= $width);
- $number = $number / 1000;
- $result = sprintf("%*dM", $width - 1, $number);
- return $result if (length($result) <= $width);
- return '#';
-}
-
-sub shorten_rate($$$)
-{
- my ($hit, $found, $width) = @_;
- my $result = rate($hit, $found, "%", 1, $width);
-
- return $result if (length($result) <= $width);
- $result = rate($hit, $found, "%", 0, $width);
- return $result if (length($result) <= $width);
- return "#";
-}
-
-#
-# list()
-#
-
-sub list()
-{
- my $data = read_info_file($list);
- my $filename;
- my $found;
- my $hit;
- my $entry;
- my $fn_found;
- my $fn_hit;
- my $br_found;
- my $br_hit;
- my $total_found = 0;
- my $total_hit = 0;
- my $fn_total_found = 0;
- my $fn_total_hit = 0;
- my $br_total_found = 0;
- my $br_total_hit = 0;
- my $prefix;
- my $strlen = length("Filename");
- my $format;
- my $heading1;
- my $heading2;
- my @footer;
- my $barlen;
- my $rate;
- my $fnrate;
- my $brrate;
- my $lastpath;
- my $F_LN_NUM = 0;
- my $F_LN_RATE = 1;
- my $F_FN_NUM = 2;
- my $F_FN_RATE = 3;
- my $F_BR_NUM = 4;
- my $F_BR_RATE = 5;
- my @fwidth_narrow = (5, 5, 3, 5, 4, 5);
- my @fwidth_wide = (6, 5, 5, 5, 6, 5);
- my @fwidth = @fwidth_wide;
- my $w;
- my $max_width = $opt_list_width;
- my $max_long = $opt_list_truncate_max;
- my $fwidth_narrow_length;
- my $fwidth_wide_length;
- my $got_prefix = 0;
- my $root_prefix = 0;
-
- # Calculate total width of narrow fields
- $fwidth_narrow_length = 0;
- foreach $w (@fwidth_narrow) {
- $fwidth_narrow_length += $w + 1;
- }
- # Calculate total width of wide fields
- $fwidth_wide_length = 0;
- foreach $w (@fwidth_wide) {
- $fwidth_wide_length += $w + 1;
- }
- # Get common file path prefix
- $prefix = get_prefix($max_width - $fwidth_narrow_length, $max_long,
- keys(%{$data}));
- $root_prefix = 1 if ($prefix eq rootdir());
- $got_prefix = 1 if (length($prefix) > 0);
- $prefix =~ s/\/$//;
- # Get longest filename length
- foreach $filename (keys(%{$data})) {
- if (!$opt_list_full_path) {
- if (!$got_prefix || !$root_prefix &&
- !($filename =~ s/^\Q$prefix\/\E//)) {
- my ($v, $d, $f) = splitpath($filename);
-
- $filename = $f;
- }
- }
- # Determine maximum length of entries
- if (length($filename) > $strlen) {
- $strlen = length($filename)
- }
- }
- if (!$opt_list_full_path) {
- my $blanks;
-
- $w = $fwidth_wide_length;
- # Check if all columns fit into max_width characters
- if ($strlen + $fwidth_wide_length > $max_width) {
- # Use narrow fields
- @fwidth = @fwidth_narrow;
- $w = $fwidth_narrow_length;
- if (($strlen + $fwidth_narrow_length) > $max_width) {
- # Truncate filenames at max width
- $strlen = $max_width - $fwidth_narrow_length;
- }
- }
- # Add some blanks between filename and fields if possible
- $blanks = int($strlen * 0.5);
- $blanks = 4 if ($blanks < 4);
- $blanks = 8 if ($blanks > 8);
- if (($strlen + $w + $blanks) < $max_width) {
- $strlen += $blanks;
- } else {
- $strlen = $max_width - $w;
- }
- }
- # Filename
- $w = $strlen;
- $format = "%-${w}s|";
- $heading1 = sprintf("%*s|", $w, "");
- $heading2 = sprintf("%-*s|", $w, "Filename");
- $barlen = $w + 1;
- # Line coverage rate
- $w = $fwidth[$F_LN_RATE];
- $format .= "%${w}s ";
- $heading1 .= sprintf("%-*s |", $w + $fwidth[$F_LN_NUM],
- "Lines");
- $heading2 .= sprintf("%-*s ", $w, "Rate");
- $barlen += $w + 1;
- # Number of lines
- $w = $fwidth[$F_LN_NUM];
- $format .= "%${w}s|";
- $heading2 .= sprintf("%*s|", $w, "Num");
- $barlen += $w + 1;
- # Function coverage rate
- $w = $fwidth[$F_FN_RATE];
- $format .= "%${w}s ";
- $heading1 .= sprintf("%-*s|", $w + $fwidth[$F_FN_NUM] + 1,
- "Functions");
- $heading2 .= sprintf("%-*s ", $w, "Rate");
- $barlen += $w + 1;
- # Number of functions
- $w = $fwidth[$F_FN_NUM];
- $format .= "%${w}s|";
- $heading2 .= sprintf("%*s|", $w, "Num");
- $barlen += $w + 1;
- # Branch coverage rate
- $w = $fwidth[$F_BR_RATE];
- $format .= "%${w}s ";
- $heading1 .= sprintf("%-*s", $w + $fwidth[$F_BR_NUM] + 1,
- "Branches");
- $heading2 .= sprintf("%-*s ", $w, "Rate");
- $barlen += $w + 1;
- # Number of branches
- $w = $fwidth[$F_BR_NUM];
- $format .= "%${w}s";
- $heading2 .= sprintf("%*s", $w, "Num");
- $barlen += $w;
- # Line end
- $format .= "\n";
- $heading1 .= "\n";
- $heading2 .= "\n";
-
- # Print heading
- print($heading1);
- print($heading2);
- print(("="x$barlen)."\n");
-
- # Print per file information
- foreach $filename (sort(keys(%{$data})))
- {
- my @file_data;
- my $print_filename = $filename;
-
- $entry = $data->{$filename};
- if (!$opt_list_full_path) {
- my $p;
-
- $print_filename = $filename;
- if (!$got_prefix || !$root_prefix &&
- !($print_filename =~ s/^\Q$prefix\/\E//)) {
- my ($v, $d, $f) = splitpath($filename);
-
- $p = catpath($v, $d, "");
- $p =~ s/\/$//;
- $print_filename = $f;
- } else {
- $p = $prefix;
- }
-
- if (!defined($lastpath) || $lastpath ne $p) {
- print("\n") if (defined($lastpath));
- $lastpath = $p;
- print("[$lastpath/]\n") if (!$root_prefix);
- }
- $print_filename = shorten_filename($print_filename,
- $strlen);
- }
-
- (undef, undef, undef, undef, undef, undef, undef, undef,
- $found, $hit, $fn_found, $fn_hit, $br_found, $br_hit) =
- get_info_entry($entry);
-
- # Assume zero count if there is no function data for this file
- if (!defined($fn_found) || !defined($fn_hit)) {
- $fn_found = 0;
- $fn_hit = 0;
- }
- # Assume zero count if there is no branch data for this file
- if (!defined($br_found) || !defined($br_hit)) {
- $br_found = 0;
- $br_hit = 0;
- }
-
- # Add line coverage totals
- $total_found += $found;
- $total_hit += $hit;
- # Add function coverage totals
- $fn_total_found += $fn_found;
- $fn_total_hit += $fn_hit;
- # Add branch coverage totals
- $br_total_found += $br_found;
- $br_total_hit += $br_hit;
-
- # Determine line coverage rate for this file
- $rate = shorten_rate($hit, $found, $fwidth[$F_LN_RATE]);
- # Determine function coverage rate for this file
- $fnrate = shorten_rate($fn_hit, $fn_found, $fwidth[$F_FN_RATE]);
- # Determine branch coverage rate for this file
- $brrate = shorten_rate($br_hit, $br_found, $fwidth[$F_BR_RATE]);
-
- # Assemble line parameters
- push(@file_data, $print_filename);
- push(@file_data, $rate);
- push(@file_data, shorten_number($found, $fwidth[$F_LN_NUM]));
- push(@file_data, $fnrate);
- push(@file_data, shorten_number($fn_found, $fwidth[$F_FN_NUM]));
- push(@file_data, $brrate);
- push(@file_data, shorten_number($br_found, $fwidth[$F_BR_NUM]));
-
- # Print assembled line
- printf($format, @file_data);
- }
-
- # Determine total line coverage rate
- $rate = shorten_rate($total_hit, $total_found, $fwidth[$F_LN_RATE]);
- # Determine total function coverage rate
- $fnrate = shorten_rate($fn_total_hit, $fn_total_found,
- $fwidth[$F_FN_RATE]);
- # Determine total branch coverage rate
- $brrate = shorten_rate($br_total_hit, $br_total_found,
- $fwidth[$F_BR_RATE]);
-
- # Print separator
- print(("="x$barlen)."\n");
-
- # Assemble line parameters
- push(@footer, sprintf("%*s", $strlen, "Total:"));
- push(@footer, $rate);
- push(@footer, shorten_number($total_found, $fwidth[$F_LN_NUM]));
- push(@footer, $fnrate);
- push(@footer, shorten_number($fn_total_found, $fwidth[$F_FN_NUM]));
- push(@footer, $brrate);
- push(@footer, shorten_number($br_total_found, $fwidth[$F_BR_NUM]));
-
- # Print assembled line
- printf($format, @footer);
-}
-
-
-#
-# get_common_filename(filename1, filename2)
-#
-# Check for filename components which are common to FILENAME1 and FILENAME2.
-# Upon success, return
-#
-# (common, path1, path2)
-#
-# or 'undef' in case there are no such parts.
-#
-
-sub get_common_filename($$)
-{
- my @list1 = split("/", $_[0]);
- my @list2 = split("/", $_[1]);
- my @result;
-
- # Work in reverse order, i.e. beginning with the filename itself
- while (@list1 && @list2 && ($list1[$#list1] eq $list2[$#list2]))
- {
- unshift(@result, pop(@list1));
- pop(@list2);
- }
-
- # Did we find any similarities?
- if (scalar(@result) > 0)
- {
- return (join("/", @result), join("/", @list1),
- join("/", @list2));
- }
- else
- {
- return undef;
- }
-}
-
-
-#
-# strip_directories($path, $depth)
-#
-# Remove DEPTH leading directory levels from PATH.
-#
-
-sub strip_directories($$)
-{
- my $filename = $_[0];
- my $depth = $_[1];
- my $i;
-
- if (!defined($depth) || ($depth < 1))
- {
- return $filename;
- }
- for ($i = 0; $i < $depth; $i++)
- {
- $filename =~ s/^[^\/]*\/+(.*)$/$1/;
- }
- return $filename;
-}
-
-
-#
-# read_diff(filename)
-#
-# Read diff output from FILENAME to memory. The diff file has to follow the
-# format generated by 'diff -u'. Returns a list of hash references:
-#
-# (mapping, path mapping)
-#
-# mapping: filename -> reference to line hash
-# line hash: line number in new file -> corresponding line number in old file
-#
-# path mapping: filename -> old filename
-#
-# Die in case of error.
-#
-
-sub read_diff($)
-{
- my $diff_file = $_[0]; # Name of diff file
- my %diff; # Resulting mapping filename -> line hash
- my %paths; # Resulting mapping old path -> new path
- my $mapping; # Reference to current line hash
- my $line; # Contents of current line
- my $num_old; # Current line number in old file
- my $num_new; # Current line number in new file
- my $file_old; # Name of old file in diff section
- my $file_new; # Name of new file in diff section
- my $filename; # Name of common filename of diff section
- my $in_block = 0; # Non-zero while we are inside a diff block
- local *HANDLE; # File handle for reading the diff file
-
- info("Reading diff $diff_file\n");
-
- # Check if file exists and is readable
- stat($diff_file);
- if (!(-r _))
- {
- die("ERROR: cannot read file $diff_file!\n");
- }
-
- # Check if this is really a plain file
- if (!(-f _))
- {
- die("ERROR: not a plain file: $diff_file!\n");
- }
-
- # Check for .gz extension
- if ($diff_file =~ /\.gz$/)
- {
- # Check for availability of GZIP tool
- system_no_output(1, "gunzip", "-h")
- and die("ERROR: gunzip command not available!\n");
-
- # Check integrity of compressed file
- system_no_output(1, "gunzip", "-t", $diff_file)
- and die("ERROR: integrity check failed for ".
- "compressed file $diff_file!\n");
-
- # Open compressed file
- open(HANDLE, "-|", "gunzip -c '$diff_file'")
- or die("ERROR: cannot start gunzip to decompress ".
- "file $_[0]!\n");
- }
- else
- {
- # Open decompressed file
- open(HANDLE, "<", $diff_file)
- or die("ERROR: cannot read file $_[0]!\n");
- }
-
- # Parse diff file line by line
- while (<HANDLE>)
- {
- chomp($_);
- $line = $_;
-
- foreach ($line)
- {
- # Filename of old file:
- # --- <filename> <date>
- /^--- (\S+)/ && do
- {
- $file_old = strip_directories($1, $strip);
- last;
- };
- # Filename of new file:
- # +++ <filename> <date>
- /^\+\+\+ (\S+)/ && do
- {
- # Add last file to resulting hash
- if ($filename)
- {
- my %new_hash;
- $diff{$filename} = $mapping;
- $mapping = \%new_hash;
- }
- $file_new = strip_directories($1, $strip);
- $filename = $file_old;
- $paths{$filename} = $file_new;
- $num_old = 1;
- $num_new = 1;
- last;
- };
- # Start of diff block:
- # @@ -old_start,old_num, +new_start,new_num @@
- /^\@\@\s+-(\d+),(\d+)\s+\+(\d+),(\d+)\s+\@\@$/ && do
- {
- $in_block = 1;
- while ($num_old < $1)
- {
- $mapping->{$num_new} = $num_old;
- $num_old++;
- $num_new++;
- }
- last;
- };
- # Unchanged line
- # <line starts with blank>
- /^ / && do
- {
- if ($in_block == 0)
- {
- last;
- }
- $mapping->{$num_new} = $num_old;
- $num_old++;
- $num_new++;
- last;
- };
- # Line as seen in old file
- # <line starts with '-'>
- /^-/ && do
- {
- if ($in_block == 0)
- {
- last;
- }
- $num_old++;
- last;
- };
- # Line as seen in new file
- # <line starts with '+'>
- /^\+/ && do
- {
- if ($in_block == 0)
- {
- last;
- }
- $num_new++;
- last;
- };
- # Empty line
- /^$/ && do
- {
- if ($in_block == 0)
- {
- last;
- }
- $mapping->{$num_new} = $num_old;
- $num_old++;
- $num_new++;
- last;
- };
- }
- }
-
- close(HANDLE);
-
- # Add final diff file section to resulting hash
- if ($filename)
- {
- $diff{$filename} = $mapping;
- }
-
- if (!%diff)
- {
- die("ERROR: no valid diff data found in $diff_file!\n".
- "Make sure to use 'diff -u' when generating the diff ".
- "file.\n");
- }
- return (\%diff, \%paths);
-}
-
-
-#
-# apply_diff($count_data, $line_hash)
-#
-# Transform count data using a mapping of lines:
-#
-# $count_data: reference to hash: line number -> data
-# $line_hash: reference to hash: line number new -> line number old
-#
-# Return a reference to transformed count data.
-#
-
-sub apply_diff($$)
-{
- my $count_data = $_[0]; # Reference to data hash: line -> hash
- my $line_hash = $_[1]; # Reference to line hash: new line -> old line
- my %result; # Resulting hash
- my $last_new = 0; # Last new line number found in line hash
- my $last_old = 0; # Last old line number found in line hash
-
- # Iterate all new line numbers found in the diff
- foreach (sort({$a <=> $b} keys(%{$line_hash})))
- {
- $last_new = $_;
- $last_old = $line_hash->{$last_new};
-
- # Is there data associated with the corresponding old line?
- if (defined($count_data->{$line_hash->{$_}}))
- {
- # Copy data to new hash with a new line number
- $result{$_} = $count_data->{$line_hash->{$_}};
- }
- }
- # Transform all other lines which come after the last diff entry
- foreach (sort({$a <=> $b} keys(%{$count_data})))
- {
- if ($_ <= $last_old)
- {
- # Skip lines which were covered by line hash
- next;
- }
- # Copy data to new hash with an offset
- $result{$_ + ($last_new - $last_old)} = $count_data->{$_};
- }
-
- return \%result;
-}
-
-
-#
-# apply_diff_to_brcount(brcount, linedata)
-#
-# Adjust line numbers of branch coverage data according to linedata.
-#
-
-sub apply_diff_to_brcount($$)
-{
- my ($brcount, $linedata) = @_;
- my $db;
-
- # Convert brcount to db format
- $db = brcount_to_db($brcount);
- # Apply diff to db format
- $db = apply_diff($db, $linedata);
- # Convert db format back to brcount format
- ($brcount) = db_to_brcount($db);
-
- return $brcount;
-}
-
-
-#
-# get_hash_max(hash_ref)
-#
-# Return the highest integer key from hash.
-#
-
-sub get_hash_max($)
-{
- my ($hash) = @_;
- my $max;
-
- foreach (keys(%{$hash})) {
- if (!defined($max)) {
- $max = $_;
- } elsif ($hash->{$_} > $max) {
- $max = $_;
- }
- }
- return $max;
-}
-
-sub get_hash_reverse($)
-{
- my ($hash) = @_;
- my %result;
-
- foreach (keys(%{$hash})) {
- $result{$hash->{$_}} = $_;
- }
-
- return \%result;
-}
-
-#
-# apply_diff_to_funcdata(funcdata, line_hash)
-#
-
-sub apply_diff_to_funcdata($$)
-{
- my ($funcdata, $linedata) = @_;
- my $last_new = get_hash_max($linedata);
- my $last_old = $linedata->{$last_new};
- my $func;
- my %result;
- my $line_diff = get_hash_reverse($linedata);
-
- foreach $func (keys(%{$funcdata})) {
- my $line = $funcdata->{$func};
-
- if (defined($line_diff->{$line})) {
- $result{$func} = $line_diff->{$line};
- } elsif ($line > $last_old) {
- $result{$func} = $line + $last_new - $last_old;
- }
- }
-
- return \%result;
-}
-
-
-#
-# get_line_hash($filename, $diff_data, $path_data)
-#
-# Find line hash in DIFF_DATA which matches FILENAME. On success, return list
-# line hash. or undef in case of no match. Die if more than one line hashes in
-# DIFF_DATA match.
-#
-
-sub get_line_hash($$$)
-{
- my $filename = $_[0];
- my $diff_data = $_[1];
- my $path_data = $_[2];
- my $conversion;
- my $old_path;
- my $new_path;
- my $diff_name;
- my $common;
- my $old_depth;
- my $new_depth;
-
- # Remove trailing slash from diff path
- $diff_path =~ s/\/$//;
- foreach (keys(%{$diff_data}))
- {
- my $sep = "";
-
- $sep = '/' if (!/^\//);
-
- # Try to match diff filename with filename
- if ($filename =~ /^\Q$diff_path$sep$_\E$/)
- {
- if ($diff_name)
- {
- # Two files match, choose the more specific one
- # (the one with more path components)
- $old_depth = ($diff_name =~ tr/\///);
- $new_depth = (tr/\///);
- if ($old_depth == $new_depth)
- {
- die("ERROR: diff file contains ".
- "ambiguous entries for ".
- "$filename\n");
- }
- elsif ($new_depth > $old_depth)
- {
- $diff_name = $_;
- }
- }
- else
- {
- $diff_name = $_;
- }
- };
- }
- if ($diff_name)
- {
- # Get converted path
- if ($filename =~ /^(.*)$diff_name$/)
- {
- ($common, $old_path, $new_path) =
- get_common_filename($filename,
- $1.$path_data->{$diff_name});
- }
- return ($diff_data->{$diff_name}, $old_path, $new_path);
- }
- else
- {
- return undef;
- }
-}
-
-
-#
-# convert_paths(trace_data, path_conversion_data)
-#
-# Rename all paths in TRACE_DATA which show up in PATH_CONVERSION_DATA.
-#
-
-sub convert_paths($$)
-{
- my $trace_data = $_[0];
- my $path_conversion_data = $_[1];
- my $filename;
- my $new_path;
-
- if (scalar(keys(%{$path_conversion_data})) == 0)
- {
- info("No path conversion data available.\n");
- return;
- }
-
- # Expand path conversion list
- foreach $filename (keys(%{$path_conversion_data}))
- {
- $new_path = $path_conversion_data->{$filename};
- while (($filename =~ s/^(.*)\/[^\/]+$/$1/) &&
- ($new_path =~ s/^(.*)\/[^\/]+$/$1/) &&
- ($filename ne $new_path))
- {
- $path_conversion_data->{$filename} = $new_path;
- }
- }
-
- # Adjust paths
- FILENAME: foreach $filename (keys(%{$trace_data}))
- {
- # Find a path in our conversion table that matches, starting
- # with the longest path
- foreach (sort({length($b) <=> length($a)}
- keys(%{$path_conversion_data})))
- {
- # Is this path a prefix of our filename?
- if (!($filename =~ /^$_(.*)$/))
- {
- next;
- }
- $new_path = $path_conversion_data->{$_}.$1;
-
- # Make sure not to overwrite an existing entry under
- # that path name
- if ($trace_data->{$new_path})
- {
- # Need to combine entries
- $trace_data->{$new_path} =
- combine_info_entries(
- $trace_data->{$filename},
- $trace_data->{$new_path},
- $filename);
- }
- else
- {
- # Simply rename entry
- $trace_data->{$new_path} =
- $trace_data->{$filename};
- }
- delete($trace_data->{$filename});
- next FILENAME;
- }
- info("No conversion available for filename $filename\n");
- }
-}
-
-#
-# sub adjust_fncdata(funcdata, testfncdata, sumfnccount)
-#
-# Remove function call count data from testfncdata and sumfnccount which
-# is no longer present in funcdata.
-#
-
-sub adjust_fncdata($$$)
-{
- my ($funcdata, $testfncdata, $sumfnccount) = @_;
- my $testname;
- my $func;
- my $f_found;
- my $f_hit;
-
- # Remove count data in testfncdata for functions which are no longer
- # in funcdata
- foreach $testname (%{$testfncdata}) {
- my $fnccount = $testfncdata->{$testname};
-
- foreach $func (%{$fnccount}) {
- if (!defined($funcdata->{$func})) {
- delete($fnccount->{$func});
- }
- }
- }
- # Remove count data in sumfnccount for functions which are no longer
- # in funcdata
- foreach $func (%{$sumfnccount}) {
- if (!defined($funcdata->{$func})) {
- delete($sumfnccount->{$func});
- }
- }
-}
-
-#
-# get_func_found_and_hit(sumfnccount)
-#
-# Return (f_found, f_hit) for sumfnccount
-#
-
-sub get_func_found_and_hit($)
-{
- my ($sumfnccount) = @_;
- my $function;
- my $f_found;
- my $f_hit;
-
- $f_found = scalar(keys(%{$sumfnccount}));
- $f_hit = 0;
- foreach $function (keys(%{$sumfnccount})) {
- if ($sumfnccount->{$function} > 0) {
- $f_hit++;
- }
- }
- return ($f_found, $f_hit);
-}
-
-#
-# diff()
-#
-
-sub diff()
-{
- my $trace_data = read_info_file($diff);
- my $diff_data;
- my $path_data;
- my $old_path;
- my $new_path;
- my %path_conversion_data;
- my $filename;
- my $line_hash;
- my $new_name;
- my $entry;
- my $testdata;
- my $testname;
- my $sumcount;
- my $funcdata;
- my $checkdata;
- my $testfncdata;
- my $sumfnccount;
- my $testbrdata;
- my $sumbrcount;
- my $found;
- my $hit;
- my $f_found;
- my $f_hit;
- my $br_found;
- my $br_hit;
- my $converted = 0;
- my $unchanged = 0;
- my @result;
- local *INFO_HANDLE;
-
- ($diff_data, $path_data) = read_diff($ARGV[0]);
-
- foreach $filename (sort(keys(%{$trace_data})))
- {
- # Find a diff section corresponding to this file
- ($line_hash, $old_path, $new_path) =
- get_line_hash($filename, $diff_data, $path_data);
- if (!$line_hash)
- {
- # There's no diff section for this file
- $unchanged++;
- next;
- }
- $converted++;
- if ($old_path && $new_path && ($old_path ne $new_path))
- {
- $path_conversion_data{$old_path} = $new_path;
- }
- # Check for deleted files
- if (scalar(keys(%{$line_hash})) == 0)
- {
- info("Removing $filename\n");
- delete($trace_data->{$filename});
- next;
- }
- info("Converting $filename\n");
- $entry = $trace_data->{$filename};
- ($testdata, $sumcount, $funcdata, $checkdata, $testfncdata,
- $sumfnccount, $testbrdata, $sumbrcount) =
- get_info_entry($entry);
- # Convert test data
- foreach $testname (keys(%{$testdata}))
- {
- # Adjust line numbers of line coverage data
- $testdata->{$testname} =
- apply_diff($testdata->{$testname}, $line_hash);
- # Adjust line numbers of branch coverage data
- $testbrdata->{$testname} =
- apply_diff_to_brcount($testbrdata->{$testname},
- $line_hash);
- # Remove empty sets of test data
- if (scalar(keys(%{$testdata->{$testname}})) == 0)
- {
- delete($testdata->{$testname});
- delete($testfncdata->{$testname});
- delete($testbrdata->{$testname});
- }
- }
- # Rename test data to indicate conversion
- foreach $testname (keys(%{$testdata}))
- {
- # Skip testnames which already contain an extension
- if ($testname =~ /,[^,]+$/)
- {
- next;
- }
- # Check for name conflict
- if (defined($testdata->{$testname.",diff"}))
- {
- # Add counts
- ($testdata->{$testname}) = add_counts(
- $testdata->{$testname},
- $testdata->{$testname.",diff"});
- delete($testdata->{$testname.",diff"});
- # Add function call counts
- ($testfncdata->{$testname}) = add_fnccount(
- $testfncdata->{$testname},
- $testfncdata->{$testname.",diff"});
- delete($testfncdata->{$testname.",diff"});
- # Add branch counts
- ($testbrdata->{$testname}) = combine_brcount(
- $testbrdata->{$testname},
- $testbrdata->{$testname.",diff"},
- $BR_ADD);
- delete($testbrdata->{$testname.",diff"});
- }
- # Move test data to new testname
- $testdata->{$testname.",diff"} = $testdata->{$testname};
- delete($testdata->{$testname});
- # Move function call count data to new testname
- $testfncdata->{$testname.",diff"} =
- $testfncdata->{$testname};
- delete($testfncdata->{$testname});
- # Move branch count data to new testname
- $testbrdata->{$testname.",diff"} =
- $testbrdata->{$testname};
- delete($testbrdata->{$testname});
- }
- # Convert summary of test data
- $sumcount = apply_diff($sumcount, $line_hash);
- # Convert function data
- $funcdata = apply_diff_to_funcdata($funcdata, $line_hash);
- # Convert branch coverage data
- $sumbrcount = apply_diff_to_brcount($sumbrcount, $line_hash);
- # Update found/hit numbers
- # Convert checksum data
- $checkdata = apply_diff($checkdata, $line_hash);
- # Convert function call count data
- adjust_fncdata($funcdata, $testfncdata, $sumfnccount);
- ($f_found, $f_hit) = get_func_found_and_hit($sumfnccount);
- ($br_found, $br_hit) = get_br_found_and_hit($sumbrcount);
- # Update found/hit numbers
- $found = 0;
- $hit = 0;
- foreach (keys(%{$sumcount}))
- {
- $found++;
- if ($sumcount->{$_} > 0)
- {
- $hit++;
- }
- }
- if ($found > 0)
- {
- # Store converted entry
- set_info_entry($entry, $testdata, $sumcount, $funcdata,
- $checkdata, $testfncdata, $sumfnccount,
- $testbrdata, $sumbrcount, $found, $hit,
- $f_found, $f_hit, $br_found, $br_hit);
- }
- else
- {
- # Remove empty data set
- delete($trace_data->{$filename});
- }
- }
-
- # Convert filenames as well if requested
- if ($convert_filenames)
- {
- convert_paths($trace_data, \%path_conversion_data);
- }
-
- info("$converted entr".($converted != 1 ? "ies" : "y")." converted, ".
- "$unchanged entr".($unchanged != 1 ? "ies" : "y")." left ".
- "unchanged.\n");
-
- # Write data
- if ($to_file)
- {
- info("Writing data to $output_filename\n");
- open(INFO_HANDLE, ">", $output_filename)
- or die("ERROR: cannot write to $output_filename!\n");
- @result = write_info_file(*INFO_HANDLE, $trace_data);
- close(*INFO_HANDLE);
- }
- else
- {
- @result = write_info_file(*STDOUT, $trace_data);
- }
-
- return @result;
-}
-
-#
-# summary()
-#
-
-sub summary()
-{
- my $filename;
- my $current;
- my $total;
- my $ln_total_found;
- my $ln_total_hit;
- my $fn_total_found;
- my $fn_total_hit;
- my $br_total_found;
- my $br_total_hit;
-
- # Read and combine trace files
- foreach $filename (@opt_summary) {
- $current = read_info_file($filename);
- if (!defined($total)) {
- $total = $current;
- } else {
- $total = combine_info_files($total, $current);
- }
- }
- # Calculate coverage data
- foreach $filename (keys(%{$total}))
- {
- my $entry = $total->{$filename};
- my $ln_found;
- my $ln_hit;
- my $fn_found;
- my $fn_hit;
- my $br_found;
- my $br_hit;
-
- (undef, undef, undef, undef, undef, undef, undef, undef,
- $ln_found, $ln_hit, $fn_found, $fn_hit, $br_found,
- $br_hit) = get_info_entry($entry);
-
- # Add to totals
- $ln_total_found += $ln_found;
- $ln_total_hit += $ln_hit;
- $fn_total_found += $fn_found;
- $fn_total_hit += $fn_hit;
- $br_total_found += $br_found;
- $br_total_hit += $br_hit;
- }
-
-
- return ($ln_total_found, $ln_total_hit, $fn_total_found, $fn_total_hit,
- $br_total_found, $br_total_hit);
-}
-
-#
-# system_no_output(mode, parameters)
-#
-# Call an external program using PARAMETERS while suppressing depending on
-# the value of MODE:
-#
-# MODE & 1: suppress STDOUT
-# MODE & 2: suppress STDERR
-#
-# Return 0 on success, non-zero otherwise.
-#
-
-sub system_no_output($@)
-{
- my $mode = shift;
- my $result;
- local *OLD_STDERR;
- local *OLD_STDOUT;
-
- # Save old stdout and stderr handles
- ($mode & 1) && open(OLD_STDOUT, ">>&", "STDOUT");
- ($mode & 2) && open(OLD_STDERR, ">>&", "STDERR");
-
- # Redirect to /dev/null
- ($mode & 1) && open(STDOUT, ">", "/dev/null");
- ($mode & 2) && open(STDERR, ">", "/dev/null");
-
- system(@_);
- $result = $?;
-
- # Close redirected handles
- ($mode & 1) && close(STDOUT);
- ($mode & 2) && close(STDERR);
-
- # Restore old handles
- ($mode & 1) && open(STDOUT, ">>&", "OLD_STDOUT");
- ($mode & 2) && open(STDERR, ">>&", "OLD_STDERR");
-
- return $result;
-}
-
-
-#
-# read_config(filename)
-#
-# Read configuration file FILENAME and return a reference to a hash containing
-# all valid key=value pairs found.
-#
-
-sub read_config($)
-{
- my $filename = $_[0];
- my %result;
- my $key;
- my $value;
- local *HANDLE;
-
- if (!open(HANDLE, "<", $filename))
- {
- warn("WARNING: cannot read configuration file $filename\n");
- return undef;
- }
- while (<HANDLE>)
- {
- chomp;
- # Skip comments
- s/#.*//;
- # Remove leading blanks
- s/^\s+//;
- # Remove trailing blanks
- s/\s+$//;
- next unless length;
- ($key, $value) = split(/\s*=\s*/, $_, 2);
- if (defined($key) && defined($value))
- {
- $result{$key} = $value;
- }
- else
- {
- warn("WARNING: malformed statement in line $. ".
- "of configuration file $filename\n");
- }
- }
- close(HANDLE);
- return \%result;
-}
-
-
-#
-# apply_config(REF)
-#
-# REF is a reference to a hash containing the following mapping:
-#
-# key_string => var_ref
-#
-# where KEY_STRING is a keyword and VAR_REF is a reference to an associated
-# variable. If the global configuration hashes CONFIG or OPT_RC contain a value
-# for keyword KEY_STRING, VAR_REF will be assigned the value for that keyword.
-#
-
-sub apply_config($)
-{
- my $ref = $_[0];
-
- foreach (keys(%{$ref}))
- {
- if (defined($opt_rc{$_})) {
- ${$ref->{$_}} = $opt_rc{$_};
- } elsif (defined($config->{$_})) {
- ${$ref->{$_}} = $config->{$_};
- }
- }
-}
-
-sub warn_handler($)
-{
- my ($msg) = @_;
-
- temp_cleanup();
- warn("$tool_name: $msg");
-}
-
-sub die_handler($)
-{
- my ($msg) = @_;
-
- temp_cleanup();
- die("$tool_name: $msg");
-}
-
-sub abort_handler($)
-{
- temp_cleanup();
- exit(1);
-}
-
-sub temp_cleanup()
-{
- if (@temp_dirs) {
- info("Removing temporary directories.\n");
- foreach (@temp_dirs) {
- rmtree($_);
- }
- @temp_dirs = ();
- }
-}
-
-sub setup_gkv_sys()
-{
- system_no_output(3, "mount", "-t", "debugfs", "nodev",
- "/sys/kernel/debug");
-}
-
-sub setup_gkv_proc()
-{
- if (system_no_output(3, "modprobe", "gcov_proc")) {
- system_no_output(3, "modprobe", "gcov_prof");
- }
-}
-
-sub check_gkv_sys($)
-{
- my ($dir) = @_;
-
- if (-e "$dir/reset") {
- return 1;
- }
- return 0;
-}
-
-sub check_gkv_proc($)
-{
- my ($dir) = @_;
-
- if (-e "$dir/vmlinux") {
- return 1;
- }
- return 0;
-}
-
-sub setup_gkv()
-{
- my $dir;
- my $sys_dir = "/sys/kernel/debug/gcov";
- my $proc_dir = "/proc/gcov";
- my @todo;
-
- if (!defined($gcov_dir)) {
- info("Auto-detecting gcov kernel support.\n");
- @todo = ( "cs", "cp", "ss", "cs", "sp", "cp" );
- } elsif ($gcov_dir =~ /proc/) {
- info("Checking gcov kernel support at $gcov_dir ".
- "(user-specified).\n");
- @todo = ( "cp", "sp", "cp", "cs", "ss", "cs");
- } else {
- info("Checking gcov kernel support at $gcov_dir ".
- "(user-specified).\n");
- @todo = ( "cs", "ss", "cs", "cp", "sp", "cp", );
- }
- foreach (@todo) {
- if ($_ eq "cs") {
- # Check /sys
- $dir = defined($gcov_dir) ? $gcov_dir : $sys_dir;
- if (check_gkv_sys($dir)) {
- info("Found ".$GKV_NAME[$GKV_SYS]." gcov ".
- "kernel support at $dir\n");
- return ($GKV_SYS, $dir);
- }
- } elsif ($_ eq "cp") {
- # Check /proc
- $dir = defined($gcov_dir) ? $gcov_dir : $proc_dir;
- if (check_gkv_proc($dir)) {
- info("Found ".$GKV_NAME[$GKV_PROC]." gcov ".
- "kernel support at $dir\n");
- return ($GKV_PROC, $dir);
- }
- } elsif ($_ eq "ss") {
- # Setup /sys
- setup_gkv_sys();
- } elsif ($_ eq "sp") {
- # Setup /proc
- setup_gkv_proc();
- }
- }
- if (defined($gcov_dir)) {
- die("ERROR: could not find gcov kernel data at $gcov_dir\n");
- } else {
- die("ERROR: no gcov kernel data found\n");
- }
-}
-
-
-#
-# get_overall_line(found, hit, name_singular, name_plural)
-#
-# Return a string containing overall information for the specified
-# found/hit data.
-#
-
-sub get_overall_line($$$$)
-{
- my ($found, $hit, $name_sn, $name_pl) = @_;
- my $name;
-
- return "no data found" if (!defined($found) || $found == 0);
- $name = ($found == 1) ? $name_sn : $name_pl;
-
- return rate($hit, $found, "% ($hit of $found $name)");
-}
-
-
-#
-# print_overall_rate(ln_do, ln_found, ln_hit, fn_do, fn_found, fn_hit, br_do
-# br_found, br_hit)
-#
-# Print overall coverage rates for the specified coverage types.
-#
-
-sub print_overall_rate($$$$$$$$$)
-{
- my ($ln_do, $ln_found, $ln_hit, $fn_do, $fn_found, $fn_hit,
- $br_do, $br_found, $br_hit) = @_;
-
- info("Summary coverage rate:\n");
- info(" lines......: %s\n",
- get_overall_line($ln_found, $ln_hit, "line", "lines"))
- if ($ln_do);
- info(" functions..: %s\n",
- get_overall_line($fn_found, $fn_hit, "function", "functions"))
- if ($fn_do);
- info(" branches...: %s\n",
- get_overall_line($br_found, $br_hit, "branch", "branches"))
- if ($br_do);
-}
-
-
-#
-# rate(hit, found[, suffix, precision, width])
-#
-# Return the coverage rate [0..100] for HIT and FOUND values. 0 is only
-# returned when HIT is 0. 100 is only returned when HIT equals FOUND.
-# PRECISION specifies the precision of the result. SUFFIX defines a
-# string that is appended to the result if FOUND is non-zero. Spaces
-# are added to the start of the resulting string until it is at least WIDTH
-# characters wide.
-#
-
-sub rate($$;$$$)
-{
- my ($hit, $found, $suffix, $precision, $width) = @_;
- my $rate;
-
- # Assign defaults if necessary
- $precision = 1 if (!defined($precision));
- $suffix = "" if (!defined($suffix));
- $width = 0 if (!defined($width));
-
- return sprintf("%*s", $width, "-") if (!defined($found) || $found == 0);
- $rate = sprintf("%.*f", $precision, $hit * 100 / $found);
-
- # Adjust rates if necessary
- if ($rate == 0 && $hit > 0) {
- $rate = sprintf("%.*f", $precision, 1 / 10 ** $precision);
- } elsif ($rate == 100 && $hit != $found) {
- $rate = sprintf("%.*f", $precision, 100 - 1 / 10 ** $precision);
- }
-
- return sprintf("%*s", $width, $rate.$suffix);
-}
diff --git a/chromium/third_party/lcov/bin/mcov b/chromium/third_party/lcov/bin/mcov
deleted file mode 100755
index e6d344665f1..00000000000
--- a/chromium/third_party/lcov/bin/mcov
+++ /dev/null
@@ -1,305 +0,0 @@
-#!/usr/bin/perl -w
-#
-# mcov: script to convert gcov data to lcov format on Mac.
-#
-# Based on lcov (http://ltp.sourceforge.net/coverage/lcov.php)
-# Written by ajeya at google dot com.
-#
-# usage:
-# mcov --directory <base directory> --output <output file> --verbose <level>
-#
-
-use strict;
-
-use Cwd;
-use File::Basename;
-use File::Find;
-use File::Spec::Functions;
-use Getopt::Long;
-
-# function prototypes
-sub process_dafile(@);
-sub canonical_path(@);
-sub split_filename(@);
-sub read_gcov_header(@);
-sub read_gcov_file(@);
-
-# scalars with default values
-my $directory = Cwd::abs_path(Cwd::getcwd);
-my $data_file_extension = ".gcda";
-my $output_filename = "output.lcov";
-my $gcov_tool = "/usr/bin/gcov";
-my $verbosity = 0;
-
-# TODO(ajeya): GetOptions doesn't handle case where the script is called with
-# no arguments. This needs to be fixed.
-my $result = GetOptions("directory|d=s" => \$directory,
- "output|o=s" => \$output_filename,
- "verbose" => \$verbosity);
-if (!$result) {
- print "Usage: $0 --directory <base directory> --output <output file>";
- print " [--verbose <level>]\n";
- exit(1);
-}
-
-# convert the directory path to absolute path.
-$directory = Cwd::abs_path($directory);
-
-# convert the output file path to absolute path.
-$output_filename = Cwd::abs_path($output_filename);
-
-# Output expected args for buildbot debugging assistance.
-my $cwd = getcwd();
-print "mcov: after abs_pathing\n";
-print "mcov: getcwd() = $cwd\n";
-print "mcov: directory for data files is $directory\n";
-print "mcov: output filename is $output_filename\n";
-
-# Sanity check; die if path is wrong.
-# We don't check for output_filename because... we create it.
-if (! -d $directory) {
- print "mcov: Bad args passed; exiting with error.\n";
- exit(1);
-}
-
-# open file for output
-open(INFO_HANDLE, ">$output_filename");
-
-my @file_list; # scalar to hold the list of all gcda files.
-if (-d $directory) {
- printf("Scanning $directory for $data_file_extension files ...\n");
- find(sub {
- my $file = $_;
- if ($file =~ m/\Q$data_file_extension\E$/i) {
- push(@file_list, Cwd::abs_path($file));
- }},
- $directory);
- printf("Found %d data files in %s\n", $#file_list + 1, $directory);
-}
-
-# Process all files in list
-foreach my $file (@file_list) {
- process_dafile($file);
-}
-close(INFO_HANDLE);
-
-# Remove the misc gcov files that are created.
-my @gcov_list = glob("*.gcov");
-foreach my $gcov_file (@gcov_list) {
- unlink($gcov_file);
-}
-
-exit(0);
-
-# end of script
-
-# process_dafile:
-# argument(s): a file path with gcda extension
-# returns: void
-# This method calls gcov to generate the coverage data and write the output in
-# lcov format to the output file.
-sub process_dafile(@) {
- my ($filename) = @_;
- print("Processing $filename ...\n");
-
- my $da_filename; # Name of data file to process
- my $base_name; # data filename without ".da/.gcda" extension
- my $gcov_error; # Error code of gcov tool
- my $object_dir; # Directory containing all object files
- my $gcov_file; # Name of a .gcov file
- my @gcov_data; # Contents of a .gcov file
- my @gcov_list; # List of generated .gcov files
- my $base_dir; # Base directory for current da file
- local *OLD_STDOUT; # Handle to store STDOUT temporarily
-
- # Get directory and basename of data file
- ($base_dir, $base_name) = split_filename(canonical_path($filename));
-
- # Check for writable $base_dir (gcov will try to write files there)
- if (!-w $base_dir) {
- print("ERROR: cannot write to directory $base_dir\n");
- return;
- }
-
- # Construct name of graph file
- $da_filename = File::Spec::Functions::catfile($base_dir,
- join(".", $base_name, "gcno"));
-
- # Ignore empty graph file (e.g. source file with no statement)
- if (-z $da_filename) {
- warn("WARNING: empty $da_filename (skipped)\n");
- return;
- }
-
- # Set $object_dir to real location of object files. This may differ
- # from $base_dir if the graph file is just a link to the "real" object
- # file location.
- $object_dir = dirname($da_filename);
-
- # Save the current STDOUT to OLD_STDOUT and set STDOUT to /dev/null to mute
- # standard output.
- if (!$verbosity) {
- open(OLD_STDOUT, ">>&STDOUT");
- open(STDOUT, ">/dev/null");
- }
-
- # run gcov utility with the supplied gcno file and object directory.
- $gcov_error = system($gcov_tool, $da_filename, "-o", $object_dir);
-
- # Restore STDOUT if we changed it before.
- if (!$verbosity) {
- open(STDOUT, ">>&OLD_STDOUT");
- }
-
- if ($gcov_error) {
- warn("WARNING: GCOV failed for $da_filename!\n");
- return;
- }
-
- # Collect data from resulting .gcov files and create .info file
- @gcov_list = glob("*.gcov");
- # Check for files
- if (!scalar(@gcov_list)) {
- warn("WARNING: gcov did not create any files for $da_filename!\n");
- }
-
- foreach $gcov_file (@gcov_list) {
- my $source_filename = read_gcov_header($gcov_file);
-
- if (!defined($source_filename)) {
- next;
- }
-
- $source_filename = canonical_path($source_filename);
-
- # Read in contents of gcov file
- @gcov_data = read_gcov_file($gcov_file);
-
- # Skip empty files
- if (!scalar(@gcov_data)) {
- warn("WARNING: skipping empty file $gcov_file\n");
- unlink($gcov_file);
- next;
- }
-
- print(INFO_HANDLE "SF:", Cwd::abs_path($source_filename), "\n");
-
- # Write coverage information for each instrumented line
- # Note: @gcov_content contains a list of (flag, count, source)
- # tuple for each source code line
- while (@gcov_data) {
- # Check for instrumented line
- if ($gcov_data[0]) {
- print(INFO_HANDLE "DA:", $gcov_data[3], ",", $gcov_data[1], "\n");
- }
- # Remove already processed data from array
- splice(@gcov_data,0,4);
- }
- print(INFO_HANDLE "end_of_record\n");
-
- # Remove .gcov file after processing
- unlink($gcov_file);
- } #end for_each
-}
-
-# canonical_path:
-# argument(s): any file path
-# returns: the file path as a string
-#
-# clean up the file path being passed.
-sub canonical_path(@) {
- my ($filename) = @_;
- return (File::Spec::Functions::canonpath($filename));
-}
-
-# split_filename:
-# argument(s): any file path
-# returns: an array with the path components
-#
-# splits the file path into path and filename (with no extension).
-sub split_filename(@){
- my ($filename) = @_;
- my ($base, $path, $ext) = File::Basename::fileparse($filename, '\.[^\.]*');
- return ($path, $base);
-}
-
-# read_gcov_header:
-# argument(s): path to gcov file
-# returns: an array the contens of the gcov header.
-#
-# reads the gcov file and returns the parsed contents of a gcov header as an
-# array.
-sub read_gcov_header(@) {
- my ($filename) = @_;
- my $source;
- local *INPUT;
-
- if (!open(INPUT, $filename)) {
- warn("WARNING: cannot read $filename!\n");
- return (undef,undef);
- }
-
- my @lines = <INPUT>;
- foreach my $line (@lines) {
- chomp($line);
- # check for lines with source string.
- if ($line =~ /^\s+-:\s+0:Source:(.*)$/) {
- # Source: header entry
- $source = $1;
- } else {
- last;
- }
- }
- close(INPUT);
- return $source;
-}
-
-# read_gcov_file:
-# argument(s): path to gcov file
-# returns: an array with the contents of the gcov file.
-#
-# reads the gcov file and returns the parsed contents of a gcov file
-# as an array.
-sub read_gcov_file(@) {
- my ($filename) = @_;
- my @result = ();
- my $number;
- local *INPUT;
-
- if (!open(INPUT, $filename)) {
- warn("WARNING: cannot read $filename!\n");
- return @result;
- }
-
- # Parse gcov output and populate the array
- my @lines = <INPUT>;
- foreach my $line (@lines) {
- chomp($line);
- if ($line =~ /^\s*([^:]+):\s*(\d+?):(.*)$/) {
- # <exec count>:<line number>:<source code>
-
- if ($1 eq "-") {
- # Uninstrumented line
- push(@result, 0);
- push(@result, 0);
- push(@result, $3);
- push(@result, $2);
- } elsif ($2 eq "0") {
- #ignore comments and other header info
- } else {
- # Source code execution data
- $number = $1;
- # Check for zero count
- if ($number eq "#####") {
- $number = 0;
- }
- push(@result, 1);
- push(@result, $number);
- push(@result, $3);
- push(@result, $2);
- }
- }
- }
- close(INPUT);
- return @result;
-}
diff --git a/chromium/third_party/lcov/bin/updateversion.pl b/chromium/third_party/lcov/bin/updateversion.pl
deleted file mode 100755
index 55f2bc1dd9a..00000000000
--- a/chromium/third_party/lcov/bin/updateversion.pl
+++ /dev/null
@@ -1,146 +0,0 @@
-#!/usr/bin/perl -w
-
-use strict;
-
-sub update_man_page($);
-sub update_bin_tool($);
-sub update_txt_file($);
-sub update_spec_file($);
-sub get_file_info($);
-
-our $directory = $ARGV[0];
-our $version = $ARGV[1];
-our $release = $ARGV[2];
-
-our @man_pages = ("man/gendesc.1", "man/genhtml.1", "man/geninfo.1",
- "man/genpng.1", "man/lcov.1", "man/lcovrc.5");
-our @bin_tools = ("bin/gendesc", "bin/genhtml", "bin/geninfo",
- "bin/genpng", "bin/lcov");
-our @txt_files = ("README");
-our @spec_files = ("rpm/lcov.spec");
-
-if (!defined($directory) || !defined($version) || !defined($release)) {
- die("Usage: $0 <directory> <version string> <release string>\n");
-}
-
-foreach (@man_pages) {
- print("Updating man page $_\n");
- update_man_page($directory."/".$_);
-}
-foreach (@bin_tools) {
- print("Updating bin tool $_\n");
- update_bin_tool($directory."/".$_);
-}
-foreach (@txt_files) {
- print("Updating text file $_\n");
- update_txt_file($directory."/".$_);
-}
-foreach (@spec_files) {
- print("Updating spec file $_\n");
- update_spec_file($directory."/".$_);
-}
-print("Done.\n");
-
-sub get_file_info($)
-{
- my ($filename) = @_;
- my ($sec, $min, $hour, $year, $month, $day);
- my @stat;
-
- @stat = stat($filename);
- ($sec, $min, $hour, $day, $month, $year) = localtime($stat[9]);
- $year += 1900;
- $month += 1;
-
- return (sprintf("%04d-%02d-%02d", $year, $month, $day),
- sprintf("%04d%02d%02d%02d%02d.%02d", $year, $month, $day,
- $hour, $min, $sec),
- sprintf("%o", $stat[2] & 07777));
-}
-
-sub update_man_page($)
-{
- my ($filename) = @_;
- my @date = get_file_info($filename);
- my $date_string = $date[0];
- local *IN;
- local *OUT;
-
- $date_string =~ s/-/\\-/g;
- open(IN, "<$filename") || die ("Error: cannot open $filename\n");
- open(OUT, ">$filename.new") ||
- die("Error: cannot create $filename.new\n");
- while (<IN>) {
- s/\"LCOV\s+\d+\.\d+\"/\"LCOV $version\"/g;
- s/\d\d\d\d\\\-\d\d\\\-\d\d/$date_string/g;
- print(OUT $_);
- }
- close(OUT);
- close(IN);
- chmod(oct($date[2]), "$filename.new");
- system("mv", "-f", "$filename.new", "$filename");
- system("touch", "$filename", "-t", $date[1]);
-}
-
-sub update_bin_tool($)
-{
- my ($filename) = @_;
- my @date = get_file_info($filename);
- local *IN;
- local *OUT;
-
- open(IN, "<$filename") || die ("Error: cannot open $filename\n");
- open(OUT, ">$filename.new") ||
- die("Error: cannot create $filename.new\n");
- while (<IN>) {
- s/(our\s+\$lcov_version\s*=\s*["']).*(["'].*)$/$1LCOV version $version$2/g;
- print(OUT $_);
- }
- close(OUT);
- close(IN);
- chmod(oct($date[2]), "$filename.new");
- system("mv", "-f", "$filename.new", "$filename");
- system("touch", "$filename", "-t", $date[1]);
-}
-
-sub update_txt_file($)
-{
- my ($filename) = @_;
- my @date = get_file_info($filename);
- local *IN;
- local *OUT;
-
- open(IN, "<$filename") || die ("Error: cannot open $filename\n");
- open(OUT, ">$filename.new") ||
- die("Error: cannot create $filename.new\n");
- while (<IN>) {
- s/(Last\s+changes:\s+)\d\d\d\d-\d\d-\d\d/$1$date[0]/g;
- print(OUT $_);
- }
- close(OUT);
- close(IN);
- chmod(oct($date[2]), "$filename.new");
- system("mv", "-f", "$filename.new", "$filename");
- system("touch", "$filename", "-t", $date[1]);
-}
-
-sub update_spec_file($)
-{
- my ($filename) = @_;
- my @date = get_file_info($filename);
- local *IN;
- local *OUT;
-
- open(IN, "<$filename") || die ("Error: cannot open $filename\n");
- open(OUT, ">$filename.new") ||
- die("Error: cannot create $filename.new\n");
- while (<IN>) {
- s/^(Version:\s*)\d+\.\d+.*$/$1$version/;
- s/^(Release:\s*).*$/$1$release/;
- print(OUT $_);
- }
- close(OUT);
- close(IN);
- system("mv", "-f", "$filename.new", "$filename");
- system("touch", "$filename", "-t", $date[1]);
-}
diff --git a/chromium/third_party/lcov/contrib/galaxy/CHANGES b/chromium/third_party/lcov/contrib/galaxy/CHANGES
deleted file mode 100644
index b09883bd6c3..00000000000
--- a/chromium/third_party/lcov/contrib/galaxy/CHANGES
+++ /dev/null
@@ -1 +0,0 @@
-09-04-2003 Initial checkin
diff --git a/chromium/third_party/lcov/contrib/galaxy/README b/chromium/third_party/lcov/contrib/galaxy/README
deleted file mode 100644
index e21c509c0ae..00000000000
--- a/chromium/third_party/lcov/contrib/galaxy/README
+++ /dev/null
@@ -1,48 +0,0 @@
--------------------------------------------------
-- README file for the LCOV galaxy mapping tool -
-- Last changes: 2003-09-04 -
--------------------------------------------------
-
-Description
------------
-
-Further README contents
------------------------
- 1. Included files
- 2. Installing
- 3. Notes and Comments
-
-
-
-1. Important files
-------------------
- README - This README file
- CHANGES - List of changes between releases
- conglomerate_functions.pl - Replacement file - Generates shading
- genflat.pl - Generates info for shading from .info files
- gen_makefile.sh - Replacement file - updates to postscript
- posterize.pl - Replacement file - generates a final ps file
-
-2. Installing
--------------
- This install requires fcgp, which means the target kernel src must be on
-the system creating the map.
-
- Download and copy the new files into the fcgp directory, (Note: its always
-a good idea to have backups).
-
- Run genflat.pl against your kernel info files
- ./genflat.pl kernel.info kernel2.info > coverage.dat
-
- Run the make command for the fcgp (Note: this can take a while)
- make KERNEL_DIR=/usr/src/linux
-
- Update posterize.pl as needed, normally page size, margins, titles.
-Most of these settings will be broken out as command line options in the future.
-
- Run posterize.pl this will generate the file poster.ps.
-
-3. Notes and Comments
----------------------
- This is a quick and dirty implementation suited for my needs. It does not
-perform any of the tiling the original did.
diff --git a/chromium/third_party/lcov/contrib/galaxy/conglomerate_functions.pl b/chromium/third_party/lcov/contrib/galaxy/conglomerate_functions.pl
deleted file mode 100755
index 4e259feee11..00000000000
--- a/chromium/third_party/lcov/contrib/galaxy/conglomerate_functions.pl
+++ /dev/null
@@ -1,195 +0,0 @@
-#! /usr/bin/perl -w
-
-# Takes a set of ps images (belonging to one file) and produces a
-# conglomerate picture of that file: static functions in the middle,
-# others around it. Each one gets a box about its area.
-
-use strict;
-
-my $SCRUNCH = $ARGV [0];
-my $BOXSCRUNCH = $ARGV [1];
-my $Tmp;
-my $DEBUG = 1;
-
-shift @ARGV; # skip SCRUNCH and BOXSCRUNCH
-shift @ARGV;
-
-
-DecorateFuncs (@ARGV);
-
-
-#TMPFILE=`mktemp ${TMPDIR:-/tmp}/$$.XXXXXX`
-
-# Arrange.
-my $ArgList = "";
-
-foreach $Tmp (@ARGV) {
- $ArgList .= "'$Tmp' ";
-}
-
-my @Arranged = `../draw_arrangement $SCRUNCH 0 360 0 $ArgList`;
-
-my $CFile = $ARGV [0];
-$CFile =~ s/\.c\..*$/.c/;
-if ($DEBUG) { print ("% Conglomeration of $CFile\n"); }
-
-print "gsave angle rotate\n";
-
-# Now output the file, except last line.
-my $LastLine = pop (@Arranged);
-my $Fill = Box_2 ($LastLine,$CFile);
-print $Fill;
-# Draw box with file name
-my @Output = Box ('normal', 'Helvetica-Bold', 32, $CFile, $LastLine);
-splice(@Output, $#Output, 0, "grestore\n");
-#print @Output;
-
-print (@Arranged);
-#add a duplicate box to test if this works
-print @Output;
-
-
-sub ParseBound
-{
- my $BBoxLine = shift;
-
- $BBoxLine =~ /(-?[\d.]+)\s+(-?[\d.]+)\s+(-?[\d.]+)\s+(-?[\d.]+)/;
-
- # XMin, YMin, XMax, YMax
- return ($1 * $BOXSCRUNCH, $2 * $BOXSCRUNCH,
- $3 * $BOXSCRUNCH, $4 * $BOXSCRUNCH);
-}
-
-
-
-# Box (type, font, fontsize, Label, BBoxLine)
-sub Box
-{
- my $Type = shift;
- my $Font = shift;
- my $Fontsize = shift;
- my $Label = shift;
- my $BBoxLine = shift;
- my @Output = ();
-
- # print (STDERR "Box ('$Type', '$Font', '$Fontsize', '$Label', '$BBoxLine')\n");
- push (@Output, "% start of box\n");
-
- push (@Output, "D5\n") if ($Type eq "dashed");
-
- # print (STDERR "BBoxLine: '$BBoxLine'\n");
- # print (STDERR "Parsed: '" . join ("' '", ParseBound ($BBoxLine)) . "\n");
- my ($XMin, $YMin, $XMax, $YMax) = ParseBound ($BBoxLine);
-
- my $LeftSpaced = $XMin + 6;
- my $BottomSpaced = $YMin + 6;
-
- # Put black box around it
- push (@Output, (
- "($Label) $LeftSpaced $BottomSpaced $Fontsize /$Font\n",
- "$YMin $XMin $YMax $XMax U\n"
- )
- );
-
- push (@Output, "D\n") if ($Type eq "dashed");
- # fill bounding box
- push (@Output, "% end of box\n");
-
- # Output bounding box
- push (@Output, "% bound $XMin $YMin $XMax $YMax\n");
-
- return @Output;
-}
-
-sub Box_2
-{
- my $BBoxLine = shift;
- my $CFile = shift;
- my $CovFile = "./coverage.dat";
- my ($XMin, $YMin, $XMax, $YMax) = ParseBound ($BBoxLine);
- my @output = `fgrep $CFile $CovFile`;
- chomp $output[0];
- my ($junk, $Class, $per) = split /\t/, $output[0];
- return "$XMin $YMin $XMax $YMax $Class\n";
-}
-# Decorate (rgb-vals(1 string) filename)
-sub Decorate
-{
- my $RGB = shift;
- my $Filename = shift;
-
- my @Input = ReadPS ($Filename);
- my $LastLine = pop (@Input);
- my @Output = ();
-
- # Color at the beginning.
- push (@Output, "C$RGB\n");
-
- # Now output the file, except last line.
- push (@Output, @Input);
-
- # Draw dashed box with function name
- # FIXME Make bound cover the label as well!
- my $FuncName = $Filename;
- $FuncName =~ s/^[^.]+\.c\.(.+?)\..*$/$1/;
-
- push (@Output, Box ('dashed', 'Helvetica', 24, $FuncName, $LastLine));
-
- # Slap over the top.
- WritePS ($Filename, @Output);
-}
-
-
-
-# Add colored boxes around functions
-sub DecorateFuncs
-{
- my $FName = "";
- my $FType = "";
-
- foreach $FName (@ARGV)
- {
- $FName =~ /\+([A-Z]+)\+/;
- $FType = $1;
-
- if ($FType eq 'STATIC') {
- Decorate ("2", $FName); # Light green.
- }
- elsif ($FType eq 'INDIRECT') {
- Decorate ("3", $FName); # Green.
- }
- elsif ($FType eq 'EXPORTED') {
- Decorate ("4", $FName); # Red.
- }
- elsif ($FType eq 'NORMAL') {
- Decorate ("5", $FName); # Blue.
- }
- else {
- die ("Unknown extension $FName");
- }
- }
-}
-
-
-sub ReadPS
-{
- my $Filename = shift;
- my @Contents = ();
-
- open (INFILE, "$Filename") or die ("Could not read $Filename: $!");
- @Contents = <INFILE>;
- close (INFILE);
-
- return @Contents;
-}
-
-sub WritePS
-{
- my $Filename = shift;
-
- open (OUTFILE, ">$Filename")
- or die ("Could not write $Filename: $!");
- print (OUTFILE @_);
- close (OUTFILE);
-}
-
diff --git a/chromium/third_party/lcov/contrib/galaxy/gen_makefile.sh b/chromium/third_party/lcov/contrib/galaxy/gen_makefile.sh
deleted file mode 100755
index ab51a5ea9b4..00000000000
--- a/chromium/third_party/lcov/contrib/galaxy/gen_makefile.sh
+++ /dev/null
@@ -1,129 +0,0 @@
-#! /bin/sh
-
-cd image
-
-# Space-optimized version: strip comments, drop precision to 3
-# figures, eliminate duplicates.
-# update(creinig): precision reduction is now done in data2ps and comments
-# (except for % bound) now are also ommitted from the start
-
-echo 'image.ps: image-unop.ps'
-#echo ' grep -v "^%" < $< | sed -e "s/\.\([0-9][0-9]\)[0-9]\+/.\1/g" -e "s/\(^\| \|-\)\([0-9][0-9][0-9]\)[0-9][0-9]\.[0-9][0-9]/\1\200/g" -e "s/\(^\| \|-\)\([0-9][0-9][0-9]\)[0-9]\.[0-9][0-9]/\1\20/g" -e "s/\(^\| \|-\)\([0-9][0-9][0-9]\)\.[0-9][0-9]/\1\2/g" -e "s/\(^\| \|-\)\([0-9][0-9]\)\.\([0-9]\)[0-9]/\1\2.\30/g" | awk "\$$0 ~ /lineto/ { if ( LASTLINE == \$$0 ) next; } { LASTLINE=\$$0; print; }" > $@'
-echo ' grep -v "^% bound" < $< > $@'
-# Need last comment (bounding box)
-echo ' tail -1 $< >> $@'
-echo ' ls -l image.ps image-unop.ps'
-
-echo 'image-unop.ps: outline.ps ring1.ps ring2.ps ring3.ps ring4.ps'
-echo ' cat ring[1234].ps > $@'
-# Bounding box is at bottom now. Next two won't change it.
-echo ' tail -1 $@ > bounding-box'
-echo ' cat outline.ps >> $@'
-echo ' cat ../tux.ps >> $@'
-echo ' cat bounding-box >> $@ && rm bounding-box'
-
-# Finished rings are precious!
-echo .SECONDARY: ring1.ps ring2.ps ring3.ps ring4.ps
-
-# Rings 1 and 4 are all thrown together.
-echo RING1_DEPS:=`find $RING1 -name '*.c.*' | sed 's/\.c.*/-all.ps/' | sort | uniq`
-echo RING4_DEPS:=`find $RING4 -name '*.c.*' | sed 's/\.c.*/-all.ps/' | sort | uniq`
-
-# Other rings are divided into dirs.
-echo RING2_DEPS:=`for d in $RING2; do echo $d-ring2.ps; done`
-echo RING3_DEPS:=`for d in $RING3; do echo $d-ring3.ps; done`
-echo
-
-# First ring starts at inner radius.
-echo 'ring1.ps: $(RING1_DEPS)'
-echo " @echo Making Ring 1"
-echo " @echo /angle 0 def > \$@"
-echo " @../draw_arrangement $FILE_SCRUNCH 0 360 $INNER_RADIUS \$(RING1_DEPS) >> \$@"
-echo " @echo Done Ring 1"
-
-# Second ring starts at end of above ring (assume it's circular, so
-# grab any bound).
-echo 'ring2.ps: ring1.ps $(RING2_DEPS)'
-echo " @echo Making Ring 2"
-echo " @echo /angle 0 def > \$@"
-echo " @../rotary_arrange.sh $DIR_SPACING" `for f in $RING2; do echo $f-ring2.ps $f-ring2.angle; done` '>> $@'
-echo " @echo Done Ring 2"
-
-# Third ring starts at end of second ring.
-echo 'ring3.ps: ring2.ps $(RING3_DEPS)'
-echo " @echo Making Ring 3"
-echo " @echo /angle 0 def > \$@"
-echo " @../rotary_arrange.sh $DIR_SPACING" `for f in $RING3; do echo $f-ring3.ps $f-ring3.angle; done` '>> $@'
-echo " @echo Done Ring 3"
-
-# Outer ring starts at end of fourth ring.
-# And it's just a big ring of drivers.
-echo 'ring4.ps: $(RING4_DEPS) ring3.radius'
-echo " @echo Making Ring 4"
-echo " @echo /angle 0 def > \$@"
-echo " @../draw_arrangement $FILE_SCRUNCH 0 360 \`cat ring3.radius\` \$(RING4_DEPS) >> \$@"
-echo " @echo Done Ring 4"
-echo
-
-# How to make directory picture: angle file contains start and end angle.
-# Second ring starts at end of above ring (assume it's circular, so
-# grab any bound).
-echo "%-ring2.ps: %-ring2.angle ring1.radius"
-echo " @echo Rendering \$@"
-echo " @../draw_arrangement $FILE_SCRUNCH 0 \`cat \$<\` \`cat ring1.radius\` \`find \$* -name '*-all.ps'\` > \$@"
-
-echo "%-ring3.ps: %-ring3.angle ring2.radius"
-echo " @echo Rendering \$@"
-echo " @../draw_arrangement $FILE_SCRUNCH 0 \`cat \$<\` \`cat ring2.radius\` \`find \$* -name '*-all.ps'\` > \$@"
-
-# How to extract radii
-echo "%.radius: %.ps"
-echo ' @echo scale=2\; `tail -1 $< | sed "s/^.* //"` + '$RING_SPACING' | bc > $@'
-echo
-
-# How to make angle. Need total angle for that directory, and weight.
-echo "%-ring2.angle: %-ring2.weight ring2.weight"
-echo ' @echo "scale=2; ( 360 - ' `echo $RING2 | wc -w` ' * ' $DIR_SPACING ') * `cat $<` / `cat ring2.weight`" | bc > $@'
-
-echo "%-ring3.angle: %-ring3.weight ring3.weight"
-echo ' @echo "scale=2; ( 360 - ' `echo $RING3 | wc -w` ' * ' $DIR_SPACING ') * `cat $<` / `cat ring3.weight`" | bc > $@'
-
-# How to make ring weights (sum directory totals).
-echo "ring2.weight:" `for d in $RING2; do echo $d-ring2.weight; done`
-echo ' @cat $^ | ../tally > $@'
-echo "ring3.weight:" `for d in $RING3; do echo $d-ring3.weight; done`
-echo ' @cat $^ | ../tally > $@'
-
-# How to make a wieght.
-echo "%-ring2.weight:" `find $RING2 -name '*.c.*' | sed 's/\.c.*/-all.ps/' | sort | uniq`
-echo ' @../total_area.pl `find $* -name \*-all.ps` > $@'
-echo "%-ring3.weight:" `find $RING3 -name '*.c.*' | sed 's/\.c.*/-all.ps/' | sort | uniq`
-echo ' @../total_area.pl `find $* -name \*-all.ps` > $@'
-echo
-
-# Now rule to make the graphs of a function.
-#echo %.ps::%
-#echo ' @../function2ps `echo $< | sed '\''s/^.*\.\([^.]*\)\.\+.*$$/\1/'\''` > $@ $<'
-## Need the space.
-##echo ' @rm -f $<'
-#echo
-
-# Rule to make all from constituent parts.
-echo %-all.ps:
-echo " @echo Rendering \$*.c"
-echo " @../conglomerate_functions.pl $FUNCTION_SCRUNCH $BOX_SCRUNCH \$^ > \$@"
-# Need the space.
-#echo ' @rm -f $^'
-echo
-
-# Generating outline, requires all the angles.
-echo outline.ps: ../make-outline.sh ring1.ps ring2.ps ring3.ps ring4.ps `for f in $RING2; do echo $f-ring2.angle; done` `for f in $RING3; do echo $f-ring3.angle; done`
-echo " ../make-outline.sh $INNER_RADIUS $DIR_SPACING $RING_SPACING \"$RING1\" > \$@"
-echo
-
-# Now all the rules to make each function.
-for d in `find . -type d`; do
- for f in `cd $d; ls *+.ps 2>/dev/null | sed 's/\.c\..*$//' | uniq`; do
- echo $d/$f-all.ps: `cd $d; ls $f.c.* | sed -e "s?^?$d/?"`
- done
-done
diff --git a/chromium/third_party/lcov/contrib/galaxy/genflat.pl b/chromium/third_party/lcov/contrib/galaxy/genflat.pl
deleted file mode 100755
index b8b8ff47b1a..00000000000
--- a/chromium/third_party/lcov/contrib/galaxy/genflat.pl
+++ /dev/null
@@ -1,1238 +0,0 @@
-#!/usr/bin/perl -w
-#
-# Copyright (c) International Business Machines Corp., 2002
-#
-# 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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-#
-# genflat
-#
-# This script generates std output from .info files as created by the
-# geninfo script. Call it with --help to get information on usage and
-# available options. This code is based on the lcov genhtml script
-# by Peter Oberparleiter <Peter.Oberparleiter@de.ibm.com>
-#
-#
-# History:
-# 2003-08-19 ripped up Peter's script James M Kenefick Jr. <jkenefic@us.ibm.com>
-#
-
-use strict;
-use File::Basename;
-use Getopt::Long;
-# Constants
-our $lcov_version = "";
-our $lcov_url = "";
-
-# Specify coverage rate limits (in %) for classifying file entries
-# HI: $hi_limit <= rate <= 100 graph color: green
-# MED: $med_limit <= rate < $hi_limit graph color: orange
-# LO: 0 <= rate < $med_limit graph color: red
-our $hi_limit = 50;
-our $med_limit = 15;
-
-# Data related prototypes
-sub print_usage(*);
-sub gen_html();
-sub process_dir($);
-sub process_file($$$);
-sub info(@);
-sub read_info_file($);
-sub get_info_entry($);
-sub set_info_entry($$$$;$$);
-sub get_prefix(@);
-sub shorten_prefix($);
-sub get_dir_list(@);
-sub get_relative_base_path($);
-sub get_date_string();
-sub split_filename($);
-sub subtract_counts($$);
-sub add_counts($$);
-sub apply_baseline($$);
-sub combine_info_files($$);
-sub combine_info_entries($$);
-sub apply_prefix($$);
-sub escape_regexp($);
-
-
-# HTML related prototypes
-
-
-sub write_file_table(*$$$$);
-
-
-# Global variables & initialization
-our %info_data; # Hash containing all data from .info file
-our $dir_prefix; # Prefix to remove from all sub directories
-our %test_description; # Hash containing test descriptions if available
-our $date = get_date_string();
-
-our @info_filenames; # List of .info files to use as data source
-our $test_title; # Title for output as written to each page header
-our $output_directory; # Name of directory in which to store output
-our $base_filename; # Optional name of file containing baseline data
-our $desc_filename; # Name of file containing test descriptions
-our $css_filename; # Optional name of external stylesheet file to use
-our $quiet; # If set, suppress information messages
-our $help; # Help option flag
-our $version; # Version option flag
-our $show_details; # If set, generate detailed directory view
-our $no_prefix; # If set, do not remove filename prefix
-our $frames; # If set, use frames for source code view
-our $keep_descriptions; # If set, do not remove unused test case descriptions
-our $no_sourceview; # If set, do not create a source code view for each file
-our $tab_size = 8; # Number of spaces to use in place of tab
-
-our $cwd = `pwd`; # Current working directory
-chomp($cwd);
-our $tool_dir = dirname($0); # Directory where genhtml tool is installed
-
-
-#
-# Code entry point
-#
-
-# Add current working directory if $tool_dir is not already an absolute path
-if (! ($tool_dir =~ /^\/(.*)$/))
-{
- $tool_dir = "$cwd/$tool_dir";
-}
-
-# Parse command line options
-if (!GetOptions("output-directory=s" => \$output_directory,
- "css-file=s" => \$css_filename,
- "baseline-file=s" => \$base_filename,
- "prefix=s" => \$dir_prefix,
- "num-spaces=i" => \$tab_size,
- "no-prefix" => \$no_prefix,
- "quiet" => \$quiet,
- "help" => \$help,
- "version" => \$version
- ))
-{
- print_usage(*STDERR);
- exit(1);
-}
-
-@info_filenames = @ARGV;
-
-# Check for help option
-if ($help)
-{
- print_usage(*STDOUT);
- exit(0);
-}
-
-# Check for version option
-if ($version)
-{
- print($lcov_version."\n");
- exit(0);
-}
-
-# Check for info filename
-if (!@info_filenames)
-{
- print(STDERR "No filename specified\n");
- print_usage(*STDERR);
- exit(1);
-}
-
-# Generate a title if none is specified
-if (!$test_title)
-{
- if (scalar(@info_filenames) == 1)
- {
- # Only one filename specified, use it as title
- $test_title = basename($info_filenames[0]);
- }
- else
- {
- # More than one filename specified, used default title
- $test_title = "unnamed";
- }
-}
-
-# Make sure tab_size is within valid range
-if ($tab_size < 1)
-{
- print(STDERR "ERROR: invalid number of spaces specified: ".
- "$tab_size!\n");
- exit(1);
-}
-
-# Do something
-gen_html();
-
-exit(0);
-
-
-
-#
-# print_usage(handle)
-#
-# Print usage information.
-#
-
-sub print_usage(*)
-{
- local *HANDLE = $_[0];
- my $executable_name = basename($0);
-
- print(HANDLE <<END_OF_USAGE);
-Usage: $executable_name [OPTIONS] INFOFILE(S)
-
-Create HTML output for coverage data found in INFOFILE. Note that INFOFILE
-may also be a list of filenames.
-
- -h, --help Print this help, then exit
- -v, --version Print version number, then exit
- -q, --quiet Do not print progress messages
- -b, --baseline-file BASEFILE Use BASEFILE as baseline file
- -p, --prefix PREFIX Remove PREFIX from all directory names
- --no-prefix Do not remove prefix from directory names
- --no-source Do not create source code view
- --num-spaces NUM Replace tabs with NUM spaces in source view
-
-See $lcov_url for more information about this tool.
-END_OF_USAGE
- ;
-}
-
-
-#
-# gen_html()
-#
-# Generate a set of HTML pages from contents of .info file INFO_FILENAME.
-# Files will be written to the current directory. If provided, test case
-# descriptions will be read from .tests file TEST_FILENAME and included
-# in ouput.
-#
-# Die on error.
-#
-
-sub gen_html()
-{
- local *HTML_HANDLE;
- my %overview;
- my %base_data;
- my $lines_found;
- my $lines_hit;
- my $overall_found = 0;
- my $overall_hit = 0;
- my $dir_name;
- my $link_name;
- my @dir_list;
- my %new_info;
-
- # Read in all specified .info files
- foreach (@info_filenames)
- {
- info("Reading data file $_\n");
- %new_info = %{read_info_file($_)};
-
- # Combine %new_info with %info_data
- %info_data = %{combine_info_files(\%info_data, \%new_info)};
- }
-
- info("Found %d entries.\n", scalar(keys(%info_data)));
-
- # Read and apply baseline data if specified
- if ($base_filename)
- {
- # Read baseline file
- info("Reading baseline file $base_filename\n");
- %base_data = %{read_info_file($base_filename)};
- info("Found %d entries.\n", scalar(keys(%base_data)));
-
- # Apply baseline
- info("Subtracting baseline data.\n");
- %info_data = %{apply_baseline(\%info_data, \%base_data)};
- }
-
- @dir_list = get_dir_list(keys(%info_data));
-
- if ($no_prefix)
- {
- # User requested that we leave filenames alone
- info("User asked not to remove filename prefix\n");
- }
- elsif (!defined($dir_prefix))
- {
- # Get prefix common to most directories in list
- $dir_prefix = get_prefix(@dir_list);
-
- if ($dir_prefix)
- {
- info("Found common filename prefix \"$dir_prefix\"\n");
- }
- else
- {
- info("No common filename prefix found!\n");
- $no_prefix=1;
- }
- }
- else
- {
- info("Using user-specified filename prefix \"".
- "$dir_prefix\"\n");
- }
-
- # Process each subdirectory and collect overview information
- foreach $dir_name (@dir_list)
- {
- ($lines_found, $lines_hit) = process_dir($dir_name);
-
- $overview{$dir_name} = "$lines_found,$lines_hit, ";
- $overall_found += $lines_found;
- $overall_hit += $lines_hit;
- }
-
-
- if ($overall_found == 0)
- {
- info("Warning: No lines found!\n");
- }
- else
- {
- info("Overall coverage rate: %d of %d lines (%.1f%%)\n",
- $overall_hit, $overall_found,
- $overall_hit*100/$overall_found);
- }
-}
-
-
-#
-# process_dir(dir_name)
-#
-
-sub process_dir($)
-{
- my $abs_dir = $_[0];
- my $trunc_dir;
- my $rel_dir = $abs_dir;
- my $base_dir;
- my $filename;
- my %overview;
- my $lines_found;
- my $lines_hit;
- my $overall_found=0;
- my $overall_hit=0;
- my $base_name;
- my $extension;
- my $testdata;
- my %testhash;
- local *HTML_HANDLE;
-
- # Remove prefix if applicable
- if (!$no_prefix)
- {
- # Match directory name beginning with $dir_prefix
- $rel_dir = apply_prefix($rel_dir, $dir_prefix);
- }
-
- $trunc_dir = $rel_dir;
-
- # Remove leading /
- if ($rel_dir =~ /^\/(.*)$/)
- {
- $rel_dir = substr($rel_dir, 1);
- }
-
- $base_dir = get_relative_base_path($rel_dir);
-
- $abs_dir = escape_regexp($abs_dir);
-
- # Match filenames which specify files in this directory, not including
- # sub-directories
- foreach $filename (grep(/^$abs_dir\/[^\/]*$/,keys(%info_data)))
- {
- ($lines_found, $lines_hit, $testdata) =
- process_file($trunc_dir, $rel_dir, $filename);
-
- $base_name = basename($filename);
-
- $overview{$base_name} = "$lines_found,$lines_hit";
-
- $testhash{$base_name} = $testdata;
-
- $overall_found += $lines_found;
- $overall_hit += $lines_hit;
- }
- write_file_table($abs_dir, "./linux/", \%overview, \%testhash, 4);
-
-
- # Calculate resulting line counts
- return ($overall_found, $overall_hit);
-}
-
-
-#
-# process_file(trunc_dir, rel_dir, filename)
-#
-
-sub process_file($$$)
-{
- info("Processing file ".apply_prefix($_[2], $dir_prefix)."\n");
- my $trunc_dir = $_[0];
- my $rel_dir = $_[1];
- my $filename = $_[2];
- my $base_name = basename($filename);
- my $base_dir = get_relative_base_path($rel_dir);
- my $testdata;
- my $testcount;
- my $sumcount;
- my $funcdata;
- my $lines_found;
- my $lines_hit;
- my @source;
- my $pagetitle;
-
- ($testdata, $sumcount, $funcdata, $lines_found, $lines_hit) =
- get_info_entry($info_data{$filename});
- return ($lines_found, $lines_hit, $testdata);
-}
-
-
-#
-# read_info_file(info_filename)
-#
-# Read in the contents of the .info file specified by INFO_FILENAME. Data will
-# be returned as a reference to a hash containing the following mappings:
-#
-# %result: for each filename found in file -> \%data
-#
-# %data: "test" -> \%testdata
-# "sum" -> \%sumcount
-# "func" -> \%funcdata
-# "found" -> $lines_found (number of instrumented lines found in file)
-# "hit" -> $lines_hit (number of executed lines in file)
-#
-# %testdata: name of test affecting this file -> \%testcount
-#
-# %testcount: line number -> execution count for a single test
-# %sumcount : line number -> execution count for all tests
-# %funcdata : line number -> name of function beginning at that line
-#
-# Note that .info file sections referring to the same file and test name
-# will automatically be combined by adding all execution counts.
-#
-# Note that if INFO_FILENAME ends with ".gz", it is assumed that the file
-# is compressed using GZIP. If available, GUNZIP will be used to decompress
-# this file.
-#
-# Die on error
-#
-
-sub read_info_file($)
-{
- my $tracefile = $_[0]; # Name of tracefile
- my %result; # Resulting hash: file -> data
- my $data; # Data handle for current entry
- my $testdata; # " "
- my $testcount; # " "
- my $sumcount; # " "
- my $funcdata; # " "
- my $line; # Current line read from .info file
- my $testname; # Current test name
- my $filename; # Current filename
- my $hitcount; # Count for lines hit
- my $count; # Execution count of current line
- my $negative; # If set, warn about negative counts
- local *INFO_HANDLE; # Filehandle for .info file
-
- # Check if file exists and is readable
- stat($_[0]);
- if (!(-r _))
- {
- die("ERROR: cannot read file $_[0]!\n");
- }
-
- # Check if this is really a plain file
- if (!(-f _))
- {
- die("ERROR: not a plain file: $_[0]!\n");
- }
-
- # Check for .gz extension
- if ($_[0] =~ /^(.*)\.gz$/)
- {
- # Check for availability of GZIP tool
- system("gunzip -h >/dev/null 2>/dev/null")
- and die("ERROR: gunzip command not available!\n");
-
- # Check integrity of compressed file
- system("gunzip -t $_[0] >/dev/null 2>/dev/null")
- and die("ERROR: integrity check failed for ".
- "compressed file $_[0]!\n");
-
- # Open compressed file
- open(INFO_HANDLE, "gunzip -c $_[0]|")
- or die("ERROR: cannot start gunzip to uncompress ".
- "file $_[0]!\n");
- }
- else
- {
- # Open uncompressed file
- open(INFO_HANDLE, $_[0])
- or die("ERROR: cannot read file $_[0]!\n");
- }
-
- $testname = "";
- while (<INFO_HANDLE>)
- {
- chomp($_);
- $line = $_;
-
- # Switch statement
- foreach ($line)
- {
- /^TN:(\w+)/ && do
- {
- # Test name information found
- $testname = $1;
- last;
- };
-
- /^[SK]F:(.*)/ && do
- {
- # Filename information found
- # Retrieve data for new entry
- $filename = $1;
-
- $data = $result{$filename};
- ($testdata, $sumcount, $funcdata) =
- get_info_entry($data);
-
- if (defined($testname))
- {
- $testcount = $testdata->{$testname};
- }
- else
- {
- my %new_hash;
- $testcount = \%new_hash;
- }
- last;
- };
-
- /^DA:(\d+),(-?\d+)/ && do
- {
- # Fix negative counts
- $count = $2 < 0 ? 0 : $2;
- if ($2 < 0)
- {
- $negative = 1;
- }
- # Execution count found, add to structure
- # Add summary counts
- $sumcount->{$1} += $count;
-
- # Add test-specific counts
- if (defined($testname))
- {
- $testcount->{$1} += $count;
- }
- last;
- };
-
- /^FN:(\d+),([^,]+)/ && do
- {
- # Function data found, add to structure
- $funcdata->{$1} = $2;
- last;
- };
-
- /^end_of_record/ && do
- {
- # Found end of section marker
- if ($filename)
- {
- # Store current section data
- if (defined($testname))
- {
- $testdata->{$testname} =
- $testcount;
- }
- set_info_entry($data, $testdata,
- $sumcount, $funcdata);
- $result{$filename} = $data;
- }
-
- };
-
- # default
- last;
- }
- }
- close(INFO_HANDLE);
-
- # Calculate lines_found and lines_hit for each file
- foreach $filename (keys(%result))
- {
- $data = $result{$filename};
-
- ($testdata, $sumcount, $funcdata) = get_info_entry($data);
-
- $data->{"found"} = scalar(keys(%{$sumcount}));
- $hitcount = 0;
-
- foreach (keys(%{$sumcount}))
- {
- if ($sumcount->{$_} >0) { $hitcount++; }
- }
-
- $data->{"hit"} = $hitcount;
-
- $result{$filename} = $data;
- }
-
- if (scalar(keys(%result)) == 0)
- {
- die("ERROR: No valid records found in tracefile $tracefile\n");
- }
- if ($negative)
- {
- warn("WARNING: Negative counts found in tracefile ".
- "$tracefile\n");
- }
-
- return(\%result);
-}
-
-
-#
-# get_info_entry(hash_ref)
-#
-# Retrieve data from an entry of the structure generated by read_info_file().
-# Return a list of references to hashes:
-# (test data hash ref, sum count hash ref, funcdata hash ref, lines found,
-# lines hit)
-#
-
-sub get_info_entry($)
-{
- my $testdata_ref = $_[0]->{"test"};
- my $sumcount_ref = $_[0]->{"sum"};
- my $funcdata_ref = $_[0]->{"func"};
- my $lines_found = $_[0]->{"found"};
- my $lines_hit = $_[0]->{"hit"};
-
- return ($testdata_ref, $sumcount_ref, $funcdata_ref, $lines_found,
- $lines_hit);
-}
-
-
-#
-# set_info_entry(hash_ref, testdata_ref, sumcount_ref, funcdata_ref[,
-# lines_found, lines_hit])
-#
-# Update the hash referenced by HASH_REF with the provided data references.
-#
-
-sub set_info_entry($$$$;$$)
-{
- my $data_ref = $_[0];
-
- $data_ref->{"test"} = $_[1];
- $data_ref->{"sum"} = $_[2];
- $data_ref->{"func"} = $_[3];
-
- if (defined($_[4])) { $data_ref->{"found"} = $_[4]; }
- if (defined($_[5])) { $data_ref->{"hit"} = $_[5]; }
-}
-
-
-#
-# get_prefix(filename_list)
-#
-# Search FILENAME_LIST for a directory prefix which is common to as many
-# list entries as possible, so that removing this prefix will minimize the
-# sum of the lengths of all resulting shortened filenames.
-#
-
-sub get_prefix(@)
-{
- my @filename_list = @_; # provided list of filenames
- my %prefix; # mapping: prefix -> sum of lengths
- my $current; # Temporary iteration variable
-
- # Find list of prefixes
- foreach (@filename_list)
- {
- # Need explicit assignment to get a copy of $_ so that
- # shortening the contained prefix does not affect the list
- $current = shorten_prefix($_);
- while ($current = shorten_prefix($current))
- {
- # Skip rest if the remaining prefix has already been
- # added to hash
- if ($prefix{$current}) { last; }
-
- # Initialize with 0
- $prefix{$current}="0";
- }
-
- }
-
- # Calculate sum of lengths for all prefixes
- foreach $current (keys(%prefix))
- {
- foreach (@filename_list)
- {
- # Add original length
- $prefix{$current} += length($_);
-
- # Check whether prefix matches
- if (substr($_, 0, length($current)) eq $current)
- {
- # Subtract prefix length for this filename
- $prefix{$current} -= length($current);
- }
- }
- }
-
- # Find and return prefix with minimal sum
- $current = (keys(%prefix))[0];
-
- foreach (keys(%prefix))
- {
- if ($prefix{$_} < $prefix{$current})
- {
- $current = $_;
- }
- }
-
- return($current);
-}
-
-
-#
-# shorten_prefix(prefix)
-#
-# Return PREFIX shortened by last directory component.
-#
-
-sub shorten_prefix($)
-{
- my @list = split("/", $_[0]);
-
- pop(@list);
- return join("/", @list);
-}
-
-
-
-#
-# get_dir_list(filename_list)
-#
-# Return sorted list of directories for each entry in given FILENAME_LIST.
-#
-
-sub get_dir_list(@)
-{
- my %result;
-
- foreach (@_)
- {
- $result{shorten_prefix($_)} = "";
- }
-
- return(sort(keys(%result)));
-}
-
-
-#
-# get_relative_base_path(subdirectory)
-#
-# Return a relative path string which references the base path when applied
-# in SUBDIRECTORY.
-#
-# Example: get_relative_base_path("fs/mm") -> "../../"
-#
-
-sub get_relative_base_path($)
-{
- my $result = "";
- my $index;
-
- # Make an empty directory path a special case
- if (!$_[0]) { return(""); }
-
- # Count number of /s in path
- $index = ($_[0] =~ s/\//\//g);
-
- # Add a ../ to $result for each / in the directory path + 1
- for (; $index>=0; $index--)
- {
- $result .= "../";
- }
-
- return $result;
-}
-
-
-#
-# get_date_string()
-#
-# Return the current date in the form: yyyy-mm-dd
-#
-
-sub get_date_string()
-{
- my $year;
- my $month;
- my $day;
-
- ($year, $month, $day) = (localtime())[5, 4, 3];
-
- return sprintf("%d-%02d-%02d", $year+1900, $month+1, $day);
-}
-
-
-#
-# split_filename(filename)
-#
-# Return (path, filename, extension) for a given FILENAME.
-#
-
-sub split_filename($)
-{
- if (!$_[0]) { return(); }
- my @path_components = split('/', $_[0]);
- my @file_components = split('\.', pop(@path_components));
- my $extension = pop(@file_components);
-
- return (join("/",@path_components), join(".",@file_components),
- $extension);
-}
-
-
-#
-# write_file_table(filehandle, base_dir, overview, testhash, fileview)
-#
-# Write a complete file table. OVERVIEW is a reference to a hash containing
-# the following mapping:
-#
-# filename -> "lines_found,lines_hit,page_link"
-#
-# TESTHASH is a reference to the following hash:
-#
-# filename -> \%testdata
-# %testdata: name of test affecting this file -> \%testcount
-# %testcount: line number -> execution count for a single test
-#
-# Heading of first column is "Filename" if FILEVIEW is true, "Directory name"
-# otherwise.
-#
-
-sub write_file_table(*$$$$)
-{
- my $dir = $_[0];
- my $base_dir = $_[1];
- my %overview = %{$_[2]};
- my %testhash = %{$_[3]};
- my $fileview = $_[4];
- my $filename;
- my $hit;
- my $found;
- my $classification;
- my $rate_string;
- my $rate;
- my $junk;
-
-
- foreach $filename (sort(keys(%overview)))
- {
- ($found, $hit, $junk) = split(",", $overview{$filename});
-#James I think this is right
- $rate = $hit * 100 / $found;
- $rate_string = sprintf("%.1f", $rate);
-
- if ($rate < 0.001) { $classification = "None"; }
- elsif ($rate < $med_limit) { $classification = "Lo"; }
- elsif ($rate < $hi_limit) { $classification = "Med"; }
- else { $classification = "Hi"; }
-
- print "$dir/$filename\t$classification\t$rate_string\n";
-
- }
-}
-
-
-#
-# info(printf_parameter)
-#
-# Use printf to write PRINTF_PARAMETER to stdout only when the $quiet flag
-# is not set.
-#
-
-sub info(@)
-{
- if (!$quiet)
- {
- # Print info string
- printf(STDERR @_);
- }
-}
-
-
-#
-# subtract_counts(data_ref, base_ref)
-#
-
-sub subtract_counts($$)
-{
- my %data = %{$_[0]};
- my %base = %{$_[1]};
- my $line;
- my $data_count;
- my $base_count;
- my $hit = 0;
- my $found = 0;
-
- foreach $line (keys(%data))
- {
- $found++;
- $data_count = $data{$line};
- $base_count = $base{$line};
-
- if (defined($base_count))
- {
- $data_count -= $base_count;
-
- # Make sure we don't get negative numbers
- if ($data_count<0) { $data_count = 0; }
- }
-
- $data{$line} = $data_count;
- if ($data_count > 0) { $hit++; }
- }
-
- return (\%data, $found, $hit);
-}
-
-
-#
-# add_counts(data1_ref, data2_ref)
-#
-# DATA1_REF and DATA2_REF are references to hashes containing a mapping
-#
-# line number -> execution count
-#
-# Return a list (RESULT_REF, LINES_FOUND, LINES_HIT) where RESULT_REF
-# is a reference to a hash containing the combined mapping in which
-# execution counts are added.
-#
-
-sub add_counts($$)
-{
- my %data1 = %{$_[0]}; # Hash 1
- my %data2 = %{$_[1]}; # Hash 2
- my %result; # Resulting hash
- my $line; # Current line iteration scalar
- my $data1_count; # Count of line in hash1
- my $data2_count; # Count of line in hash2
- my $found = 0; # Total number of lines found
- my $hit = 0; # Number of lines with a count > 0
-
- foreach $line (keys(%data1))
- {
- $data1_count = $data1{$line};
- $data2_count = $data2{$line};
-
- # Add counts if present in both hashes
- if (defined($data2_count)) { $data1_count += $data2_count; }
-
- # Store sum in %result
- $result{$line} = $data1_count;
-
- $found++;
- if ($data1_count > 0) { $hit++; }
- }
-
- # Add lines unique to data2
- foreach $line (keys(%data2))
- {
- # Skip lines already in data1
- if (defined($data1{$line})) { next; }
-
- # Copy count from data2
- $result{$line} = $data2{$line};
-
- $found++;
- if ($result{$line} > 0) { $hit++; }
- }
-
- return (\%result, $found, $hit);
-}
-
-
-#
-# apply_baseline(data_ref, baseline_ref)
-#
-# Subtract the execution counts found in the baseline hash referenced by
-# BASELINE_REF from actual data in DATA_REF.
-#
-
-sub apply_baseline($$)
-{
- my %data_hash = %{$_[0]};
- my %base_hash = %{$_[1]};
- my $filename;
- my $testname;
- my $data;
- my $data_testdata;
- my $data_funcdata;
- my $data_count;
- my $base;
- my $base_testdata;
- my $base_count;
- my $sumcount;
- my $found;
- my $hit;
-
- foreach $filename (keys(%data_hash))
- {
- # Get data set for data and baseline
- $data = $data_hash{$filename};
- $base = $base_hash{$filename};
-
- # Get set entries for data and baseline
- ($data_testdata, undef, $data_funcdata) =
- get_info_entry($data);
- ($base_testdata, $base_count) = get_info_entry($base);
-
- # Sumcount has to be calculated anew
- $sumcount = {};
-
- # For each test case, subtract test specific counts
- foreach $testname (keys(%{$data_testdata}))
- {
- # Get counts of both data and baseline
- $data_count = $data_testdata->{$testname};
-
- $hit = 0;
-
- ($data_count, undef, $hit) =
- subtract_counts($data_count, $base_count);
-
- # Check whether this test case did hit any line at all
- if ($hit > 0)
- {
- # Write back resulting hash
- $data_testdata->{$testname} = $data_count;
- }
- else
- {
- # Delete test case which did not impact this
- # file
- delete($data_testdata->{$testname});
- }
-
- # Add counts to sum of counts
- ($sumcount, $found, $hit) =
- add_counts($sumcount, $data_count);
- }
-
- # Write back resulting entry
- set_info_entry($data, $data_testdata, $sumcount,
- $data_funcdata, $found, $hit);
-
- $data_hash{$filename} = $data;
- }
-
- return (\%data_hash);
-}
-
-
-#
-# combine_info_entries(entry_ref1, entry_ref2)
-#
-# Combine .info data entry hashes referenced by ENTRY_REF1 and ENTRY_REF2.
-# Return reference to resulting hash.
-#
-
-sub combine_info_entries($$)
-{
- my $entry1 = $_[0]; # Reference to hash containing first entry
- my $testdata1;
- my $sumcount1;
- my $funcdata1;
-
- my $entry2 = $_[1]; # Reference to hash containing second entry
- my $testdata2;
- my $sumcount2;
- my $funcdata2;
-
- my %result; # Hash containing combined entry
- my %result_testdata;
- my $result_sumcount = {};
- my %result_funcdata;
- my $lines_found;
- my $lines_hit;
-
- my $testname;
-
- # Retrieve data
- ($testdata1, $sumcount1, $funcdata1) = get_info_entry($entry1);
- ($testdata2, $sumcount2, $funcdata2) = get_info_entry($entry2);
-
- # Combine funcdata
- foreach (keys(%{$funcdata1}))
- {
- $result_funcdata{$_} = $funcdata1->{$_};
- }
-
- foreach (keys(%{$funcdata2}))
- {
- $result_funcdata{$_} = $funcdata2->{$_};
- }
-
- # Combine testdata
- foreach $testname (keys(%{$testdata1}))
- {
- if (defined($testdata2->{$testname}))
- {
- # testname is present in both entries, requires
- # combination
- ($result_testdata{$testname}) =
- add_counts($testdata1->{$testname},
- $testdata2->{$testname});
- }
- else
- {
- # testname only present in entry1, add to result
- $result_testdata{$testname} = $testdata1->{$testname};
- }
-
- # update sum count hash
- ($result_sumcount, $lines_found, $lines_hit) =
- add_counts($result_sumcount,
- $result_testdata{$testname});
- }
-
- foreach $testname (keys(%{$testdata2}))
- {
- # Skip testnames already covered by previous iteration
- if (defined($testdata1->{$testname})) { next; }
-
- # testname only present in entry2, add to result hash
- $result_testdata{$testname} = $testdata2->{$testname};
-
- # update sum count hash
- ($result_sumcount, $lines_found, $lines_hit) =
- add_counts($result_sumcount,
- $result_testdata{$testname});
- }
-
- # Calculate resulting sumcount
-
- # Store result
- set_info_entry(\%result, \%result_testdata, $result_sumcount,
- \%result_funcdata, $lines_found, $lines_hit);
-
- return(\%result);
-}
-
-
-#
-# combine_info_files(info_ref1, info_ref2)
-#
-# Combine .info data in hashes referenced by INFO_REF1 and INFO_REF2. Return
-# reference to resulting hash.
-#
-
-sub combine_info_files($$)
-{
- my %hash1 = %{$_[0]};
- my %hash2 = %{$_[1]};
- my $filename;
-
- foreach $filename (keys(%hash2))
- {
- if ($hash1{$filename})
- {
- # Entry already exists in hash1, combine them
- $hash1{$filename} =
- combine_info_entries($hash1{$filename},
- $hash2{$filename});
- }
- else
- {
- # Entry is unique in both hashes, simply add to
- # resulting hash
- $hash1{$filename} = $hash2{$filename};
- }
- }
-
- return(\%hash1);
-}
-
-
-#
-# apply_prefix(filename, prefix)
-#
-# If FILENAME begins with PREFIX, remove PREFIX from FILENAME and return
-# resulting string, otherwise return FILENAME.
-#
-
-sub apply_prefix($$)
-{
- my $filename = $_[0];
- my $prefix = $_[1];
- my $clean_prefix = escape_regexp($prefix);
-
- if (defined($prefix) && ($prefix ne ""))
- {
- if ($filename =~ /^$clean_prefix\/(.*)$/)
- {
- return substr($filename, length($prefix) + 1);
- }
- }
-
- return $filename;
-}
-
-
-#
-# escape_regexp(string)
-#
-# Escape special characters in STRING which would be incorrectly interpreted
-# in a PERL regular expression.
-#
-
-sub escape_regexp($)
-{
- my $string = $_[0];
-
- # Escape special characters
- $string =~ s/\\/\\\\/g;
- $string =~ s/\^/\\\^/g;
- $string =~ s/\$/\\\$/g;
- $string =~ s/\./\\\./g;
- $string =~ s/\|/\\\|/g;
- $string =~ s/\(/\\\(/g;
- $string =~ s/\)/\\\)/g;
- $string =~ s/\[/\\\[/g;
- $string =~ s/\]/\\\]/g;
- $string =~ s/\*/\\\*/g;
- $string =~ s/\?/\\\?/g;
- $string =~ s/\{/\\\{/g;
- $string =~ s/\}/\\\}/g;
- $string =~ s/\+/\\\+/g;
-
- return $string;
-}
diff --git a/chromium/third_party/lcov/contrib/galaxy/posterize.pl b/chromium/third_party/lcov/contrib/galaxy/posterize.pl
deleted file mode 100755
index 1b2895ede67..00000000000
--- a/chromium/third_party/lcov/contrib/galaxy/posterize.pl
+++ /dev/null
@@ -1,312 +0,0 @@
-#!/usr/bin/perl
-#
-# Copyright (c) International Business Machines Corp., 2002
-#
-# 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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-#
-# posterize.pl
-#
-# This script generates a postscript file from output generated from the
-# fcgp http://sourceforge.net/projects/fcgp/ for plotting
-#
-#
-# History:
-# 2003-09-04 wrote - James M Kenefick Jr. <jkenefic@us.ibm.com>
-#
-
-
-
-# a good deal of this could be turned in to cli
-# arguments.
-
-# Constants
-my $Title = "Linux Kernel Coverage";
-my $KernelVersion = "2.5.73";
-my $TestDescription = "A Sample Print";
-my $Image = "../lgp/image.ps";
-
-# Variables
-my $Bounds = "";
-# Paper sizes in inches
-my $PAPER_WIDTH = 34;
-my $PAPER_HEIGHT = 42;
-
-# points per inch
-my $ppi = 72;
-
-# Margins
-my $TopMargin = 1;
-my $BottomMargin = 1.5;
-my $LeftMargin = 1;
-my $RightMargin = 1;
-
-
-$RightMargin = $PAPER_WIDTH - $RightMargin;
-$TopMargin = $PAPER_HEIGHT - $TopMargin;
-
-my $filename = "poster.ps";
-
-# Sizes in ppi
-my $PPI_WIDTH = ($PAPER_WIDTH * $ppi);
-my $PPI_HEIGHT = ($PAPER_HEIGHT * $ppi);
-
-# Date we create poster
-my $date = `date`;
-
-print STDERR "Creating Poster\n";
-
-open POSTER, ">$filename";
-
-
-
-print(POSTER <<END_OF_USAGE);
-%!PS-Adobe-1.0
-%%DocumentFonts: Helvetica Helvetica-Bold
-%%Title: Linux 2.4.0 Kernel Poster
-%%Creator: Rusty's scripts and postersize (GPL)
-%%CreationDate: $date
-%%Pages: 1
-%%BoundingBox: 0 0 $PPI_WIDTH $PPI_HEIGHT
-%%EndComments
-%!
-/PRorig_showpage_x178313 /showpage load def /showpage{
- errordict /handleerror {} put
- }def
-/initgraphics{}def/setpagedevice{pop}def
-statusdict begin /a4tray{}def /lettertray{}def end
-/a4{}def/a3{}def/a0{}def/letter{}def/legal{}def
-/a4small{}def /lettersmall{}def /a4tray{}def /lettertray{}def
-/setscreen{pop pop pop}def
-/ColorManagement {pop} def
-
-
-/A {gsave newpath 0 360 arc stroke grestore} bind def
-/M {moveto} bind def
-/L {lineto} bind def
-/D {[] 0 setdash} bind def
-/D5 {[5] 0 setdash} bind def
-/C0 {0 0 0 setrgbcolor} bind def
-/C1 {.8 .4 .4 setrgbcolor} bind def
-/C2 {.5 1 .5 setrgbcolor} bind def
-/C3 {0 .7 0 setrgbcolor} bind def
-/C4 {1 0 0 setrgbcolor} bind def
-/C5 {0 0 1 setrgbcolor} bind def
-/R {grestore} bind def
-/S {0 0 M stroke} bind def
-/T {gsave translate} bind def
-/U {C0 newpath 4 copy 4 2 roll 8 7 roll M L L L closepath stroke
-C1 findfont exch scalefont setfont M show} bind def
-
-% Added James M Kenefick Jr.
-/Hi_Color {0 0 1} def
-/Med_Color {0 .60 1} def
-/Lo_Color {0 1 1} def
-/None_Color {.75 .75 .75} def
-/Hi {newpath 4 copy 4 2 roll 8 7 roll M L L L Hi_Color setrgbcolor fill closepath} bind def
-/Med {newpath 4 copy 4 2 roll 8 7 roll M L L L Med_Color setrgbcolor fill closepath} bind def
-/Lo {newpath 4 copy 4 2 roll 8 7 roll M L L L Lo_Color setrgbcolor fill closepath} bind def
-/None {newpath 4 copy 4 2 roll 8 7 roll M L L L None_Color setrgbcolor fill closepath} bind def
-
-/inch
-{
- 72 mul
-}
-def
-
-/LeftMargin $LeftMargin inch def
-/RightMargin $RightMargin inch def
-/TopMargin $TopMargin inch def
-/BottomMargin $BottomMargin inch def
-/FontScale 25 def
-/AuthorFontScale 70 def
-
-/centerText
-{
- dup
- stringwidth pop
- 2 div
- RightMargin LeftMargin sub 2 div
- exch sub
- LeftMargin add
- NextLine moveto
- show
-}
-def
-
-/upLine
-{
- /NextLine
- NextLine LineSpace2 add
- def
-}
-def
-
-/advanceLine
-{
- /NextLine
- NextLine LineSpace sub
- def
-}
-def
-
-/fontScale
-{
- TopMargin BottomMargin sub FontScale div
-}
-def
-
-/authorfontScale
-{
- TopMargin BottomMargin sub AuthorFontScale div
-}
-def
-
-/rightJustify
-{
- dup
- stringwidth pop
- RightMargin 1 inch sub
- exch sub
- NextLine moveto
- show
-}
-def
-
-/usableY
-{
- TopMargin LineSpace 3 mul sub BottomMargin sub
-}
-def
-
-/usableX
-{
- RightMargin LeftMargin sub
-}
-def
-gsave
-/Times-Roman findfont fontScale scalefont setfont
-/LineSpace fontScale def
-/NextLine (B) stringwidth pop TopMargin exch sub def
-
-%%EndProlog
-%%Page 1
-% title
-
-($Title) centerText advanceLine
-(Kernel: $KernelVersion) centerText advanceLine
-($TestDescription) centerText
-
-% Author Block
-LeftMargin BottomMargin translate
-/Times-Roman findfont authorfontScale scalefont setfont
-/LineSpace2 authorfontScale def
-/NextLine 0 def
-(Based on work by Rusty Russell, Christian Reiniger) rightJustify
-upLine
-(By James M. Kenefick Jr.) rightJustify
-
-grestore
-LeftMargin BottomMargin translate
-
-% Key Block
-15 15 scale
-% This is the key for the graph.
-
-/box { newpath moveto 0 1 rlineto 2 0 rlineto 0 -1 rlineto closepath } def
-/key { setrgbcolor 2 copy box gsave fill grestore 0 0 0 setrgbcolor strokepath fill moveto 2.4 0.25 rmoveto show } def
-
-/Helvetica-Oblique findfont
-1 scalefont setfont
-0.1 setlinewidth
-
-(static functions) 1 5 0.5 1 0.5 key % Light green.
-(indirectly called functions) 1 7 0 0.7 0 key % green
-(exported functions) 1 9 1 0 0 key % red
-(other functions) 1 11 0 0 1 key % blue
-
-(Low Coverage) 1 15 Lo_Color key % blue
-(Medium Coverage) 1 17 Med_Color key % blue
-(Hi Coverage) 1 19 Hi_Color key % blue
-(No Coverage) 1 21 None_Color key % blue
-1 3.25 moveto
-0.8 0.4 0.4 setrgbcolor
-/Helvetica findfont
-1 scalefont setfont
-(xxx) show
-1 3 moveto
-2.4 0.25 rmoveto
-0 0 0 setrgbcolor
-/Helvetica-Oblique findfont
-1 scalefont setfont
-(function name) show
-
-1 1.25 moveto
-0.8 0.4 0.4 setrgbcolor
-/Helvetica-Bold findfont
-1 scalefont setfont
-(xxx) show
-1 1 moveto
-2.4 0.25 rmoveto
-0 0 0 setrgbcolor
-/Helvetica-Oblique findfont
-1 scalefont setfont
-(source filename) show
-
-6 24 moveto
-/Helvetica-Bold findfont
-2 scalefont setfont
-(Key) show
-
-% Box around it
-newpath
-0.2 0.2 moveto
-0.2 27 lineto
-17 27 lineto
-17 0.2 lineto
-closepath
-strokepath fill
-
-
-1 15 div 1 15 div scale
-
-% find and move to center
-END_OF_USAGE
-
-# Find the bounds for the image
-
-$Bounds = `tail -1 $Image`;
-($Junk, $Junk, $minX, $minY, $maxX, $maxY) = split / /, $Bounds;
-
-my $xRange = $maxX - $minX;
-my $yRange = $maxY - $minY;
-
-if ($xRange < $yRange){
- $Range = $xRange;
-} else {
- $Range = $yRange;
-}
-print POSTER " 0 usableY usableX sub 2 div translate\n";
-print POSTER "usableX $Range div usableX $Range div scale\n";
-print POSTER "$Range 2 div $Range 2 div translate\n";
-print POSTER "gsave\n";
-# Paste in actual image.
-print POSTER `cat /home/lgp/image.ps`;
-print POSTER "%%Trailer\n";
-print POSTER "grestore\n";
-print POSTER "showpage\n";
-print POSTER "PRorig_showpage_x178313\n";
-print POSTER "/showpage /PRorig_showpage_x178313 load def\n";
-
diff --git a/chromium/third_party/lcov/descriptions.tests b/chromium/third_party/lcov/descriptions.tests
deleted file mode 100644
index b91fe3972c2..00000000000
--- a/chromium/third_party/lcov/descriptions.tests
+++ /dev/null
@@ -1,2990 +0,0 @@
-personality01
- Check that we can set the personality for a process.
-personality02
- Check that we get EINVAL for a bad personality.
-exit01
- Check that exit returns the correct values to the waiting parent
-exit02
- Check that exit flushes output file buffers and closes files upon
- exiting
-wait02
- Basic test for wait(2) system call.
-wait401
- check that a call to wait4() correctly waits for a child
- process to exit
-wait402
- check for ECHILD errno when using an illegal pid value
-
-waitpid01
- Check that when a child kills itself by generating an alarm
- exception, the waiting parent is correctly notified.
-waitpid02
- Check that when a child kills itself by generating an integer zero
- divide exception, the waiting parent is correctly notified.
-waitpid03
- Check that parent waits until specific child has returned.
-waitpid04
- test to check the error conditions in waitpid sys call
-waitpid05
- Check that when a child kills itself with a kill statement after
- determining its process id by using getpid, the parent receives a
- correct report of the cause of its death. This also indirectly
- checks that getpid returns the correct process id.
-waitpid06
- Tests to see if pid's returned from fork and waitpid are same.
-waitpid07
- Tests to see if pid's returned from fork and waitpid are same.
-waitpid08
- Tests to see if pid's returned from fork and waitpid are same
-waitpid09
- Check ability of parent to wait until child returns, and that the
- child's process id is returned through the waitpid. Check that
- waitpid returns immediately if no child is present.
-waitpid10
- Tests to see if pid's returned from fork and waitpid are same
-waitpid11
- Tests to see if pid's returned from fork and waitpid are same
-waitpid12
- Tests to see if pid's returned from fork and waitpid are same
-waitpid13
- Tests to see if pid's returned from fork and waitpid are same
-fcntl01
- Test F_DUPFD, F_SETFL cmds of fcntl
-fcntl02
- Basic test for fcntl(2) using F_DUPFD argument.
-fcntl03
- Basic test for fcntl(2) using F_GETFD argument.
-fcntl04
- Basic test for fcntl(2) using F_GETFL argument.
-fcntl05
- Basic test for fcntl(2) using F_GETLK argument.
-fcntl06
- Error checking conditions for remote locking of regions of a file.
-fcntl07
- Close-On-Exec functional test.
-fcntl07B
- Close-On-Exec of named pipe functional test.
-fcntl08
- Basic test for fcntl(2) using F_SETFL argument.
-fcntl09
- Basic test for fcntl(2) using F_SETLK argument.
-fcntl10
- Basic test for fcntl(2) using F_SETLKW argument.
-fcntl11
- Testcase to check locking of regions of a file
-
-fcntl12
-
- Testcase to test that fcntl() sets EMFILE for F_DUPFD command.
-
-fcntl13
-
- Testcase to test that fcntl() sets errno correctly.
-
-fcntl14
-
- File locking test cases for fcntl. In Linux, S_ENFMT is not implemented
- in the kernel. However all standard Unix kernels define S_ENFMT as
- S_ISGID. So this test defines S_ENFMT as S_ISGID.
-
-fcntl15
-
- Check that file locks are removed when file closed
-
-fcntl16
-
- Additional file locking test cases for checking proper notification
- of processes on lock change
-
-fcntl17
-
- Check deadlock detection for file locking
-
-fcntl18
-
- Test to check the error conditions in fcntl system call
-
-fcntl19
-
- Testcase to check locking of regions of a file
-
-fcntl20
-
- Check locking of regions of a file
-
-fcntl21
-
- Check locking of regions of a file
-
-dup01
-
- Basic test for dup(2).
-
-dup02
-
- Negative test for dup(2) with bad fd.
-
-dup03
-
- Negative test for dup(2) (too many fds).
-
-dup04
-
- Basic test for dup(2) of a system pipe descriptor.
-
-dup05
-
- Basic test for dup(2) of a named pipe descriptor.
-
-dup201
-
- Negative tests for dup2() with bad fd (EBADF), and for "too many
- open files" (EMFILE)
-
-dup202
-
- Is the access mode the same for both file descriptors?
- 0: read only ? "0444"
- 1: write only ? "0222"
- 2: read/write ? "0666"
-
-dup203
-
- Testcase to check the basic functionality of dup2().
-
-dup204
-
- Testcase to check the basic functionality of dup2(2).
-
-
-msync01
-
- Verify that, msync() succeeds, when the region to synchronize, is part
- of, or all of a mapped region.
-
-msync02
-
- Verify that msync() succeeds when the region to synchronize is mapped
- shared and the flags argument is MS_INVALIDATE.
-
-msync03
-
- Verify that, msync() fails, when the region to synchronize, is outside
- the address space of the process.
-
-msync04
-
- Verify that, msync() fails, when the region to synchronize, is mapped
- but the flags argument is invalid.
-
-msync05
-
- Verify that, msync() fails, when the region to synchronize, was not
- mapped.
-
-
-sendfile02
-
- Testcase to test the basic functionality of the sendfile(2) system call.
-
-sendfile03
-
- Testcase to test that sendfile(2) system call returns appropriate
- errnos on error.
-
-fork01
- Basic test for fork(2).
-fork02
- Test correct operation of fork:
- pid == 0 in child;
- pid > 0 in parent from wait;
-fork03
- Check that child can use a large text space and do a large
- number of operations.
-fork04
- Child inheritance of Environment Variables after fork().
-fork05
- Make sure LDT is propagated correctly
-fork06
- Test that a process can fork children a large number of
- times in succession
-fork07
- Check that all children inherit parent's file descriptor
-fork08
- Check if the parent's file descriptors are affected by
- actions in the child; they should not be.
-fork09
- Check that child has access to a full set of files.
-fork10
- Check inheritance of file descriptor by children, they
- should all be referring to the same file.
-fork11
- Test that parent gets a pid from each child when doing wait
-vfork01
- Fork a process using vfork() and verify that, the attribute values like
- euid, ruid, suid, egid, rgid, sgid, umask, inode and device number of
- root and current working directories are same as that of the parent
- process.
-vfork02
- Fork a process using vfork() and verify that, the pending signals in
- the parent are not pending in the child process.
-ioctl01
-
- Testcase to check the errnos set by the ioctl(2) system call.
-
-ioctl02
-
- Testcase to test the TCGETA, and TCSETA ioctl implementations for
- the tty driver
-
-sockioctl01
-
- Verify that ioctl() on sockets returns the proper errno for various
- failure cases
-
-getitimer01
- check that a correct call to getitimer() succeeds
-
-
-getitimer02
- check that a getitimer() call fails as expected
- with an incorrect second argument.
-
-getitimer03
- check that a getitimer() call fails as expected
- with an incorrect first argument.
-
-setitimer01
- check that a reasonable setitimer() call succeeds.
-
-
-setitimer02
- check that a setitimer() call fails as expected
- with incorrect values.
-
-setitimer03
- check that a setitimer() call fails as expected
- with incorrect values.
-
-float_trigo
- increase CPUs workload - verify that results of some math functions are stable
- trigonometric (acos, asin, atan, atan2, cos, sin, tan),
- hyperbolic (cosh, sinh, tanh),
-
-float_exp_log
- increase CPUs workload - verify that results of some math functions are stable
- exponential and logarithmic functions (exp, log, log10),
- Functions that manipulate floating-point numbers (modf, ldexp, frexp),
- Euclidean distance function (hypot),
-
-float_bessel
- increase CPUs workload - verify that results of some math functions are stable
- Bessel (j0, j1, y0, y1),
- Computes the natural logarithm of the gamma function (lgamma),
-
-fload_power
- increase CPUs workload - verify that results of some math functions are stable
- Computes sqrt, power, fmod
-
-float_iperb
- increase CPUs workload - verify that results of some math functions are stable
-pth_str01
-
- Creates a tree of threads
-
-pth_str02
-
- Creates n threads
-
-pth_str03
-
- Creates a tree of threads does calculations, and
- returns result to parent
-
-
-asyncio02
-
- Write/close flushes data to the file.
-
-
-fpathconf
-
- Basic test for fpathconf(2)
-
-gethostid01
-
- Basic test for gethostid(2)
-
-
-pathconf01
-
- Basic test for pathconf(2)
-
-setpgrp01
-
- Basic test for the setpgrp(2) system call.
-
-setpgrp02
-
- Testcase to check the basic functionality of the setpgrp(2) syscall.
-
-
-ulimit01
-
- Basic test for the ulimit(2) system call.
-
-mmstress
-
- Performs General Stress with Race conditions
-
-mmap1
-
- Test the LINUX memory manager. The program is aimed at
- stressing the memory manager by simultaneous map/unmap/read
- by light weight processes, the test is scheduled to run for
- a minimum of 24 hours.
-
-mmap2
-
- Test the LINUX memory manager. The program is aimed at
- stressing the memory manager by repeated map/write/unmap of a
- of a large gb size file.
-
-mmap3
-
- Test the LINUX memory manager. The program is aimed at
- stressing the memory manager by repeated map/write/unmap
- of file/memory of random size (maximum 1GB) this is done by
- multiple processes.
-
-mmap001
-
- Tests mmapping a big file and writing it once
-
-mmap01
-
- Verify that, mmap() succeeds when used to map a file where size of the
- file is not a multiple of the page size, the memory area beyond the end
- of the file to the end of the page is accessible. Also, verify that
- this area is all zeroed and the modifications done to this area are
- not written to the file.
-
-mmap02
-
- Call mmap() with prot parameter set to PROT_READ and with the file
- descriptor being open for read, to map a file creating mapped memory
- with read access. The minimum file permissions should be 0444.
-
-mmap03
-
- Call mmap() to map a file creating a mapped region with execute access
- under the following conditions -
- - The prot parameter is set to PROT_EXE
- - The file descriptor is open for read
- - The file being mapped has execute permission bit set.
- - The minimum file permissions should be 0555.
-
- The call should succeed to map the file creating mapped memory with the
- required attributes.
-
-mmap04
-
- Call mmap() to map a file creating a mapped region with read/exec access
- under the following conditions -
- - The prot parameter is set to PROT_READ|PROT_EXEC
- - The file descriptor is open for read
- - The file being mapped has read and execute permission bit set.
- - The minimum file permissions should be 0555.
-
- The call should succeed to map the file creating mapped memory with the
- required attributes.
-
-
-mmap05
-
- Call mmap() to map a file creating mapped memory with no access under
- the following conditions -
- - The prot parameter is set to PROT_NONE
- - The file descriptor is open for read(any mode other than write)
- - The minimum file permissions should be 0444.
-
- The call should succeed to map the file creating mapped memory with the
- required attributes.
-
-mmap06
-
- Call mmap() to map a file creating a mapped region with read access
- under the following conditions -
- - The prot parameter is set to PROT_READ
- - The file descriptor is open for writing.
-
- The call should fail to map the file.
-
-
-mmap07
-
- Call mmap() to map a file creating a mapped region with read access
- under the following conditions -
- - The prot parameter is set to PROT_WRITE
- - The file descriptor is open for writing.
- - The flags parameter has MAP_PRIVATE set.
-
- The call should fail to map the file.
-
-mmap08
-
- Verify that mmap() fails to map a file creating a mapped region
- when the file specified by file descriptor is not valid.
-
-
-mremap01
-
- Verify that, mremap() succeeds when used to expand the existing
- virtual memory mapped region to the requested size where the
- virtual memory area was previously mapped to a file using mmap().
-
-mremap02
-
- Verify that,
- mremap() fails when used to expand the existing virtual memory mapped
- region to the requested size, if the virtual memory area previously
- mapped was not page aligned or invalid argument specified.
-
-mremap03
-
- Verify that,
- mremap() fails when used to expand the existing virtual memory mapped
- region to the requested size, if there already exists mappings that
- cover the whole address space requested or the old address specified was
- not mapped.
-
-mremap04
-
- Verify that,
- mremap() fails when used to expand the existing virtual memory mapped
- region to the requested size, if the memory area cannot be expanded at
- the current virtual address and MREMAP_MAYMOVE flag not set.
-
-munmap01
-
- Verify that, munmap call will succeed to unmap a mapped file or
- anonymous shared memory region from the calling process's address space
- and after successful completion of munmap, the unmapped region is no
- longer accessible.
-
-munmap02
-
- Verify that, munmap call will succeed to unmap a mapped file or
- anonymous shared memory region from the calling process's address space
- if the region specified by the address and the length is part or all of
- the mapped region.
-
-munmap03
-
- Verify that, munmap call will fail to unmap a mapped file or anonymous
- shared memory region from the calling process's address space if the
- address and the length of the region to be unmapped points outside the
- calling process's address space
-
-brk01
- Test the basic functionality of brk.
-
-sbrk01
- Basic test for the sbrk(2) system call.
-
-
-mprotect01
-
- Testcase to check the error conditions for mprotect(2)
-
-mprotect02
-
- Testcase to check the mprotect(2) system call.
-
-mprotect03
-
- Testcase to check the mprotect(2) system call.
-
-msgctl01
- create a message queue, then issue the IPC_STAT command
- and RMID commands to test the functionality
-
-
-msgctl02
- create a message queue, then issue the IPC_SET command
- to lower the msg_qbytes value.
-
-
-msgctl03
- create a message queue, then issue the IPC_RMID command
-
-
-
-msgctl04
- test for EACCES, EFAULT and EINVAL errors using
- a variety of incorrect calls.
-
-
-msgctl05
- test for EPERM error
-
-
-
-msgget01
- create a message queue, write a message to it and
- read it back.
-
-
-msgget02
- test for EEXIST and ENOENT errors
-
-
-msgget03
- test for an ENOSPC error by using up all available
- message queues.
-
-msgget04
- test for an EACCES error by creating a message queue
- with no read or write permission and then attempting
- to access it with various permissions.
-
-msgrcv01
- test that msgrcv() receives the expected message
-
-msgrcv02
- test for EACCES and EFAULT errors
-
-msgrcv03
- test for EINVAL error
-
-msgrcv04
- test for E2BIG and ENOMSG errors
-
-msgrcv05
- test for EINTR error
-
-msgrcv06
- test for EIDRM error
-
-msgsnd01
- test that msgsnd() enqueues a message correctly
-
-msgsnd02
- test for EACCES and EFAULT errors
-
-msgsnd03
- test for EINVAL error
-
-msgsnd04
- test for EAGAIN error
-
-msgsnd05
- test for EINTR error
-
-
-msgsnd06
- test for EIDRM error
-
-link02
-
- Basic test for link(2)
-
-link03
-
- Multi links tests
-
-link04
-
- Negative test cases for link(2)
-
-link05
-
- Multi links (EMLINK) negative test
-
-readlink01
-
- Verify that, readlink will succeed to read the contents of the symbolic
- link created the process.
-
-readlink02
-
- Basic test for the readlink(2) system call
-
-readlink03
-
- Verify that,
- 1) readlink(2) returns -1 and sets errno to EACCES if search/write
- permission is denied in the directory where the symbolic link
- resides.
- 2) readlink(2) returns -1 and sets errno to EINVAL if the buffer size
- is not positive.
- 3) readlink(2) returns -1 and sets errno to EINVAL if the specified
- file is not a symbolic link file.
- 4) readlink(2) returns -1 and sets errno to ENAMETOOLONG if the
- pathname component of symbolic link is too long (ie, > PATH_MAX).
- 5) readlink(2) returns -1 and sets errno to ENOENT if the component of
- symbolic link points to an empty string.
-
-readlink04
-
- Verify that, readlink call will succeed to read the contents of the
- symbolic link if invoked by non-root user who is not the owner of the
- symbolic link.
-
-
-symlink01
-
- Test of various file function calls, such as rename or open, on a symbolic
- link file.
-
-symlink02
-
- Basic test for the symlink(2) system call.
-
-symlink03
-
- Verify that,
- 1) symlink(2) returns -1 and sets errno to EACCES if search/write
- permission is denied in the directory where the symbolic link is
- being created.
- 2) symlink(2) returns -1 and sets errno to EEXIST if the specified
- symbolic link already exists.
- 3) symlink(2) returns -1 and sets errno to EFAULT if the specified
- file or symbolic link points to invalid address.
- 4) symlink(2) returns -1 and sets errno to ENAMETOOLONG if the
- pathname component of symbolic link is too long (ie, > PATH_MAX).
- 5) symlink(2) returns -1 and sets errno to ENOTDIR if the directory
- component in pathname of symbolic link is not a directory.
- 6) symlink(2) returns -1 and sets errno to ENOENT if the component of
- symbolic link points to an empty string.
-
-symlink04
-
- Verify that, symlink will succeed to create a symbolic link of an existing
- object name path.
-
-
-symlink05
-
- Verify that, symlink will succeed to create a symbolic link of an
- non-existing object name path.
-
-
-unlink05
-
- Basic test for the unlink(2) system call.
-
-unlink06
-
- Test for the unlink(2) system call of a FIFO.
-
-unlink07
-
- Tests for error handling for the unlink(2) system call.
-
-unlink08
-
- More tests for error handling for the unlink(2) system call.
-
-
-linktest
-
- Regression test for max links per file
-
-rename01
-
- This test will verify the rename(2) syscall basic functionality.
- Verify rename() works when the "new" file or directory does not exist.
-
-rename02
-
- Basic test for the rename(2) system call
-
-rename03
-
- This test will verify that rename(2) functions correctly
- when the "new" file or directory exists
-
-rename04
-
- This test will verify that rename(2) failed when newpath is
- a non-empty directory and return EEXIST or ENOTEMPTY
-
-rename05
-
- This test will verify that rename(2) fails with EISDIR
-
-rename06
-
- This test will verify that rename(2) failed in EINVAL
-
-rename07
-
- This test will verify that rename(2) failed in ENOTDIR
-
-rename08
-
- This test will verify that rename(2) syscall failed in EFAULT
-
-rename09
-
- check rename() fails with EACCES
-
-rename10
-
- This test will verify that rename(2) syscall fails with ENAMETOOLONG
- and ENOENT
-
-rename11
-
- This test will verify that rename(2) failed in EBUSY
-
-rename12
-
- check rename() fails with EPERM
-
-rename13
-
- Verify rename() return successfully and performs no other action
- when "old" file and "new" file link to the same file.
-
-rmdir01
-
- This test will verify that rmdir(2) syscall basic functionality.
- verify rmdir(2) returns a value of 0 and the directory being
- removed
-
-rmdir02
-
- This test will verify that rmdir(2) fail in
- 1. ENOTEMPTY
- 2. EBUSY
- 3. ENAMETOOLONG
- 4. ENOENT
- 5. ENOTDIR
- 6. EFAULT
- 7. EFAULT
-
-rmdir03
-
- check rmdir() fails with EPERM or EACCES
-
-rmdir04
-
- Basic test for the rmdir(2) system call
-
-rmdir05
-
- Verify that rmdir(2) returns a value of -1 and sets errno to indicate the error.
-
-
-
-mkdir01
-
- Basic errno test for mkdir(2)
-
-mkdir02
-
- This test will verify that new directory created
- by mkdir(2) inherits the group ID from the parent
- directory and S_ISGID bit, if the S_ISGID bit is set
- in the parent directory.
-
-mkdir03
-
- Check mkdir() with various error conditions that should produce
- EFAULT, ENAMETOOLONG, EEXIST, ENOENT and ENOTDIR
-
-mkdir04
-
- Attempt to create a directory in a directory having no permissions.
-
-mkdir05
-
- This test will verify the mkdir(2) syscall basic functionality
-
-mkdir08
-
- Basic test for mkdir(2)
-
-
-mknod01
-
- Basic test for mknod(2)
-
-mknod02
-
- Verify that mknod(2) succeeds when used to create a filesystem
- node with set group-ID bit set on a directory without set group-ID bit set.
- The node created should have set group-ID bit set and its gid should be
- equal to that of its parent directory.
-
-mknod03
-
- Verify that mknod(2) succeeds when used to create a filesystem
- node with set group-ID bit set on a directory with set group-ID bit set.
- The node created should have set group-ID bit set and its gid should be
- equal to the effective gid of the process.
-
-mknod04
-
- Verify that mknod(2) succeeds when used to create a filesystem
- node on a directory with set group-ID bit set.
- The node created should not have group-ID bit set and its gid should be
- equal to the effective gid of the process.
-
-mknod05
-
- Verify that mknod(2) succeeds when used by root to create a filesystem
- node with set group-ID bit set on a directory with set group-ID bit set.
- The node created should have set group-ID bit set and its gid should be
- equal to that of its parent directory.
-
-
-mknod06
-
- Verify that,
- 1) mknod(2) returns -1 and sets errno to EEXIST if specified path
- already exists.
- 2) mknod(2) returns -1 and sets errno to EFAULT if pathname points
- outside user's accessible address space.
- 3) mknod(2) returns -1 and sets errno to ENOENT if the directory
- component in pathname does not exist.
- 4) mknod(2) returns -1 and sets errno to ENAMETOOLONG if the pathname
- component was too long.
- 5) mknod(2) returns -1 and sets errno to ENOTDIR if the directory
- component in pathname is not a directory.
-
-mknod07
-
- Verify that,
- 1) mknod(2) returns -1 and sets errno to EPERM if the process id of
- the caller is not super-user.
- 2) mknod(2) returns -1 and sets errno to EACCES if parent directory
- does not allow write permission to the process.
-
-mknod08
-
- Verify that mknod(2) succeeds when used to create a filesystem
- node on a directory without set group-ID bit set. The node created
- should not have set group-ID bit set and its gid should be equal to that
- of its parent directory.
-
-
-
-
-access01
-
- Basic test for access(2) using F_OK, R_OK, W_OK, and X_OK arguments.
-
-access02
-
- Verify that access() succeeds to check the read/write/execute permissions
- on a file if the mode argument passed was R_OK/W_OK/X_OK.
-
- Also verify that, access() succeeds to test the accessibility of the file
- referred to by symbolic link if the pathname points to a symbolic link.
-
-access03
-
- EFAULT error testing for access(2).
-
-access04
-
- Verify that,
- 1. access() fails with -1 return value and sets errno to EACCES
- if the permission bits of the file mode do not permit the
- requested (Read/Write/Execute) access.
- 2. access() fails with -1 return value and sets errno to EINVAL
- if the specified access mode argument is invalid.
- 3. access() fails with -1 return value and sets errno to EFAULT
- if the pathname points outside allocate address space for the
- process.
- 4. access() fails with -1 return value and sets errno to ENOENT
- if the specified file doesn't exist (or pathname is NULL).
- 5. access() fails with -1 return value and sets errno to ENAMETOOLONG
- if the pathname size is > PATH_MAX characters.
-
-access05
-
- Verify that access() succeeds to check the existence of a file if
- search access is permitted on the pathname of the specified file.
-
-access06
-
- EFAULT error testing for access(2).
-
-chroot01
-
- Testcase to check the whether chroot sets errno to EPERM.
-
-chroot02
-
- Test functionality of chroot(2)
-
-chroot03
-
- Testcase to test whether chroot(2) sets errno correctly.
-
-pipeio
-
- This tool can be used to beat on system or named pipes.
- See the help() function below for user information.
-
-pipe01
-
- Testcase to check the basic functionality of the pipe(2) syscall:
- Check that both ends of the pipe (both file descriptors) are
- available to a process opening the pipe.
-
-pipe05
-
- Check what happens when pipe is passed a bad file descriptor.
-
-pipe06
-
- Check what happens when the system runs out of pipes.
-
-pipe08
-
- Check that a SIGPIPE signal is generated when a write is
- attempted on an empty pipe.
-
-pipe09
-
- Check that two processes can use the same pipe at the same time.
-
-pipe10
-
- Check that parent can open a pipe and have a child read from it
-
-pipe11
-
- Check if many children can read what is written to a pipe by the
- parent.
-
-
-sem01
-
- Creates a semaphore and two processes. The processes
- each go through a loop where they semdown, delay for a
- random amount of time, and semup, so they will almost
- always be fighting for control of the semaphore.
-
-sem02
- The application creates several threads using pthread_create().
- One thread performs a semop() with the SEM_UNDO flag set. The
- change in semaphore value performed by that semop should be
- "undone" only when the last pthread exits.
-
-
-semctl01
-
- test the 10 possible semctl() commands
-
-semctl02
-
- test for EACCES error
-
-semctl03
-
- test for EINVAL and EFAULT errors
-
-semctl04
-
- test for EPERM error
-
-
-semctl05
-
- test for ERANGE error
-
-semget01
-
- test that semget() correctly creates a semaphore set
-
-semget02
-
- test for EACCES and EEXIST errors
-
-semget03
-
- test for ENOENT error
-
-semget05
-
- test for ENOSPC error
-
-semget06
-
- test for EINVAL error
-
-semop01
-
- test that semop() basic functionality is correct
-
-semop02
-
- test for E2BIG, EACCES, EFAULT and EINVAL errors
-
-semop03
-
- test for EFBIG error
-
-semop04
-
- test for EAGAIN error
-
-semop05
-
- test for EINTR and EIDRM errors
-
-
-
-msgctl01
- create a message queue, then issue the IPC_STAT command
- and RMID commands to test the functionality
-
-
-msgctl02
- create a message queue, then issue the IPC_SET command
- to lower the msg_qbytes value.
-
-
-msgctl03
- create a message queue, then issue the IPC_RMID command
-
-
-
-msgctl04
- test for EACCES, EFAULT and EINVAL errors using
- a variety of incorrect calls.
-
-
-msgctl05
- test for EPERM error
-
-
-
-msgget01
- create a message queue, write a message to it and
- read it back.
-
-
-msgget02
- test for EEXIST and ENOENT errors
-
-
-msgget03
- test for an ENOSPC error by using up all available
- message queues.
-
-msgget04
- test for an EACCES error by creating a message queue
- with no read or write permission and then attempting
- to access it with various permissions.
-
-msgrcv01
- test that msgrcv() receives the expected message
-
-msgrcv02
- test for EACCES and EFAULT errors
-
-msgrcv03
- test for EINVAL error
-
-msgrcv04
- test for E2BIG and ENOMSG errors
-
-msgrcv05
- test for EINTR error
-
-msgrcv06
- test for EIDRM error
-
-msgsnd01
- test that msgsnd() enqueues a message correctly
-
-msgsnd02
- test for EACCES and EFAULT errors
-
-msgsnd03
- test for EINVAL error
-
-msgsnd04
- test for EAGAIN error
-
-msgsnd05
- test for EINTR error
-
-
-msgsnd06
- test for EIDRM error
-
-shmat01
- test that shmat() works correctly
-
-shmat02
- check for EINVAL and EACCES errors
-
-
-shmat03
- test for EACCES error
-
-
-shmctl01
- test the IPC_STAT, IPC_SET and IPC_RMID commands as
- they are used with shmctl()
-
-
-shmctl02
- check for EACCES, EFAULT and EINVAL errors
-
-
-shmctl03
- check for EACCES, and EPERM errors
-
-
-shmdt01
- check that shared memory is detached correctly
-
-
-shmdt02
- check for EINVAL error
-
-
-shmget01
- test that shmget() correctly creates a shared memory segment
-
-
-shmget02
- check for ENOENT, EEXIST and EINVAL errors
-
-
-shmget03
- test for ENOSPC error
-
-
-shmget04
- test for EACCES error
-
-
-shmget05
- test for EACCES error
-
-openfile
-
- Creates files and opens simultaneously
-
-open01
-
- Open a file with oflag = O_CREAT set, does it set the sticky bit off?
-
- Open "/tmp" with O_DIRECTORY, does it set the S_IFDIR bit on?
-
-open02
-
- Test if open without O_CREAT returns -1 if a file does not exist.
-
-open03
-
- Basic test for open(2)
-
-open04
-
- Testcase to check that open(2) sets EMFILE if a process opens files
- more than its descriptor size
-
-open05
-
- Testcase to check open(2) sets errno to EACCES correctly.
-
-open06
-
- Testcase to check open(2) sets errno to ENXIO correctly.
-
-open07
-
- Test the open(2) system call to ensure that it sets ELOOP correctly.
-
-open08
-
- Check for the following errors:
- 1. EEXIST
- 2. EISDIR
- 3. ENOTDIR
- 4. ENAMETOOLONG
- 5. EFAULT
- 6. ETXTBSY
-
-
-openfile
-
- Creates files and opens simultaneously
-
-
-chdir01
-
- Check proper operation of chdir(): tests whether the
- system call can it change the current, working directory, and find a
- file there? Will it fail on a non-directory entry ?
-
-chdir02
-
- Basic test for chdir(2).
-
-chdir03
-
- Testcase for testing that chdir(2) sets EACCES errno
-
-chdir04
-
- Testcase to test whether chdir(2) sets errno correctly.
-
-
-chmod01
-
- Verify that, chmod(2) succeeds when used to change the mode permissions
- of a file.
-
-chmod02
-
- Basic test for chmod(2).
-
-chmod03
-
- Verify that, chmod(2) will succeed to change the mode of a file
- and set the sticky bit on it if invoked by non-root (uid != 0)
- process with the following constraints,
- - the process is the owner of the file.
- - the effective group ID or one of the supplementary group ID's of the
- process is equal to the group ID of the file.
-
-chmod04
-
- Verify that, chmod(2) will succeed to change the mode of a directory
- and set the sticky bit on it if invoked by non-root (uid != 0) process
- with the following constraints,
- - the process is the owner of the directory.
- - the effective group ID or one of the supplementary group ID's of the
- process is equal to the group ID of the directory.
-
-chmod05
-
- Verify that, chmod(2) will succeed to change the mode of a directory
- but fails to set the setgid bit on it if invoked by non-root (uid != 0)
- process with the following constraints,
- - the process is the owner of the directory.
- - the effective group ID or one of the supplementary group ID's of the
- process is not equal to the group ID of the directory.
-
-chmod06
-
- Verify that,
- 1) chmod(2) returns -1 and sets errno to EPERM if the effective user id
- of process does not match the owner of the file and the process is
- not super user.
- 2) chmod(2) returns -1 and sets errno to EACCES if search permission is
- denied on a component of the path prefix.
- 3) chmod(2) returns -1 and sets errno to EFAULT if pathname points
- outside user's accessible address space.
- 4) chmod(2) returns -1 and sets errno to ENAMETOOLONG if the pathname
- component is too long.
- 5) chmod(2) returns -1 and sets errno to ENOTDIR if the directory
- component in pathname is not a directory.
- 6) chmod(2) returns -1 and sets errno to ENOENT if the specified file
- does not exists.
-
-chmod07
-
- Verify that, chmod(2) will succeed to change the mode of a file/directory
- and sets the sticky bit on it if invoked by root (uid = 0) process with
- the following constraints,
- - the process is not the owner of the file/directory.
- - the effective group ID or one of the supplementary group ID's of the
- process is equal to the group ID of the file/directory.
-
-
-chown01
-
- Basic test for chown(2).
-
-chown02
-
- Verify that, when chown(2) invoked by super-user to change the owner and
- group of a file specified by path to any numeric owner(uid)/group(gid)
- values,
- - clears setuid and setgid bits set on an executable file.
- - preserves setgid bit set on a non-group-executable file.
-
-chown03
-
- Verify that, chown(2) succeeds to change the group of a file specified
- by path when called by non-root user with the following constraints,
- - euid of the process is equal to the owner of the file.
- - the intended gid is either egid, or one of the supplementary gids
- of the process.
- Also, verify that chown() clears the setuid/setgid bits set on the file.
-
-chown04
-
- Verify that,
- 1) chown(2) returns -1 and sets errno to EPERM if the effective user id
- of process does not match the owner of the file and the process is
- not super user.
- 2) chown(2) returns -1 and sets errno to EACCES if search permission is
- denied on a component of the path prefix.
- 3) chown(2) returns -1 and sets errno to EFAULT if pathname points
- outside user's accessible address space.
- 4) chown(2) returns -1 and sets errno to ENAMETOOLONG if the pathname
- component is too long.
- 5) chown(2) returns -1 and sets errno to ENOTDIR if the directory
- component in pathname is not a directory.
- 6) chown(2) returns -1 and sets errno to ENOENT if the specified file
- does not exists.
-
-chown05
-
- Verify that, chown(2) succeeds to change the owner and group of a file
- specified by path to any numeric owner(uid)/group(gid) values when invoked
- by super-user.
-
-
-close01
-
- Test that closing a regular file and a pipe works correctly
-
-close02
-
- Check that an invalid file descriptor returns EBADF
-
-close08
-
- Basic test for close(2).
-
-
-fchdir01
-
- create a directory and cd into it.
-
-fchdir02
-
- try to cd into a bad directory (bad fd).
-
-
-fchmod01
-
- Basic test for Fchmod(2).
-
-fchmod02
-
- Verify that, fchmod(2) will succeed to change the mode of a file/directory
- set the sticky bit on it if invoked by root (uid = 0) process with
- the following constraints,
- - the process is not the owner of the file/directory.
- - the effective group ID or one of the supplementary group ID's of the
- process is equal to the group ID of the file/directory.
-
-fchmod03
-
- Verify that, fchmod(2) will succeed to change the mode of a file
- and set the sticky bit on it if invoked by non-root (uid != 0)
- process with the following constraints,
- - the process is the owner of the file.
- - the effective group ID or one of the supplementary group ID's of the
- process is equal to the group ID of the file.
-
-fchmod04
-
- Verify that, fchmod(2) will succeed to change the mode of a directory
- and set the sticky bit on it if invoked by non-root (uid != 0) process
- with the following constraints,
- - the process is the owner of the directory.
- - the effective group ID or one of the supplementary group ID's of the
- process is equal to the group ID of the directory.
-
-fchmod05
-
- Verify that, fchmod(2) will succeed to change the mode of a directory
- but fails to set the setgid bit on it if invoked by non-root (uid != 0)
- process with the following constraints,
- - the process is the owner of the directory.
- - the effective group ID or one of the supplementary group ID's of the
- process is not equal to the group ID of the directory.
-
-fchmod06
-
- Verify that,
- 1) fchmod(2) returns -1 and sets errno to EPERM if the effective user id
- of process does not match the owner of the file and the process is
- not super user.
- 2) fchmod(2) returns -1 and sets errno to EBADF if the file descriptor
- of the specified file is not valid.
-
-fchmod07
-
- Verify that, fchmod(2) succeeds when used to change the mode permissions
- of a file specified by file descriptor.
-
-
-fchown01
-
- Basic test for fchown(2).
-
-fchown02
-
- Verify that, when fchown(2) invoked by super-user to change the owner and
- group of a file specified by file descriptor to any numeric
- owner(uid)/group(gid) values,
- - clears setuid and setgid bits set on an executable file.
- - preserves setgid bit set on a non-group-executable file.
-
-fchown03
-
- Verify that, fchown(2) succeeds to change the group of a file specified
- by path when called by non-root user with the following constraints,
- - euid of the process is equal to the owner of the file.
- - the intended gid is either egid, or one of the supplementary gids
- of the process.
- Also, verify that fchown() clears the setuid/setgid bits set on the file.
-
-fchown04
-
- Verify that,
- 1) fchown(2) returns -1 and sets errno to EPERM if the effective user id
- of process does not match the owner of the file and the process is
- not super user.
- 2) fchown(2) returns -1 and sets errno to EBADF if the file descriptor
- of the specified file is not valid.
-
-fchown05
-
- Verify that, fchown(2) succeeds to change the owner and group of a file
- specified by file descriptor to any numeric owner(uid)/group(gid) values
- when invoked by super-user.
-
-lchown01
-
- Verify that, lchown(2) succeeds to change the owner and group of a file
- specified by path to any numeric owner(uid)/group(gid) values when invoked
- by super-user.
-
-
-lchown02
-
- Verify that,
- 1) lchown(2) returns -1 and sets errno to EPERM if the effective user id
- of process does not match the owner of the file and the process is
- not super user.
- 2) lchown(2) returns -1 and sets errno to EACCES if search permission is
- denied on a component of the path prefix.
- 3) lchown(2) returns -1 and sets errno to EFAULT if pathname points
- outside user's accessible address space.
- 4) lchown(2) returns -1 and sets errno to ENAMETOOLONG if the pathname
- component is too long.
- 5) lchown(2) returns -1 and sets errno to ENOTDIR if the directory
- component in pathname is not a directory.
- 6) lchown(2) returns -1 and sets errno to ENOENT if the specified file
- does not exists.
-
-
-creat01
-
- Testcase to check the basic functionality of the creat(2) system call.
-
-creat03
-
- Testcase to check whether the sticky bit cleared.
-
-creat04
-
- Testcase to check creat(2) fails with EACCES
-
-creat05
-
- Testcase to check that creat(2) system call returns EMFILE.
-
-creat06
-
- Testcase to check creat(2) sets the following errnos correctly:
- 1. EISDIR
- 2. ENAMETOOLONG
- 3. ENOENT
- 4. ENOTDIR
- 5. EFAULT
- 6. EACCES
-
-creat07
-
- Testcase to check creat(2) sets the following errnos correctly:
- 1. ETXTBSY
-
-creat09
-
- Basic test for creat(2) using 0700 argument.
-
-truncate01
-
- Verify that, truncate(2) succeeds to truncate a file to a specified
- length.
-
-
-truncate02
-
- Verify that, truncate(2) succeeds to truncate a file to a certain length,
- but the attempt to read past the truncated length will fail.
-
-
-truncate03
-
- Verify that,
- 1) truncate(2) returns -1 and sets errno to EACCES if search/write
- permission denied for the process on the component of the path prefix
- or named file.
- 2) truncate(2) returns -1 and sets errno to ENOTDIR if the component of
- the path prefix is not a directory.
- 3) truncate(2) returns -1 and sets errno to EFAULT if pathname points
- outside user's accessible address space.
- 4) truncate(2) returns -1 and sets errno to ENAMETOOLONG if the component
- of a pathname exceeded 255 characters or entire pathname exceeds 1023
- characters.
- 5) truncate(2) returns -1 and sets errno to ENOENT if the named file
- does not exist.
-
-ftruncate01
-
- Verify that, ftruncate(2) succeeds to truncate a file to a specified
- length if the file indicated by file descriptor opened for writing.
-
-ftruncate02
-
- Verify that, ftruncate(2) succeeds to truncate a file to a certain length,
- but the attempt to read past the truncated length will fail.
-
-ftruncate03
-
- Verify that,
- 1) ftruncate(2) returns -1 and sets errno to EINVAL if the specified
- truncate length is less than 0.
- 2) ftruncate(2) returns -1 and sets errno to EBADF if the file descriptor
- of the specified file is not valid.
-
-vhangup01
-
- Check the return value, and errno of vhangup(2)
- when a non-root user calls vhangup().
-
-vhangup02
-
- To test the basic functionality of vhangup(2)
-growfiles
-
- This program will grow a list of files.
- Each file will grow by grow_incr before the same
- file grows twice. Each file is open and closed before next file is opened.
-
-pipe01
-
- Testcase to check the basic functionality of the pipe(2) syscall:
- Check that both ends of the pipe (both file descriptors) are
- available to a process opening the pipe.
-
-pipe05
-
- Check what happens when pipe is passed a bad file descriptor.
-
-pipe06
-
- Check what happens when the system runs out of pipes.
-
-pipe08
-
- Check that a SIGPIPE signal is generated when a write is
- attempted on an empty pipe.
-
-pipe09
-
- Check that two processes can use the same pipe at the same time.
-
-pipe10
-
- Check that parent can open a pipe and have a child read from it
-
-pipe11
-
- Check if many children can read what is written to a pipe by the
- parent.
-
-pipeio
-
- This tool can be used to beat on system or named pipes.
- See the help() function below for user information.
-
- /ipc_stress/message_queue_test_01.c
- /ipc_stress/pipe_test_01.c
- /ipc_stress/semaphore_test_01.c
- /ipc_stress/single_test_01.c
-
-proc01
- Recursively reads all files within /proc filesystem.
-
-lftest
- The purpose of this test is to verify the file size limitations of a filesystem.
- It writes one buffer at a time and lseeks from the beginning of the file to the
- end of the last write position. The intent is to test lseek64.
-
-
-llseek01
-
- Verify that, llseek() call succeeds to set the file pointer position
- to an offset larger than file size. Also, verify that any attempt
- to write to this location fails.
-
-llseek02
-
- Verify that,
- 1. llseek() returns -1 and sets errno to EINVAL, if the 'Whence' argument
- is not a proper value.
- 2. llseek() returns -1 and sets errno to EBADF, if the file handle of
- the specified file is not valid.
-
-lseek01
-
- Basic test for lseek(2)
-
-lseek02
-
- Negative test for lseek(2)
-
-lseek03
-
- Negative test for lseek(2) whence
-
-lseek04
-
- Negative test for lseek(2) of a fifo
-
-lseek05
-
- Negative test for lseek(2) of a pipe
-
-lseek06
-
- Verify that, lseek() call succeeds to set the file pointer position
- to less than or equal to the file size, when a file is opened for
- read or write.
-
-lseek07
-
- Verify that, lseek() call succeeds to set the file pointer position
- to more than the file size, when a file is opened for reading/writing.
-
-lseek08
-
- Verify that, lseek() call succeeds to set the file pointer position
- to the end of the file when 'whence' value set to SEEK_END and any
- attempts to read from that position should fail.
-
-lseek09
-
- Verify that, lseek() call succeeds to set the file pointer position
- to the current specified location, when 'whence' value is set to
- SEEK_CUR and the data read from the specified location should match
- the expected data.
-
-lseek10
-
- Verify that,
- 1. lseek() returns -1 and sets errno to ESPIPE, if the file handle of
- the specified file is associated with a pipe, socket, or FIFO.
- 2. lseek() returns -1 and sets errno to EINVAL, if the 'Whence' argument
- is not a proper value.
- 3. lseek() returns -1 and sets errno to EBADF, if the file handle of
- the specified file is not valid.
-
-rwtest
-
- A wrapper for doio and iogen.
-
-doio
- a general purpose io initiator with system call and
- write logging. See doio.h for the structure which defines
- what doio requests should look like.
-
- Currently doio can handle read,write,reada,writea,ssread,
- sswrite, and many varieties of listio requests.
- For disk io, if the O_SSD flag is set doio will allocate
- the appropriate amount of ssd and do the transfer - thus, doio
- can handle all of the primitive types of file io.
-
-iogen
- A tool for generating file/sds io for a doio process
-
-pread01
-
- Verify the functionality of pread() by writing known data using pwrite()
- to the file at various specified offsets and later read from the file from
- various specified offsets, comparing the data read against the data
- written.
-
-pread02
-
- Verify that,
- 1) pread() fails when attempted to read from an unnamed pipe.
- 2) pread() fails if the specified offset position was invalid.
-
-
-pwrite01
-
- Verify the functionality of pwrite() by writing known data using pwrite()
- to the file at various specified offsets and later read from the file from
- various specified offsets, comparing the data written against the data
- read using read().
-
-pwrite02
-
- Verify that,
- 1) pwrite() fails when attempted to write to an unnamed pipe.
- 2) pwrite() fails if the specified offset position was invalid.
-
-
-read01
-
- Basic test for the read(2) system call
-
-read02
-
- test 1: Does read return -1 if file descriptor is not valid, check for EBADF
-
- test 2: Check if read sets EISDIR, if the fd refers to a directory
-
- test 3: Check if read sets EFAULT, if buf is -1.
-
-read03
-
- Testcase to check that read() sets errno to EAGAIN
-
-read04
-
- Testcase to check if read returns the number of bytes read correctly.
-
-
-readv01
-
- Testcase to check the basic functionality of the readv(2) system call.
-
-readv02
-
- Testcase to check the error conditions of the readv(2) system call.
-
-write01
-
- Basic test for write(2) system call.
-
-write02
-
- Basic functionality test: does the return from write match the count
- of the number of bytes written.
-
-
-write03
-
- Testcase to check that write(2) doesn't corrupt a file when it fails
-
-write04
-
- Testcase to check that write() sets errno to EAGAIN
-
-write05
-
- Check the return value, and errnos of write(2)
- - when the file descriptor is invalid - EBADF
- - when the buf parameter is invalid - EFAULT
- - on an attempt to write to a pipe that is not open for reading - EPIPE
-
-
-writev01
-
- Testcase to check the basic functionality of writev(2) system call.
-
-
-writev02
-
- In these testcases, writev() is called with partially valid data
- to be written in a sparse file.
-
-
-writev03
-
- The testcases are written calling writev() with partially valid data
- to overwrite the contents, to write in the beginning and to write in
- the end of the file.
-
-writev04
-
- The testcases are written calling writev() with partially valid data
- to overwrite the contents, to write in the beginning and to write in
- the end of the file. This is same as writev03, but the length of
- buffer used here is 8192 bytes.
-
-writev05
-
- These testcases are written to test writev() on sparse files. This
- is same as writev02. But the initial write() with valid data is
- done at the beginning of the file.
-
-disktest
-
- Does repeated accesses to a filespec and optionally writes to, reads from,
- and verifies the data. By default, disktest makes assumptions about
- the running environment which allows for a quick start of IO generation.
- However, Disktest has a large number of command line options which can
- be used to adapt the test for a variety of uses including data integrity,
- medium integrity, performance, and simple application simulation.
-
-
-
-
-getdents01
- get a directory entry
-
-getdents02
- check that we get a failure with a bad file descriptor
-
-
-getdents03
- check for an EINVAL error
-
-
-getdents04
- check for an ENOTDIR error
-
-getdents05
- check that we get a failure with a bad dirp address.
-process_stress
- Spawn creates a tree
- of processes with Dval depth and Bval breadth. Each parent will spawn
- Bval children. Each child will store information about themselves
- in shared memory. The leaf nodes will communicate the existence
- of one another through message queues, once each leaf node has
- received communication from all of her siblings she will reduce
- the semaphore count and exit. Meanwhile all parents are waiting
- to hear from their children through the use of semaphores. When
- the semaphore count reaches zero then the parent knows all the
- children have talked to one another. Locking of the connter semaphore
- is provided by the use of another (binary) semaphore.
-
-
-
-
-sched_stress
- Exports required environment variables and runs sched_driver
-sched_driver
- This program uses system calls to change the
- priorities of the throughput measurement testcases.
- When real-time is in effect, priorities 50 through 64
- are used. (MAX_PRI and MIN_PRI) When user-time
- (normal) is in effect, 0-14 (corresponding to nice()
- calls) is used. The driver only keeps track of
- values from 50 to 64, and the testcases will scale
- them down to 0 to 14 when needed, to change the
- priority of a user-time process.
-
-time-schedule
- This programme will determine the context switch
- (scheduling) overhead on a system. It takes into
- account SMP machines. True context switches are
- measured.
-trace_sched
- This utility spawns N tasks, each task sets its priority
- by making a system call to the scheduler. The thread
- function reads the priority that the scheduler sets for
- this task and also reads from /proc the processor this
- task last executed on the information that is gathered
- by the thread function may be in real-time. Its only an
- approximation.
-
-sched_getscheduler01
-
- Testcase to check sched_getscheduler() returns correct return value
-
-sched_getscheduler02
-
- To check for the errno ESRCH
-
-
-sched_setscheduler01
-
- Testcase to test whether sched_setscheduler(2) sets the errnos
- correctly.
-
-sched_setscheduler02
-
- Testcase to test whether sched_setscheduler(2) sets the errnos
- correctly.
-
-
-sched_yield01
-
- Testcase to check that sched_yield returns correct values.
-
-
-nice01
-
- Verify that root can provide a negative value to nice()
- and hence root can decrease the nice value of the process
- using nice() system call
-
-nice02
-
- Verify that any user can successfully increase the nice value of
- the process by passing a higher increment value (> max. applicable limits)
- to nice() system call.
-
-nice03
-
- Verify that any user can successfully increase the nice value of
- the process by passing an increment value (< max. applicable limits) to
- nice() system call.
-
-nice04
-
- Verify that, nice(2) fails when, a non-root user attempts to increase
- the priority of a process by specifying a negative increment value.
-
-nice05
-
- Basic test for nice(2)
-
-
-poll01
-
- Verify that valid open file descriptor must be provided to poll() to
- succeed.
-
-select01
-
- Basic test for the select(2) system call to a fd of regular file with no I/O
- and small timeout
-
-select02
-
- Basic test for the select(2) system call to fd of system pipe with no I/O
- and small timeout
-
-select03
-
- Basic test for the select(2) system call to fd of a named-pipe (FIFO)
-
-select04
-
- Verify that select(2) returns immediately (does not block) if the
- timeout value is zero.
-
-select05
-
- Verify that select(2) fails when one or more of the file descriptor sets
- specify a file descriptor which is not valid.
-
-select06
-
- Verify that select(2) fails when a signal is delivered before any of the
- selected events occur and before the timeout interval expires.
-
-select07
-
- Verify that select(2) fails when an invalid timeout interval is specified.
-
-select08
-
- Verify the functionality of select(2) by passing non-null writefds
- which points to a regular file, pipes or FIFO's.
-
-select09
-
- Verify the functionality of select(2) by passing non-null readfds
- which points to a regular file, pipes or FIFO's.
-
-select10
-
- Verify that a successful call to select() shall return the desired
- number of modified descriptors for which bits are set in the bit masks,
- where descriptors points to a regular file, pipes or FIFO's.
-sem01
-
- Creates a semaphore and two processes. The processes
- each go through a loop where they semdown, delay for a
- random amount of time, and semup, so they will almost
- always be fighting for control of the semaphore.
-
-sem02
- The application creates several threads using pthread_create().
- One thread performs a semop() with the SEM_UNDO flag set. The
- change in semaphore value performed by that semop should be
- "undone" only when the last pthread exits.
-
-
-semctl01
-
- test the 10 possible semctl() commands
-
-semctl02
-
- test for EACCES error
-
-semctl03
-
- test for EINVAL and EFAULT errors
-
-semctl04
-
- test for EPERM error
-
-
-semctl05
-
- test for ERANGE error
-
-semget01
-
- test that semget() correctly creates a semaphore set
-
-semget02
-
- test for EACCES and EEXIST errors
-
-semget03
-
- test for ENOENT error
-
-semget05
-
- test for ENOSPC error
-
-semget06
-
- test for EINVAL error
-
-semop01
-
- test that semop() basic functionality is correct
-
-semop02
-
- test for E2BIG, EACCES, EFAULT and EINVAL errors
-
-semop03
-
- test for EFBIG error
-
-semop04
-
- test for EAGAIN error
-
-semop05
-
- test for EINTR and EIDRM errors
-
-
-shmat01
- test that shmat() works correctly
-
-shmat02
- check for EINVAL and EACCES errors
-
-
-shmat03
- test for EACCES error
-
-
-shmctl01
- test the IPC_STAT, IPC_SET and IPC_RMID commands as
- they are used with shmctl()
-
-
-shmctl02
- check for EACCES, EFAULT and EINVAL errors
-
-
-shmctl03
- check for EACCES, and EPERM errors
-
-
-shmdt01
- check that shared memory is detached correctly
-
-
-shmdt02
- check for EINVAL error
-
-
-shmget01
- test that shmget() correctly creates a shared memory segment
-
-
-shmget02
- check for ENOENT, EEXIST and EINVAL errors
-
-
-shmget03
- test for ENOSPC error
-
-
-shmget04
- test for EACCES error
-
-
-shmget05
- test for EACCES error
-shmat1
-
- Test the LINUX memory manager. The program is aimed at
- stressing the memory manager by repeated shmat/write/read/
- shmatd of file/memory of random size (maximum 1000 * 4096)
- done by multiple processes.
-
-shm_test
-
- This program is designed to stress the Memory management sub -
- system of Linux. This program will spawn multiple pairs of
- reader and writer threads. One thread will create the shared
- segment of random size and write to this memory, the other
- pair will read from this memory.
-
-sigaction01
-
- Test some features of sigaction (see below for more details)
-
-
-sigaction02
-
- Testcase to check the basic errnos set by the sigaction(2) syscall.
-
-
-sigaltstack01
-
- Send a signal using the main stack. While executing the signal handler
- compare a variable's address lying on the main stack with the stack
- boundaries returned by sigaltstack().
-
-
-sigaltstack02
-
- Verify that,
- 1. sigaltstack() fails and sets errno to EINVAL when "ss_flags" field
- pointed to by 'ss' contains invalid flags.
- 2. sigaltstack() fails and sets errno to ENOMEM when the size of alternate
- stack area is less than MINSIGSTKSZ.
-
-sighold02
-
- Basic test for the sighold02(2) system call.
-
-
-signal01
- set the signal handler to our own function
-
-
-signal02
- Test that we get an error using illegal signals
-
-signal03
-
- Boundary value and other invalid value checking of signal setup and signal
- sending.
-
-
-signal04
- restore signals to default behavior
-
-
-signal05
- set signals to be ignored
-
-
-sigprocmask01
-
- Verify that sigprocmask() succeeds to examine and change the calling
- process's signal mask.
- Also, verify that sigpending() succeeds to store signal mask that are
- blocked from delivery and pending for the calling process.
-
-sigrelse01
-
- Basic test for the sigrelse(2) system call.
-
-sigsuspend01
-
- Verify that sigsuspend() succeeds to change process's current signal
- mask with the specified signal mask and suspends the process execution
- until the delivery of a signal.
-kill01
-
- Test case to check the basic functionality of kill().
-
-kill02
-
- Sending a signal to processes with the same process group ID
-
-kill03
-
- Test case to check that kill fails when given an invalid signal.
-
-kill04
-
- Test case to check that kill() fails when passed a non-existent pid.
-
-kill05
-
- Test case to check that kill() fails when passed a pid owned by another
- user.
-
-kill06
-
- Test case to check the basic functionality of kill() when killing an
- entire process group with a negative pid.
-
-kill07
-
- Test case to check that SIGKILL can not be caught.
-
-kill08
-
- Test case to check the basic functionality of kill() when kill an
- entire process group.
-
-kill09
- Basic test for kill(2)
-
-kill10
- Signal flooding test.
-
-
-mtest01
- mallocs memory <chunksize> at a time until malloc fails.
-mallocstress
-
- This program is designed to stress the VMM by doing repeated */
- mallocs and frees, with out using the swap space. This is */
- achieved by spawning N threads with repeatedly malloc and free*/
- a memory of size M. The stress can be increased by increasing */
- the number of repetitions over the default number using the */
- -l [num] option.
-
-clisrv
-
- Sender: Read contents of data file. Write each line to socket, then
- read line back from socket and write to standard output.
- Receiver: Read a stream socket one line at a time and write each line
- back to the sender.
- Usage: pthcli [port number]
-
-
-socket01
-
- Verify that socket() returns the proper errno for various failure cases
-
-
-socketpair01
-
- Verify that socketpair() returns the proper errno for various failure cases
-
-
-sockioctl01
-
- Verify that ioctl() on sockets returns the proper errno for various
- failure cases
-
-connect01
-
- Verify that connect() returns the proper errno for various failure cases
-
-getpeername01
-
- Verify that getpeername() returns the proper errno for various failure cases
-
-
-getsockname01
-
- Verify that getsockname() returns the proper errno for various failure cases
-
-getsockopt01
-
- Verify that getsockopt() returns the proper errno for various failure cases
-
-listen01
-
- Verify that listen() returns the proper errno for various failure cases
-
-accept01
-
- Verify that accept() returns the proper errno for various failure cases
-
-bind01
-
- Verify that bind() returns the proper errno for various failure cases
-
-
-recv01
-
- Verify that recv() returns the proper errno for various failure cases
-
-
-recvfrom01
-
- Verify that recvfrom() returns the proper errno for various failure cases
-
-
-recvmsg01
-
- Verify that recvmsg() returns the proper errno for various failure cases
-
-send01
-
- Verify that send() returns the proper errno for various failure cases
-
-sendmsg01
-
- Verify that sendmsg() returns the proper errno for various failure cases
-sendto01
-
- Verify that sendto() returns the proper errno for various failure cases
-
-setsockopt01
-
- Verify that setsockopt() returns the proper errno for various failure cases
-
-
-fstat01
-
- Basic test for fstat(2)
-
-fstat02
-
- Verify that, fstat(2) succeeds to get the status of a file and fills
- the stat structure elements though file pointed to by file descriptor
- not opened for reading.
-
-fstat03
-
- Verify that, fstat(2) returns -1 and sets errno to EBADF if the file
- pointed to by file descriptor is not valid.
-
-fstat04
-
- Verify that, fstat(2) succeeds to get the status of a file pointed by
- file descriptor and fills the stat structure elements.
-
-
-fstatfs01
-
- Basic test for fstatfs(2)
-
-fstatfs02
-
- Testcase to check fstatfs() sets errno correctly.
-
-lstat01
-
- Verify that, lstat(2) succeeds to get the status of a file pointed to by
- symlink and fills the stat structure elements.
-
-lstat02
-
- Basic test for lstat(2)
-
-lstat03
-
- Verify that,
- 1) lstat(2) returns -1 and sets errno to EACCES if search permission is
- denied on a component of the path prefix.
- 2) lstat(2) returns -1 and sets errno to ENOENT if the specified file
- does not exists or empty string.
- 3) lstat(2) returns -1 and sets errno to EFAULT if pathname points
- outside user's accessible address space.
- 4) lstat(2) returns -1 and sets errno to ENAMETOOLONG if the pathname
- component is too long.
- 5) lstat(2) returns -1 and sets errno to ENOTDIR if the directory
- component in pathname is not a directory.
-
-stat01
-
- Verify that, stat(2) succeeds to get the status of a file and fills the
- stat structure elements.
-
-stat02
-
- Verify that, stat(2) succeeds to get the status of a file and fills the
- stat structure elements though process doesn't have read access to the
- file.
-
-
-stat03
-
- Verify that,
- 1) stat(2) returns -1 and sets errno to EACCES if search permission is
- denied on a component of the path prefix.
- 2) stat(2) returns -1 and sets errno to ENOENT if the specified file
- does not exists or empty string.
- 3) stat(2) returns -1 and sets errno to EFAULT if pathname points
- outside user's accessible address space.
- 4) stat(2) returns -1 and sets errno to ENAMETOOLONG if the pathname
- component is too long.
- 5) stat(2) returns -1 and sets errno to ENOTDIR if the directory
- component in pathname is not a directory.
-
-stat05
-
- Basic test for the stat05(2) system call.
-
-statfs01
-
- Basic test for the statfs(2) system call.
-
-statfs02
-
- Testcase to check that statfs(2) sets errno correctly.
-
-
-read01
-
- Basic test for the read(2) system call
-
-read02
-
- test 1: Does read return -1 if file descriptor is not valid, check for EBADF
-
- test 2: Check if read sets EISDIR, if the fd refers to a directory
-
- test 3: Check if read sets EFAULT, if buf is -1.
-
-read03
-
- Testcase to check that read() sets errno to EAGAIN
-
-read04
-
- Testcase to check if read returns the number of bytes read correctly.
-
-umask01
-
- Basic test for the umask(2) system call.
-
-umask02
-
- Check that umask changes the mask, and that the previous
- value of the mask is returned correctly for each value.
-
-umask03
-
- Check that umask changes the mask, and that the previous
- value of the mask is returned correctly for each value.
-
-
-
-getgroups01
-
- Getgroups system call critical test
-
-getgroups02
-
- Basic test for getgroups(2)
-
-getgroups03
-
- Verify that, getgroups() system call gets the supplementary group IDs
- of the calling process.
-
-getgroups04
-
- Verify that,
- getgroups() fails with -1 and sets errno to EINVAL if the size
- argument value is -ve.
-
-gethostname01
-
- Basic test for gethostname(2)
-
-
-getpgid01
-
- Testcase to check the basic functionality of getpgid().
-
-getpgid02
-
- Testcase to check the basic functionality of getpgid().
-
-getpgrp01
- Basic test for getpgrp(2)
-
-
-getpriority01
-
- Verify that getpriority() succeeds get the scheduling priority of
- the current process, process group or user.
-
-
-getpriority02
-
- Verify that,
- 1) getpriority() sets errno to ESRCH if no process was located
- was located for 'which' and 'who' arguments.
- 2) getpriority() sets errno to EINVAL if 'which' argument was
- not one of PRIO_PROCESS, PRIO_PGRP, or PRIO_USER.
-
-getresgid01
-
- Verify that getresgid() will be successful to get the real, effective
- and saved user id of the calling process.
-
-getresgid02
-
- Verify that getresgid() will be successful to get the real, effective
- and saved user ids after calling process invokes setregid() to change
- the effective/saved gids to that of specified user.
-
-getresgid03
-
- Verify that getresgid() will be successful to get the real, effective
- and saved user ids after calling process invokes setresgid() to change
- the effective gid to that of specified user.
-
-
-getresuid01
-
- Verify that getresuid() will be successful to get the real, effective
- and saved user id of the calling process.
-
-getresuid02
-
- Verify that getresuid() will be successful to get the real, effective
- and saved user ids after calling process invokes setreuid() to change
- the effective/saved uids to that of specified user.
-
-getresuid03
-
- Verify that getresuid() will be successful to get the real, effective
- and saved user ids after calling process invokes setresuid() to change
- the effective uid to that of specified user.
-
-
-getsid01
-
- call getsid() and make sure it succeeds
-
-getsid02
-
- call getsid() with an invalid PID to produce a failure
-
-
-setfsgid01
-
- Testcase to check the basic functionality of setfsgid(2) system
- call.
-
-setfsuid01
-
- Testcase to test the basic functionality of the setfsuid(2) system
- call.
-
-
-setgid01
-
- Basic test for the setgid(2) system call.
-
-setgid02
-
- Testcase to ensure that the setgid() system call sets errno to EPERM
-
-
-setgroups01
-
- Basic test for the setgroups(2) system call.
-
-setgroups02
-
- Verify that,
- 1. setgroups() fails with -1 and sets errno to EINVAL if the size
- argument value is > NGROUPS
- 2. setgroups() fails with -1 and sets errno to EPERM if the
- calling process is not super-user.
-
-setgroups03
-
- Verify that, only root process can invoke setgroups() system call to
- set the supplementary group IDs of the process.
-
-
-setpgid01
-
- Basic test for setpgid(2) system call.
-
-setpgid02
-
- Testcase to check that setpgid() sets errno correctly.
-
-setpgid03
-
- Test to check the error and trivial conditions in setpgid system call
-
-setpriority01
-
- set the priority for the test process lower.
-
-setpriority02
-
- test for an expected failure by trying to raise
- the priority for the test process while not having
- permissions to do so.
-
-setpriority03
-
- test for an expected failure by using an invalid
- PRIO value
- setpriority04
-
-setpriority04
- test for an expected failure by using an invalid
- process id
-
-
-setpriority05
- test for an expected failure by trying to change
- a process with an ID that is different from the
- test process
-
-setregid01
-
- Basic test for the setregid(2) system call.
-
-setregid02
-
- Test that setregid() fails and sets the proper errno values when a
- non-root user attempts to change the real or effective group id to a
- value other than the current gid or the current effective gid.
-
-setregid03
-
- Test setregid() when executed by a non-root user.
-
-setregid04
-
- Test setregid() when executed by root.
-
-setresuid01
-
- Test setresuid() when executed by root.
-
-setresuid02
-
- Test that a non-root user can change the real, effective and saved
- uid values through the setresuid system call.
-
-
-setresuid03
-
- Test that the setresuid system call sets the proper errno
- values when a non-root user attempts to change the real, effective or
- saved uid to a value other than one of the current uid, the current
- effective uid of the current saved uid. Also verify that setresuid
- fails if an invalid uid value is given.
-
-setreuid01
-
- Basic test for the setreuid(2) system call.
-
-setreuid02
-
- Test setreuid() when executed by root.
-
-setreuid03
-
- Test setreuid() when executed by an unprivileged user.
-
-
-setreuid04
-
- Test that root can change the real and effective uid to an
- unprivileged user.
-
-setreuid05
-
- Test the setreuid() feature, verifying the role of the saved-set-uid
- and setreuid's effect on it.
-
-setreuid06
-
- Test that EINVAL is set when setreuid is given an invalid user id.
-
-setrlimit01
-
- Testcase to check the basic functionality of the setrlimit system call.
-
-
-setrlimit02
-
- Testcase to test the different errnos set by setrlimit(2) system call.
-
-setrlimit03
-
- Test for EPERM when the super-user tries to increase RLIMIT_NOFILE
- beyond the system limit.
-
-setsid01
-
- Test to check the error and trivial conditions in setsid system call
-
-setuid01
-
- Basic test for the setuid(2) system call.
-
-setuid02
-
- Basic test for the setuid(2) system call as root.
-
-setuid03
-
- Test to check the error and trivial conditions in setuid
-
-fs_perms
-
- Regression test for Linux filesystem permissions.
-uname01
-
- Basic test for the uname(2) system call.
-
-uname02
-
- Call uname() with an invalid address to produce a failure
-
-uname03
-
- Call uname() and make sure it succeeds
-sysctl01
-
- Testcase for testing the basic functionality of sysctl(2) system call.
- This testcase attempts to read the kernel parameters using
- sysctl({CTL_KERN, KERN_ }, ...) and compares it with the known
- values.
-
-sysctl03
-
- Testcase to check that sysctl(2) sets errno to EPERM correctly.
-
-
-sysctl04
-
- Testcase to check that sysctl(2) sets errno to ENOTDIR
-
-
-sysctl05
-
- Testcase to check that sysctl(2) sets errno to EFAULT
-
-time01
-
- Basic test for the time(2) system call.
-
-
-time02
-
- Verify that time(2) returns the value of time in seconds since
- the Epoch and stores this value in the memory pointed to by the parameter.
-
-times01
-
- Basic test for the times(2) system call.
-
-times02
-
- Testcase to test that times() sets errno correctly
-
-times03
-
- Testcase to check the basic functionality of the times() system call.
-
-utime01
-
- Verify that the system call utime() successfully sets the modification
- and access times of a file to the current time, if the times argument
- is null, and the user ID of the process is "root".
-
-utime02
-
- Verify that the system call utime() successfully sets the modification
- and access times of a file to the current time, under the following
- constraints,
- - The times argument is null.
- - The user ID of the process is not "root".
- - The file is owned by the user ID of the process.
-
-utime03
-
- Verify that the system call utime() successfully sets the modification
- and access times of a file to the current time, under the following
- constraints,
- - The times argument is null.
- - The user ID of the process is not "root".
- - The file is not owned by the user ID of the process.
- - The user ID of the process has write access to the file.
-
-
-utime04
-
- Verify that the system call utime() successfully sets the modification
- and access times of a file to the time specified by times argument, if
- the times argument is not null, and the user ID of the process is "root".
-
-
-utime05
-
- Verify that the system call utime() successfully sets the modification
- and access times of a file to the value specified by the times argument
- under the following constraints,
- - The times argument is not null,
- - The user ID of the process is not "root".
- - The file is owned by the user ID of the process.
-
-
-utime06
-
- 1. Verify that the system call utime() fails to set the modification
- and access times of a file to the current time, under the following
- constraints,
- - The times argument is null.
- - The user ID of the process is not "root".
- - The file is not owned by the user ID of the process.
- - The user ID of the process does not have write access to the
- file.
- 2. Verify that the system call utime() fails to set the modification
- and access times of a file if the specified file doesn't exist.
-
-settimeofday01
-
- Testcase to check the basic functionality of settimeofday().
-
-
-settimeofday02
-
- Testcase to check that settimeofday() sets errnos correctly.
-
-stime01
-
- Verify that the system call stime() successfully sets the system's idea
- of data and time if invoked by "root" user.
-
-stime02
-
- Verify that the system call stime() fails to set the system's idea
- of data and time if invoked by "non-root" user.
-
-gettimeofday01
-
- Testcase to check that gettimeofday(2) sets errno to EFAULT.
-
-
-
-alarm01
-
- Basic test for alarm(2).
-
-alarm02
-
- Boundary Value Test for alarm(2).
-
-alarm03
-
- Alarm(2) cleared by a fork.
-
-alarm04
-
- Check that when an alarm request is made, the signal SIGALRM is received
- even after the process has done an exec().
-
-alarm05
-
- Check the functionality of the Alarm system call when the time input
- parameter is non zero.
-
-alarm06
-
- Check the functionality of the Alarm system call when the time input
- parameter is zero.
-
-alarm07
-
- Check the functionality of the alarm() when the time input
- parameter is non-zero and the process does a fork.
-
-getegid01
-
- Basic test for getegid(2)
-
-
-geteuid01
-
- Basic test for geteuid(2)
-
-
-getgid01
-
- Basic test for getgid(2)
-
-getgid02
-
- Testcase to check the basic functionality of getgid().
-
-getgid03
-
- Testcase to check the basic functionality of getegid().
-
-
-getpid01
-
- Basic test for getpid(2)
-
-
-getpid02
-
- Verify that getpid() system call gets the process ID of the of the
- calling process.
-
-
-getppid01
-
- Testcase to check the basic functionality of the getppid() syscall.
-
-
-getuid01
-
- Basic test for getuid(2)
-
-getuid02
-
- Testcase to check the basic functionality of the geteuid() system call.
-
-getuid03
-
- Testcase to check the basic functionality of the getuid() system call.
-
-nanosleep01
-
- Verify that nanosleep() will be successful to suspend the execution
- of a process for a specified time.
-
-nanosleep02
-
- Verify that nanosleep() will be successful to suspend the execution
- of a process, returns after the receipt of a signal and writes the
- remaining sleep time into the structure.
-
-nanosleep03
-
- Verify that nanosleep() will fail to suspend the execution
- of a process for a specified time if interrupted by a non-blocked signal.
-
-nanosleep04
-
- Verify that nanosleep() will fail to suspend the execution
- of a process if the specified pause time is invalid.
-
diff --git a/chromium/third_party/lcov/example/Makefile b/chromium/third_party/lcov/example/Makefile
deleted file mode 100644
index 2f698a1b32f..00000000000
--- a/chromium/third_party/lcov/example/Makefile
+++ /dev/null
@@ -1,98 +0,0 @@
-#
-# Makefile for the LCOV example program.
-#
-# Make targets:
-# - example: compile the example program
-# - output: run test cases on example program and create HTML output
-# - clean: clean up directory
-#
-
-CC := gcc
-CFLAGS := -Wall -I. -fprofile-arcs -ftest-coverage
-
-LCOV := ../bin/lcov
-GENHTML := ../bin/genhtml
-GENDESC := ../bin/gendesc
-GENPNG := ../bin/genpng
-
-# Depending on the presence of the GD.pm perl module, we can use the
-# special option '--frames' for genhtml
-USE_GENPNG := $(shell $(GENPNG) --help >/dev/null 2>/dev/null; echo $$?)
-
-ifeq ($(USE_GENPNG),0)
- FRAMES := --frames
-else
- FRAMES :=
-endif
-
-.PHONY: clean output test_noargs test_2_to_2000 test_overflow
-
-all: output
-
-example: example.o iterate.o gauss.o
- $(CC) example.o iterate.o gauss.o -o example -lgcov
-
-example.o: example.c iterate.h gauss.h
- $(CC) $(CFLAGS) -c example.c -o example.o
-
-iterate.o: methods/iterate.c iterate.h
- $(CC) $(CFLAGS) -c methods/iterate.c -o iterate.o
-
-gauss.o: methods/gauss.c gauss.h
- $(CC) $(CFLAGS) -c methods/gauss.c -o gauss.o
-
-output: example descriptions test_noargs test_2_to_2000 test_overflow
- @echo
- @echo '*'
- @echo '* Generating HTML output'
- @echo '*'
- @echo
- $(GENHTML) trace_noargs.info trace_args.info trace_overflow.info \
- --output-directory output --title "Basic example" \
- --show-details --description-file descriptions $(FRAMES) \
- --legend
- @echo
- @echo '*'
- @echo '* See '`pwd`/output/index.html
- @echo '*'
- @echo
-
-descriptions: descriptions.txt
- $(GENDESC) descriptions.txt -o descriptions
-
-all_tests: example test_noargs test_2_to_2000 test_overflow
-
-test_noargs:
- @echo
- @echo '*'
- @echo '* Test case 1: running ./example without parameters'
- @echo '*'
- @echo
- $(LCOV) --zerocounters --directory .
- ./example
- $(LCOV) --capture --directory . --output-file trace_noargs.info --test-name test_noargs --no-external
-
-test_2_to_2000:
- @echo
- @echo '*'
- @echo '* Test case 2: running ./example 2 2000'
- @echo '*'
- @echo
- $(LCOV) --zerocounters --directory .
- ./example 2 2000
- $(LCOV) --capture --directory . --output-file trace_args.info --test-name test_2_to_2000 --no-external
-
-test_overflow:
- @echo
- @echo '*'
- @echo '* Test case 3: running ./example 0 100000 (causes an overflow)'
- @echo '*'
- @echo
- $(LCOV) --zerocounters --directory .
- ./example 0 100000 || true
- $(LCOV) --capture --directory . --output-file trace_overflow.info --test-name "test_overflow" --no-external
-
-clean:
- rm -rf *.o *.bb *.bbg *.da *.gcno *.gcda *.info output example \
- descriptions
-
diff --git a/chromium/third_party/lcov/example/README b/chromium/third_party/lcov/example/README
deleted file mode 100644
index cf6cf2e4c68..00000000000
--- a/chromium/third_party/lcov/example/README
+++ /dev/null
@@ -1,6 +0,0 @@
-
-To get an example of how the LCOV generated HTML output looks like,
-type 'make output' and point a web browser to the resulting file
-
- output/index.html
-
diff --git a/chromium/third_party/lcov/example/descriptions.txt b/chromium/third_party/lcov/example/descriptions.txt
deleted file mode 100644
index 47e6021310d..00000000000
--- a/chromium/third_party/lcov/example/descriptions.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-test_noargs
- Example program is called without arguments so that default range
- [0..9] is used.
-
-test_2_to_2000
- Example program is called with "2" and "2000" as arguments.
-
-test_overflow
- Example program is called with "0" and "100000" as arguments. The
- resulting sum is too large to be stored as an int variable.
diff --git a/chromium/third_party/lcov/example/example.c b/chromium/third_party/lcov/example/example.c
deleted file mode 100644
index f9049aa64ba..00000000000
--- a/chromium/third_party/lcov/example/example.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * example.c
- *
- * Calculate the sum of a given range of integer numbers. The range is
- * specified by providing two integer numbers as command line argument.
- * If no arguments are specified, assume the predefined range [0..9].
- * Abort with an error message if the resulting number is too big to be
- * stored as int variable.
- *
- * This program example is similar to the one found in the GCOV documentation.
- * It is used to demonstrate the HTML output generated by LCOV.
- *
- * The program is split into 3 modules to better demonstrate the 'directory
- * overview' function. There are also a lot of bloated comments inserted to
- * artificially increase the source code size so that the 'source code
- * overview' function makes at least a minimum of sense.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "iterate.h"
-#include "gauss.h"
-
-static int start = 0;
-static int end = 9;
-
-
-int main (int argc, char* argv[])
-{
- int total1, total2;
-
- /* Accept a pair of numbers as command line arguments. */
-
- if (argc == 3)
- {
- start = atoi(argv[1]);
- end = atoi(argv[2]);
- }
-
-
- /* Use both methods to calculate the result. */
-
- total1 = iterate_get_sum (start, end);
- total2 = gauss_get_sum (start, end);
-
-
- /* Make sure both results are the same. */
-
- if (total1 != total2)
- {
- printf ("Failure (%d != %d)!\n", total1, total2);
- }
- else
- {
- printf ("Success, sum[%d..%d] = %d\n", start, end, total1);
- }
-
- return 0;
-}
diff --git a/chromium/third_party/lcov/example/gauss.h b/chromium/third_party/lcov/example/gauss.h
deleted file mode 100644
index 302a4a98038..00000000000
--- a/chromium/third_party/lcov/example/gauss.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef GAUSS_H
-#define GAUSS_H GAUSS_h
-
-extern int gauss_get_sum (int min, int max);
-
-#endif /* GAUSS_H */
diff --git a/chromium/third_party/lcov/example/iterate.h b/chromium/third_party/lcov/example/iterate.h
deleted file mode 100644
index 471327951cf..00000000000
--- a/chromium/third_party/lcov/example/iterate.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef ITERATE_H
-#define ITERATE_H ITERATE_H
-
-extern int iterate_get_sum (int min, int max);
-
-#endif /* ITERATE_H */
diff --git a/chromium/third_party/lcov/example/methods/gauss.c b/chromium/third_party/lcov/example/methods/gauss.c
deleted file mode 100644
index 9da3ce50835..00000000000
--- a/chromium/third_party/lcov/example/methods/gauss.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * methods/gauss.c
- *
- * Calculate the sum of a given range of integer numbers.
- *
- * Somewhat of a more subtle way of calculation - and it even has a story
- * behind it:
- *
- * Supposedly during math classes in elementary school, the teacher of
- * young mathematician Gauss gave the class an assignment to calculate the
- * sum of all natural numbers between 1 and 100, hoping that this task would
- * keep the kids occupied for some time. The story goes that Gauss had the
- * result ready after only a few minutes. What he had written on his black
- * board was something like this:
- *
- * 1 + 100 = 101
- * 2 + 99 = 101
- * 3 + 98 = 101
- * .
- * .
- * 100 + 1 = 101
- *
- * s = (1/2) * 100 * 101 = 5050
- *
- * A more general form of this formula would be
- *
- * s = (1/2) * (max + min) * (max - min + 1)
- *
- * which is used in the piece of code below to implement the requested
- * function in constant time, i.e. without dependencies on the size of the
- * input parameters.
- *
- */
-
-#include "gauss.h"
-
-
-int gauss_get_sum (int min, int max)
-{
- /* This algorithm doesn't work well with invalid range specifications
- so we're intercepting them here. */
- if (max < min)
- {
- return 0;
- }
-
- return (int) ((max + min) * (double) (max - min + 1) / 2);
-}
diff --git a/chromium/third_party/lcov/example/methods/iterate.c b/chromium/third_party/lcov/example/methods/iterate.c
deleted file mode 100644
index 023d1801c93..00000000000
--- a/chromium/third_party/lcov/example/methods/iterate.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * methods/iterate.c
- *
- * Calculate the sum of a given range of integer numbers.
- *
- * This particular method of implementation works by way of brute force,
- * i.e. it iterates over the entire range while adding the numbers to finally
- * get the total sum. As a positive side effect, we're able to easily detect
- * overflows, i.e. situations in which the sum would exceed the capacity
- * of an integer variable.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "iterate.h"
-
-
-int iterate_get_sum (int min, int max)
-{
- int i, total;
-
- total = 0;
-
- /* This is where we loop over each number in the range, including
- both the minimum and the maximum number. */
-
- for (i = min; i <= max; i++)
- {
- /* We can detect an overflow by checking whether the new
- sum would become negative. */
-
- if (total + i < total)
- {
- printf ("Error: sum too large!\n");
- exit (1);
- }
-
- /* Everything seems to fit into an int, so continue adding. */
-
- total += i;
- }
-
- return total;
-}
diff --git a/chromium/third_party/lcov/lcovrc b/chromium/third_party/lcov/lcovrc
deleted file mode 100644
index 9c65970485f..00000000000
--- a/chromium/third_party/lcov/lcovrc
+++ /dev/null
@@ -1,157 +0,0 @@
-#
-# /etc/lcovrc - system-wide defaults for LCOV
-#
-# To change settings for a single user, place a customized copy of this file
-# at location ~/.lcovrc
-#
-
-# Specify an external style sheet file (same as --css-file option of genhtml)
-#genhtml_css_file = gcov.css
-
-# Specify coverage rate limits (in %) for classifying file entries
-# HI: hi_limit <= rate <= 100 graph color: green
-# MED: med_limit <= rate < hi_limit graph color: orange
-# LO: 0 <= rate < med_limit graph color: red
-genhtml_hi_limit = 90
-genhtml_med_limit = 75
-
-# Width of line coverage field in source code view
-genhtml_line_field_width = 12
-
-# Width of branch coverage field in source code view
-genhtml_branch_field_width = 16
-
-# Width of overview image (used by --frames option of genhtml)
-genhtml_overview_width = 80
-
-# Resolution of overview navigation: this number specifies the maximum
-# difference in lines between the position a user selected from the overview
-# and the position the source code window is scrolled to (used by --frames
-# option of genhtml)
-genhtml_nav_resolution = 4
-
-# Clicking a line in the overview image should show the source code view at
-# a position a bit further up so that the requested line is not the first
-# line in the window. This number specifies that offset in lines (used by
-# --frames option of genhtml)
-genhtml_nav_offset = 10
-
-# Do not remove unused test descriptions if non-zero (same as
-# --keep-descriptions option of genhtml)
-genhtml_keep_descriptions = 0
-
-# Do not remove prefix from directory names if non-zero (same as --no-prefix
-# option of genhtml)
-genhtml_no_prefix = 0
-
-# Do not create source code view if non-zero (same as --no-source option of
-# genhtml)
-genhtml_no_source = 0
-
-# Replace tabs with number of spaces in source view (same as --num-spaces
-# option of genhtml)
-genhtml_num_spaces = 8
-
-# Highlight lines with converted-only data if non-zero (same as --highlight
-# option of genhtml)
-genhtml_highlight = 0
-
-# Include color legend in HTML output if non-zero (same as --legend option of
-# genhtml)
-genhtml_legend = 0
-
-# Use FILE as HTML prolog for generated pages (same as --html-prolog option of
-# genhtml)
-#genhtml_html_prolog = FILE
-
-# Use FILE as HTML epilog for generated pages (same as --html-epilog option of
-# genhtml)
-#genhtml_html_epilog = FILE
-
-# Use custom filename extension for pages (same as --html-extension option of
-# genhtml)
-#genhtml_html_extension = html
-
-# Compress all generated html files with gzip.
-#genhtml_html_gzip = 1
-
-# Include sorted overview pages (can be disabled by the --no-sort option of
-# genhtml)
-genhtml_sort = 1
-
-# Include function coverage data display (can be disabled by the
-# --no-func-coverage option of genhtml)
-#genhtml_function_coverage = 1
-
-# Include branch coverage data display (can be disabled by the
-# --no-branch-coverage option of genhtml)
-#genhtml_branch_coverage = 1
-
-# Specify the character set of all generated HTML pages
-genhtml_charset=UTF-8
-
-# Location of the gcov tool (same as --gcov-info option of geninfo)
-#geninfo_gcov_tool = gcov
-
-# Adjust test names to include operating system information if non-zero
-#geninfo_adjust_testname = 0
-
-# Calculate checksum for each source code line if non-zero (same as --checksum
-# option of geninfo if non-zero, same as --no-checksum if zero)
-#geninfo_checksum = 1
-
-# Specify whether to capture coverage data for external source files (can
-# be overridden by the --external and --no-external options of geninfo/lcov)
-#geninfo_external = 1
-
-# Enable libtool compatibility mode if non-zero (same as --compat-libtool option
-# of geninfo if non-zero, same as --no-compat-libtool if zero)
-#geninfo_compat_libtool = 0
-
-# Use gcov's --all-blocks option if non-zero
-#geninfo_gcov_all_blocks = 1
-
-# Specify compatiblity modes (same as --compat option of geninfo).
-#geninfo_compat = libtool=on, hammer=auto, split_crc=auto
-
-# Adjust path to source files by removing or changing path components that
-# match the specified pattern (Perl regular expression format)
-#geninfo_adjust_src_path = /tmp/build => /usr/src
-
-# Specify if geninfo should try to automatically determine the base-directory
-# when collecting coverage data.
-geninfo_auto_base = 1
-
-# Directory containing gcov kernel files
-# lcov_gcov_dir = /proc/gcov
-
-# Location of the insmod tool
-lcov_insmod_tool = /sbin/insmod
-
-# Location of the modprobe tool
-lcov_modprobe_tool = /sbin/modprobe
-
-# Location of the rmmod tool
-lcov_rmmod_tool = /sbin/rmmod
-
-# Location for temporary directories
-lcov_tmp_dir = /tmp
-
-# Show full paths during list operation if non-zero (same as --list-full-path
-# option of lcov)
-lcov_list_full_path = 0
-
-# Specify the maximum width for list output. This value is ignored when
-# lcov_list_full_path is non-zero.
-lcov_list_width = 80
-
-# Specify the maximum percentage of file names which may be truncated when
-# choosing a directory prefix in list output. This value is ignored when
-# lcov_list_full_path is non-zero.
-lcov_list_truncate_max = 20
-
-# Specify if function coverage data should be collected and processed.
-lcov_function_coverage = 1
-
-# Specify if branch coverage data should be collected and processed.
-lcov_branch_coverage = 0
diff --git a/chromium/third_party/lcov/man/gendesc.1 b/chromium/third_party/lcov/man/gendesc.1
deleted file mode 100644
index d1c5382023f..00000000000
--- a/chromium/third_party/lcov/man/gendesc.1
+++ /dev/null
@@ -1,78 +0,0 @@
-.TH gendesc 1 "LCOV 1.10" 2012\-10\-10 "User Manuals"
-.SH NAME
-gendesc \- Generate a test case description file
-.SH SYNOPSIS
-.B gendesc
-.RB [ \-h | \-\-help ]
-.RB [ \-v | \-\-version ]
-.RS 8
-.br
-.RB [ \-o | \-\-output\-filename
-.IR filename ]
-.br
-.I inputfile
-.SH DESCRIPTION
-Convert plain text test case descriptions into a format as understood by
-.BR genhtml .
-.I inputfile
-needs to observe the following format:
-
-For each test case:
-.IP " \-"
-one line containing the test case name beginning at the start of the line
-.RE
-.IP " \-"
-one or more lines containing the test case description indented with at
-least one whitespace character (tab or space)
-.RE
-
-.B Example input file:
-
-test01
-.RS
-An example test case description.
-.br
-Description continued
-.RE
-
-test42
-.RS
-Supposedly the answer to most of your questions
-.RE
-
-Note: valid test names can consist of letters, decimal digits and the
-underscore character ('_').
-.SH OPTIONS
-.B \-h
-.br
-.B \-\-help
-.RS
-Print a short help text, then exit.
-.RE
-
-.B \-v
-.br
-.B \-\-version
-.RS
-Print version number, then exit.
-.RE
-
-
-.BI "\-o " filename
-.br
-.BI "\-\-output\-filename " filename
-.RS
-Write description data to
-.IR filename .
-
-By default, output is written to STDOUT.
-.RE
-.SH AUTHOR
-Peter Oberparleiter <Peter.Oberparleiter@de.ibm.com>
-
-.SH SEE ALSO
-.BR lcov (1),
-.BR genhtml (1),
-.BR geninfo (1),
-.BR genpng (1),
-.BR gcov (1)
diff --git a/chromium/third_party/lcov/man/genhtml.1 b/chromium/third_party/lcov/man/genhtml.1
deleted file mode 100644
index 9788323b9e2..00000000000
--- a/chromium/third_party/lcov/man/genhtml.1
+++ /dev/null
@@ -1,569 +0,0 @@
-.TH genhtml 1 "LCOV 1.10" 2012\-10\-10 "User Manuals"
-.SH NAME
-genhtml \- Generate HTML view from LCOV coverage data files
-.SH SYNOPSIS
-.B genhtml
-.RB [ \-h | \-\-help ]
-.RB [ \-v | \-\-version ]
-.RS 8
-.br
-.RB [ \-q | \-\-quiet ]
-.RB [ \-s | \-\-show\-details ]
-.RB [ \-f | \-\-frames ]
-.br
-.RB [ \-b | \-\-baseline\-file ]
-.IR baseline\-file
-.br
-.RB [ \-o | \-\-output\-directory
-.IR output\-directory ]
-.br
-.RB [ \-t | \-\-title
-.IR title ]
-.br
-.RB [ \-d | \-\-description\-file
-.IR description\-file ]
-.br
-.RB [ \-k | \-\-keep\-descriptions ]
-.RB [ \-c | \-\-css\-file
-.IR css\-file ]
-.br
-.RB [ \-p | \-\-prefix
-.IR prefix ]
-.RB [ \-\-no\-prefix ]
-.br
-.RB [ \-\-no\-source ]
-.RB [ \-\-num\-spaces
-.IR num ]
-.RB [ \-\-highlight ]
-.br
-.RB [ \-\-legend ]
-.RB [ \-\-html\-prolog
-.IR prolog\-file ]
-.br
-.RB [ \-\-html\-epilog
-.IR epilog\-file ]
-.RB [ \-\-html\-extension
-.IR extension ]
-.br
-.RB [ \-\-html\-gzip ]
-.RB [ \-\-sort ]
-.RB [ \-\-no\-sort ]
-.br
-.RB [ \-\-function\-coverage ]
-.RB [ \-\-no\-function\-coverage ]
-.br
-.RB [ \-\-branch\-coverage ]
-.RB [ \-\-no\-branch\-coverage ]
-.br
-.RB [ \-\-demangle\-cpp ]
-.RB [ \-\-ignore\-errors
-.IR errors ]
-.br
-.RB [ \-\-config\-file
-.IR config\-file ]
-.RB [ \-\-rc
-.IR keyword = value ]
-.br
-.IR tracefile(s)
-.RE
-.SH DESCRIPTION
-Create an HTML view of coverage data found in
-.IR tracefile .
-Note that
-.I tracefile
-may also be a list of filenames.
-
-HTML output files are created in the current working directory unless the
-\-\-output\-directory option is used. If
-.I tracefile
-ends with ".gz", it is assumed to be GZIP\-compressed and the gunzip tool
-will be used to decompress it transparently.
-
-Note that all source code files have to be present and readable at the
-exact file system location they were compiled.
-
-Use option
-.I \--css\-file
-to modify layout and colors of the generated HTML output. Files are
-marked in different colors depending on the associated coverage rate. By
-default, the coverage limits for low, medium and high coverage are set to
-0\-75%, 75\-90% and 90\-100% percent respectively. To change these
-values, use configuration file options
-.IR genhtml_hi_limit " and " genhtml_med_limit .
-
-Also note that when displaying percentages, 0% and 100% are only printed when
-the values are exactly 0% and 100% respectively. Other values which would
-conventionally be rounded to 0% or 100% are instead printed as nearest
-non-boundary value. This behavior is in accordance with that of the
-.BR gcov (1)
-tool.
-
-.SH OPTIONS
-.B \-h
-.br
-.B \-\-help
-.RS
-Print a short help text, then exit.
-
-.RE
-.B \-v
-.br
-.B \-\-version
-.RS
-Print version number, then exit.
-
-.RE
-.B \-q
-.br
-.B \-\-quiet
-.RS
-Do not print progress messages.
-
-Suppresses all informational progress output. When this switch is enabled,
-only error or warning messages are printed.
-
-.RE
-.B \-f
-.br
-.B \-\-frames
-.RS
-Use HTML frames for source code view.
-
-If enabled, a frameset is created for each source code file, providing
-an overview of the source code as a "clickable" image. Note that this
-option will slow down output creation noticeably because each source
-code character has to be inspected once. Note also that the GD.pm Perl
-module has to be installed for this option to work (it may be obtained
-from http://www.cpan.org).
-
-.RE
-.B \-s
-.br
-.B \-\-show\-details
-.RS
-Generate detailed directory view.
-
-When this option is enabled,
-.B genhtml
-generates two versions of each
-file view. One containing the standard information plus a link to a
-"detailed" version. The latter additionally contains information about
-which test case covered how many lines of each source file.
-
-.RE
-.BI "\-b " baseline\-file
-.br
-.BI "\-\-baseline\-file " baseline\-file
-.RS
-Use data in
-.I baseline\-file
-as coverage baseline.
-
-The tracefile specified by
-.I baseline\-file
-is read and all counts found in the original
-.I tracefile
-are decremented by the corresponding counts in
-.I baseline\-file
-before creating any output.
-
-Note that when a count for a particular line in
-.I baseline\-file
-is greater than the count in the
-.IR tracefile ,
-the result is zero.
-
-.RE
-.BI "\-o " output\-directory
-.br
-.BI "\-\-output\-directory " output\-directory
-.RS
-Create files in
-.I output\-directory.
-
-Use this option to tell
-.B genhtml
-to write the resulting files to a directory other than
-the current one. If
-.I output\-directory
-does not exist, it will be created.
-
-It is advisable to use this option since depending on the
-project size, a lot of files and subdirectories may be created.
-
-.RE
-.BI "\-t " title
-.br
-.BI "\-\-title " title
-.RS
-Display
-.I title
-in header of all pages.
-
-.I title
-is written to the header portion of each generated HTML page to
-identify the context in which a particular output
-was created. By default this is the name of the tracefile.
-
-.RE
-.BI "\-d " description\-file
-.br
-.BI "\-\-description\-file " description\-file
-.RS
-Read test case descriptions from
-.IR description\-file .
-
-All test case descriptions found in
-.I description\-file
-and referenced in the input data file are read and written to an extra page
-which is then incorporated into the HTML output.
-
-The file format of
-.IR "description\-file " is:
-
-for each test case:
-.RS
-TN:<testname>
-.br
-TD:<test description>
-
-.RE
-
-Valid test case names can consist of letters, numbers and the underscore
-character ('_').
-.RE
-.B \-k
-.br
-.B \-\-keep\-descriptions
-.RS
-Do not remove unused test descriptions.
-
-Keep descriptions found in the description file even if the coverage data
-indicates that the associated test case did not cover any lines of code.
-
-This option can also be configured permanently using the configuration file
-option
-.IR genhtml_keep_descriptions .
-
-.RE
-.BI "\-c " css\-file
-.br
-.BI "\-\-css\-file " css\-file
-.RS
-Use external style sheet file
-.IR css\-file .
-
-Using this option, an extra .css file may be specified which will replace
-the default one. This may be helpful if the default colors make your eyes want
-to jump out of their sockets :)
-
-This option can also be configured permanently using the configuration file
-option
-.IR genhtml_css_file .
-
-.RE
-.BI "\-p " prefix
-.br
-.BI "\-\-prefix " prefix
-.RS
-Remove
-.I prefix
-from all directory names.
-
-Because lists containing long filenames are difficult to read, there is a
-mechanism implemented that will automatically try to shorten all directory
-names on the overview page beginning with a common prefix. By default,
-this is done using an algorithm that tries to find the prefix which, when
-applied, will minimize the resulting sum of characters of all directory
-names.
-
-Use this option to specify the prefix to be removed by yourself.
-
-.RE
-.B \-\-no\-prefix
-.RS
-Do not remove prefix from directory names.
-
-This switch will completely disable the prefix mechanism described in the
-previous section.
-
-This option can also be configured permanently using the configuration file
-option
-.IR genhtml_no_prefix .
-
-.RE
-.B \-\-no\-source
-.RS
-Do not create source code view.
-
-Use this switch if you don't want to get a source code view for each file.
-
-This option can also be configured permanently using the configuration file
-option
-.IR genhtml_no_source .
-
-.RE
-.BI "\-\-num\-spaces " spaces
-.RS
-Replace tabs in source view with
-.I num
-spaces.
-
-Default value is 8.
-
-This option can also be configured permanently using the configuration file
-option
-.IR genhtml_num_spaces .
-
-.RE
-.B \-\-highlight
-.RS
-Highlight lines with converted\-only coverage data.
-
-Use this option in conjunction with the \-\-diff option of
-.B lcov
-to highlight those lines which were only covered in data sets which were
-converted from previous source code versions.
-
-This option can also be configured permanently using the configuration file
-option
-.IR genhtml_highlight .
-
-.RE
-.B \-\-legend
-.RS
-Include color legend in HTML output.
-
-Use this option to include a legend explaining the meaning of color coding
-in the resulting HTML output.
-
-This option can also be configured permanently using the configuration file
-option
-.IR genhtml_legend .
-
-.RE
-.BI "\-\-html\-prolog " prolog\-file
-.RS
-Read customized HTML prolog from
-.IR prolog\-file .
-
-Use this option to replace the default HTML prolog (the initial part of the
-HTML source code leading up to and including the <body> tag) with the contents
-of
-.IR prolog\-file .
-Within the prolog text, the following words will be replaced when a page is generated:
-
-.B "@pagetitle@"
-.br
-The title of the page.
-
-.B "@basedir@"
-.br
-A relative path leading to the base directory (e.g. for locating css\-files).
-
-This option can also be configured permanently using the configuration file
-option
-.IR genhtml_html_prolog .
-
-.RE
-.BI "\-\-html\-epilog " epilog\-file
-.RS
-Read customized HTML epilog from
-.IR epilog\-file .
-
-Use this option to replace the default HTML epilog (the final part of the HTML
-source including </body>) with the contents of
-.IR epilog\-file .
-
-Within the epilog text, the following words will be replaced when a page is generated:
-
-.B "@basedir@"
-.br
-A relative path leading to the base directory (e.g. for locating css\-files).
-
-This option can also be configured permanently using the configuration file
-option
-.IR genhtml_html_epilog .
-
-.RE
-.BI "\-\-html\-extension " extension
-.RS
-Use customized filename extension for generated HTML pages.
-
-This option is useful in situations where different filename extensions
-are required to render the resulting pages correctly (e.g. php). Note that
-a '.' will be inserted between the filename and the extension specified by
-this option.
-
-This option can also be configured permanently using the configuration file
-option
-.IR genhtml_html_extension .
-.RE
-
-.B \-\-html\-gzip
-.RS
-Compress all generated html files with gzip and add a .htaccess file specifying
-gzip\-encoding in the root output directory.
-
-Use this option if you want to save space on your webserver. Requires a
-webserver with .htaccess support and a browser with support for gzip
-compressed html.
-
-This option can also be configured permanently using the configuration file
-option
-.IR genhtml_html_gzip .
-
-.RE
-.B \-\-sort
-.br
-.B \-\-no\-sort
-.RS
-Specify whether to include sorted views of file and directory overviews.
-
-Use \-\-sort to include sorted views or \-\-no\-sort to not include them.
-Sorted views are
-.B enabled
-by default.
-
-When sorted views are enabled, each overview page will contain links to
-views of that page sorted by coverage rate.
-
-This option can also be configured permanently using the configuration file
-option
-.IR genhtml_sort .
-
-.RE
-.B \-\-function\-coverage
-.br
-.B \-\-no\-function\-coverage
-.RS
-Specify whether to display function coverage summaries in HTML output.
-
-Use \-\-function\-coverage to enable function coverage summaries or
-\-\-no\-function\-coverage to disable it. Function coverage summaries are
-.B enabled
-by default
-
-When function coverage summaries are enabled, each overview page will contain
-the number of functions found and hit per file or directory, together with
-the resulting coverage rate. In addition, each source code view will contain
-a link to a page which lists all functions found in that file plus the
-respective call count for those functions.
-
-This option can also be configured permanently using the configuration file
-option
-.IR genhtml_function_coverage .
-
-.RE
-.B \-\-branch\-coverage
-.br
-.B \-\-no\-branch\-coverage
-.RS
-Specify whether to display branch coverage data in HTML output.
-
-Use \-\-branch\-coverage to enable branch coverage display or
-\-\-no\-branch\-coverage to disable it. Branch coverage data display is
-.B enabled
-by default
-
-When branch coverage display is enabled, each overview page will contain
-the number of branches found and hit per file or directory, together with
-the resulting coverage rate. In addition, each source code view will contain
-an extra column which lists all branches of a line with indications of
-whether the branch was taken or not. Branches are shown in the following format:
-
- ' + ': Branch was taken at least once
-.br
- ' - ': Branch was not taken
-.br
- ' # ': The basic block containing the branch was never executed
-.br
-
-Note that it might not always be possible to relate branches to the
-corresponding source code statements: during compilation, GCC might shuffle
-branches around or eliminate some of them to generate better code.
-
-This option can also be configured permanently using the configuration file
-option
-.IR genhtml_branch_coverage .
-
-.RE
-.B \-\-demangle\-cpp
-.RS
-Specify whether to demangle C++ function names.
-
-Use this option if you want to convert C++ internal function names to
-human readable format for display on the HTML function overview page.
-This option requires that the c++filt tool is installed (see
-.BR c++filt (1)).
-
-.RE
-.B \-\-ignore\-errors
-.I errors
-.br
-.RS
-Specify a list of errors after which to continue processing.
-
-Use this option to specify a list of one or more classes of errors after which
-geninfo should continue processing instead of aborting.
-
-.I errors
-can be a comma\-separated list of the following keywords:
-
-.B source:
-the source code file for a data set could not be found.
-.RE
-
-.B \-\-config\-file
-.I config\-file
-.br
-.RS
-Specify a configuration file to use.
-
-When this option is specified, neither the system\-wide configuration file
-/etc/lcovrc, nor the per\-user configuration file ~/.lcovrc is read.
-
-This option may be useful when there is a need to run several
-instances of
-.B genhtml
-with different configuration file options in parallel.
-.RE
-
-.B \-\-rc
-.IR keyword = value
-.br
-.RS
-Override a configuration directive.
-
-Use this option to specify a
-.IR keyword = value
-statement which overrides the corresponding configuration statement in
-the lcovrc configuration file. You can specify this option more than once
-to override multiple configuration statements.
-See
-.BR lcovrc (5)
-for a list of available keywords and their meaning.
-.RE
-
-.SH FILES
-
-.I /etc/lcovrc
-.RS
-The system\-wide configuration file.
-.RE
-
-.I ~/.lcovrc
-.RS
-The per\-user configuration file.
-.RE
-
-.SH AUTHOR
-Peter Oberparleiter <Peter.Oberparleiter@de.ibm.com>
-
-.SH SEE ALSO
-.BR lcov (1),
-.BR lcovrc (5),
-.BR geninfo (1),
-.BR genpng (1),
-.BR gendesc (1),
-.BR gcov (1)
diff --git a/chromium/third_party/lcov/man/geninfo.1 b/chromium/third_party/lcov/man/geninfo.1
deleted file mode 100644
index d9ca97c2e44..00000000000
--- a/chromium/third_party/lcov/man/geninfo.1
+++ /dev/null
@@ -1,512 +0,0 @@
-.TH geninfo 1 "LCOV 1.10" 2012\-10\-10 "User Manuals"
-.SH NAME
-geninfo \- Generate tracefiles from .da files
-.SH SYNOPSIS
-.B geninfo
-.RB [ \-h | \-\-help ]
-.RB [ \-v | \-\-version ]
-.RB [ \-q | \-\-quiet ]
-.br
-.RS 8
-.RB [ \-i | \-\-initial ]
-.RB [ \-t | \-\-test\-name
-.IR test\-name ]
-.br
-.RB [ \-o | \-\-output\-filename
-.IR filename ]
-.RB [ \-f | \-\-follow ]
-.br
-.RB [ \-b | \-\-base\-directory
-.IR directory ]
-.br
-.RB [ \-\-checksum ]
-.RB [ \-\-no\-checksum ]
-.br
-.RB [ \-\-compat\-libtool ]
-.RB [ \-\-no\-compat\-libtool ]
-.br
-.RB [ \-\-gcov\-tool
-.IR tool ]
-.RB [ \-\-ignore\-errors
-.IR errors ]
-.br
-.RB [ \-\-no\-recursion ]
-.I directory
-.RB [ \-\-external ]
-.RB [ \-\-no\-external ]
-.br
-.RB [ \-\-config\-file
-.IR config\-file ]
-.RB [ \-\-no\-markers ]
-.br
-.RB [ \-\-derive\-func\-data ]
-.RB [ \-\-compat
-.IR mode =on|off|auto]
-.br
-.RB [ \-\-rc
-.IR keyword = value ]
-.RE
-.SH DESCRIPTION
-.B geninfo
-converts all GCOV coverage data files found in
-.I directory
-into tracefiles, which the
-.B genhtml
-tool can convert to HTML output.
-
-Unless the \-\-output\-filename option is specified,
-.B geninfo
-writes its
-output to one file per .da file, the name of which is generated by simply
-appending ".info" to the respective .da file name.
-
-Note that the current user needs write access to both
-.I directory
-as well as to the original source code location. This is necessary because
-some temporary files have to be created there during the conversion process.
-
-Note also that
-.B geninfo
-is called from within
-.BR lcov ,
-so that there is usually no need to call it directly.
-
-.B Exclusion markers
-
-To exclude specific lines of code from a tracefile, you can add exclusion
-markers to the source code. Exclusion markers are keywords which can for
-example be added in the form of a comment.
-
-The following markers are recognized by geninfo:
-
-LCOV_EXCL_LINE
-.RS
-Lines containing this marker will be excluded.
-.br
-.RE
-LCOV_EXCL_START
-.RS
-Marks the beginning of an excluded section. The current line is part of this
-section.
-.br
-.RE
-LCOV_EXCL_STOP
-.RS
-Marks the end of an excluded section. The current line not part of this
-section.
-.RE
-.br
-
-.SH OPTIONS
-
-.B \-b
-.I directory
-.br
-.B \-\-base\-directory
-.I directory
-.br
-.RS
-.RI "Use " directory
-as base directory for relative paths.
-
-Use this option to specify the base directory of a build\-environment
-when geninfo produces error messages like:
-
-.RS
-ERROR: could not read source file /home/user/project/subdir1/subdir2/subdir1/subdir2/file.c
-.RE
-
-In this example, use /home/user/project as base directory.
-
-This option is required when using geninfo on projects built with libtool or
-similar build environments that work with a base directory, i.e. environments,
-where the current working directory when invoking the compiler is not the same
-directory in which the source code file is located.
-
-Note that this option will not work in environments where multiple base
-directories are used. In that case use configuration file setting
-.B geninfo_auto_base=1
-(see
-.BR lcovrc (5)).
-.RE
-
-.B \-\-checksum
-.br
-.B \-\-no\-checksum
-.br
-.RS
-Specify whether to generate checksum data when writing tracefiles.
-
-Use \-\-checksum to enable checksum generation or \-\-no\-checksum to
-disable it. Checksum generation is
-.B disabled
-by default.
-
-When checksum generation is enabled, a checksum will be generated for each
-source code line and stored along with the coverage data. This checksum will
-be used to prevent attempts to combine coverage data from different source
-code versions.
-
-If you don't work with different source code versions, disable this option
-to speed up coverage data processing and to reduce the size of tracefiles.
-.RE
-
-.B \-\-compat
-.IR mode = value [, mode = value ,...]
-.br
-.RS
-Set compatibility mode.
-
-Use \-\-compat to specify that geninfo should enable one or more compatibility
-modes when capturing coverage data. You can provide a comma-separated list
-of mode=value pairs to specify the values for multiple modes.
-
-Valid
-.I values
-are:
-
-.B on
-.RS
-Enable compatibility mode.
-.RE
-.B off
-.RS
-Disable compatibility mode.
-.RE
-.B auto
-.RS
-Apply auto-detection to determine if compatibility mode is required. Note that
-auto-detection is not available for all compatibility modes.
-.RE
-
-If no value is specified, 'on' is assumed as default value.
-
-Valid
-.I modes
-are:
-
-.B libtool
-.RS
-Enable this mode if you are capturing coverage data for a project that
-was built using the libtool mechanism. See also
-\-\-compat\-libtool.
-
-The default value for this setting is 'on'.
-
-.RE
-.B hammer
-.RS
-Enable this mode if you are capturing coverage data for a project that
-was built using a version of GCC 3.3 that contains a modification
-(hammer patch) of later GCC versions. You can identify a modified GCC 3.3
-by checking the build directory of your project for files ending in the
-extension '.bbg'. Unmodified versions of GCC 3.3 name these files '.bb'.
-
-The default value for this setting is 'auto'.
-
-.RE
-.B split_crc
-.RS
-Enable this mode if you are capturing coverage data for a project that
-was built using a version of GCC 4.6 that contains a modification
-(split function checksums) of later GCC versions. Typical error messages
-when running geninfo on coverage data produced by such GCC versions are
-\'out of memory' and 'reached unexpected end of file'.
-
-The default value for this setting is 'auto'
-.RE
-
-.RE
-
-.B \-\-compat\-libtool
-.br
-.B \-\-no\-compat\-libtool
-.br
-.RS
-Specify whether to enable libtool compatibility mode.
-
-Use \-\-compat\-libtool to enable libtool compatibility mode or \-\-no\-compat\-libtool
-to disable it. The libtool compatibility mode is
-.B enabled
-by default.
-
-When libtool compatibility mode is enabled, geninfo will assume that the source
-code relating to a .da file located in a directory named ".libs" can be
-found in its parent directory.
-
-If you have directories named ".libs" in your build environment but don't use
-libtool, disable this option to prevent problems when capturing coverage data.
-.RE
-
-.B \-\-config\-file
-.I config\-file
-.br
-.RS
-Specify a configuration file to use.
-
-When this option is specified, neither the system\-wide configuration file
-/etc/lcovrc, nor the per\-user configuration file ~/.lcovrc is read.
-
-This option may be useful when there is a need to run several
-instances of
-.B geninfo
-with different configuration file options in parallel.
-.RE
-
-.B \-\-derive\-func\-data
-.br
-.RS
-Calculate function coverage data from line coverage data.
-
-Use this option to collect function coverage data, even if the version of the
-gcov tool installed on the test system does not provide this data. lcov will
-instead derive function coverage data from line coverage data and
-information about which lines belong to a function.
-.RE
-
-.B \-\-external
-.br
-.B \-\-no\-external
-.br
-.RS
-Specify whether to capture coverage data for external source files.
-
-External source files are files which are not located in one of the directories
-specified by \-\-directory or \-\-base\-directory. Use \-\-external to include
-external source files while capturing coverage data or \-\-no\-external to
-ignore this data.
-
-Data for external source files is
-.B included
-by default.
-.RE
-
-.B \-f
-.br
-.B \-\-follow
-.RS
-Follow links when searching .da files.
-.RE
-
-.B \-\-gcov\-tool
-.I tool
-.br
-.RS
-Specify the location of the gcov tool.
-.RE
-
-.B \-h
-.br
-.B \-\-help
-.RS
-Print a short help text, then exit.
-.RE
-
-.B \-\-ignore\-errors
-.I errors
-.br
-.RS
-Specify a list of errors after which to continue processing.
-
-Use this option to specify a list of one or more classes of errors after which
-geninfo should continue processing instead of aborting.
-
-.I errors
-can be a comma\-separated list of the following keywords:
-
-.B gcov:
-the gcov tool returned with a non\-zero return code.
-
-.B source:
-the source code file for a data set could not be found.
-.RE
-
-.B \-i
-.br
-.B \-\-initial
-.RS
-Capture initial zero coverage data.
-
-Run geninfo with this option on the directories containing .bb, .bbg or .gcno
-files before running any test case. The result is a "baseline" coverage data
-file that contains zero coverage for every instrumented line and function.
-Combine this data file (using lcov \-a) with coverage data files captured
-after a test run to ensure that the percentage of total lines covered is
-correct even when not all object code files were loaded during the test.
-
-Note: currently, the \-\-initial option does not generate branch coverage
-information.
-.RE
-
-.B \-\-no\-markers
-.br
-.RS
-Use this option if you want to get coverage data without regard to exclusion
-markers in the source code file.
-.RE
-
-.B \-\-no\-recursion
-.br
-.RS
-Use this option if you want to get coverage data for the specified directory
-only without processing subdirectories.
-.RE
-
-.BI "\-o " output\-filename
-.br
-.BI "\-\-output\-filename " output\-filename
-.RS
-Write all data to
-.IR output\-filename .
-
-If you want to have all data written to a single file (for easier
-handling), use this option to specify the respective filename. By default,
-one tracefile will be created for each processed .da file.
-.RE
-
-.B \-q
-.br
-.B \-\-quiet
-.RS
-Do not print progress messages.
-
-Suppresses all informational progress output. When this switch is enabled,
-only error or warning messages are printed.
-.RE
-
-.B \-\-rc
-.IR keyword = value
-.br
-.RS
-Override a configuration directive.
-
-Use this option to specify a
-.IR keyword = value
-statement which overrides the corresponding configuration statement in
-the lcovrc configuration file. You can specify this option more than once
-to override multiple configuration statements.
-See
-.BR lcovrc (5)
-for a list of available keywords and their meaning.
-.RE
-
-.BI "\-t " testname
-.br
-.BI "\-\-test\-name " testname
-.RS
-Use test case name
-.I testname
-for resulting data. Valid test case names can consist of letters, decimal
-digits and the underscore character ('_').
-
-This proves useful when data from several test cases is merged (i.e. by
-simply concatenating the respective tracefiles) in which case a test
-name can be used to differentiate between data from each test case.
-.RE
-
-.B \-v
-.br
-.B \-\-version
-.RS
-Print version number, then exit.
-.RE
-
-
-.SH FILES
-
-.I /etc/lcovrc
-.RS
-The system\-wide configuration file.
-.RE
-
-.I ~/.lcovrc
-.RS
-The per\-user configuration file.
-.RE
-
-Following is a quick description of the tracefile format as used by
-.BR genhtml ", " geninfo " and " lcov .
-
-A tracefile is made up of several human\-readable lines of text,
-divided into sections. If available, a tracefile begins with the
-.I testname
-which is stored in the following format:
-
- TN:<test name>
-
-For each source file referenced in the .da file, there is a section containing
-filename and coverage data:
-
- SF:<absolute path to the source file>
-
-Following is a list of line numbers for each function name found in the
-source file:
-
- FN:<line number of function start>,<function name>
-
-Next, there is a list of execution counts for each instrumented function:
-
- FNDA:<execution count>,<function name>
-
-This list is followed by two lines containing the number of functions found
-and hit:
-
- FNF:<number of functions found>
- FNH:<number of function hit>
-
-Branch coverage information is stored which one line per branch:
-
- BRDA:<line number>,<block number>,<branch number>,<taken>
-
-Block number and branch number are gcc internal IDs for the branch. Taken is
-either '-' if the basic block containing the branch was never executed or
-a number indicating how often that branch was taken.
-
-Branch coverage summaries are stored in two lines:
-
- BRF:<number of branches found>
- BRH:<number of branches hit>
-
-Then there is a list of execution counts for each instrumented line
-(i.e. a line which resulted in executable code):
-
- DA:<line number>,<execution count>[,<checksum>]
-
-Note that there may be an optional checksum present for each instrumented
-line. The current
-.B geninfo
-implementation uses an MD5 hash as checksumming algorithm.
-
-At the end of a section, there is a summary about how many lines
-were found and how many were actually instrumented:
-
- LH:<number of lines with a non\-zero execution count>
- LF:<number of instrumented lines>
-
-Each sections ends with:
-
- end_of_record
-
-In addition to the main source code file there are sections for all
-#included files which also contain executable code.
-
-Note that the absolute path of a source file is generated by interpreting
-the contents of the respective .bb file (see
-.BR "gcov " (1)
-for more information on this file type). Relative filenames are prefixed
-with the directory in which the .bb file is found.
-
-Note also that symbolic links to the .bb file will be resolved so that the
-actual file path is used instead of the path to a link. This approach is
-necessary for the mechanism to work with the /proc/gcov files.
-
-.SH AUTHOR
-Peter Oberparleiter <Peter.Oberparleiter@de.ibm.com>
-
-.SH SEE ALSO
-.BR lcov (1),
-.BR lcovrc (5),
-.BR genhtml (1),
-.BR genpng (1),
-.BR gendesc (1),
-.BR gcov (1)
diff --git a/chromium/third_party/lcov/man/genpng.1 b/chromium/third_party/lcov/man/genpng.1
deleted file mode 100644
index 5c13bd51cbe..00000000000
--- a/chromium/third_party/lcov/man/genpng.1
+++ /dev/null
@@ -1,101 +0,0 @@
-.TH genpng 1 "LCOV 1.10" 2012\-10\-10 "User Manuals"
-.SH NAME
-genpng \- Generate an overview image from a source file
-.SH SYNOPSIS
-.B genpng
-.RB [ \-h | \-\-help ]
-.RB [ \-v | \-\-version ]
-.RS 7
-.br
-.RB [ \-t | \-\-tab\-size
-.IR tabsize ]
-.RB [ \-w | \-\-width
-.IR width ]
-.br
-.RB [ \-o | \-\-output\-filename
-.IR output\-filename ]
-.br
-.IR source\-file
-.SH DESCRIPTION
-.B genpng
-creates an overview image for a given source code file of either
-plain text or .gcov file format.
-
-Note that the
-.I GD.pm
-Perl module has to be installed for this script to work
-(it may be obtained from
-.IR http://www.cpan.org ).
-
-Note also that
-.B genpng
-is called from within
-.B genhtml
-so that there is usually no need to call it directly.
-
-.SH OPTIONS
-.B \-h
-.br
-.B \-\-help
-.RS
-Print a short help text, then exit.
-.RE
-
-.B \-v
-.br
-.B \-\-version
-.RS
-Print version number, then exit.
-.RE
-
-.BI "\-t " tab\-size
-.br
-.BI "\-\-tab\-size " tab\-size
-.RS
-Use
-.I tab\-size
-spaces in place of tab.
-
-All occurrences of tabulator signs in the source code file will be replaced
-by the number of spaces defined by
-.I tab\-size
-(default is 4).
-.RE
-
-.BI "\-w " width
-.br
-.BI "\-\-width " width
-.RS
-Set width of output image to
-.I width
-pixel.
-
-The resulting image will be exactly
-.I width
-pixel wide (default is 80).
-
-Note that source code lines which are longer than
-.I width
-will be truncated.
-.RE
-
-
-.BI "\-o " filename
-.br
-.BI "\-\-output\-filename " filename
-.RS
-Write image to
-.IR filename .
-
-Specify a name for the resulting image file (default is
-.IR source\-file .png).
-.RE
-.SH AUTHOR
-Peter Oberparleiter <Peter.Oberparleiter@de.ibm.com>
-
-.SH SEE ALSO
-.BR lcov (1),
-.BR genhtml (1),
-.BR geninfo (1),
-.BR gendesc (1),
-.BR gcov (1)
diff --git a/chromium/third_party/lcov/man/lcov.1 b/chromium/third_party/lcov/man/lcov.1
deleted file mode 100644
index 092d86560bc..00000000000
--- a/chromium/third_party/lcov/man/lcov.1
+++ /dev/null
@@ -1,883 +0,0 @@
-.TH lcov 1 "LCOV 1.10" 2012\-10\-10 "User Manuals"
-.SH NAME
-lcov \- a graphical GCOV front\-end
-.SH SYNOPSIS
-.B lcov
-.BR \-c | \-\-capture
-.RS 5
-.br
-.RB [ \-d | \-\-directory
-.IR directory ]
-.RB [ \-k | \-\-kernel\-directory
-.IR directory ]
-.br
-.RB [ \-o | \-\-output\-file
-.IR tracefile ]
-.RB [ \-t | \-\-test\-name
-.IR testname ]
-.br
-.RB [ \-b | \-\-base\-directory
-.IR directory ]
-.RB [ \-i | \-\-initial ]
-.RB [ \-\-gcov\-tool
-.IR tool ]
-.br
-.RB [ \-\-checksum ]
-.RB [ \-\-no\-checksum ]
-.RB [ \-\-no\-recursion ]
-.RB [ \-f | \-\-follow ]
-.br
-.RB [ \-\-compat\-libtool ]
-.RB [ \-\-no\-compat\-libtool ]
-.RB [ \-\-ignore\-errors
-.IR errors ]
-.br
-.RB [ \-\-to\-package
-.IR package ]
-.RB [ \-\-from\-package
-.IR package ]
-.RB [ \-q | \-\-quiet ]
-.br
-.RB [ \-\-no\-markers ]
-.RB [ \-\-external ]
-.RB [ \-\-no\-external ]
-.br
-.RB [ \-\-config\-file
-.IR config\-file ]
-.RB [ \-\-rc
-.IR keyword = value ]
-.br
-.RB [ \-\-compat
-.IR mode =on|off|auto]
-.br
-.RE
-
-.B lcov
-.BR \-z | \-\-zerocounters
-.RS 5
-.br
-.RB [ \-d | \-\-directory
-.IR directory ]
-.RB [ \-\-no\-recursion ]
-.RB [ \-f | \-\-follow ]
-.br
-.RB [ \-q | \-\-quiet ]
-.br
-.RE
-
-.B lcov
-.BR \-l | \-\-list
-.I tracefile
-.RS 5
-.br
-.RB [ \-q | \-\-quiet ]
-.RB [ \-\-list\-full\-path ]
-.RB [ \-\-no\-list\-full\-path ]
-.br
-.RB [ \-\-config\-file
-.IR config\-file ]
-.RB [ \-\-rc
-.IR keyword = value ]
-.br
-.RE
-
-.B lcov
-.BR \-a | \-\-add\-tracefile
-.I tracefile
-.RS 5
-.br
-.RB [ \-o | \-\-output\-file
-.IR tracefile ]
-.RB [ \-\-checksum ]
-.RB [ \-\-no\-checksum ]
-.br
-.RB [ \-q | \-\-quiet ]
-.RB [ \-\-config\-file
-.IR config\-file ]
-.RB [ \-\-rc
-.IR keyword = value ]
-.br
-.RE
-
-.B lcov
-.BR \-e | \-\-extract
-.I tracefile pattern
-.RS 5
-.br
-.RB [ \-o | \-\-output\-file
-.IR tracefile ]
-.RB [ \-\-checksum ]
-.RB [ \-\-no\-checksum ]
-.br
-.RB [ \-q | \-\-quiet ]
-.RB [ \-\-config\-file
-.IR config\-file ]
-.RB [ \-\-rc
-.IR keyword = value ]
-.br
-.RE
-
-.B lcov
-.BR \-r | \-\-remove
-.I tracefile pattern
-.RS 5
-.br
-.RB [ \-o | \-\-output\-file
-.IR tracefile ]
-.RB [ \-\-checksum ]
-.RB [ \-\-no\-checksum ]
-.br
-.RB [ \-q | \-\-quiet ]
-.RB [ \-\-config\-file
-.IR config\-file ]
-.RB [ \-\-rc
-.IR keyword = value ]
-.br
-.RE
-
-.B lcov
-.BR \-\-diff
-.IR "tracefile diff"
-.RS 5
-.br
-.RB [ \-o | \-\-output\-file
-.IR tracefile ]
-.RB [ \-\-checksum ]
-.RB [ \-\-no\-checksum ]
-.br
-.RB [ \-\-convert\-filenames ]
-.RB [ \-\-strip
-.IR depth ]
-.RB [ \-\-path
-.IR path ]
-.RB [ \-q | \-\-quiet ]
-.br
-.RB [ \-\-config\-file
-.IR config\-file ]
-.RB [ \-\-rc
-.IR keyword = value ]
-.br
-.RE
-
-.B lcov
-.BR \-\-summary
-.I tracefile
-.RS 5
-.br
-.RB [ \-q | \-\-quiet ]
-.br
-.RE
-
-.B lcov
-.RB [ \-h | \-\-help ]
-.RB [ \-v | \-\-version ]
-.RS 5
-.br
-.RE
-
-.SH DESCRIPTION
-.B lcov
-is a graphical front\-end for GCC's coverage testing tool gcov. It collects
-line, function and branch coverage data for multiple source files and creates
-HTML pages containing the source code annotated with coverage information.
-It also adds overview pages for easy navigation within the file structure.
-
-Use
-.B lcov
-to collect coverage data and
-.B genhtml
-to create HTML pages. Coverage data can either be collected from the
-currently running Linux kernel or from a user space application. To do this,
-you have to complete the following preparation steps:
-
-For Linux kernel coverage:
-.RS
-Follow the setup instructions for the gcov\-kernel infrastructure:
-.I http://ltp.sourceforge.net/coverage/gcov.php
-.br
-
-
-.RE
-For user space application coverage:
-.RS
-Compile the application with GCC using the options
-"\-fprofile\-arcs" and "\-ftest\-coverage".
-.RE
-
-Please note that this man page refers to the output format of
-.B lcov
-as ".info file" or "tracefile" and that the output of GCOV
-is called ".da file".
-
-Also note that when printing percentages, 0% and 100% are only printed when
-the values are exactly 0% and 100% respectively. Other values which would
-conventionally be rounded to 0% or 100% are instead printed as nearest
-non-boundary value. This behavior is in accordance with that of the
-.BR gcov (1)
-tool.
-
-.SH OPTIONS
-
-
-.B \-a
-.I tracefile
-.br
-.B \-\-add\-tracefile
-.I tracefile
-.br
-.RS
-Add contents of
-.IR tracefile .
-
-Specify several tracefiles using the \-a switch to combine the coverage data
-contained in these files by adding up execution counts for matching test and
-filename combinations.
-
-The result of the add operation will be written to stdout or the tracefile
-specified with \-o.
-
-Only one of \-z, \-c, \-a, \-e, \-r, \-l, \-\-diff or \-\-summary may be
-specified at a time.
-
-.RE
-
-.B \-b
-.I directory
-.br
-.B \-\-base\-directory
-.I directory
-.br
-.RS
-.RI "Use " directory
-as base directory for relative paths.
-
-Use this option to specify the base directory of a build\-environment
-when lcov produces error messages like:
-
-.RS
-ERROR: could not read source file /home/user/project/subdir1/subdir2/subdir1/subdir2/file.c
-.RE
-
-In this example, use /home/user/project as base directory.
-
-This option is required when using lcov on projects built with libtool or
-similar build environments that work with a base directory, i.e. environments,
-where the current working directory when invoking the compiler is not the same
-directory in which the source code file is located.
-
-Note that this option will not work in environments where multiple base
-directories are used. In that case use configuration file setting
-.B geninfo_auto_base=1
-(see
-.BR lcovrc (5)).
-.RE
-
-.B \-c
-.br
-.B \-\-capture
-.br
-.RS
-Capture coverage data.
-
-By default captures the current kernel execution counts and writes the
-resulting coverage data to the standard output. Use the \-\-directory
-option to capture counts for a user space program.
-
-The result of the capture operation will be written to stdout or the tracefile
-specified with \-o.
-
-Only one of \-z, \-c, \-a, \-e, \-r, \-l, \-\-diff or \-\-summary may be
-specified at a time.
-.RE
-
-.B \-\-checksum
-.br
-.B \-\-no\-checksum
-.br
-.RS
-Specify whether to generate checksum data when writing tracefiles.
-
-Use \-\-checksum to enable checksum generation or \-\-no\-checksum to
-disable it. Checksum generation is
-.B disabled
-by default.
-
-When checksum generation is enabled, a checksum will be generated for each
-source code line and stored along with the coverage data. This checksum will
-be used to prevent attempts to combine coverage data from different source
-code versions.
-
-If you don't work with different source code versions, disable this option
-to speed up coverage data processing and to reduce the size of tracefiles.
-.RE
-
-.B \-\-compat
-.IR mode = value [, mode = value ,...]
-.br
-.RS
-Set compatibility mode.
-
-Use \-\-compat to specify that lcov should enable one or more compatibility
-modes when capturing coverage data. You can provide a comma-separated list
-of mode=value pairs to specify the values for multiple modes.
-
-Valid
-.I values
-are:
-
-.B on
-.RS
-Enable compatibility mode.
-.RE
-.B off
-.RS
-Disable compatibility mode.
-.RE
-.B auto
-.RS
-Apply auto-detection to determine if compatibility mode is required. Note that
-auto-detection is not available for all compatibility modes.
-.RE
-
-If no value is specified, 'on' is assumed as default value.
-
-Valid
-.I modes
-are:
-
-.B libtool
-.RS
-Enable this mode if you are capturing coverage data for a project that
-was built using the libtool mechanism. See also
-\-\-compat\-libtool.
-
-The default value for this setting is 'on'.
-
-.RE
-.B hammer
-.RS
-Enable this mode if you are capturing coverage data for a project that
-was built using a version of GCC 3.3 that contains a modification
-(hammer patch) of later GCC versions. You can identify a modified GCC 3.3
-by checking the build directory of your project for files ending in the
-extension '.bbg'. Unmodified versions of GCC 3.3 name these files '.bb'.
-
-The default value for this setting is 'auto'.
-
-.RE
-.B split_crc
-.RS
-Enable this mode if you are capturing coverage data for a project that
-was built using a version of GCC 4.6 that contains a modification
-(split function checksums) of later GCC versions. Typical error messages
-when running lcov on coverage data produced by such GCC versions are
-\'out of memory' and 'reached unexpected end of file'.
-
-The default value for this setting is 'auto'
-.RE
-
-.RE
-
-.B \-\-compat\-libtool
-.br
-.B \-\-no\-compat\-libtool
-.br
-.RS
-Specify whether to enable libtool compatibility mode.
-
-Use \-\-compat\-libtool to enable libtool compatibility mode or \-\-no\-compat\-libtool
-to disable it. The libtool compatibility mode is
-.B enabled
-by default.
-
-When libtool compatibility mode is enabled, lcov will assume that the source
-code relating to a .da file located in a directory named ".libs" can be
-found in its parent directory.
-
-If you have directories named ".libs" in your build environment but don't use
-libtool, disable this option to prevent problems when capturing coverage data.
-.RE
-
-.B \-\-config\-file
-.I config\-file
-.br
-.RS
-Specify a configuration file to use.
-
-When this option is specified, neither the system\-wide configuration file
-/etc/lcovrc, nor the per\-user configuration file ~/.lcovrc is read.
-
-This option may be useful when there is a need to run several
-instances of
-.B lcov
-with different configuration file options in parallel.
-.RE
-
-.B \-\-convert\-filenames
-.br
-.RS
-Convert filenames when applying diff.
-
-Use this option together with \-\-diff to rename the file names of processed
-data sets according to the data provided by the diff.
-.RE
-
-.B \-\-diff
-.I tracefile
-.I difffile
-.br
-.RS
-Convert coverage data in
-.I tracefile
-using source code diff file
-.IR difffile .
-
-Use this option if you want to merge coverage data from different source code
-levels of a program, e.g. when you have data taken from an older version
-and want to combine it with data from a more current version.
-.B lcov
-will try to map source code lines between those versions and adjust the coverage
-data respectively.
-.I difffile
-needs to be in unified format, i.e. it has to be created using the "\-u" option
-of the
-.B diff
-tool.
-
-Note that lines which are not present in the old version will not be counted
-as instrumented, therefore tracefiles resulting from this operation should
-not be interpreted individually but together with other tracefiles taken
-from the newer version. Also keep in mind that converted coverage data should
-only be used for overview purposes as the process itself introduces a loss
-of accuracy.
-
-The result of the diff operation will be written to stdout or the tracefile
-specified with \-o.
-
-Only one of \-z, \-c, \-a, \-e, \-r, \-l, \-\-diff or \-\-summary may be
-specified at a time.
-.RE
-
-.B \-d
-.I directory
-.br
-.B \-\-directory
-.I directory
-.br
-.RS
-Use .da files in
-.I directory
-instead of kernel.
-
-If you want to work on coverage data for a user space program, use this
-option to specify the location where the program was compiled (that's
-where the counter files ending with .da will be stored).
-
-Note that you may specify this option more than once.
-.RE
-
-.B \-\-external
-.br
-.B \-\-no\-external
-.br
-.RS
-Specify whether to capture coverage data for external source files.
-
-External source files are files which are not located in one of the directories
-specified by \-\-directory or \-\-base\-directory. Use \-\-external to include
-external source files while capturing coverage data or \-\-no\-external to
-ignore this data.
-
-Data for external source files is
-.B included
-by default.
-.RE
-
-.B \-e
-.I tracefile
-.I pattern
-.br
-.B \-\-extract
-.I tracefile
-.I pattern
-.br
-.RS
-Extract data from
-.IR tracefile .
-
-Use this switch if you want to extract coverage data for only a particular
-set of files from a tracefile. Additional command line parameters will be
-interpreted as shell wildcard patterns (note that they may need to be
-escaped accordingly to prevent the shell from expanding them first).
-Every file entry in
-.I tracefile
-which matches at least one of those patterns will be extracted.
-
-The result of the extract operation will be written to stdout or the tracefile
-specified with \-o.
-
-Only one of \-z, \-c, \-a, \-e, \-r, \-l, \-\-diff or \-\-summary may be
-specified at a time.
-.RE
-
-.B \-f
-.br
-.B \-\-follow
-.br
-.RS
-Follow links when searching for .da files.
-.RE
-
-.B \-\-from\-package
-.I package
-.br
-.RS
-Use .da files in
-.I package
-instead of kernel or directory.
-
-Use this option if you have separate machines for build and test and
-want to perform the .info file creation on the build machine. See
-\-\-to\-package for more information.
-.RE
-
-.B \-\-gcov\-tool
-.I tool
-.br
-.RS
-Specify the location of the gcov tool.
-.RE
-
-.B \-h
-.br
-.B \-\-help
-.br
-.RS
-Print a short help text, then exit.
-.RE
-
-.B \-\-ignore\-errors
-.I errors
-.br
-.RS
-Specify a list of errors after which to continue processing.
-
-Use this option to specify a list of one or more classes of errors after which
-lcov should continue processing instead of aborting.
-
-.I errors
-can be a comma\-separated list of the following keywords:
-
-.B gcov:
-the gcov tool returned with a non\-zero return code.
-
-.B source:
-the source code file for a data set could not be found.
-.RE
-
-.B \-i
-.br
-.B \-\-initial
-.RS
-Capture initial zero coverage data.
-
-Run lcov with \-c and this option on the directories containing .bb, .bbg
-or .gcno files before running any test case. The result is a "baseline"
-coverage data file that contains zero coverage for every instrumented line.
-Combine this data file (using lcov \-a) with coverage data files captured
-after a test run to ensure that the percentage of total lines covered is
-correct even when not all source code files were loaded during the test.
-
-Recommended procedure when capturing data for a test case:
-
-1. create baseline coverage data file
-.RS
-# lcov \-c \-i \-d appdir \-o app_base.info
-.br
-
-.RE
-2. perform test
-.RS
-# appdir/test
-.br
-
-.RE
-3. create test coverage data file
-.RS
-# lcov \-c \-d appdir \-o app_test.info
-.br
-
-.RE
-4. combine baseline and test coverage data
-.RS
-# lcov \-a app_base.info \-a app_test.info \-o app_total.info
-.br
-
-.RE
-.RE
-
-.B \-k
-.I subdirectory
-.br
-.B \-\-kernel\-directory
-.I subdirectory
-.br
-.RS
-Capture kernel coverage data only from
-.IR subdirectory .
-
-Use this option if you don't want to get coverage data for all of the
-kernel, but only for specific subdirectories. This option may be specified
-more than once.
-
-Note that you may need to specify the full path to the kernel subdirectory
-depending on the version of the kernel gcov support.
-.RE
-
-.B \-l
-.I tracefile
-.br
-.B \-\-list
-.I tracefile
-.br
-.RS
-List the contents of the
-.IR tracefile .
-
-Only one of \-z, \-c, \-a, \-e, \-r, \-l, \-\-diff or \-\-summary may be
-specified at a time.
-.RE
-
-.B \-\-list\-full\-path
-.br
-.B \-\-no\-list\-full\-path
-.br
-.RS
-Specify whether to show full paths during list operation.
-
-Use \-\-list\-full\-path to show full paths during list operation
-or \-\-no\-list\-full\-path to show shortened paths. Paths are
-.B shortened
-by default.
-.RE
-
-.B \-\-no\-markers
-.br
-.RS
-Use this option if you want to get coverage data without regard to exclusion
-markers in the source code file. See
-.BR "geninfo " (1)
-for details on exclusion markers.
-.RE
-
-.B \-\-no\-recursion
-.br
-.RS
-Use this option if you want to get coverage data for the specified directory
-only without processing subdirectories.
-.RE
-
-.B \-o
-.I tracefile
-.br
-.B \-\-output\-file
-.I tracefile
-.br
-.RS
-Write data to
-.I tracefile
-instead of stdout.
-
-Specify "\-" as a filename to use the standard output.
-
-By convention, lcov\-generated coverage data files are called "tracefiles" and
-should have the filename extension ".info".
-.RE
-
-.B \-\-path
-.I path
-.br
-.RS
-Strip path from filenames when applying diff.
-
-Use this option together with \-\-diff to tell lcov to disregard the specified
-initial path component when matching between tracefile and diff filenames.
-.RE
-
-.B \-q
-.br
-.B \-\-quiet
-.br
-.RS
-Do not print progress messages.
-
-This option is implied when no output filename is specified to prevent
-progress messages to mess with coverage data which is also printed to
-the standard output.
-.RE
-
-.B \-\-rc
-.IR keyword = value
-.br
-.RS
-Override a configuration directive.
-
-Use this option to specify a
-.IR keyword = value
-statement which overrides the corresponding configuration statement in
-the lcovrc configuration file. You can specify this option more than once
-to override multiple configuration statements.
-See
-.BR lcovrc (5)
-for a list of available keywords and their meaning.
-.RE
-
-.B \-r
-.I tracefile
-.I pattern
-.br
-.B \-\-remove
-.I tracefile
-.I pattern
-.br
-.RS
-Remove data from
-.IR tracefile .
-
-Use this switch if you want to remove coverage data for a particular
-set of files from a tracefile. Additional command line parameters will be
-interpreted as shell wildcard patterns (note that they may need to be
-escaped accordingly to prevent the shell from expanding them first).
-Every file entry in
-.I tracefile
-which matches at least one of those patterns will be removed.
-
-The result of the remove operation will be written to stdout or the tracefile
-specified with \-o.
-
-Only one of \-z, \-c, \-a, \-e, \-r, \-l, \-\-diff or \-\-summary may be
-specified at a time.
-.RE
-
-.B \-\-strip
-.I depth
-.br
-.RS
-Strip path components when applying diff.
-
-Use this option together with \-\-diff to tell lcov to disregard the specified
-number of initial directories when matching tracefile and diff filenames.
-.RE
-
-.B \-\-summary
-.I tracefile
-.br
-.RS
-Show summary coverage information for the specified tracefile.
-
-Note that you may specify this option more than once.
-
-Only one of \-z, \-c, \-a, \-e, \-r, \-l, \-\-diff or \-\-summary may be
-specified at a time.
-.RE
-
-.B \-t
-.I testname
-.br
-.B \-\-test\-name
-.I testname
-.br
-.RS
-Specify test name to be stored in the tracefile.
-
-This name identifies a coverage data set when more than one data set is merged
-into a combined tracefile (see option \-a).
-
-Valid test names can consist of letters, decimal digits and the underscore
-character ("_").
-.RE
-
-.B \-\-to\-package
-.I package
-.br
-.RS
-Store .da files for later processing.
-
-Use this option if you have separate machines for build and test and
-want to perform the .info file creation on the build machine. To do this,
-follow these steps:
-
-On the test machine:
-.RS
-.br
-\- run the test
-.br
-\- run lcov \-c [\-d directory] \-\-to-package
-.I file
-.br
-\- copy
-.I file
-to the build machine
-.RE
-.br
-
-On the build machine:
-.RS
-.br
-\- run lcov \-c \-\-from-package
-.I file
-[\-o and other options]
-.RE
-.br
-
-This works for both kernel and user space coverage data. Note that you might
-have to specify the path to the build directory using \-b with
-either \-\-to\-package or \-\-from-package. Note also that the package data
-must be converted to a .info file before recompiling the program or it will
-become invalid.
-.RE
-
-.B \-v
-.br
-.B \-\-version
-.br
-.RS
-Print version number, then exit.
-.RE
-
-.B \-z
-.br
-.B \-\-zerocounters
-.br
-.RS
-Reset all execution counts to zero.
-
-By default tries to reset kernel execution counts. Use the \-\-directory
-option to reset all counters of a user space program.
-
-Only one of \-z, \-c, \-a, \-e, \-r, \-l, \-\-diff or \-\-summary may be
-specified at a time.
-.RE
-
-.SH FILES
-
-.I /etc/lcovrc
-.RS
-The system\-wide configuration file.
-.RE
-
-.I ~/.lcovrc
-.RS
-The per\-user configuration file.
-.RE
-
-.SH AUTHOR
-Peter Oberparleiter <Peter.Oberparleiter@de.ibm.com>
-
-.SH SEE ALSO
-.BR lcovrc (5),
-.BR genhtml (1),
-.BR geninfo (1),
-.BR genpng (1),
-.BR gendesc (1),
-.BR gcov (1)
diff --git a/chromium/third_party/lcov/man/lcovrc.5 b/chromium/third_party/lcov/man/lcovrc.5
deleted file mode 100644
index 8566ef30da8..00000000000
--- a/chromium/third_party/lcov/man/lcovrc.5
+++ /dev/null
@@ -1,821 +0,0 @@
-.TH lcovrc 5 "LCOV 1.10" 2012\-10\-10 "User Manuals"
-
-.SH NAME
-lcovrc \- lcov configuration file
-
-.SH DESCRIPTION
-The
-.I lcovrc
-file contains configuration information for the
-.B lcov
-code coverage tool (see
-.BR lcov (1)).
-.br
-
-The system\-wide configuration file is located at
-.IR /etc/lcovrc .
-To change settings for a single user, place a customized copy of this file at
-location
-.IR ~/.lcovrc .
-Where available, command\-line options override configuration file settings.
-
-Lines in a configuration file can either be:
-.IP " *"
-empty lines or lines consisting only of white space characters. These lines are
-ignored.
-.IP " *"
-comment lines which start with a hash sign ('#'). These are treated like empty
-lines and will be ignored.
-.IP " *"
-statements in the form
-.RI ' key " = " value '.
-A list of valid statements and their description can be found in
-section 'OPTIONS' below.
-.PP
-
-.B Example configuration:
-.IP
-#
-.br
-# Example LCOV configuration file
-.br
-#
-.br
-
-# External style sheet file
-.br
-#genhtml_css_file = gcov.css
-.br
-
-# Coverage rate limits
-.br
-genhtml_hi_limit = 90
-.br
-genhtml_med_limit = 75
-.br
-
-# Width of line coverage field in source code view
-.br
-genhtml_line_field_width = 12
-.br
-
-# Width of branch coverage field in source code view
-.br
-genhtml_branch_field_width = 16
-.br
-
-# Width of overview image
-.br
-genhtml_overview_width = 80
-.br
-
-# Resolution of overview navigation
-.br
-genhtml_nav_resolution = 4
-.br
-
-# Offset for source code navigation
-.br
-genhtml_nav_offset = 10
-.br
-
-# Do not remove unused test descriptions if non\-zero
-.br
-genhtml_keep_descriptions = 0
-.br
-
-# Do not remove prefix from directory names if non\-zero
-.br
-genhtml_no_prefix = 0
-.br
-
-# Do not create source code view if non\-zero
-.br
-genhtml_no_source = 0
-.br
-
-# Specify size of tabs
-.br
-genhtml_num_spaces = 8
-.br
-
-# Highlight lines with converted\-only data if non\-zero
-.br
-genhtml_highlight = 0
-.br
-
-# Include color legend in HTML output if non\-zero
-.br
-genhtml_legend = 0
-.br
-
-# Include HTML file at start of HTML output
-.br
-#genhtml_html_prolog = prolog.html
-.br
-
-# Include HTML file at end of HTML output
-.br
-#genhtml_html_epilog = epilog.html
-.br
-
-# Use custom HTML file extension
-.br
-#genhtml_html_extension = html
-.br
-
-# Compress all generated html files with gzip.
-.br
-#genhtml_html_gzip = 1
-.br
-
-# Include sorted overview pages
-.br
-genhtml_sort = 1
-.br
-
-# Include function coverage data display
-.br
-#genhtml_function_coverage = 1
-.br
-
-# Include branch coverage data display
-.br
-#genhtml_branch_coverage = 1
-.br
-
-# Specify the character set of all generated HTML pages
-.br
-genhtml_charset=UTF\-8
-.br
-
-# Location of the gcov tool
-.br
-#geninfo_gcov_tool = gcov
-.br
-
-# Adjust test names if non\-zero
-.br
-#geninfo_adjust_testname = 0
-.br
-
-# Calculate a checksum for each line if non\-zero
-.br
-geninfo_checksum = 0
-.br
-
-# Enable libtool compatibility mode if non\-zero
-.br
-geninfo_compat_libtool = 0
-.br
-
-# Specify whether to capture coverage data for external source
-.br
-# files
-.br
-#geninfo_external = 1
-.br
-
-# Use gcov's --all-blocks option if non-zero
-.br
-#geninfo_gcov_all_blocks = 1
-.br
-
-# Specify compatiblity modes (same as \-\-compat option
-.br
-# of geninfo)
-.br
-#geninfo_compat = libtool=on, hammer=auto, split_crc=auto
-.br
-
-# Adjust path to source files by removing or changing path
-.br
-# components that match the specified pattern (Perl regular
-.br
-# expression format)
-.br
-#geninfo_adjust_src_path = /tmp/build => /usr/src
-
-# Specify if geninfo should try to automatically determine
-.br
-# the base-directory when collecting coverage data.
-.br
-geninfo_auto_base = 1
-.br
-
-# Directory containing gcov kernel files
-.br
-lcov_gcov_dir = /proc/gcov
-.br
-
-# Location for temporary directories
-.br
-lcov_tmp_dir = /tmp
-.br
-
-# Show full paths during list operation if non\-zero
-.br
-lcov_list_full_path = 0
-.br
-
-# Specify the maximum width for list output. This value is
-.br
-# ignored when lcov_list_full_path is non\-zero.
-.br
-lcov_list_width = 80
-.br
-
-# Specify the maximum percentage of file names which may be
-.br
-# truncated when choosing a directory prefix in list output.
-.br
-# This value is ignored when lcov_list_full_path is non\-zero.
-.br
-lcov_list_truncate_max = 20
-
-# Specify if function coverage data should be collected and
-.br
-# processed.
-.br
-lcov_function_coverage = 1
-.br
-
-# Specify if branch coverage data should be collected and
-.br
-# processed.
-.br
-lcov_branch_coverage = 0
-.br
-.PP
-
-.SH OPTIONS
-
-.BR genhtml_css_file " ="
-.I filename
-.IP
-Specify an external style sheet file. Use this option to modify the appearance of the HTML output as generated by
-.BR genhtml .
-During output generation, a copy of this file will be placed in the output
-directory.
-.br
-
-This option corresponds to the \-\-css\-file command line option of
-.BR genhtml .
-.br
-
-By default, a standard CSS file is generated.
-.PP
-
-.BR genhtml_hi_limit " ="
-.I hi_limit
-.br
-.BR genhtml_med_limit " ="
-.I med_limit
-.br
-.IP
-Specify coverage rate limits for classifying file entries. Use this option to
-modify the coverage rates (in percent) for line, function and branch coverage at
-which a result is classified as high, medium or low coverage. This
-classification affects the color of the corresponding entries on the overview
-pages of the HTML output:
-.br
-
-High: hi_limit <= rate <= 100 default color: green
-.br
-Medium: med_limit <= rate < hi_limit default color: orange
-.br
-Low: 0 <= rate < med_limit default color: red
-.br
-
-Defaults are 90 and 75 percent.
-.PP
-
-.BR genhtml_line_field_width " ="
-.I number_of_characters
-.IP
-Specify the width (in characters) of the source code view column containing
-line coverage information.
-.br
-
-Default is 12.
-.PP
-
-.BR genhtml_branch_field_width " ="
-.I number_of_characters
-.IP
-Specify the width (in characters) of the source code view column containing
-branch coverage information.
-.br
-
-Default is 16.
-.PP
-
-.BR genhtml_overview_width " ="
-.I pixel_size
-.IP
-Specify the width (in pixel) of the overview image created when generating HTML
-output using the \-\-frames option of
-.BR genhtml .
-.br
-
-Default is 80.
-.PP
-
-.BR genhtml_nav_resolution " ="
-.I lines
-.IP
-Specify the resolution of overview navigation when generating HTML output using
-the \-\-frames option of
-.BR genhtml .
-This number specifies the maximum difference in lines between the position a
-user selected from the overview and the position the source code window is
-scrolled to.
-.br
-
-Default is 4.
-.PP
-
-
-.BR genhtml_nav_offset " ="
-.I lines
-.IP
-Specify the overview navigation line offset as applied when generating HTML
-output using the \-\-frames option of
-.BR genhtml.
-.br
-
-Clicking a line in the overview image should show the source code view at
-a position a bit further up, so that the requested line is not the first
-line in the window. This number specifies that offset.
-.br
-
-Default is 10.
-.PP
-
-
-.BR genhtml_keep_descriptions " ="
-.IR 0 | 1
-.IP
-If non\-zero, keep unused test descriptions when generating HTML output using
-.BR genhtml .
-.br
-
-This option corresponds to the \-\-keep\-descriptions option of
-.BR genhtml .
-.br
-
-Default is 0.
-.PP
-
-.BR genhtml_no_prefix " ="
-.IR 0 | 1
-.IP
-If non\-zero, do not try to find and remove a common prefix from directory names.
-.br
-
-This option corresponds to the \-\-no\-prefix option of
-.BR genhtml .
-.br
-
-Default is 0.
-.PP
-
-.BR genhtml_no_source " ="
-.IR 0 | 1
-.IP
-If non\-zero, do not create a source code view when generating HTML output using
-.BR genhtml .
-.br
-
-This option corresponds to the \-\-no\-source option of
-.BR genhtml .
-.br
-
-Default is 0.
-.PP
-
-.BR genhtml_num_spaces " ="
-.I num
-.IP
-Specify the number of spaces to use as replacement for tab characters in the
-HTML source code view as generated by
-.BR genhtml .
-.br
-
-This option corresponds to the \-\-num\-spaces option of
-.BR genthml .
-.br
-
-Default is 8.
-
-.PP
-
-.BR genhtml_highlight " ="
-.IR 0 | 1
-.IP
-If non\-zero, highlight lines with converted\-only data in
-HTML output as generated by
-.BR genhtml .
-.br
-
-This option corresponds to the \-\-highlight option of
-.BR genhtml .
-.br
-
-Default is 0.
-.PP
-
-.BR genhtml_legend " ="
-.IR 0 | 1
-.IP
-If non\-zero, include a legend explaining the meaning of color coding in the HTML
-output as generated by
-.BR genhtml .
-.br
-
-This option corresponds to the \-\-legend option of
-.BR genhtml .
-.br
-
-Default is 0.
-.PP
-
-.BR genhtml_html_prolog " ="
-.I filename
-.IP
-If set, include the contents of the specified file at the beginning of HTML
-output.
-
-This option corresponds to the \-\-html\-prolog option of
-.BR genhtml .
-.br
-
-Default is to use no extra prolog.
-.PP
-
-.BR genhtml_html_epilog " ="
-.I filename
-.IP
-If set, include the contents of the specified file at the end of HTML output.
-
-This option corresponds to the \-\-html\-epilog option of
-.BR genhtml .
-.br
-
-Default is to use no extra epilog.
-.PP
-
-.BR genhtml_html_extension " ="
-.I extension
-.IP
-If set, use the specified string as filename extension for generated HTML files.
-
-This option corresponds to the \-\-html\-extension option of
-.BR genhtml .
-.br
-
-Default extension is "html".
-.PP
-
-.BR genhtml_html_gzip " ="
-.IR 0 | 1
-.IP
-If set, compress all html files using gzip.
-
-This option corresponds to the \-\-html\-gzip option of
-.BR genhtml .
-.br
-
-Default extension is 0.
-.PP
-
-.BR genhtml_sort " ="
-.IR 0 | 1
-.IP
-If non\-zero, create overview pages sorted by coverage rates when generating
-HTML output using
-.BR genhtml .
-.br
-
-This option can be set to 0 by using the \-\-no\-sort option of
-.BR genhtml .
-.br
-
-Default is 1.
-.PP
-
-.BR genhtml_function_coverage " ="
-.IR 0 | 1
-.IP
-If non\-zero, include function coverage data when generating HTML output using
-.BR genhtml .
-.br
-
-This option can be set to 0 by using the \-\-no\-function\-coverage option of
-.BR genhtml .
-.br
-
-Default is 1.
-.PP
-
-.BR genhtml_branch_coverage " ="
-.IR 0 | 1
-.IP
-If non\-zero, include branch coverage data when generating HTML output using
-.BR genhtml .
-.br
-
-This option can be set to 0 by using the \-\-no\-branch\-coverage option of
-.BR genhtml .
-.br
-
-Default is 1.
-.PP
-
-.BR genhtml_charset " ="
-.I charset
-.IP
-Specify the character set of all generated HTML pages.
-.br
-
-Use this option if the source code contains characters which are not
-part of the default character set. Note that this option is ignored
-when a custom HTML prolog is specified (see also
-.BR genhtml_html_prolog ).
-.br
-
-Default is UTF-8.
-.PP
-.BR geninfo_gcov_tool " ="
-.I path_to_gcov
-.IP
-Specify the location of the gcov tool (see
-.BR gcov (1))
-which is used to generate coverage information from data files.
-.br
-
-Default is 'gcov'.
-.PP
-
-.BR geninfo_adjust_testname " ="
-.IR 0 | 1
-.IP
-If non\-zero, adjust test names to include operating system information
-when capturing coverage data.
-.br
-
-Default is 0.
-.PP
-
-.BR geninfo_checksum " ="
-.IR 0 | 1
-.IP
-If non\-zero, generate source code checksums when capturing coverage data.
-Checksums are useful to prevent merging coverage data from incompatible
-source code versions but checksum generation increases the size of coverage
-files and the time used to generate those files.
-.br
-
-This option corresponds to the \-\-checksum and \-\-no\-checksum command line
-option of
-.BR geninfo .
-.br
-
-Default is 0.
-.PP
-
-.BR geninfo_compat_libtool " ="
-.IR 0 | 1
-.IP
-If non\-zero, enable libtool compatibility mode. When libtool compatibility
-mode is enabled, lcov will assume that the source code relating to a .da file
-located in a directory named ".libs" can be found in its parent directory.
-.br
-
-This option corresponds to the \-\-compat\-libtool and \-\-no\-compat\-libtool
-command line option of
-.BR geninfo .
-.br
-
-Default is 1.
-.PP
-
-.BR geninfo_external " ="
-.IR 0 | 1
-.IP
-If non\-zero, capture coverage data for external source files.
-
-External source files are files which are not located in one of the directories
-(including sub-directories)
-specified by the \-\-directory or \-\-base\-directory options of
-.BR lcov / geninfo .
-
-Default is 1.
-.PP
-
-.BR geninfo_gcov_all_blocks " ="
-.IR 0 | 1
-.IP
-If non\-zero, call the gcov tool with option --all-blocks.
-
-Using --all-blocks will produce more detailed branch coverage information for
-each line. Set this option to zero if you do not need detailed branch coverage
-information to speed up the process of capturing code coverage or to work
-around a bug in some versions of gcov which will cause it to endlessly loop
-when analysing some files.
-
-Default is 1.
-.PP
-
-.BR geninfo_compat " ="
-.IR mode = value [, mode = value ,...]
-.IP
-Specify that geninfo should enable one or more compatibility modes
-when capturing coverage data.
-
-This option corresponds to the \-\-compat command line option of
-.BR geninfo .
-
-Default is 'libtool=on, hammer=auto, split_crc=auto'.
-.PP
-
-.BR geninfo_adjust_src_path " ="
-.IR pattern " => " replacement
-.br
-.BR geninfo_adjust_src_path " ="
-.I pattern
-.IP
-Adjust source paths when capturing coverage data.
-
-Use this option in situations where geninfo cannot find the correct
-path to source code files of a project. By providing a
-.I pattern
-in Perl regular expression format (see
-.BR perlre (1))
-and an optional replacement string, you can instruct geninfo to
-remove or change parts of the incorrect source path.
-
-.B Example:
-.br
-
-1. When geninfo reports that it cannot find source file
-.br
-
- /path/to/src/.libs/file.c
-.br
-
-while the file is actually located in
-.br
-
- /path/to/src/file.c
-.br
-
-use the following parameter:
-.br
-
- geninfo_adjust_src_path = /.libs
-
-This will remove all "/.libs" strings from the path.
-
-2. When geninfo reports that it cannot find source file
-.br
-
- /tmp/build/file.c
-.br
-
-while the file is actually located in
-.br
-
- /usr/src/file.c
-.br
-
-use the following parameter:
-.br
-
- geninfo_adjust_src_path = /tmp/build => /usr/src
-.br
-
-This will change all "/tmp/build" strings in the path to "/usr/src".
-.PP
-
-.BR geninfo_auto_base " ="
-.IR 0 | 1
-.IP
-If non\-zero, apply a heuristic to determine the base directory when
-collecting coverage data.
-.br
-
-Use this option when using geninfo on projects built with libtool or
-similar build environments that work with multiple base directories,
-i.e. environments, where the current working directory when invoking the
-compiler ist not the same directory in which the source code file is
-located, and in addition, is different between files of the same project.
-.br
-
-Default is 1.
-.PP
-
-.BR lcov_gcov_dir " ="
-.I path_to_kernel_coverage_data
-.IP
-Specify the path to the directory where kernel coverage data can be found
-or leave undefined for auto-detection.
-.br
-
-Default is auto-detection.
-.PP
-
-.BR lcov_tmp_dir " ="
-.I temp
-.IP
-Specify the location of a directory used for temporary files.
-.br
-
-Default is '/tmp'.
-.PP
-
-.BR lcov_list_full_path " ="
-.IR 0 | 1
-.IP
-If non-zero, print the full path to source code files during a list operation.
-.br
-
-This option corresponds to the \-\-list\-full\-path option of
-.BR lcov .
-.br
-
-Default is 0.
-.PP
-
-.BR lcov_list_max_width " ="
-.IR width
-.IP
-Specify the maximum width for list output. This value is ignored when
-lcov_list_full_path is non\-zero.
-.br
-
-Default is 80.
-.PP
-
-.BR lcov_list_truncate_max
-.B " ="
-.IR percentage
-.IP
-Specify the maximum percentage of file names which may be truncated when
-choosing a directory prefix in list output. This value is ignored when
-lcov_list_full_path is non\-zero.
-.br
-
-Default is 20.
-.PP
-
-.BR lcov_function_coverage " ="
-.IR 0 | 1
-.IP
-Specify whether lcov should handle function coverage data.
-.br
-
-Setting this option to 0 can reduce memory and CPU time consumption
-when lcov is collecting and processing coverage data, as well as
-reduce the size of the resulting data files. Note that setting
-.B genhtml_function_coverage
-will override this option for HTML generation.
-.br
-
-Default is 1.
-.PP
-
-.BR lcov_branch_coverage " ="
-.IR 0 | 1
-.IP
-Specify whether lcov should handle branch coverage data.
-.br
-
-Setting this option to 0 can reduce memory and CPU time consumption
-when lcov is collecting and processing coverage data, as well as
-reduce the size of the resulting data files. Note that setting
-.B genhtml_branch_coverage
-will override this option for HTML generation.
-.br
-
-Default is 0.
-.PP
-
-.SH FILES
-
-.TP
-.I /etc/lcovrc
-The system\-wide
-.B lcov
-configuration file.
-
-.TP
-.I ~/.lcovrc
-The individual per\-user configuration file.
-.PP
-
-.SH SEE ALSO
-.BR lcov (1),
-.BR genhtml (1),
-.BR geninfo (1),
-.BR gcov (1)
diff --git a/chromium/third_party/lcov/rpm/lcov.spec b/chromium/third_party/lcov/rpm/lcov.spec
deleted file mode 100644
index d1daca15057..00000000000
--- a/chromium/third_party/lcov/rpm/lcov.spec
+++ /dev/null
@@ -1,51 +0,0 @@
-Summary: A graphical GCOV front-end
-Name: lcov
-Version: 1.10
-Release: 1
-License: GPL
-Group: Development/Tools
-URL: http://ltp.sourceforge.net/coverage/lcov.php
-Source0: http://downloads.sourceforge.net/ltp/lcov-%{version}.tar.gz
-BuildRoot: /var/tmp/%{name}-%{version}-root
-BuildArch: noarch
-Requires: perl >= 5.8.8
-
-%description
-LCOV is a graphical front-end for GCC's coverage testing tool gcov. It collects
-gcov data for multiple source files and creates HTML pages containing the
-source code annotated with coverage information. It also adds overview pages
-for easy navigation within the file structure.
-
-%prep
-%setup -q -n lcov-%{version}
-
-%build
-exit 0
-
-%install
-rm -rf $RPM_BUILD_ROOT
-make install PREFIX=$RPM_BUILD_ROOT
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%files
-%defattr(-,root,root)
-/usr/bin
-/usr/share
-/etc
-
-%changelog
-* Mon May 07 2012 Peter Oberparleiter (Peter.Oberparleiter@de.ibm.com)
-- added dependency on perl 5.8.8 for >>& open mode support
-* Wed Aug 13 2008 Peter Oberparleiter (Peter.Oberparleiter@de.ibm.com)
-- changed description + summary text
-* Mon Aug 20 2007 Peter Oberparleiter (Peter.Oberparleiter@de.ibm.com)
-- fixed "Copyright" tag
-* Mon Jul 14 2003 Peter Oberparleiter (Peter.Oberparleiter@de.ibm.com)
-- removed variables for version/release to support source rpm building
-- added initial rm command in install section
-* Mon Apr 7 2003 Peter Oberparleiter (Peter.Oberparleiter@de.ibm.com)
-- implemented variables for version/release
-* Fri Oct 8 2002 Peter Oberparleiter (Peter.Oberparleiter@de.ibm.com)
-- created initial spec file
diff --git a/chromium/third_party/logilab/README.chromium b/chromium/third_party/logilab/README.chromium
deleted file mode 100644
index fdee23da3d1..00000000000
--- a/chromium/third_party/logilab/README.chromium
+++ /dev/null
@@ -1,12 +0,0 @@
-URL: http://www.logilab.org/
-Name: logilab
-Version: unknown
-Description:
-This directory contains the logilab-astng and logilab-common modules. See
-the individual README.chromium files for details.
-License: GPL v2
-License File: logilab/common/LICENSE.txt
-Security Critical: No
-
-Local Modifications:
-None
diff --git a/chromium/third_party/logilab/logilab/__init__.py b/chromium/third_party/logilab/logilab/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/chromium/third_party/logilab/logilab/__init__.py
+++ /dev/null
diff --git a/chromium/third_party/logilab/logilab/astroid/LICENSE.txt b/chromium/third_party/logilab/logilab/astroid/LICENSE.txt
deleted file mode 100644
index b7b5f53df14..00000000000
--- a/chromium/third_party/logilab/logilab/astroid/LICENSE.txt
+++ /dev/null
@@ -1,340 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- 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 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 St, Fifth Floor, Boston, MA 02110-1301 USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) year name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
-Public License instead of this License.
diff --git a/chromium/third_party/logilab/logilab/astroid/README.chromium b/chromium/third_party/logilab/logilab/astroid/README.chromium
deleted file mode 100644
index 8f8f9bf79c0..00000000000
--- a/chromium/third_party/logilab/logilab/astroid/README.chromium
+++ /dev/null
@@ -1,12 +0,0 @@
-URL: http://www.logilab.org/project/logilab-astng
-Name: logilab-astng
-Version: 1.3.4
-License: GPL v2
-License File: LICENSE.txt
-Security Critical: No
-
-Description:
-This directory contains the logilab-astng module, required for pylint.
-
-Local Modifications:
-None
diff --git a/chromium/third_party/logilab/logilab/astroid/__init__.py b/chromium/third_party/logilab/logilab/astroid/__init__.py
deleted file mode 100644
index d4fd12c577a..00000000000
--- a/chromium/third_party/logilab/logilab/astroid/__init__.py
+++ /dev/null
@@ -1,131 +0,0 @@
-# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of astroid.
-#
-# astroid is free software: you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as published by the
-# Free Software Foundation, either version 2.1 of the License, or (at your
-# option) any later version.
-#
-# astroid 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 Lesser General Public License
-# for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with astroid. If not, see <http://www.gnu.org/licenses/>.
-"""Python Abstract Syntax Tree New Generation
-
-The aim of this module is to provide a common base representation of
-python source code for projects such as pychecker, pyreverse,
-pylint... Well, actually the development of this library is essentially
-governed by pylint's needs.
-
-It extends class defined in the python's _ast module with some
-additional methods and attributes. Instance attributes are added by a
-builder object, which can either generate extended ast (let's call
-them astroid ;) by visiting an existent ast tree or by inspecting living
-object. Methods are added by monkey patching ast classes.
-
-Main modules are:
-
-* nodes and scoped_nodes for more information about methods and
- attributes added to different node classes
-
-* the manager contains a high level object to get astroid trees from
- source files and living objects. It maintains a cache of previously
- constructed tree for quick access
-
-* builder contains the class responsible to build astroid trees
-"""
-__doctype__ = "restructuredtext en"
-
-import sys
-import re
-from operator import attrgetter
-
-# WARNING: internal imports order matters !
-
-# make all exception classes accessible from astroid package
-from astroid.exceptions import *
-
-# make all node classes accessible from astroid package
-from astroid.nodes import *
-
-# trigger extra monkey-patching
-from astroid import inference
-
-# more stuff available
-from astroid import raw_building
-from astroid.bases import YES, Instance, BoundMethod, UnboundMethod
-from astroid.node_classes import are_exclusive, unpack_infer
-from astroid.scoped_nodes import builtin_lookup
-
-# make a manager instance (borg) as well as Project and Package classes
-# accessible from astroid package
-from astroid.manager import AstroidManager, Project
-MANAGER = AstroidManager()
-del AstroidManager
-
-# transform utilities (filters and decorator)
-
-class AsStringRegexpPredicate(object):
- """Class to be used as predicate that may be given to `register_transform`
-
- First argument is a regular expression that will be searched against the `as_string`
- representation of the node onto which it's applied.
-
- If specified, the second argument is an `attrgetter` expression that will be
- applied on the node first to get the actual node on which `as_string` should
- be called.
-
- WARNING: This can be fairly slow, as it has to convert every AST node back
- to Python code; you should consider examining the AST directly instead.
- """
- def __init__(self, regexp, expression=None):
- self.regexp = re.compile(regexp)
- self.expression = expression
-
- def __call__(self, node):
- if self.expression is not None:
- node = attrgetter(self.expression)(node)
- return self.regexp.search(node.as_string())
-
-def inference_tip(infer_function):
- """Given an instance specific inference function, return a function to be
- given to MANAGER.register_transform to set this inference function.
-
- Typical usage
-
- .. sourcecode:: python
-
- MANAGER.register_transform(CallFunc, inference_tip(infer_named_tuple),
- predicate)
- """
- def transform(node, infer_function=infer_function):
- node._explicit_inference = infer_function
- return node
- return transform
-
-
-def register_module_extender(manager, module_name, get_extension_mod):
- def transform(node):
- extension_module = get_extension_mod()
- for name, obj in extension_module.locals.items():
- node.locals[name] = obj
-
- manager.register_transform(Module, transform, lambda n: n.name == module_name)
-
-
-# load brain plugins
-from os import listdir
-from os.path import join, dirname
-BRAIN_MODULES_DIR = join(dirname(__file__), 'brain')
-if BRAIN_MODULES_DIR not in sys.path:
- # add it to the end of the list so user path take precedence
- sys.path.append(BRAIN_MODULES_DIR)
-# load modules in this directory
-for module in listdir(BRAIN_MODULES_DIR):
- if module.endswith('.py'):
- __import__(module[:-3])
diff --git a/chromium/third_party/logilab/logilab/astroid/__pkginfo__.py b/chromium/third_party/logilab/logilab/astroid/__pkginfo__.py
deleted file mode 100644
index 0c924149602..00000000000
--- a/chromium/third_party/logilab/logilab/astroid/__pkginfo__.py
+++ /dev/null
@@ -1,42 +0,0 @@
-# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of astroid.
-#
-# astroid is free software: you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as published by the
-# Free Software Foundation, either version 2.1 of the License, or (at your
-# option) any later version.
-#
-# astroid 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 Lesser General Public License
-# for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with astroid. If not, see <http://www.gnu.org/licenses/>.
-"""astroid packaging information"""
-distname = 'astroid'
-
-modname = 'astroid'
-
-numversion = (1, 3, 4)
-version = '.'.join([str(num) for num in numversion])
-
-install_requires = ['logilab-common >= 0.60.0', 'six']
-
-license = 'LGPL'
-
-author = 'Logilab'
-author_email = 'pylint-dev@lists.logilab.org'
-mailinglist = "mailto://%s" % author_email
-web = 'http://bitbucket.org/logilab/astroid'
-
-description = "A abstract syntax tree for Python with inference support."
-
-classifiers = ["Topic :: Software Development :: Libraries :: Python Modules",
- "Topic :: Software Development :: Quality Assurance",
- "Programming Language :: Python",
- "Programming Language :: Python :: 2",
- "Programming Language :: Python :: 3",
- ]
diff --git a/chromium/third_party/logilab/logilab/astroid/as_string.py b/chromium/third_party/logilab/logilab/astroid/as_string.py
deleted file mode 100644
index f627f9e8832..00000000000
--- a/chromium/third_party/logilab/logilab/astroid/as_string.py
+++ /dev/null
@@ -1,499 +0,0 @@
-# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of astroid.
-#
-# astroid is free software: you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as published by the
-# Free Software Foundation, either version 2.1 of the License, or (at your
-# option) any later version.
-#
-# astroid 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 Lesser General Public License
-# for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with astroid. If not, see <http://www.gnu.org/licenses/>.
-"""This module renders Astroid nodes as string:
-
-* :func:`to_code` function return equivalent (hopefuly valid) python string
-
-* :func:`dump` function return an internal representation of nodes found
- in the tree, useful for debugging or understanding the tree structure
-"""
-
-import sys
-
-INDENT = ' ' # 4 spaces ; keep indentation variable
-
-
-def dump(node, ids=False):
- """print a nice astroid tree representation.
-
- :param ids: if true, we also print the ids (usefull for debugging)
- """
- result = []
- _repr_tree(node, result, ids=ids)
- return "\n".join(result)
-
-def _repr_tree(node, result, indent='', _done=None, ids=False):
- """built a tree representation of a node as a list of lines"""
- if _done is None:
- _done = set()
- if not hasattr(node, '_astroid_fields'): # not a astroid node
- return
- if node in _done:
- result.append(indent + 'loop in tree: %s' % node)
- return
- _done.add(node)
- node_str = str(node)
- if ids:
- node_str += ' . \t%x' % id(node)
- result.append(indent + node_str)
- indent += INDENT
- for field in node._astroid_fields:
- value = getattr(node, field)
- if isinstance(value, (list, tuple)):
- result.append(indent + field + " = [")
- for child in value:
- if isinstance(child, (list, tuple)):
- # special case for Dict # FIXME
- _repr_tree(child[0], result, indent, _done, ids)
- _repr_tree(child[1], result, indent, _done, ids)
- result.append(indent + ',')
- else:
- _repr_tree(child, result, indent, _done, ids)
- result.append(indent + "]")
- else:
- result.append(indent + field + " = ")
- _repr_tree(value, result, indent, _done, ids)
-
-
-class AsStringVisitor(object):
- """Visitor to render an Astroid node as a valid python code string"""
-
- def __call__(self, node):
- """Makes this visitor behave as a simple function"""
- return node.accept(self)
-
- def _stmt_list(self, stmts):
- """return a list of nodes to string"""
- stmts = '\n'.join([nstr for nstr in [n.accept(self) for n in stmts] if nstr])
- return INDENT + stmts.replace('\n', '\n'+INDENT)
-
-
- ## visit_<node> methods ###########################################
-
- def visit_arguments(self, node):
- """return an astroid.Function node as string"""
- return node.format_args()
-
- def visit_assattr(self, node):
- """return an astroid.AssAttr node as string"""
- return self.visit_getattr(node)
-
- def visit_assert(self, node):
- """return an astroid.Assert node as string"""
- if node.fail:
- return 'assert %s, %s' % (node.test.accept(self),
- node.fail.accept(self))
- return 'assert %s' % node.test.accept(self)
-
- def visit_assname(self, node):
- """return an astroid.AssName node as string"""
- return node.name
-
- def visit_assign(self, node):
- """return an astroid.Assign node as string"""
- lhs = ' = '.join([n.accept(self) for n in node.targets])
- return '%s = %s' % (lhs, node.value.accept(self))
-
- def visit_augassign(self, node):
- """return an astroid.AugAssign node as string"""
- return '%s %s %s' % (node.target.accept(self), node.op, node.value.accept(self))
-
- def visit_backquote(self, node):
- """return an astroid.Backquote node as string"""
- return '`%s`' % node.value.accept(self)
-
- def visit_binop(self, node):
- """return an astroid.BinOp node as string"""
- return '(%s) %s (%s)' % (node.left.accept(self), node.op, node.right.accept(self))
-
- def visit_boolop(self, node):
- """return an astroid.BoolOp node as string"""
- return (' %s ' % node.op).join(['(%s)' % n.accept(self)
- for n in node.values])
-
- def visit_break(self, node):
- """return an astroid.Break node as string"""
- return 'break'
-
- def visit_callfunc(self, node):
- """return an astroid.CallFunc node as string"""
- expr_str = node.func.accept(self)
- args = [arg.accept(self) for arg in node.args]
- if node.starargs:
- args.append('*' + node.starargs.accept(self))
- if node.kwargs:
- args.append('**' + node.kwargs.accept(self))
- return '%s(%s)' % (expr_str, ', '.join(args))
-
- def visit_class(self, node):
- """return an astroid.Class node as string"""
- decorate = node.decorators and node.decorators.accept(self) or ''
- bases = ', '.join([n.accept(self) for n in node.bases])
- if sys.version_info[0] == 2:
- bases = bases and '(%s)' % bases or ''
- else:
- metaclass = node.metaclass()
- if metaclass and not node.has_metaclass_hack():
- if bases:
- bases = '(%s, metaclass=%s)' % (bases, metaclass.name)
- else:
- bases = '(metaclass=%s)' % metaclass.name
- else:
- bases = bases and '(%s)' % bases or ''
- docs = node.doc and '\n%s"""%s"""' % (INDENT, node.doc) or ''
- return '\n\n%sclass %s%s:%s\n%s\n' % (decorate, node.name, bases, docs,
- self._stmt_list(node.body))
-
- def visit_compare(self, node):
- """return an astroid.Compare node as string"""
- rhs_str = ' '.join(['%s %s' % (op, expr.accept(self))
- for op, expr in node.ops])
- return '%s %s' % (node.left.accept(self), rhs_str)
-
- def visit_comprehension(self, node):
- """return an astroid.Comprehension node as string"""
- ifs = ''.join([' if %s' % n.accept(self) for n in node.ifs])
- return 'for %s in %s%s' % (node.target.accept(self),
- node.iter.accept(self), ifs)
-
- def visit_const(self, node):
- """return an astroid.Const node as string"""
- return repr(node.value)
-
- def visit_continue(self, node):
- """return an astroid.Continue node as string"""
- return 'continue'
-
- def visit_delete(self, node): # XXX check if correct
- """return an astroid.Delete node as string"""
- return 'del %s' % ', '.join([child.accept(self)
- for child in node.targets])
-
- def visit_delattr(self, node):
- """return an astroid.DelAttr node as string"""
- return self.visit_getattr(node)
-
- def visit_delname(self, node):
- """return an astroid.DelName node as string"""
- return node.name
-
- def visit_decorators(self, node):
- """return an astroid.Decorators node as string"""
- return '@%s\n' % '\n@'.join([item.accept(self) for item in node.nodes])
-
- def visit_dict(self, node):
- """return an astroid.Dict node as string"""
- return '{%s}' % ', '.join(['%s: %s' % (key.accept(self),
- value.accept(self))
- for key, value in node.items])
-
- def visit_dictcomp(self, node):
- """return an astroid.DictComp node as string"""
- return '{%s: %s %s}' % (node.key.accept(self), node.value.accept(self),
- ' '.join([n.accept(self) for n in node.generators]))
-
- def visit_discard(self, node):
- """return an astroid.Discard node as string"""
- return node.value.accept(self)
-
- def visit_emptynode(self, node):
- """dummy method for visiting an Empty node"""
- return ''
-
- def visit_excepthandler(self, node):
- if node.type:
- if node.name:
- excs = 'except %s, %s' % (node.type.accept(self),
- node.name.accept(self))
- else:
- excs = 'except %s' % node.type.accept(self)
- else:
- excs = 'except'
- return '%s:\n%s' % (excs, self._stmt_list(node.body))
-
- def visit_ellipsis(self, node):
- """return an astroid.Ellipsis node as string"""
- return '...'
-
- def visit_empty(self, node):
- """return an Empty node as string"""
- return ''
-
- def visit_exec(self, node):
- """return an astroid.Exec node as string"""
- if node.locals:
- return 'exec %s in %s, %s' % (node.expr.accept(self),
- node.locals.accept(self),
- node.globals.accept(self))
- if node.globals:
- return 'exec %s in %s' % (node.expr.accept(self),
- node.globals.accept(self))
- return 'exec %s' % node.expr.accept(self)
-
- def visit_extslice(self, node):
- """return an astroid.ExtSlice node as string"""
- return ','.join([dim.accept(self) for dim in node.dims])
-
- def visit_for(self, node):
- """return an astroid.For node as string"""
- fors = 'for %s in %s:\n%s' % (node.target.accept(self),
- node.iter.accept(self),
- self._stmt_list(node.body))
- if node.orelse:
- fors = '%s\nelse:\n%s' % (fors, self._stmt_list(node.orelse))
- return fors
-
- def visit_from(self, node):
- """return an astroid.From node as string"""
- return 'from %s import %s' % ('.' * (node.level or 0) + node.modname,
- _import_string(node.names))
-
- def visit_function(self, node):
- """return an astroid.Function node as string"""
- decorate = node.decorators and node.decorators.accept(self) or ''
- docs = node.doc and '\n%s"""%s"""' % (INDENT, node.doc) or ''
- return '\n%sdef %s(%s):%s\n%s' % (decorate, node.name, node.args.accept(self),
- docs, self._stmt_list(node.body))
-
- def visit_genexpr(self, node):
- """return an astroid.GenExpr node as string"""
- return '(%s %s)' % (node.elt.accept(self),
- ' '.join([n.accept(self) for n in node.generators]))
-
- def visit_getattr(self, node):
- """return an astroid.Getattr node as string"""
- return '%s.%s' % (node.expr.accept(self), node.attrname)
-
- def visit_global(self, node):
- """return an astroid.Global node as string"""
- return 'global %s' % ', '.join(node.names)
-
- def visit_if(self, node):
- """return an astroid.If node as string"""
- ifs = ['if %s:\n%s' % (node.test.accept(self), self._stmt_list(node.body))]
- if node.orelse:# XXX use elif ???
- ifs.append('else:\n%s' % self._stmt_list(node.orelse))
- return '\n'.join(ifs)
-
- def visit_ifexp(self, node):
- """return an astroid.IfExp node as string"""
- return '%s if %s else %s' % (node.body.accept(self),
- node.test.accept(self),
- node.orelse.accept(self))
-
- def visit_import(self, node):
- """return an astroid.Import node as string"""
- return 'import %s' % _import_string(node.names)
-
- def visit_keyword(self, node):
- """return an astroid.Keyword node as string"""
- return '%s=%s' % (node.arg, node.value.accept(self))
-
- def visit_lambda(self, node):
- """return an astroid.Lambda node as string"""
- return 'lambda %s: %s' % (node.args.accept(self),
- node.body.accept(self))
-
- def visit_list(self, node):
- """return an astroid.List node as string"""
- return '[%s]' % ', '.join([child.accept(self) for child in node.elts])
-
- def visit_listcomp(self, node):
- """return an astroid.ListComp node as string"""
- return '[%s %s]' % (node.elt.accept(self),
- ' '.join([n.accept(self) for n in node.generators]))
-
- def visit_module(self, node):
- """return an astroid.Module node as string"""
- docs = node.doc and '"""%s"""\n\n' % node.doc or ''
- return docs + '\n'.join([n.accept(self) for n in node.body]) + '\n\n'
-
- def visit_name(self, node):
- """return an astroid.Name node as string"""
- return node.name
-
- def visit_pass(self, node):
- """return an astroid.Pass node as string"""
- return 'pass'
-
- def visit_print(self, node):
- """return an astroid.Print node as string"""
- nodes = ', '.join([n.accept(self) for n in node.values])
- if not node.nl:
- nodes = '%s,' % nodes
- if node.dest:
- return 'print >> %s, %s' % (node.dest.accept(self), nodes)
- return 'print %s' % nodes
-
- def visit_raise(self, node):
- """return an astroid.Raise node as string"""
- if node.exc:
- if node.inst:
- if node.tback:
- return 'raise %s, %s, %s' % (node.exc.accept(self),
- node.inst.accept(self),
- node.tback.accept(self))
- return 'raise %s, %s' % (node.exc.accept(self),
- node.inst.accept(self))
- return 'raise %s' % node.exc.accept(self)
- return 'raise'
-
- def visit_return(self, node):
- """return an astroid.Return node as string"""
- if node.value:
- return 'return %s' % node.value.accept(self)
- else:
- return 'return'
-
- def visit_index(self, node):
- """return a astroid.Index node as string"""
- return node.value.accept(self)
-
- def visit_set(self, node):
- """return an astroid.Set node as string"""
- return '{%s}' % ', '.join([child.accept(self) for child in node.elts])
-
- def visit_setcomp(self, node):
- """return an astroid.SetComp node as string"""
- return '{%s %s}' % (node.elt.accept(self),
- ' '.join([n.accept(self) for n in node.generators]))
-
- def visit_slice(self, node):
- """return a astroid.Slice node as string"""
- lower = node.lower and node.lower.accept(self) or ''
- upper = node.upper and node.upper.accept(self) or ''
- step = node.step and node.step.accept(self) or ''
- if step:
- return '%s:%s:%s' % (lower, upper, step)
- return '%s:%s' % (lower, upper)
-
- def visit_subscript(self, node):
- """return an astroid.Subscript node as string"""
- return '%s[%s]' % (node.value.accept(self), node.slice.accept(self))
-
- def visit_tryexcept(self, node):
- """return an astroid.TryExcept node as string"""
- trys = ['try:\n%s' % self._stmt_list(node.body)]
- for handler in node.handlers:
- trys.append(handler.accept(self))
- if node.orelse:
- trys.append('else:\n%s' % self._stmt_list(node.orelse))
- return '\n'.join(trys)
-
- def visit_tryfinally(self, node):
- """return an astroid.TryFinally node as string"""
- return 'try:\n%s\nfinally:\n%s' % (self._stmt_list(node.body),
- self._stmt_list(node.finalbody))
-
- def visit_tuple(self, node):
- """return an astroid.Tuple node as string"""
- if len(node.elts) == 1:
- return '(%s, )' % node.elts[0].accept(self)
- return '(%s)' % ', '.join([child.accept(self) for child in node.elts])
-
- def visit_unaryop(self, node):
- """return an astroid.UnaryOp node as string"""
- if node.op == 'not':
- operator = 'not '
- else:
- operator = node.op
- return '%s%s' % (operator, node.operand.accept(self))
-
- def visit_while(self, node):
- """return an astroid.While node as string"""
- whiles = 'while %s:\n%s' % (node.test.accept(self),
- self._stmt_list(node.body))
- if node.orelse:
- whiles = '%s\nelse:\n%s' % (whiles, self._stmt_list(node.orelse))
- return whiles
-
- def visit_with(self, node): # 'with' without 'as' is possible
- """return an astroid.With node as string"""
- items = ', '.join(('(%s)' % expr.accept(self)) +
- (vars and ' as (%s)' % (vars.accept(self)) or '')
- for expr, vars in node.items)
- return 'with %s:\n%s' % (items, self._stmt_list(node.body))
-
- def visit_yield(self, node):
- """yield an ast.Yield node as string"""
- yi_val = node.value and (" " + node.value.accept(self)) or ""
- expr = 'yield' + yi_val
- if node.parent.is_statement:
- return expr
- else:
- return "(%s)" % (expr,)
-
-
-class AsStringVisitor3k(AsStringVisitor):
- """AsStringVisitor3k overwrites some AsStringVisitor methods"""
-
- def visit_excepthandler(self, node):
- if node.type:
- if node.name:
- excs = 'except %s as %s' % (node.type.accept(self),
- node.name.accept(self))
- else:
- excs = 'except %s' % node.type.accept(self)
- else:
- excs = 'except'
- return '%s:\n%s' % (excs, self._stmt_list(node.body))
-
- def visit_nonlocal(self, node):
- """return an astroid.Nonlocal node as string"""
- return 'nonlocal %s' % ', '.join(node.names)
-
- def visit_raise(self, node):
- """return an astroid.Raise node as string"""
- if node.exc:
- if node.cause:
- return 'raise %s from %s' % (node.exc.accept(self),
- node.cause.accept(self))
- return 'raise %s' % node.exc.accept(self)
- return 'raise'
-
- def visit_starred(self, node):
- """return Starred node as string"""
- return "*" + node.value.accept(self)
-
- def visit_yieldfrom(self, node):
- """ Return an astroid.YieldFrom node as string. """
- yi_val = node.value and (" " + node.value.accept(self)) or ""
- expr = 'yield from' + yi_val
- if node.parent.is_statement:
- return expr
- else:
- return "(%s)" % (expr,)
-
-
-def _import_string(names):
- """return a list of (name, asname) formatted as a string"""
- _names = []
- for name, asname in names:
- if asname is not None:
- _names.append('%s as %s' % (name, asname))
- else:
- _names.append(name)
- return ', '.join(_names)
-
-
-if sys.version_info >= (3, 0):
- AsStringVisitor = AsStringVisitor3k
-
-# this visitor is stateless, thus it can be reused
-to_code = AsStringVisitor()
-
diff --git a/chromium/third_party/logilab/logilab/astroid/bases.py b/chromium/third_party/logilab/logilab/astroid/bases.py
deleted file mode 100644
index f1f4cc4b0b3..00000000000
--- a/chromium/third_party/logilab/logilab/astroid/bases.py
+++ /dev/null
@@ -1,665 +0,0 @@
-# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of astroid.
-#
-# astroid is free software: you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as published by the
-# Free Software Foundation, either version 2.1 of the License, or (at your
-# option) any later version.
-#
-# astroid 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 Lesser General Public License
-# for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with astroid. If not, see <http://www.gnu.org/licenses/>.
-"""This module contains base classes and functions for the nodes and some
-inference utils.
-"""
-
-__docformat__ = "restructuredtext en"
-
-import sys
-from contextlib import contextmanager
-
-from logilab.common.decorators import cachedproperty
-
-from astroid.exceptions import (InferenceError, AstroidError, NotFoundError,
- UnresolvableName, UseInferenceDefault)
-
-
-if sys.version_info >= (3, 0):
- BUILTINS = 'builtins'
-else:
- BUILTINS = '__builtin__'
-
-
-class Proxy(object):
- """a simple proxy object"""
-
- _proxied = None # proxied object may be set by class or by instance
-
- def __init__(self, proxied=None):
- if proxied is not None:
- self._proxied = proxied
-
- def __getattr__(self, name):
- if name == '_proxied':
- return getattr(self.__class__, '_proxied')
- if name in self.__dict__:
- return self.__dict__[name]
- return getattr(self._proxied, name)
-
- def infer(self, context=None):
- yield self
-
-
-# Inference ##################################################################
-
-MISSING = object()
-
-
-class InferenceContext(object):
- __slots__ = ('path', 'callcontext', 'boundnode', 'infered')
-
- def __init__(self,
- path=None, callcontext=None, boundnode=None, infered=None):
- if path is None:
- self.path = frozenset()
- else:
- self.path = path
- self.callcontext = callcontext
- self.boundnode = boundnode
- if infered is None:
- self.infered = {}
- else:
- self.infered = infered
-
- def push(self, key):
- # This returns a NEW context with the same attributes, but a new key
- # added to `path`. The intention is that it's only passed to callees
- # and then destroyed; otherwise scope() may not work correctly.
- # The cache will be shared, since it's the same exact dict.
- if key in self.path:
- # End the containing generator
- raise StopIteration
-
- return InferenceContext(
- self.path.union([key]),
- self.callcontext,
- self.boundnode,
- self.infered,
- )
-
- @contextmanager
- def scope(self, callcontext=MISSING, boundnode=MISSING):
- try:
- orig = self.callcontext, self.boundnode
- if callcontext is not MISSING:
- self.callcontext = callcontext
- if boundnode is not MISSING:
- self.boundnode = boundnode
- yield
- finally:
- self.callcontext, self.boundnode = orig
-
- def cache_generator(self, key, generator):
- results = []
- for result in generator:
- results.append(result)
- yield result
-
- self.infered[key] = tuple(results)
- return
-
-
-def _infer_stmts(stmts, context, frame=None, lookupname=None):
- """return an iterator on statements inferred by each statement in <stmts>
- """
- stmt = None
- infered = False
- if context is None:
- context = InferenceContext()
- for stmt in stmts:
- if stmt is YES:
- yield stmt
- infered = True
- continue
-
- kw = {}
- infered_name = stmt._infer_name(frame, lookupname)
- if infered_name is not None:
- # only returns not None if .infer() accepts a lookupname kwarg
- kw['lookupname'] = infered_name
-
- try:
- for infered in stmt.infer(context, **kw):
- yield infered
- infered = True
- except UnresolvableName:
- continue
- except InferenceError:
- yield YES
- infered = True
- if not infered:
- raise InferenceError(str(stmt))
-
-
-# special inference objects (e.g. may be returned as nodes by .infer()) #######
-
-class _Yes(object):
- """a yes object"""
- def __repr__(self):
- return 'YES'
- def __getattribute__(self, name):
- if name == 'next':
- raise AttributeError('next method should not be called')
- if name.startswith('__') and name.endswith('__'):
- # to avoid inspection pb
- return super(_Yes, self).__getattribute__(name)
- return self
- def __call__(self, *args, **kwargs):
- return self
-
-
-YES = _Yes()
-
-
-class Instance(Proxy):
- """a special node representing a class instance"""
- def getattr(self, name, context=None, lookupclass=True):
- try:
- values = self._proxied.instance_attr(name, context)
- except NotFoundError:
- if name == '__class__':
- return [self._proxied]
- if lookupclass:
- # class attributes not available through the instance
- # unless they are explicitly defined
- if name in ('__name__', '__bases__', '__mro__', '__subclasses__'):
- return self._proxied.local_attr(name)
- return self._proxied.getattr(name, context)
- raise NotFoundError(name)
- # since we've no context information, return matching class members as
- # well
- if lookupclass:
- try:
- return values + self._proxied.getattr(name, context)
- except NotFoundError:
- pass
- return values
-
- def igetattr(self, name, context=None):
- """inferred getattr"""
- if not context:
- context = InferenceContext()
- try:
- # avoid recursively inferring the same attr on the same class
- new_context = context.push((self._proxied, name))
- # XXX frame should be self._proxied, or not ?
- get_attr = self.getattr(name, new_context, lookupclass=False)
- return _infer_stmts(
- self._wrap_attr(get_attr, new_context),
- new_context,
- frame=self,
- )
- except NotFoundError:
- try:
- # fallback to class'igetattr since it has some logic to handle
- # descriptors
- return self._wrap_attr(self._proxied.igetattr(name, context),
- context)
- except NotFoundError:
- raise InferenceError(name)
-
- def _wrap_attr(self, attrs, context=None):
- """wrap bound methods of attrs in a InstanceMethod proxies"""
- for attr in attrs:
- if isinstance(attr, UnboundMethod):
- if BUILTINS + '.property' in attr.decoratornames():
- for infered in attr.infer_call_result(self, context):
- yield infered
- else:
- yield BoundMethod(attr, self)
- else:
- yield attr
-
- def infer_call_result(self, caller, context=None):
- """infer what a class instance is returning when called"""
- infered = False
- for node in self._proxied.igetattr('__call__', context):
- if node is YES:
- continue
- for res in node.infer_call_result(caller, context):
- infered = True
- yield res
- if not infered:
- raise InferenceError()
-
- def __repr__(self):
- return '<Instance of %s.%s at 0x%s>' % (self._proxied.root().name,
- self._proxied.name,
- id(self))
- def __str__(self):
- return 'Instance of %s.%s' % (self._proxied.root().name,
- self._proxied.name)
-
- def callable(self):
- try:
- self._proxied.getattr('__call__')
- return True
- except NotFoundError:
- return False
-
- def pytype(self):
- return self._proxied.qname()
-
- def display_type(self):
- return 'Instance of'
-
-
-class UnboundMethod(Proxy):
- """a special node representing a method not bound to an instance"""
- def __repr__(self):
- frame = self._proxied.parent.frame()
- return '<%s %s of %s at 0x%s' % (self.__class__.__name__,
- self._proxied.name,
- frame.qname(), id(self))
-
- def is_bound(self):
- return False
-
- def getattr(self, name, context=None):
- if name == 'im_func':
- return [self._proxied]
- return super(UnboundMethod, self).getattr(name, context)
-
- def igetattr(self, name, context=None):
- if name == 'im_func':
- return iter((self._proxied,))
- return super(UnboundMethod, self).igetattr(name, context)
-
- def infer_call_result(self, caller, context):
- # If we're unbound method __new__ of builtin object, the result is an
- # instance of the class given as first argument.
- if (self._proxied.name == '__new__' and
- self._proxied.parent.frame().qname() == '%s.object' % BUILTINS):
- infer = caller.args[0].infer() if caller.args else []
- return ((x is YES and x or Instance(x)) for x in infer)
- return self._proxied.infer_call_result(caller, context)
-
-
-class BoundMethod(UnboundMethod):
- """a special node representing a method bound to an instance"""
- def __init__(self, proxy, bound):
- UnboundMethod.__init__(self, proxy)
- self.bound = bound
-
- def is_bound(self):
- return True
-
- def infer_call_result(self, caller, context):
- with context.scope(boundnode=self.bound):
- for infered in self._proxied.infer_call_result(caller, context):
- yield infered
-
-
-class Generator(Instance):
- """a special node representing a generator.
-
- Proxied class is set once for all in raw_building.
- """
- def callable(self):
- return False
-
- def pytype(self):
- return '%s.generator' % BUILTINS
-
- def display_type(self):
- return 'Generator'
-
- def __repr__(self):
- return '<Generator(%s) l.%s at 0x%s>' % (self._proxied.name, self.lineno, id(self))
-
- def __str__(self):
- return 'Generator(%s)' % (self._proxied.name)
-
-
-# decorators ##################################################################
-
-def path_wrapper(func):
- """return the given infer function wrapped to handle the path"""
- def wrapped(node, context=None, _func=func, **kwargs):
- """wrapper function handling context"""
- if context is None:
- context = InferenceContext()
- context = context.push((node, kwargs.get('lookupname')))
-
- yielded = set()
- for res in _func(node, context, **kwargs):
- # unproxy only true instance, not const, tuple, dict...
- if res.__class__ is Instance:
- ares = res._proxied
- else:
- ares = res
- if not ares in yielded:
- yield res
- yielded.add(ares)
- return wrapped
-
-def yes_if_nothing_infered(func):
- def wrapper(*args, **kwargs):
- infered = False
- for node in func(*args, **kwargs):
- infered = True
- yield node
- if not infered:
- yield YES
- return wrapper
-
-def raise_if_nothing_infered(func):
- def wrapper(*args, **kwargs):
- infered = False
- for node in func(*args, **kwargs):
- infered = True
- yield node
- if not infered:
- raise InferenceError()
- return wrapper
-
-
-# Node ######################################################################
-
-class NodeNG(object):
- """Base Class for all Astroid node classes.
-
- It represents a node of the new abstract syntax tree.
- """
- is_statement = False
- optional_assign = False # True for For (and for Comprehension if py <3.0)
- is_function = False # True for Function nodes
- # attributes below are set by the builder module or by raw factories
- lineno = None
- fromlineno = None
- tolineno = None
- col_offset = None
- # parent node in the tree
- parent = None
- # attributes containing child node(s) redefined in most concrete classes:
- _astroid_fields = ()
- # instance specific inference function infer(node, context)
- _explicit_inference = None
-
- def infer(self, context=None, **kwargs):
- """main interface to the interface system, return a generator on infered
- values.
-
- If the instance has some explicit inference function set, it will be
- called instead of the default interface.
- """
- if self._explicit_inference is not None:
- # explicit_inference is not bound, give it self explicitly
- try:
- return self._explicit_inference(self, context, **kwargs)
- except UseInferenceDefault:
- pass
-
- if not context:
- return self._infer(context, **kwargs)
-
- key = (self, kwargs.get('lookupname'), context.callcontext, context.boundnode)
- if key in context.infered:
- return iter(context.infered[key])
-
- return context.cache_generator(key, self._infer(context, **kwargs))
-
- def _repr_name(self):
- """return self.name or self.attrname or '' for nice representation"""
- return getattr(self, 'name', getattr(self, 'attrname', ''))
-
- def __str__(self):
- return '%s(%s)' % (self.__class__.__name__, self._repr_name())
-
- def __repr__(self):
- return '<%s(%s) l.%s [%s] at 0x%x>' % (self.__class__.__name__,
- self._repr_name(),
- self.fromlineno,
- self.root().name,
- id(self))
-
-
- def accept(self, visitor):
- func = getattr(visitor, "visit_" + self.__class__.__name__.lower())
- return func(self)
-
- def get_children(self):
- for field in self._astroid_fields:
- attr = getattr(self, field)
- if attr is None:
- continue
- if isinstance(attr, (list, tuple)):
- for elt in attr:
- yield elt
- else:
- yield attr
-
- def last_child(self):
- """an optimized version of list(get_children())[-1]"""
- for field in self._astroid_fields[::-1]:
- attr = getattr(self, field)
- if not attr: # None or empty listy / tuple
- continue
- if attr.__class__ in (list, tuple):
- return attr[-1]
- else:
- return attr
- return None
-
- def parent_of(self, node):
- """return true if i'm a parent of the given node"""
- parent = node.parent
- while parent is not None:
- if self is parent:
- return True
- parent = parent.parent
- return False
-
- def statement(self):
- """return the first parent node marked as statement node"""
- if self.is_statement:
- return self
- return self.parent.statement()
-
- def frame(self):
- """return the first parent frame node (i.e. Module, Function or Class)
- """
- return self.parent.frame()
-
- def scope(self):
- """return the first node defining a new scope (i.e. Module, Function,
- Class, Lambda but also GenExpr)
- """
- return self.parent.scope()
-
- def root(self):
- """return the root node of the tree, (i.e. a Module)"""
- if self.parent:
- return self.parent.root()
- return self
-
- def child_sequence(self, child):
- """search for the right sequence where the child lies in"""
- for field in self._astroid_fields:
- node_or_sequence = getattr(self, field)
- if node_or_sequence is child:
- return [node_or_sequence]
- # /!\ compiler.ast Nodes have an __iter__ walking over child nodes
- if isinstance(node_or_sequence, (tuple, list)) and child in node_or_sequence:
- return node_or_sequence
- else:
- msg = 'Could not find %s in %s\'s children'
- raise AstroidError(msg % (repr(child), repr(self)))
-
- def locate_child(self, child):
- """return a 2-uple (child attribute name, sequence or node)"""
- for field in self._astroid_fields:
- node_or_sequence = getattr(self, field)
- # /!\ compiler.ast Nodes have an __iter__ walking over child nodes
- if child is node_or_sequence:
- return field, child
- if isinstance(node_or_sequence, (tuple, list)) and child in node_or_sequence:
- return field, node_or_sequence
- msg = 'Could not find %s in %s\'s children'
- raise AstroidError(msg % (repr(child), repr(self)))
- # FIXME : should we merge child_sequence and locate_child ? locate_child
- # is only used in are_exclusive, child_sequence one time in pylint.
-
- def next_sibling(self):
- """return the next sibling statement"""
- return self.parent.next_sibling()
-
- def previous_sibling(self):
- """return the previous sibling statement"""
- return self.parent.previous_sibling()
-
- def nearest(self, nodes):
- """return the node which is the nearest before this one in the
- given list of nodes
- """
- myroot = self.root()
- mylineno = self.fromlineno
- nearest = None, 0
- for node in nodes:
- assert node.root() is myroot, \
- 'nodes %s and %s are not from the same module' % (self, node)
- lineno = node.fromlineno
- if node.fromlineno > mylineno:
- break
- if lineno > nearest[1]:
- nearest = node, lineno
- # FIXME: raise an exception if nearest is None ?
- return nearest[0]
-
- # these are lazy because they're relatively expensive to compute for every
- # single node, and they rarely get looked at
-
- @cachedproperty
- def fromlineno(self):
- if self.lineno is None:
- return self._fixed_source_line()
- else:
- return self.lineno
-
- @cachedproperty
- def tolineno(self):
- if not self._astroid_fields:
- # can't have children
- lastchild = None
- else:
- lastchild = self.last_child()
- if lastchild is None:
- return self.fromlineno
- else:
- return lastchild.tolineno
-
- # TODO / FIXME:
- assert self.fromlineno is not None, self
- assert self.tolineno is not None, self
-
- def _fixed_source_line(self):
- """return the line number where the given node appears
-
- we need this method since not all nodes have the lineno attribute
- correctly set...
- """
- line = self.lineno
- _node = self
- try:
- while line is None:
- _node = next(_node.get_children())
- line = _node.lineno
- except StopIteration:
- _node = self.parent
- while _node and line is None:
- line = _node.lineno
- _node = _node.parent
- return line
-
- def block_range(self, lineno):
- """handle block line numbers range for non block opening statements
- """
- return lineno, self.tolineno
-
- def set_local(self, name, stmt):
- """delegate to a scoped parent handling a locals dictionary"""
- self.parent.set_local(name, stmt)
-
- def nodes_of_class(self, klass, skip_klass=None):
- """return an iterator on nodes which are instance of the given class(es)
-
- klass may be a class object or a tuple of class objects
- """
- if isinstance(self, klass):
- yield self
- for child_node in self.get_children():
- if skip_klass is not None and isinstance(child_node, skip_klass):
- continue
- for matching in child_node.nodes_of_class(klass, skip_klass):
- yield matching
-
- def _infer_name(self, frame, name):
- # overridden for From, Import, Global, TryExcept and Arguments
- return None
-
- def _infer(self, context=None):
- """we don't know how to resolve a statement by default"""
- # this method is overridden by most concrete classes
- raise InferenceError(self.__class__.__name__)
-
- def infered(self):
- '''return list of infered values for a more simple inference usage'''
- return list(self.infer())
-
- def instanciate_class(self):
- """instanciate a node if it is a Class node, else return self"""
- return self
-
- def has_base(self, node):
- return False
-
- def callable(self):
- return False
-
- def eq(self, value):
- return False
-
- def as_string(self):
- from astroid.as_string import to_code
- return to_code(self)
-
- def repr_tree(self, ids=False):
- from astroid.as_string import dump
- return dump(self)
-
-
-class Statement(NodeNG):
- """Statement node adding a few attributes"""
- is_statement = True
-
- def next_sibling(self):
- """return the next sibling statement"""
- stmts = self.parent.child_sequence(self)
- index = stmts.index(self)
- try:
- return stmts[index +1]
- except IndexError:
- pass
-
- def previous_sibling(self):
- """return the previous sibling statement"""
- stmts = self.parent.child_sequence(self)
- index = stmts.index(self)
- if index >= 1:
- return stmts[index -1]
diff --git a/chromium/third_party/logilab/logilab/astroid/brain/builtin_inference.py b/chromium/third_party/logilab/logilab/astroid/brain/builtin_inference.py
deleted file mode 100644
index f60e7913b36..00000000000
--- a/chromium/third_party/logilab/logilab/astroid/brain/builtin_inference.py
+++ /dev/null
@@ -1,245 +0,0 @@
-"""Astroid hooks for various builtins."""
-
-import sys
-from functools import partial
-from textwrap import dedent
-
-import six
-from astroid import (MANAGER, UseInferenceDefault,
- inference_tip, YES, InferenceError, UnresolvableName)
-from astroid import nodes
-from astroid.builder import AstroidBuilder
-
-
-def _extend_str(class_node, rvalue):
- """function to extend builtin str/unicode class"""
- # TODO(cpopa): this approach will make astroid to believe
- # that some arguments can be passed by keyword, but
- # unfortunately, strings and bytes don't accept keyword arguments.
- code = dedent('''
- class whatever(object):
- def join(self, iterable):
- return {rvalue}
- def replace(self, old, new, count=None):
- return {rvalue}
- def format(self, *args, **kwargs):
- return {rvalue}
- def encode(self, encoding='ascii', errors=None):
- return ''
- def decode(self, encoding='ascii', errors=None):
- return u''
- def capitalize(self):
- return {rvalue}
- def title(self):
- return {rvalue}
- def lower(self):
- return {rvalue}
- def upper(self):
- return {rvalue}
- def swapcase(self):
- return {rvalue}
- def index(self, sub, start=None, end=None):
- return 0
- def find(self, sub, start=None, end=None):
- return 0
- def count(self, sub, start=None, end=None):
- return 0
- def strip(self, chars=None):
- return {rvalue}
- def lstrip(self, chars=None):
- return {rvalue}
- def rstrip(self, chars=None):
- return {rvalue}
- def rjust(self, width, fillchar=None):
- return {rvalue}
- def center(self, width, fillchar=None):
- return {rvalue}
- def ljust(self, width, fillchar=None):
- return {rvalue}
- ''')
- code = code.format(rvalue=rvalue)
- fake = AstroidBuilder(MANAGER).string_build(code)['whatever']
- for method in fake.mymethods():
- class_node.locals[method.name] = [method]
- method.parent = class_node
-
-def extend_builtins(class_transforms):
- from astroid.bases import BUILTINS
- builtin_ast = MANAGER.astroid_cache[BUILTINS]
- for class_name, transform in class_transforms.items():
- transform(builtin_ast[class_name])
-
-if sys.version_info > (3, 0):
- extend_builtins({'bytes': partial(_extend_str, rvalue="b''"),
- 'str': partial(_extend_str, rvalue="''")})
-else:
- extend_builtins({'str': partial(_extend_str, rvalue="''"),
- 'unicode': partial(_extend_str, rvalue="u''")})
-
-
-def register_builtin_transform(transform, builtin_name):
- """Register a new transform function for the given *builtin_name*.
-
- The transform function must accept two parameters, a node and
- an optional context.
- """
- def _transform_wrapper(node, context=None):
- result = transform(node, context=context)
- if result:
- result.parent = node
- result.lineno = node.lineno
- result.col_offset = node.col_offset
- return iter([result])
-
- MANAGER.register_transform(nodes.CallFunc,
- inference_tip(_transform_wrapper),
- lambda n: (isinstance(n.func, nodes.Name) and
- n.func.name == builtin_name))
-
-
-def _generic_inference(node, context, node_type, transform):
- args = node.args
- if not args:
- return node_type()
- if len(node.args) > 1:
- raise UseInferenceDefault()
-
- arg, = args
- transformed = transform(arg)
- if not transformed:
- try:
- infered = next(arg.infer(context=context))
- except (InferenceError, StopIteration):
- raise UseInferenceDefault()
- if infered is YES:
- raise UseInferenceDefault()
- transformed = transform(infered)
- if not transformed or transformed is YES:
- raise UseInferenceDefault()
- return transformed
-
-
-def _generic_transform(arg, klass, iterables, build_elts):
- if isinstance(arg, klass):
- return arg
- elif isinstance(arg, iterables):
- if not all(isinstance(elt, nodes.Const)
- for elt in arg.elts):
- # TODO(cpopa): Don't support heterogenous elements.
- # Not yet, though.
- raise UseInferenceDefault()
- elts = [elt.value for elt in arg.elts]
- elif isinstance(arg, nodes.Dict):
- if not all(isinstance(elt[0], nodes.Const)
- for elt in arg.items):
- raise UseInferenceDefault()
- elts = [item[0].value for item in arg.items]
- elif (isinstance(arg, nodes.Const) and
- isinstance(arg.value, (six.string_types, six.binary_type))):
- elts = arg.value
- else:
- return
- return klass(elts=build_elts(elts))
-
-
-def _infer_builtin(node, context,
- klass=None, iterables=None,
- build_elts=None):
- transform_func = partial(
- _generic_transform,
- klass=klass,
- iterables=iterables,
- build_elts=build_elts)
-
- return _generic_inference(node, context, klass, transform_func)
-
-# pylint: disable=invalid-name
-infer_tuple = partial(
- _infer_builtin,
- klass=nodes.Tuple,
- iterables=(nodes.List, nodes.Set),
- build_elts=tuple)
-
-infer_list = partial(
- _infer_builtin,
- klass=nodes.List,
- iterables=(nodes.Tuple, nodes.Set),
- build_elts=list)
-
-infer_set = partial(
- _infer_builtin,
- klass=nodes.Set,
- iterables=(nodes.List, nodes.Tuple),
- build_elts=set)
-
-
-def _get_elts(arg, context):
- is_iterable = lambda n: isinstance(n,
- (nodes.List, nodes.Tuple, nodes.Set))
- try:
- infered = next(arg.infer(context))
- except (InferenceError, UnresolvableName):
- raise UseInferenceDefault()
- if isinstance(infered, nodes.Dict):
- items = infered.items
- elif is_iterable(infered):
- items = []
- for elt in infered.elts:
- # If an item is not a pair of two items,
- # then fallback to the default inference.
- # Also, take in consideration only hashable items,
- # tuples and consts. We are choosing Names as well.
- if not is_iterable(elt):
- raise UseInferenceDefault()
- if len(elt.elts) != 2:
- raise UseInferenceDefault()
- if not isinstance(elt.elts[0],
- (nodes.Tuple, nodes.Const, nodes.Name)):
- raise UseInferenceDefault()
- items.append(tuple(elt.elts))
- else:
- raise UseInferenceDefault()
- return items
-
-def infer_dict(node, context=None):
- """Try to infer a dict call to a Dict node.
-
- The function treats the following cases:
-
- * dict()
- * dict(mapping)
- * dict(iterable)
- * dict(iterable, **kwargs)
- * dict(mapping, **kwargs)
- * dict(**kwargs)
-
- If a case can't be infered, we'll fallback to default inference.
- """
- has_keywords = lambda args: all(isinstance(arg, nodes.Keyword)
- for arg in args)
- if not node.args and not node.kwargs:
- # dict()
- return nodes.Dict()
- elif has_keywords(node.args) and node.args:
- # dict(a=1, b=2, c=4)
- items = [(nodes.Const(arg.arg), arg.value) for arg in node.args]
- elif (len(node.args) >= 2 and
- has_keywords(node.args[1:])):
- # dict(some_iterable, b=2, c=4)
- elts = _get_elts(node.args[0], context)
- keys = [(nodes.Const(arg.arg), arg.value) for arg in node.args[1:]]
- items = elts + keys
- elif len(node.args) == 1:
- items = _get_elts(node.args[0], context)
- else:
- raise UseInferenceDefault()
-
- empty = nodes.Dict()
- empty.items = items
- return empty
-
-# Builtins inference
-register_builtin_transform(infer_tuple, 'tuple')
-register_builtin_transform(infer_set, 'set')
-register_builtin_transform(infer_list, 'list')
-register_builtin_transform(infer_dict, 'dict')
diff --git a/chromium/third_party/logilab/logilab/astroid/brain/py2gi.py b/chromium/third_party/logilab/logilab/astroid/brain/py2gi.py
deleted file mode 100644
index 6747898de5b..00000000000
--- a/chromium/third_party/logilab/logilab/astroid/brain/py2gi.py
+++ /dev/null
@@ -1,155 +0,0 @@
-"""Astroid hooks for the Python 2 GObject introspection bindings.
-
-Helps with understanding everything imported from 'gi.repository'
-"""
-
-import inspect
-import itertools
-import sys
-import re
-
-from astroid import MANAGER, AstroidBuildingException
-from astroid.builder import AstroidBuilder
-
-
-_inspected_modules = {}
-
-_identifier_re = r'^[A-Za-z_]\w*$'
-
-def _gi_build_stub(parent):
- """
- Inspect the passed module recursively and build stubs for functions,
- classes, etc.
- """
- classes = {}
- functions = {}
- constants = {}
- methods = {}
- for name in dir(parent):
- if name.startswith("__"):
- continue
-
- # Check if this is a valid name in python
- if not re.match(_identifier_re, name):
- continue
-
- try:
- obj = getattr(parent, name)
- except:
- continue
-
- if inspect.isclass(obj):
- classes[name] = obj
- elif (inspect.isfunction(obj) or
- inspect.isbuiltin(obj)):
- functions[name] = obj
- elif (inspect.ismethod(obj) or
- inspect.ismethoddescriptor(obj)):
- methods[name] = obj
- elif type(obj) in [int, str]:
- constants[name] = obj
- elif (str(obj).startswith("<flags") or
- str(obj).startswith("<enum ") or
- str(obj).startswith("<GType ") or
- inspect.isdatadescriptor(obj)):
- constants[name] = 0
- elif callable(obj):
- # Fall back to a function for anything callable
- functions[name] = obj
- else:
- # Assume everything else is some manner of constant
- constants[name] = 0
-
- ret = ""
-
- if constants:
- ret += "# %s contants\n\n" % parent.__name__
- for name in sorted(constants):
- if name[0].isdigit():
- # GDK has some busted constant names like
- # Gdk.EventType.2BUTTON_PRESS
- continue
-
- val = constants[name]
-
- strval = str(val)
- if type(val) is str:
- strval = '"%s"' % str(val).replace("\\", "\\\\")
- ret += "%s = %s\n" % (name, strval)
-
- if ret:
- ret += "\n\n"
- if functions:
- ret += "# %s functions\n\n" % parent.__name__
- for name in sorted(functions):
- func = functions[name]
- ret += "def %s(*args, **kwargs):\n" % name
- ret += " pass\n"
-
- if ret:
- ret += "\n\n"
- if methods:
- ret += "# %s methods\n\n" % parent.__name__
- for name in sorted(methods):
- func = methods[name]
- ret += "def %s(self, *args, **kwargs):\n" % name
- ret += " pass\n"
-
- if ret:
- ret += "\n\n"
- if classes:
- ret += "# %s classes\n\n" % parent.__name__
- for name in sorted(classes):
- ret += "class %s(object):\n" % name
-
- classret = _gi_build_stub(classes[name])
- if not classret:
- classret = "pass\n"
-
- for line in classret.splitlines():
- ret += " " + line + "\n"
- ret += "\n"
-
- return ret
-
-def _import_gi_module(modname):
- # we only consider gi.repository submodules
- if not modname.startswith('gi.repository.'):
- raise AstroidBuildingException()
- # build astroid representation unless we already tried so
- if modname not in _inspected_modules:
- modnames = [modname]
- optional_modnames = []
-
- # GLib and GObject may have some special case handling
- # in pygobject that we need to cope with. However at
- # least as of pygobject3-3.13.91 the _glib module doesn't
- # exist anymore, so if treat these modules as optional.
- if modname == 'gi.repository.GLib':
- optional_modnames.append('gi._glib')
- elif modname == 'gi.repository.GObject':
- optional_modnames.append('gi._gobject')
-
- try:
- modcode = ''
- for m in itertools.chain(modnames, optional_modnames):
- try:
- __import__(m)
- modcode += _gi_build_stub(sys.modules[m])
- except ImportError:
- if m not in optional_modnames:
- raise
- except ImportError:
- astng = _inspected_modules[modname] = None
- else:
- astng = AstroidBuilder(MANAGER).string_build(modcode, modname)
- _inspected_modules[modname] = astng
- else:
- astng = _inspected_modules[modname]
- if astng is None:
- raise AstroidBuildingException('Failed to import module %r' % modname)
- return astng
-
-
-MANAGER.register_failed_import_hook(_import_gi_module)
-
diff --git a/chromium/third_party/logilab/logilab/astroid/brain/py2mechanize.py b/chromium/third_party/logilab/logilab/astroid/brain/py2mechanize.py
deleted file mode 100644
index 20a253a4580..00000000000
--- a/chromium/third_party/logilab/logilab/astroid/brain/py2mechanize.py
+++ /dev/null
@@ -1,18 +0,0 @@
-from astroid import MANAGER, register_module_extender
-from astroid.builder import AstroidBuilder
-
-def mechanize_transform():
- return AstroidBuilder(MANAGER).string_build('''
-
-class Browser(object):
- def open(self, url, data=None, timeout=None):
- return None
- def open_novisit(self, url, data=None, timeout=None):
- return None
- def open_local_file(self, filename):
- return None
-
-''')
-
-
-register_module_extender(MANAGER, 'mechanize', mechanize_transform)
diff --git a/chromium/third_party/logilab/logilab/astroid/brain/py2pytest.py b/chromium/third_party/logilab/logilab/astroid/brain/py2pytest.py
deleted file mode 100644
index e24d449cdc8..00000000000
--- a/chromium/third_party/logilab/logilab/astroid/brain/py2pytest.py
+++ /dev/null
@@ -1,31 +0,0 @@
-"""Astroid hooks for pytest."""
-
-from astroid import MANAGER, register_module_extender
-from astroid.builder import AstroidBuilder
-
-
-def pytest_transform():
- return AstroidBuilder(MANAGER).string_build('''
-
-try:
- import _pytest.mark
- import _pytest.recwarn
- import _pytest.runner
- import _pytest.python
-except ImportError:
- pass
-else:
- deprecated_call = _pytest.recwarn.deprecated_call
- exit = _pytest.runner.exit
- fail = _pytest.runner.fail
- fixture = _pytest.python.fixture
- importorskip = _pytest.runner.importorskip
- mark = _pytest.mark.MarkGenerator()
- raises = _pytest.python.raises
- skip = _pytest.runner.skip
- yield_fixture = _pytest.python.yield_fixture
-
-''')
-
-register_module_extender(MANAGER, 'pytest', pytest_transform)
-register_module_extender(MANAGER, 'py.test', pytest_transform)
diff --git a/chromium/third_party/logilab/logilab/astroid/brain/py2qt4.py b/chromium/third_party/logilab/logilab/astroid/brain/py2qt4.py
deleted file mode 100644
index d557809769b..00000000000
--- a/chromium/third_party/logilab/logilab/astroid/brain/py2qt4.py
+++ /dev/null
@@ -1,22 +0,0 @@
-"""Astroid hooks for the Python 2 qt4 module.
-
-Currently help understanding of :
-
-* PyQT4.QtCore
-"""
-
-from astroid import MANAGER, register_module_extender
-from astroid.builder import AstroidBuilder
-
-
-def pyqt4_qtcore_transform():
- return AstroidBuilder(MANAGER).string_build('''
-
-def SIGNAL(signal_name): pass
-
-class QObject(object):
- def emit(self, signal): pass
-''')
-
-
-register_module_extender(MANAGER, 'PyQt4.QtCore', pyqt4_qtcore_transform)
diff --git a/chromium/third_party/logilab/logilab/astroid/brain/py2stdlib.py b/chromium/third_party/logilab/logilab/astroid/brain/py2stdlib.py
deleted file mode 100644
index 2bfcbcd3764..00000000000
--- a/chromium/third_party/logilab/logilab/astroid/brain/py2stdlib.py
+++ /dev/null
@@ -1,334 +0,0 @@
-
-"""Astroid hooks for the Python 2 standard library.
-
-Currently help understanding of :
-
-* hashlib.md5 and hashlib.sha1
-"""
-
-import sys
-from functools import partial
-from textwrap import dedent
-
-from astroid import (
- MANAGER, AsStringRegexpPredicate,
- UseInferenceDefault, inference_tip,
- YES, InferenceError, register_module_extender)
-from astroid import exceptions
-from astroid import nodes
-from astroid.builder import AstroidBuilder
-
-PY3K = sys.version_info > (3, 0)
-PY33 = sys.version_info >= (3, 3)
-
-# general function
-
-def infer_func_form(node, base_type, context=None, enum=False):
- """Specific inference function for namedtuple or Python 3 enum. """
- def infer_first(node):
- try:
- value = next(node.infer(context=context))
- if value is YES:
- raise UseInferenceDefault()
- else:
- return value
- except StopIteration:
- raise InferenceError()
-
- # node is a CallFunc node, class name as first argument and generated class
- # attributes as second argument
- if len(node.args) != 2:
- # something weird here, go back to class implementation
- raise UseInferenceDefault()
- # namedtuple or enums list of attributes can be a list of strings or a
- # whitespace-separate string
- try:
- name = infer_first(node.args[0]).value
- names = infer_first(node.args[1])
- try:
- attributes = names.value.replace(',', ' ').split()
- except AttributeError:
- if not enum:
- attributes = [infer_first(const).value for const in names.elts]
- else:
- # Enums supports either iterator of (name, value) pairs
- # or mappings.
- # TODO: support only list, tuples and mappings.
- if hasattr(names, 'items') and isinstance(names.items, list):
- attributes = [infer_first(const[0]).value
- for const in names.items
- if isinstance(const[0], nodes.Const)]
- elif hasattr(names, 'elts'):
- # Enums can support either ["a", "b", "c"]
- # or [("a", 1), ("b", 2), ...], but they can't
- # be mixed.
- if all(isinstance(const, nodes.Tuple)
- for const in names.elts):
- attributes = [infer_first(const.elts[0]).value
- for const in names.elts
- if isinstance(const, nodes.Tuple)]
- else:
- attributes = [infer_first(const).value
- for const in names.elts]
- else:
- raise AttributeError
- if not attributes:
- raise AttributeError
- except (AttributeError, exceptions.InferenceError) as exc:
- raise UseInferenceDefault()
- # we want to return a Class node instance with proper attributes set
- class_node = nodes.Class(name, 'docstring')
- class_node.parent = node.parent
- # set base class=tuple
- class_node.bases.append(base_type)
- # XXX add __init__(*attributes) method
- for attr in attributes:
- fake_node = nodes.EmptyNode()
- fake_node.parent = class_node
- class_node.instance_attrs[attr] = [fake_node]
- return class_node, name, attributes
-
-
-# module specific transformation functions #####################################
-
-def hashlib_transform():
- template = '''
-
-class %(name)s(object):
- def __init__(self, value=''): pass
- def digest(self):
- return %(digest)s
- def copy(self):
- return self
- def update(self, value): pass
- def hexdigest(self):
- return ''
- @property
- def name(self):
- return %(name)r
- @property
- def block_size(self):
- return 1
- @property
- def digest_size(self):
- return 1
-'''
- algorithms = ('md5', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512')
- classes = "".join(
- template % {'name': hashfunc, 'digest': 'b""' if PY3K else '""'}
- for hashfunc in algorithms)
- return AstroidBuilder(MANAGER).string_build(classes)
-
-
-def collections_transform():
- return AstroidBuilder(MANAGER).string_build('''
-
-class defaultdict(dict):
- default_factory = None
- def __missing__(self, key): pass
-
-class deque(object):
- maxlen = 0
- def __init__(self, iterable=None, maxlen=None): pass
- def append(self, x): pass
- def appendleft(self, x): pass
- def clear(self): pass
- def count(self, x): return 0
- def extend(self, iterable): pass
- def extendleft(self, iterable): pass
- def pop(self): pass
- def popleft(self): pass
- def remove(self, value): pass
- def reverse(self): pass
- def rotate(self, n): pass
- def __iter__(self): return self
-
-''')
-
-
-def pkg_resources_transform():
- return AstroidBuilder(MANAGER).string_build('''
-
-def resource_exists(package_or_requirement, resource_name):
- pass
-
-def resource_isdir(package_or_requirement, resource_name):
- pass
-
-def resource_filename(package_or_requirement, resource_name):
- pass
-
-def resource_stream(package_or_requirement, resource_name):
- pass
-
-def resource_string(package_or_requirement, resource_name):
- pass
-
-def resource_listdir(package_or_requirement, resource_name):
- pass
-
-def extraction_error():
- pass
-
-def get_cache_path(archive_name, names=()):
- pass
-
-def postprocess(tempname, filename):
- pass
-
-def set_extraction_path(path):
- pass
-
-def cleanup_resources(force=False):
- pass
-
-''')
-
-
-def subprocess_transform():
- if PY3K:
- communicate = (bytes('string', 'ascii'), bytes('string', 'ascii'))
- init = """
- def __init__(self, args, bufsize=0, executable=None,
- stdin=None, stdout=None, stderr=None,
- preexec_fn=None, close_fds=False, shell=False,
- cwd=None, env=None, universal_newlines=False,
- startupinfo=None, creationflags=0, restore_signals=True,
- start_new_session=False, pass_fds=()):
- pass
- """
- else:
- communicate = ('string', 'string')
- init = """
- def __init__(self, args, bufsize=0, executable=None,
- stdin=None, stdout=None, stderr=None,
- preexec_fn=None, close_fds=False, shell=False,
- cwd=None, env=None, universal_newlines=False,
- startupinfo=None, creationflags=0):
- pass
- """
- if PY33:
- wait_signature = 'def wait(self, timeout=None)'
- else:
- wait_signature = 'def wait(self)'
- return AstroidBuilder(MANAGER).string_build('''
-
-class Popen(object):
- returncode = pid = 0
- stdin = stdout = stderr = file()
-
- %(init)s
-
- def communicate(self, input=None):
- return %(communicate)r
- %(wait_signature)s:
- return self.returncode
- def poll(self):
- return self.returncode
- def send_signal(self, signal):
- pass
- def terminate(self):
- pass
- def kill(self):
- pass
- ''' % {'init': init,
- 'communicate': communicate,
- 'wait_signature': wait_signature})
-
-
-# namedtuple support ###########################################################
-
-def looks_like_namedtuple(node):
- func = node.func
- if type(func) is nodes.Getattr:
- return func.attrname == 'namedtuple'
- if type(func) is nodes.Name:
- return func.name == 'namedtuple'
- return False
-
-def infer_named_tuple(node, context=None):
- """Specific inference function for namedtuple CallFunc node"""
- class_node, name, attributes = infer_func_form(node, nodes.Tuple._proxied,
- context=context)
- fake = AstroidBuilder(MANAGER).string_build('''
-class %(name)s(tuple):
- _fields = %(fields)r
- def _asdict(self):
- return self.__dict__
- @classmethod
- def _make(cls, iterable, new=tuple.__new__, len=len):
- return new(cls, iterable)
- def _replace(_self, **kwds):
- result = _self._make(map(kwds.pop, %(fields)r, _self))
- if kwds:
- raise ValueError('Got unexpected field names: %%r' %% list(kwds))
- return result
- ''' % {'name': name, 'fields': attributes})
- class_node.locals['_asdict'] = fake.body[0].locals['_asdict']
- class_node.locals['_make'] = fake.body[0].locals['_make']
- class_node.locals['_replace'] = fake.body[0].locals['_replace']
- class_node.locals['_fields'] = fake.body[0].locals['_fields']
- # we use UseInferenceDefault, we can't be a generator so return an iterator
- return iter([class_node])
-
-def infer_enum(node, context=None):
- """ Specific inference function for enum CallFunc node. """
- enum_meta = nodes.Class("EnumMeta", 'docstring')
- class_node = infer_func_form(node, enum_meta,
- context=context, enum=True)[0]
- return iter([class_node.instanciate_class()])
-
-def infer_enum_class(node):
- """ Specific inference for enums. """
- names = set(('Enum', 'IntEnum', 'enum.Enum', 'enum.IntEnum'))
- for basename in node.basenames:
- # TODO: doesn't handle subclasses yet. This implementation
- # is a hack to support enums.
- if basename not in names:
- continue
- if node.root().name == 'enum':
- # Skip if the class is directly from enum module.
- break
- for local, values in node.locals.items():
- if any(not isinstance(value, nodes.AssName)
- for value in values):
- continue
-
- stmt = values[0].statement()
- if isinstance(stmt.targets[0], nodes.Tuple):
- targets = stmt.targets[0].itered()
- else:
- targets = stmt.targets
-
- new_targets = []
- for target in targets:
- # Replace all the assignments with our mocked class.
- classdef = dedent('''
- class %(name)s(object):
- @property
- def value(self):
- # Not the best return.
- return None
- @property
- def name(self):
- return %(name)r
- ''' % {'name': target.name})
- fake = AstroidBuilder(MANAGER).string_build(classdef)[target.name]
- fake.parent = target.parent
- for method in node.mymethods():
- fake.locals[method.name] = [method]
- new_targets.append(fake.instanciate_class())
- node.locals[local] = new_targets
- break
- return node
-
-
-MANAGER.register_transform(nodes.CallFunc, inference_tip(infer_named_tuple),
- looks_like_namedtuple)
-MANAGER.register_transform(nodes.CallFunc, inference_tip(infer_enum),
- AsStringRegexpPredicate('Enum', 'func'))
-MANAGER.register_transform(nodes.Class, infer_enum_class)
-register_module_extender(MANAGER, 'hashlib', hashlib_transform)
-register_module_extender(MANAGER, 'collections', collections_transform)
-register_module_extender(MANAGER, 'pkg_resources', pkg_resources_transform)
-register_module_extender(MANAGER, 'subprocess', subprocess_transform)
diff --git a/chromium/third_party/logilab/logilab/astroid/brain/pynose.py b/chromium/third_party/logilab/logilab/astroid/brain/pynose.py
deleted file mode 100644
index 6315a34dc09..00000000000
--- a/chromium/third_party/logilab/logilab/astroid/brain/pynose.py
+++ /dev/null
@@ -1,56 +0,0 @@
-# copyright 2003-2015 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of astroid.
-#
-# astroid is free software: you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as published by the
-# Free Software Foundation, either version 2.1 of the License, or (at your
-# option) any later version.
-#
-# astroid 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 Lesser General Public License
-# for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with astroid. If not, see <http://www.gnu.org/licenses/>.
-
-"""Hooks for nose library."""
-
-import re
-import unittest
-
-from astroid import List, MANAGER, register_module_extender
-from astroid.builder import AstroidBuilder
-
-
-def _pep8(name, caps=re.compile('([A-Z])')):
- return caps.sub(lambda m: '_' + m.groups()[0].lower(), name)
-
-
-def nose_transform():
- """Custom transform for the nose.tools module."""
-
- builder = AstroidBuilder(MANAGER)
- stub = AstroidBuilder(MANAGER).string_build('''__all__ = []''')
- unittest_module = builder.module_build(unittest.case)
- case = unittest_module['TestCase']
- all_entries = ['ok_', 'eq_']
-
- for method_name, method in case.locals.items():
- if method_name.startswith('assert') and '_' not in method_name:
- pep8_name = _pep8(method_name)
- all_entries.append(pep8_name)
- stub[pep8_name] = method[0]
-
- # Update the __all__ variable, since nose.tools
- # does this manually with .append.
- all_assign = stub['__all__'].parent
- all_object = List(all_entries)
- all_object.parent = all_assign
- all_assign.value = all_object
- return stub
-
-
-register_module_extender(MANAGER, 'nose.tools.trivial', nose_transform)
diff --git a/chromium/third_party/logilab/logilab/astroid/brain/pysix_moves.py b/chromium/third_party/logilab/logilab/astroid/brain/pysix_moves.py
deleted file mode 100644
index 5648278cf12..00000000000
--- a/chromium/third_party/logilab/logilab/astroid/brain/pysix_moves.py
+++ /dev/null
@@ -1,225 +0,0 @@
-# copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of astroid.
-#
-# astroid is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# astroid 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with astroid. If not, see <http://www.gnu.org/licenses/>.
-
-"""Astroid hooks for six.moves."""
-
-import sys
-from textwrap import dedent
-
-from astroid import MANAGER, register_module_extender
-from astroid.builder import AstroidBuilder
-
-
-def six_moves_transform_py2():
- return AstroidBuilder(MANAGER).string_build(dedent('''
- import urllib as _urllib
- import urllib2 as _urllib2
- import urlparse as _urlparse
-
- class Moves(object):
- import BaseHTTPServer
- import CGIHTTPServer
- import SimpleHTTPServer
-
- from StringIO import StringIO
- from cStringIO import StringIO as cStringIO
- from UserDict import UserDict
- from UserList import UserList
- from UserString import UserString
-
- import __builtin__ as builtins
- import thread as _thread
- import dummy_thread as _dummy_thread
- import ConfigParser as configparser
- import copy_reg as copyreg
- from itertools import (imap as map,
- ifilter as filter,
- ifilterfalse as filterfalse,
- izip_longest as zip_longest,
- izip as zip)
- import htmlentitydefs as html_entities
- import HTMLParser as html_parser
- import httplib as http_client
- import cookielib as http_cookiejar
- import Cookie as http_cookies
- import Queue as queue
- import repr as reprlib
- from pipes import quote as shlex_quote
- import SocketServer as socketserver
- import SimpleXMLRPCServer as xmlrpc_server
- import xmlrpclib as xmlrpc_client
- import _winreg as winreg
- import robotparser as urllib_robotparser
-
- input = raw_input
- intern = intern
- range = xrange
- xrange = xrange
- reduce = reduce
- reload_module = reload
-
- class UrllibParse(object):
- ParseResult = _urlparse.ParseResult
- SplitResult = _urlparse.SplitResult
- parse_qs = _urlparse.parse_qs
- parse_qsl = _urlparse.parse_qsl
- urldefrag = _urlparse.urldefrag
- urljoin = _urlparse.urljoin
- urlparse = _urlparse.urlparse
- urlsplit = _urlparse.urlsplit
- urlunparse = _urlparse.urlunparse
- urlunsplit = _urlparse.urlunsplit
- quote = _urllib.quote
- quote_plus = _urllib.quote_plus
- unquote = _urllib.unquote
- unquote_plus = _urllib.unquote_plus
- urlencode = _urllib.urlencode
- splitquery = _urllib.splitquery
- splittag = _urllib.splittag
- splituser = _urllib.splituser
- uses_fragment = _urlparse.uses_fragment
- uses_netloc = _urlparse.uses_netloc
- uses_params = _urlparse.uses_params
- uses_query = _urlparse.uses_query
- uses_relative = _urlparse.uses_relative
-
- class UrllibError(object):
- URLError = _urllib2.URLError
- HTTPError = _urllib2.HTTPError
- ContentTooShortError = _urllib.ContentTooShortError
-
- class DummyModule(object):
- pass
-
- class UrllibRequest(object):
- urlopen = _urllib2.urlopen
- install_opener = _urllib2.install_opener
- build_opener = _urllib2.build_opener
- pathname2url = _urllib.pathname2url
- url2pathname = _urllib.url2pathname
- getproxies = _urllib.getproxies
- Request = _urllib2.Request
- OpenerDirector = _urllib2.OpenerDirector
- HTTPDefaultErrorHandler = _urllib2.HTTPDefaultErrorHandler
- HTTPRedirectHandler = _urllib2.HTTPRedirectHandler
- HTTPCookieProcessor = _urllib2.HTTPCookieProcessor
- ProxyHandler = _urllib2.ProxyHandler
- BaseHandler = _urllib2.BaseHandler
- HTTPPasswordMgr = _urllib2.HTTPPasswordMgr
- HTTPPasswordMgrWithDefaultRealm = _urllib2.HTTPPasswordMgrWithDefaultRealm
- AbstractBasicAuthHandler = _urllib2.AbstractBasicAuthHandler
- HTTPBasicAuthHandler = _urllib2.HTTPBasicAuthHandler
- ProxyBasicAuthHandler = _urllib2.ProxyBasicAuthHandler
- AbstractDigestAuthHandler = _urllib2.AbstractDigestAuthHandler
- HTTPDigestAuthHandler = _urllib2.HTTPDigestAuthHandler
- ProxyDigestAuthHandler = _urllib2.ProxyDigestAuthHandler
- HTTPHandler = _urllib2.HTTPHandler
- HTTPSHandler = _urllib2.HTTPSHandler
- FileHandler = _urllib2.FileHandler
- FTPHandler = _urllib2.FTPHandler
- CacheFTPHandler = _urllib2.CacheFTPHandler
- UnknownHandler = _urllib2.UnknownHandler
- HTTPErrorProcessor = _urllib2.HTTPErrorProcessor
- urlretrieve = _urllib.urlretrieve
- urlcleanup = _urllib.urlcleanup
- proxy_bypass = _urllib.proxy_bypass
-
- urllib_parse = UrllibParse()
- urllib_error = UrllibError()
- urllib = DummyModule()
- urllib.request = UrllibRequest()
- urllib.parse = UrllibParse()
- urllib.error = UrllibError()
-
- moves = Moves()
-
- '''))
-
-
-def six_moves_transform_py3():
- return AstroidBuilder(MANAGER).string_build(dedent('''
- class Moves(object):
- import _io
- cStringIO = _io.StringIO
- filter = filter
- from itertools import filterfalse
- input = input
- from sys import intern
- map = map
- range = range
- from imp import reload as reload_module
- from functools import reduce
- from shlex import quote as shlex_quote
- from io import StringIO
- from collections import UserDict, UserList, UserString
- xrange = range
- zip = zip
- from itertools import zip_longest
- import builtins
- import configparser
- import copyreg
- import _dummy_thread
- import http.cookiejar as http_cookiejar
- import http.cookies as http_cookies
- import html.entities as html_entities
- import html.parser as html_parser
- import http.client as http_client
- import http.server
- BaseHTTPServer = CGIHTTPServer = SimpleHTTPServer = http.server
- import pickle as cPickle
- import queue
- import reprlib
- import socketserver
- import _thread
- import winreg
- import xmlrpc.server as xmlrpc_server
- import xmlrpc.client as xmlrpc_client
- import urllib.robotparser as urllib_robotparser
- import email.mime.multipart as email_mime_multipart
- import email.mime.nonmultipart as email_mime_nonmultipart
- import email.mime.text as email_mime_text
- import email.mime.base as email_mime_base
- import urllib.parse as urllib_parse
- import urllib.error as urllib_error
- import tkinter
- import tkinter.dialog as tkinter_dialog
- import tkinter.filedialog as tkinter_filedialog
- import tkinter.scrolledtext as tkinter_scrolledtext
- import tkinter.simpledialog as tkinder_simpledialog
- import tkinter.tix as tkinter_tix
- import tkinter.ttk as tkinter_ttk
- import tkinter.constants as tkinter_constants
- import tkinter.dnd as tkinter_dnd
- import tkinter.colorchooser as tkinter_colorchooser
- import tkinter.commondialog as tkinter_commondialog
- import tkinter.filedialog as tkinter_tkfiledialog
- import tkinter.font as tkinter_font
- import tkinter.messagebox as tkinter_messagebox
- import urllib.request
- import urllib.robotparser as urllib_robotparser
- import urllib.parse as urllib_parse
- import urllib.error as urllib_error
- moves = Moves()
- '''))
-
-if sys.version_info[0] == 2:
- TRANSFORM = six_moves_transform_py2
-else:
- TRANSFORM = six_moves_transform_py3
-
-register_module_extender(MANAGER, 'six', TRANSFORM)
diff --git a/chromium/third_party/logilab/logilab/astroid/builder.py b/chromium/third_party/logilab/logilab/astroid/builder.py
deleted file mode 100644
index 1fe7a36d422..00000000000
--- a/chromium/third_party/logilab/logilab/astroid/builder.py
+++ /dev/null
@@ -1,240 +0,0 @@
-# copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of astroid.
-#
-# astroid is free software: you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as published by the
-# Free Software Foundation, either version 2.1 of the License, or (at your
-# option) any later version.
-#
-# astroid 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 Lesser General Public License
-# for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with astroid. If not, see <http://www.gnu.org/licenses/>.
-"""The AstroidBuilder makes astroid from living object and / or from _ast
-
-The builder is not thread safe and can't be used to parse different sources
-at the same time.
-"""
-from __future__ import with_statement
-
-__docformat__ = "restructuredtext en"
-
-import sys
-from os.path import splitext, basename, exists, abspath
-
-from astroid.exceptions import AstroidBuildingException, InferenceError
-from astroid.raw_building import InspectBuilder
-from astroid.rebuilder import TreeRebuilder
-from astroid.manager import AstroidManager
-from astroid.bases import YES, Instance
-from astroid.modutils import modpath_from_file
-
-from _ast import PyCF_ONLY_AST
-def parse(string):
- return compile(string, "<string>", 'exec', PyCF_ONLY_AST)
-
-if sys.version_info >= (3, 0):
- from tokenize import detect_encoding
-
- def open_source_file(filename):
- with open(filename, 'rb') as byte_stream:
- encoding = detect_encoding(byte_stream.readline)[0]
- stream = open(filename, 'r', newline=None, encoding=encoding)
- try:
- data = stream.read()
- except UnicodeError: # wrong encodingg
- # detect_encoding returns utf-8 if no encoding specified
- msg = 'Wrong (%s) or no encoding specified' % encoding
- raise AstroidBuildingException(msg)
- return stream, encoding, data
-
-else:
- import re
-
- _ENCODING_RGX = re.compile(r"\s*#+.*coding[:=]\s*([-\w.]+)")
-
- def _guess_encoding(string):
- """get encoding from a python file as string or return None if not found
- """
- # check for UTF-8 byte-order mark
- if string.startswith('\xef\xbb\xbf'):
- return 'UTF-8'
- for line in string.split('\n', 2)[:2]:
- # check for encoding declaration
- match = _ENCODING_RGX.match(line)
- if match is not None:
- return match.group(1)
-
- def open_source_file(filename):
- """get data for parsing a file"""
- stream = open(filename, 'U')
- data = stream.read()
- encoding = _guess_encoding(data)
- return stream, encoding, data
-
-# ast NG builder ##############################################################
-
-MANAGER = AstroidManager()
-
-class AstroidBuilder(InspectBuilder):
- """provide astroid building methods"""
-
- def __init__(self, manager=None):
- InspectBuilder.__init__(self)
- self._manager = manager or MANAGER
-
- def module_build(self, module, modname=None):
- """build an astroid from a living module instance
- """
- node = None
- path = getattr(module, '__file__', None)
- if path is not None:
- path_, ext = splitext(module.__file__)
- if ext in ('.py', '.pyc', '.pyo') and exists(path_ + '.py'):
- node = self.file_build(path_ + '.py', modname)
- if node is None:
- # this is a built-in module
- # get a partial representation by introspection
- node = self.inspect_build(module, modname=modname, path=path)
- # we have to handle transformation by ourselves since the rebuilder
- # isn't called for builtin nodes
- #
- # XXX it's then only called for Module nodes, not for underlying
- # nodes
- node = self._manager.transform(node)
- return node
-
- def file_build(self, path, modname=None):
- """build astroid from a source code file (i.e. from an ast)
-
- path is expected to be a python source file
- """
- try:
- stream, encoding, data = open_source_file(path)
- except IOError as exc:
- msg = 'Unable to load file %r (%s)' % (path, exc)
- raise AstroidBuildingException(msg)
- except SyntaxError as exc: # py3k encoding specification error
- raise AstroidBuildingException(exc)
- except LookupError as exc: # unknown encoding
- raise AstroidBuildingException(exc)
- with stream:
- # get module name if necessary
- if modname is None:
- try:
- modname = '.'.join(modpath_from_file(path))
- except ImportError:
- modname = splitext(basename(path))[0]
- # build astroid representation
- module = self._data_build(data, modname, path)
- return self._post_build(module, encoding)
-
- def string_build(self, data, modname='', path=None):
- """build astroid from source code string and return rebuilded astroid"""
- module = self._data_build(data, modname, path)
- module.file_bytes = data.encode('utf-8')
- return self._post_build(module, 'utf-8')
-
- def _post_build(self, module, encoding):
- """handles encoding and delayed nodes
- after a module has been built
- """
- module.file_encoding = encoding
- self._manager.cache_module(module)
- # post tree building steps after we stored the module in the cache:
- for from_node in module._from_nodes:
- if from_node.modname == '__future__':
- for symbol, _ in from_node.names:
- module.future_imports.add(symbol)
- self.add_from_names_to_locals(from_node)
- # handle delayed assattr nodes
- for delayed in module._delayed_assattr:
- self.delayed_assattr(delayed)
- return module
-
- def _data_build(self, data, modname, path):
- """build tree node from data and add some informations"""
- # this method could be wrapped with a pickle/cache function
- try:
- node = parse(data + '\n')
- except TypeError as exc:
- raise AstroidBuildingException(exc)
- if path is not None:
- node_file = abspath(path)
- else:
- node_file = '<?>'
- if modname.endswith('.__init__'):
- modname = modname[:-9]
- package = True
- else:
- package = path and path.find('__init__.py') > -1 or False
- rebuilder = TreeRebuilder(self._manager)
- module = rebuilder.visit_module(node, modname, node_file, package)
- module._from_nodes = rebuilder._from_nodes
- module._delayed_assattr = rebuilder._delayed_assattr
- return module
-
- def add_from_names_to_locals(self, node):
- """store imported names to the locals;
- resort the locals if coming from a delayed node
- """
-
- _key_func = lambda node: node.fromlineno
- def sort_locals(my_list):
- my_list.sort(key=_key_func)
- for (name, asname) in node.names:
- if name == '*':
- try:
- imported = node.do_import_module()
- except InferenceError:
- continue
- for name in imported.wildcard_import_names():
- node.parent.set_local(name, node)
- sort_locals(node.parent.scope().locals[name])
- else:
- node.parent.set_local(asname or name, node)
- sort_locals(node.parent.scope().locals[asname or name])
-
- def delayed_assattr(self, node):
- """visit a AssAttr node -> add name to locals, handle members
- definition
- """
- try:
- frame = node.frame()
- for infered in node.expr.infer():
- if infered is YES:
- continue
- try:
- if infered.__class__ is Instance:
- infered = infered._proxied
- iattrs = infered.instance_attrs
- elif isinstance(infered, Instance):
- # Const, Tuple, ... we may be wrong, may be not, but
- # anyway we don't want to pollute builtin's namespace
- continue
- elif infered.is_function:
- iattrs = infered.instance_attrs
- else:
- iattrs = infered.locals
- except AttributeError:
- # XXX log error
- #import traceback
- #traceback.print_exc()
- continue
- values = iattrs.setdefault(node.attrname, [])
- if node in values:
- continue
- # get assign in __init__ first XXX useful ?
- if frame.name == '__init__' and values and not \
- values[0].frame().name == '__init__':
- values.insert(0, node)
- else:
- values.append(node)
- except InferenceError:
- pass
-
diff --git a/chromium/third_party/logilab/logilab/astroid/exceptions.py b/chromium/third_party/logilab/logilab/astroid/exceptions.py
deleted file mode 100644
index 3889e2e79fa..00000000000
--- a/chromium/third_party/logilab/logilab/astroid/exceptions.py
+++ /dev/null
@@ -1,51 +0,0 @@
-# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of astroid.
-#
-# astroid is free software: you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as published by the
-# Free Software Foundation, either version 2.1 of the License, or (at your
-# option) any later version.
-#
-# astroid 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 Lesser General Public License
-# for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with astroid. If not, see <http://www.gnu.org/licenses/>.
-"""this module contains exceptions used in the astroid library
-
-"""
-
-__doctype__ = "restructuredtext en"
-
-class AstroidError(Exception):
- """base exception class for all astroid related exceptions"""
-
-class AstroidBuildingException(AstroidError):
- """exception class when we are unable to build an astroid representation"""
-
-class ResolveError(AstroidError):
- """base class of astroid resolution/inference error"""
-
-class NotFoundError(ResolveError):
- """raised when we are unable to resolve a name"""
-
-class InferenceError(ResolveError):
- """raised when we are unable to infer a node"""
-
-class UseInferenceDefault(Exception):
- """exception to be raised in custom inference function to indicate that it
- should go back to the default behaviour
- """
-
-class UnresolvableName(InferenceError):
- """raised when we are unable to resolve a name"""
-
-class NoDefault(AstroidError):
- """raised by function's `default_value` method when an argument has
- no default value
- """
-
diff --git a/chromium/third_party/logilab/logilab/astroid/inference.py b/chromium/third_party/logilab/logilab/astroid/inference.py
deleted file mode 100644
index f29b3d11e79..00000000000
--- a/chromium/third_party/logilab/logilab/astroid/inference.py
+++ /dev/null
@@ -1,401 +0,0 @@
-# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of astroid.
-#
-# astroid is free software: you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as published by the
-# Free Software Foundation, either version 2.1 of the License, or (at your
-# option) any later version.
-#
-# astroid 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 Lesser General Public License
-# for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with astroid. If not, see <http://www.gnu.org/licenses/>.
-"""this module contains a set of functions to handle inference on astroid trees
-"""
-
-__doctype__ = "restructuredtext en"
-
-from itertools import chain
-
-from astroid import nodes
-
-from astroid.manager import AstroidManager
-from astroid.exceptions import (AstroidError, InferenceError, NoDefault,
- NotFoundError, UnresolvableName)
-from astroid.bases import (YES, Instance, InferenceContext,
- _infer_stmts, path_wrapper,
- raise_if_nothing_infered)
-from astroid.protocols import (
- _arguments_infer_argname,
- BIN_OP_METHOD, UNARY_OP_METHOD)
-
-MANAGER = AstroidManager()
-
-
-class CallContext(object):
- """when inferring a function call, this class is used to remember values
- given as argument
- """
- def __init__(self, args, starargs, dstarargs):
- self.args = []
- self.nargs = {}
- for arg in args:
- if isinstance(arg, nodes.Keyword):
- self.nargs[arg.arg] = arg.value
- else:
- self.args.append(arg)
- self.starargs = starargs
- self.dstarargs = dstarargs
-
- def infer_argument(self, funcnode, name, context):
- """infer a function argument value according to the call context"""
- # 1. search in named keywords
- try:
- return self.nargs[name].infer(context)
- except KeyError:
- # Function.args.args can be None in astroid (means that we don't have
- # information on argnames)
- argindex = funcnode.args.find_argname(name)[0]
- if argindex is not None:
- # 2. first argument of instance/class method
- if argindex == 0 and funcnode.type in ('method', 'classmethod'):
- if context.boundnode is not None:
- boundnode = context.boundnode
- else:
- # XXX can do better ?
- boundnode = funcnode.parent.frame()
- if funcnode.type == 'method':
- if not isinstance(boundnode, Instance):
- boundnode = Instance(boundnode)
- return iter((boundnode,))
- if funcnode.type == 'classmethod':
- return iter((boundnode,))
- # if we have a method, extract one position
- # from the index, so we'll take in account
- # the extra parameter represented by `self` or `cls`
- if funcnode.type in ('method', 'classmethod'):
- argindex -= 1
- # 2. search arg index
- try:
- return self.args[argindex].infer(context)
- except IndexError:
- pass
- # 3. search in *args (.starargs)
- if self.starargs is not None:
- its = []
- for infered in self.starargs.infer(context):
- if infered is YES:
- its.append((YES,))
- continue
- try:
- its.append(infered.getitem(argindex, context).infer(context))
- except (InferenceError, AttributeError):
- its.append((YES,))
- except (IndexError, TypeError):
- continue
- if its:
- return chain(*its)
- # 4. XXX search in **kwargs (.dstarargs)
- if self.dstarargs is not None:
- its = []
- for infered in self.dstarargs.infer(context):
- if infered is YES:
- its.append((YES,))
- continue
- try:
- its.append(infered.getitem(name, context).infer(context))
- except (InferenceError, AttributeError):
- its.append((YES,))
- except (IndexError, TypeError):
- continue
- if its:
- return chain(*its)
- # 5. */** argument, (Tuple or Dict)
- if name == funcnode.args.vararg:
- return iter((nodes.const_factory(())))
- if name == funcnode.args.kwarg:
- return iter((nodes.const_factory({})))
- # 6. return default value if any
- try:
- return funcnode.args.default_value(name).infer(context)
- except NoDefault:
- raise InferenceError(name)
-
-
-# .infer method ###############################################################
-
-
-def infer_end(self, context=None):
- """inference's end for node such as Module, Class, Function, Const...
- """
- yield self
-nodes.Module._infer = infer_end
-nodes.Class._infer = infer_end
-nodes.Function._infer = infer_end
-nodes.Lambda._infer = infer_end
-nodes.Const._infer = infer_end
-nodes.List._infer = infer_end
-nodes.Tuple._infer = infer_end
-nodes.Dict._infer = infer_end
-nodes.Set._infer = infer_end
-
-def _higher_function_scope(node):
- """ Search for the first function which encloses the given
- scope. This can be used for looking up in that function's
- scope, in case looking up in a lower scope for a particular
- name fails.
-
- :param node: A scope node.
- :returns:
- ``None``, if no parent function scope was found,
- otherwise an instance of :class:`astroid.scoped_nodes.Function`,
- which encloses the given node.
- """
- current = node
- while current.parent and not isinstance(current.parent, nodes.Function):
- current = current.parent
- if current and current.parent:
- return current.parent
-
-def infer_name(self, context=None):
- """infer a Name: use name lookup rules"""
- frame, stmts = self.lookup(self.name)
- if not stmts:
- # Try to see if the name is enclosed in a nested function
- # and use the higher (first function) scope for searching.
- # TODO: should this be promoted to other nodes as well?
- parent_function = _higher_function_scope(self.scope())
- if parent_function:
- _, stmts = parent_function.lookup(self.name)
-
- if not stmts:
- raise UnresolvableName(self.name)
- return _infer_stmts(stmts, context, frame, self.name)
-nodes.Name._infer = path_wrapper(infer_name)
-nodes.AssName.infer_lhs = infer_name # won't work with a path wrapper
-
-
-def infer_callfunc(self, context=None):
- """infer a CallFunc node by trying to guess what the function returns"""
- if context is None:
- context = InferenceContext()
- for callee in self.func.infer(context):
- with context.scope(
- callcontext=CallContext(self.args, self.starargs, self.kwargs),
- boundnode=None,
- ):
- if callee is YES:
- yield callee
- continue
- try:
- if hasattr(callee, 'infer_call_result'):
- for infered in callee.infer_call_result(self, context):
- yield infered
- except InferenceError:
- ## XXX log error ?
- continue
-nodes.CallFunc._infer = path_wrapper(raise_if_nothing_infered(infer_callfunc))
-
-
-def infer_import(self, context=None, asname=True, lookupname=None):
- """infer an Import node: return the imported module/object"""
- if lookupname is None:
- raise InferenceError()
- if asname:
- yield self.do_import_module(self.real_name(lookupname))
- else:
- yield self.do_import_module(lookupname)
-nodes.Import._infer = path_wrapper(infer_import)
-
-def infer_name_module(self, name):
- context = InferenceContext()
- return self.infer(context, asname=False, lookupname=name)
-nodes.Import.infer_name_module = infer_name_module
-
-
-def infer_from(self, context=None, asname=True, lookupname=None):
- """infer a From nodes: return the imported module/object"""
- if lookupname is None:
- raise InferenceError()
- if asname:
- lookupname = self.real_name(lookupname)
- module = self.do_import_module()
- try:
- return _infer_stmts(module.getattr(lookupname, ignore_locals=module is self.root()), context, lookupname=lookupname)
- except NotFoundError:
- raise InferenceError(lookupname)
-nodes.From._infer = path_wrapper(infer_from)
-
-
-def infer_getattr(self, context=None):
- """infer a Getattr node by using getattr on the associated object"""
- if not context:
- context = InferenceContext()
- for owner in self.expr.infer(context):
- if owner is YES:
- yield owner
- continue
- try:
- with context.scope(boundnode=owner):
- for obj in owner.igetattr(self.attrname, context):
- yield obj
- except (NotFoundError, InferenceError):
- pass
- except AttributeError:
- # XXX method / function
- pass
-nodes.Getattr._infer = path_wrapper(raise_if_nothing_infered(infer_getattr))
-nodes.AssAttr.infer_lhs = raise_if_nothing_infered(infer_getattr) # # won't work with a path wrapper
-
-
-def infer_global(self, context=None, lookupname=None):
- if lookupname is None:
- raise InferenceError()
- try:
- return _infer_stmts(self.root().getattr(lookupname), context)
- except NotFoundError:
- raise InferenceError()
-nodes.Global._infer = path_wrapper(infer_global)
-
-
-def infer_subscript(self, context=None):
- """infer simple subscription such as [1,2,3][0] or (1,2,3)[-1]"""
- value = next(self.value.infer(context))
- if value is YES:
- yield YES
- return
-
- index = next(self.slice.infer(context))
- if index is YES:
- yield YES
- return
-
- if isinstance(index, nodes.Const):
- try:
- assigned = value.getitem(index.value, context)
- except AttributeError:
- raise InferenceError()
- except (IndexError, TypeError):
- yield YES
- return
-
- # Prevent inferring if the infered subscript
- # is the same as the original subscripted object.
- if self is assigned:
- yield YES
- return
- for infered in assigned.infer(context):
- yield infered
- else:
- raise InferenceError()
-nodes.Subscript._infer = path_wrapper(infer_subscript)
-nodes.Subscript.infer_lhs = raise_if_nothing_infered(infer_subscript)
-
-def infer_unaryop(self, context=None):
- for operand in self.operand.infer(context):
- try:
- yield operand.infer_unary_op(self.op)
- except TypeError:
- continue
- except AttributeError:
- meth = UNARY_OP_METHOD[self.op]
- if meth is None:
- yield YES
- else:
- try:
- # XXX just suppose if the type implement meth, returned type
- # will be the same
- operand.getattr(meth)
- yield operand
- except GeneratorExit:
- raise
- except:
- yield YES
-nodes.UnaryOp._infer = path_wrapper(infer_unaryop)
-
-def _infer_binop(operator, operand1, operand2, context, failures=None):
- if operand1 is YES:
- yield operand1
- return
- try:
- for valnode in operand1.infer_binary_op(operator, operand2, context):
- yield valnode
- except AttributeError:
- try:
- # XXX just suppose if the type implement meth, returned type
- # will be the same
- operand1.getattr(BIN_OP_METHOD[operator])
- yield operand1
- except:
- if failures is None:
- yield YES
- else:
- failures.append(operand1)
-
-def infer_binop(self, context=None):
- failures = []
- for lhs in self.left.infer(context):
- for val in _infer_binop(self.op, lhs, self.right, context, failures):
- yield val
- for lhs in failures:
- for rhs in self.right.infer(context):
- for val in _infer_binop(self.op, rhs, lhs, context):
- yield val
-nodes.BinOp._infer = path_wrapper(infer_binop)
-
-
-def infer_arguments(self, context=None, lookupname=None):
- if lookupname is None:
- raise InferenceError()
- return _arguments_infer_argname(self, lookupname, context)
-nodes.Arguments._infer = infer_arguments
-
-
-def infer_ass(self, context=None):
- """infer a AssName/AssAttr: need to inspect the RHS part of the
- assign node
- """
- stmt = self.statement()
- if isinstance(stmt, nodes.AugAssign):
- return stmt.infer(context)
- stmts = list(self.assigned_stmts(context=context))
- return _infer_stmts(stmts, context)
-nodes.AssName._infer = path_wrapper(infer_ass)
-nodes.AssAttr._infer = path_wrapper(infer_ass)
-
-def infer_augassign(self, context=None):
- failures = []
- for lhs in self.target.infer_lhs(context):
- for val in _infer_binop(self.op, lhs, self.value, context, failures):
- yield val
- for lhs in failures:
- for rhs in self.value.infer(context):
- for val in _infer_binop(self.op, rhs, lhs, context):
- yield val
-nodes.AugAssign._infer = path_wrapper(infer_augassign)
-
-
-# no infer method on DelName and DelAttr (expected InferenceError)
-
-
-def infer_empty_node(self, context=None):
- if not self.has_underlying_object():
- yield YES
- else:
- try:
- for infered in MANAGER.infer_ast_from_something(self.object,
- context=context):
- yield infered
- except AstroidError:
- yield YES
-nodes.EmptyNode._infer = path_wrapper(infer_empty_node)
-
-
-def infer_index(self, context=None):
- return self.value.infer(context)
-nodes.Index._infer = infer_index
diff --git a/chromium/third_party/logilab/logilab/astroid/inspector.py b/chromium/third_party/logilab/logilab/astroid/inspector.py
deleted file mode 100644
index 1fc319260ed..00000000000
--- a/chromium/third_party/logilab/logilab/astroid/inspector.py
+++ /dev/null
@@ -1,273 +0,0 @@
-# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of astroid.
-#
-# astroid is free software: you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as published by the
-# Free Software Foundation, either version 2.1 of the License, or (at your
-# option) any later version.
-#
-# astroid 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 Lesser General Public License
-# for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with astroid. If not, see <http://www.gnu.org/licenses/>.
-"""visitor doing some postprocessing on the astroid tree.
-Try to resolve definitions (namespace) dictionary, relationship...
-
-This module has been imported from pyreverse
-"""
-
-__docformat__ = "restructuredtext en"
-
-from os.path import dirname
-
-import astroid
-from astroid.exceptions import InferenceError
-from astroid.utils import LocalsVisitor
-from astroid.modutils import get_module_part, is_relative, is_standard_module
-
-class IdGeneratorMixIn(object):
- """
- Mixin adding the ability to generate integer uid
- """
- def __init__(self, start_value=0):
- self.id_count = start_value
-
- def init_counter(self, start_value=0):
- """init the id counter
- """
- self.id_count = start_value
-
- def generate_id(self):
- """generate a new identifier
- """
- self.id_count += 1
- return self.id_count
-
-
-class Linker(IdGeneratorMixIn, LocalsVisitor):
- """
- walk on the project tree and resolve relationships.
-
- According to options the following attributes may be added to visited nodes:
-
- * uid,
- a unique identifier for the node (on astroid.Project, astroid.Module,
- astroid.Class and astroid.locals_type). Only if the linker has been instantiated
- with tag=True parameter (False by default).
-
- * Function
- a mapping from locals names to their bounded value, which may be a
- constant like a string or an integer, or an astroid node (on astroid.Module,
- astroid.Class and astroid.Function).
-
- * instance_attrs_type
- as locals_type but for klass member attributes (only on astroid.Class)
-
- * implements,
- list of implemented interface _objects_ (only on astroid.Class nodes)
- """
-
- def __init__(self, project, inherited_interfaces=0, tag=False):
- IdGeneratorMixIn.__init__(self)
- LocalsVisitor.__init__(self)
- # take inherited interface in consideration or not
- self.inherited_interfaces = inherited_interfaces
- # tag nodes or not
- self.tag = tag
- # visited project
- self.project = project
-
-
- def visit_project(self, node):
- """visit an astroid.Project node
-
- * optionally tag the node with a unique id
- """
- if self.tag:
- node.uid = self.generate_id()
- for module in node.modules:
- self.visit(module)
-
- def visit_package(self, node):
- """visit an astroid.Package node
-
- * optionally tag the node with a unique id
- """
- if self.tag:
- node.uid = self.generate_id()
- for subelmt in node.values():
- self.visit(subelmt)
-
- def visit_module(self, node):
- """visit an astroid.Module node
-
- * set the locals_type mapping
- * set the depends mapping
- * optionally tag the node with a unique id
- """
- if hasattr(node, 'locals_type'):
- return
- node.locals_type = {}
- node.depends = []
- if self.tag:
- node.uid = self.generate_id()
-
- def visit_class(self, node):
- """visit an astroid.Class node
-
- * set the locals_type and instance_attrs_type mappings
- * set the implements list and build it
- * optionally tag the node with a unique id
- """
- if hasattr(node, 'locals_type'):
- return
- node.locals_type = {}
- if self.tag:
- node.uid = self.generate_id()
- # resolve ancestors
- for baseobj in node.ancestors(recurs=False):
- specializations = getattr(baseobj, 'specializations', [])
- specializations.append(node)
- baseobj.specializations = specializations
- # resolve instance attributes
- node.instance_attrs_type = {}
- for assattrs in node.instance_attrs.values():
- for assattr in assattrs:
- self.handle_assattr_type(assattr, node)
- # resolve implemented interface
- try:
- node.implements = list(node.interfaces(self.inherited_interfaces))
- except InferenceError:
- node.implements = ()
-
- def visit_function(self, node):
- """visit an astroid.Function node
-
- * set the locals_type mapping
- * optionally tag the node with a unique id
- """
- if hasattr(node, 'locals_type'):
- return
- node.locals_type = {}
- if self.tag:
- node.uid = self.generate_id()
-
- link_project = visit_project
- link_module = visit_module
- link_class = visit_class
- link_function = visit_function
-
- def visit_assname(self, node):
- """visit an astroid.AssName node
-
- handle locals_type
- """
- # avoid double parsing done by different Linkers.visit
- # running over the same project:
- if hasattr(node, '_handled'):
- return
- node._handled = True
- if node.name in node.frame():
- frame = node.frame()
- else:
- # the name has been defined as 'global' in the frame and belongs
- # there. Btw the frame is not yet visited as the name is in the
- # root locals; the frame hence has no locals_type attribute
- frame = node.root()
- try:
- values = node.infered()
- try:
- already_infered = frame.locals_type[node.name]
- for valnode in values:
- if not valnode in already_infered:
- already_infered.append(valnode)
- except KeyError:
- frame.locals_type[node.name] = values
- except astroid.InferenceError:
- pass
-
- def handle_assattr_type(self, node, parent):
- """handle an astroid.AssAttr node
-
- handle instance_attrs_type
- """
- try:
- values = list(node.infer())
- try:
- already_infered = parent.instance_attrs_type[node.attrname]
- for valnode in values:
- if not valnode in already_infered:
- already_infered.append(valnode)
- except KeyError:
- parent.instance_attrs_type[node.attrname] = values
- except astroid.InferenceError:
- pass
-
- def visit_import(self, node):
- """visit an astroid.Import node
-
- resolve module dependencies
- """
- context_file = node.root().file
- for name in node.names:
- relative = is_relative(name[0], context_file)
- self._imported_module(node, name[0], relative)
-
-
- def visit_from(self, node):
- """visit an astroid.From node
-
- resolve module dependencies
- """
- basename = node.modname
- context_file = node.root().file
- if context_file is not None:
- relative = is_relative(basename, context_file)
- else:
- relative = False
- for name in node.names:
- if name[0] == '*':
- continue
- # analyze dependencies
- fullname = '%s.%s' % (basename, name[0])
- if fullname.find('.') > -1:
- try:
- # XXX: don't use get_module_part, missing package precedence
- fullname = get_module_part(fullname, context_file)
- except ImportError:
- continue
- if fullname != basename:
- self._imported_module(node, fullname, relative)
-
-
- def compute_module(self, context_name, mod_path):
- """return true if the module should be added to dependencies"""
- package_dir = dirname(self.project.path)
- if context_name == mod_path:
- return 0
- elif is_standard_module(mod_path, (package_dir,)):
- return 1
- return 0
-
- # protected methods ########################################################
-
- def _imported_module(self, node, mod_path, relative):
- """notify an imported module, used to analyze dependencies
- """
- module = node.root()
- context_name = module.name
- if relative:
- mod_path = '%s.%s' % ('.'.join(context_name.split('.')[:-1]),
- mod_path)
- if self.compute_module(context_name, mod_path):
- # handle dependencies
- if not hasattr(module, 'depends'):
- module.depends = []
- mod_paths = module.depends
- if not mod_path in mod_paths:
- mod_paths.append(mod_path)
diff --git a/chromium/third_party/logilab/logilab/astroid/manager.py b/chromium/third_party/logilab/logilab/astroid/manager.py
deleted file mode 100644
index fe787136d42..00000000000
--- a/chromium/third_party/logilab/logilab/astroid/manager.py
+++ /dev/null
@@ -1,390 +0,0 @@
-# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of astroid.
-#
-# astroid is free software: you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as published by the
-# Free Software Foundation, either version 2.1 of the License, or (at your
-# option) any later version.
-#
-# astroid 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 Lesser General Public License
-# for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with astroid. If not, see <http://www.gnu.org/licenses/>.
-"""astroid manager: avoid multiple astroid build of a same module when
-possible by providing a class responsible to get astroid representation
-from various source and using a cache of built modules)
-"""
-from __future__ import print_function
-
-__docformat__ = "restructuredtext en"
-
-import collections
-import imp
-import os
-from os.path import dirname, join, isdir, exists
-from warnings import warn
-import zipimport
-
-from logilab.common.configuration import OptionsProviderMixIn
-
-from astroid.exceptions import AstroidBuildingException
-from astroid import modutils
-
-
-def astroid_wrapper(func, modname):
- """wrapper to give to AstroidManager.project_from_files"""
- print('parsing %s...' % modname)
- try:
- return func(modname)
- except AstroidBuildingException as exc:
- print(exc)
- except Exception as exc:
- import traceback
- traceback.print_exc()
-
-def _silent_no_wrap(func, modname):
- """silent wrapper that doesn't do anything; can be used for tests"""
- return func(modname)
-
-def safe_repr(obj):
- try:
- return repr(obj)
- except:
- return '???'
-
-
-
-class AstroidManager(OptionsProviderMixIn):
- """the astroid manager, responsible to build astroid from files
- or modules.
-
- Use the Borg pattern.
- """
-
- name = 'astroid loader'
- options = (("ignore",
- {'type' : "csv", 'metavar' : "<file>",
- 'dest' : "black_list", "default" : ('CVS',),
- 'help' : "add <file> (may be a directory) to the black list\
-. It should be a base name, not a path. You may set this option multiple times\
-."}),
- ("project",
- {'default': "No Name", 'type' : 'string', 'short': 'p',
- 'metavar' : '<project name>',
- 'help' : 'set the project name.'}),
- )
- brain = {}
- def __init__(self):
- self.__dict__ = AstroidManager.brain
- if not self.__dict__:
- OptionsProviderMixIn.__init__(self)
- self.load_defaults()
- # NOTE: cache entries are added by the [re]builder
- self.astroid_cache = {}
- self._mod_file_cache = {}
- self.transforms = collections.defaultdict(list)
- self._failed_import_hooks = []
- self.always_load_extensions = False
- self.extension_package_whitelist = set()
-
- def ast_from_file(self, filepath, modname=None, fallback=True, source=False):
- """given a module name, return the astroid object"""
- try:
- filepath = modutils.get_source_file(filepath, include_no_ext=True)
- source = True
- except modutils.NoSourceFile:
- pass
- if modname is None:
- try:
- modname = '.'.join(modutils.modpath_from_file(filepath))
- except ImportError:
- modname = filepath
- if modname in self.astroid_cache and self.astroid_cache[modname].file == filepath:
- return self.astroid_cache[modname]
- if source:
- from astroid.builder import AstroidBuilder
- return AstroidBuilder(self).file_build(filepath, modname)
- elif fallback and modname:
- return self.ast_from_module_name(modname)
- raise AstroidBuildingException('unable to get astroid for file %s' %
- filepath)
-
- def _build_stub_module(self, modname):
- from astroid.builder import AstroidBuilder
- return AstroidBuilder(self).string_build('', modname)
-
- def _can_load_extension(self, modname):
- if self.always_load_extensions:
- return True
- if modutils.is_standard_module(modname):
- return True
- parts = modname.split('.')
- return any(
- '.'.join(parts[:x]) in self.extension_package_whitelist
- for x in range(1, len(parts) + 1))
-
- def ast_from_module_name(self, modname, context_file=None):
- """given a module name, return the astroid object"""
- if modname in self.astroid_cache:
- return self.astroid_cache[modname]
- if modname == '__main__':
- return self._build_stub_module(modname)
- old_cwd = os.getcwd()
- if context_file:
- os.chdir(dirname(context_file))
- try:
- filepath, mp_type = self.file_from_module_name(modname, context_file)
- if mp_type == modutils.PY_ZIPMODULE:
- module = self.zip_import_data(filepath)
- if module is not None:
- return module
- elif mp_type in (imp.C_BUILTIN, imp.C_EXTENSION):
- if mp_type == imp.C_EXTENSION and not self._can_load_extension(modname):
- return self._build_stub_module(modname)
- try:
- module = modutils.load_module_from_name(modname)
- except Exception as ex:
- msg = 'Unable to load module %s (%s)' % (modname, ex)
- raise AstroidBuildingException(msg)
- return self.ast_from_module(module, modname)
- elif mp_type == imp.PY_COMPILED:
- raise AstroidBuildingException("Unable to load compiled module %s" % (modname,))
- if filepath is None:
- raise AstroidBuildingException("Unable to load module %s" % (modname,))
- return self.ast_from_file(filepath, modname, fallback=False)
- except AstroidBuildingException as e:
- for hook in self._failed_import_hooks:
- try:
- return hook(modname)
- except AstroidBuildingException:
- pass
- raise e
- finally:
- os.chdir(old_cwd)
-
- def zip_import_data(self, filepath):
- if zipimport is None:
- return None
- from astroid.builder import AstroidBuilder
- builder = AstroidBuilder(self)
- for ext in ('.zip', '.egg'):
- try:
- eggpath, resource = filepath.rsplit(ext + os.path.sep, 1)
- except ValueError:
- continue
- try:
- importer = zipimport.zipimporter(eggpath + ext)
- zmodname = resource.replace(os.path.sep, '.')
- if importer.is_package(resource):
- zmodname = zmodname + '.__init__'
- module = builder.string_build(importer.get_source(resource),
- zmodname, filepath)
- return module
- except:
- continue
- return None
-
- def file_from_module_name(self, modname, contextfile):
- try:
- value = self._mod_file_cache[(modname, contextfile)]
- except KeyError:
- try:
- value = modutils.file_info_from_modpath(
- modname.split('.'), context_file=contextfile)
- except ImportError as ex:
- msg = 'Unable to load module %s (%s)' % (modname, ex)
- value = AstroidBuildingException(msg)
- self._mod_file_cache[(modname, contextfile)] = value
- if isinstance(value, AstroidBuildingException):
- raise value
- return value
-
- def ast_from_module(self, module, modname=None):
- """given an imported module, return the astroid object"""
- modname = modname or module.__name__
- if modname in self.astroid_cache:
- return self.astroid_cache[modname]
- try:
- # some builtin modules don't have __file__ attribute
- filepath = module.__file__
- if modutils.is_python_source(filepath):
- return self.ast_from_file(filepath, modname)
- except AttributeError:
- pass
- from astroid.builder import AstroidBuilder
- return AstroidBuilder(self).module_build(module, modname)
-
- def ast_from_class(self, klass, modname=None):
- """get astroid for the given class"""
- if modname is None:
- try:
- modname = klass.__module__
- except AttributeError:
- raise AstroidBuildingException(
- 'Unable to get module for class %s' % safe_repr(klass))
- modastroid = self.ast_from_module_name(modname)
- return modastroid.getattr(klass.__name__)[0] # XXX
-
-
- def infer_ast_from_something(self, obj, context=None):
- """infer astroid for the given class"""
- if hasattr(obj, '__class__') and not isinstance(obj, type):
- klass = obj.__class__
- else:
- klass = obj
- try:
- modname = klass.__module__
- except AttributeError:
- raise AstroidBuildingException(
- 'Unable to get module for %s' % safe_repr(klass))
- except Exception as ex:
- raise AstroidBuildingException(
- 'Unexpected error while retrieving module for %s: %s'
- % (safe_repr(klass), ex))
- try:
- name = klass.__name__
- except AttributeError:
- raise AstroidBuildingException(
- 'Unable to get name for %s' % safe_repr(klass))
- except Exception as ex:
- raise AstroidBuildingException(
- 'Unexpected error while retrieving name for %s: %s'
- % (safe_repr(klass), ex))
- # take care, on living object __module__ is regularly wrong :(
- modastroid = self.ast_from_module_name(modname)
- if klass is obj:
- for infered in modastroid.igetattr(name, context):
- yield infered
- else:
- for infered in modastroid.igetattr(name, context):
- yield infered.instanciate_class()
-
- def project_from_files(self, files, func_wrapper=astroid_wrapper,
- project_name=None, black_list=None):
- """return a Project from a list of files or modules"""
- # build the project representation
- project_name = project_name or self.config.project
- black_list = black_list or self.config.black_list
- project = Project(project_name)
- for something in files:
- if not exists(something):
- fpath = modutils.file_from_modpath(something.split('.'))
- elif isdir(something):
- fpath = join(something, '__init__.py')
- else:
- fpath = something
- astroid = func_wrapper(self.ast_from_file, fpath)
- if astroid is None:
- continue
- # XXX why is first file defining the project.path ?
- project.path = project.path or astroid.file
- project.add_module(astroid)
- base_name = astroid.name
- # recurse in package except if __init__ was explicitly given
- if astroid.package and something.find('__init__') == -1:
- # recurse on others packages / modules if this is a package
- for fpath in modutils.get_module_files(dirname(astroid.file),
- black_list):
- astroid = func_wrapper(self.ast_from_file, fpath)
- if astroid is None or astroid.name == base_name:
- continue
- project.add_module(astroid)
- return project
-
- def register_transform(self, node_class, transform, predicate=None):
- """Register `transform(node)` function to be applied on the given
- Astroid's `node_class` if `predicate` is None or returns true
- when called with the node as argument.
-
- The transform function may return a value which is then used to
- substitute the original node in the tree.
- """
- self.transforms[node_class].append((transform, predicate))
-
- def unregister_transform(self, node_class, transform, predicate=None):
- """Unregister the given transform."""
- self.transforms[node_class].remove((transform, predicate))
-
- def register_failed_import_hook(self, hook):
- """Registers a hook to resolve imports that cannot be found otherwise.
-
- `hook` must be a function that accepts a single argument `modname` which
- contains the name of the module or package that could not be imported.
- If `hook` can resolve the import, must return a node of type `astroid.Module`,
- otherwise, it must raise `AstroidBuildingException`.
- """
- self._failed_import_hooks.append(hook)
-
- def transform(self, node):
- """Call matching transforms for the given node if any and return the
- transformed node.
- """
- cls = node.__class__
- if cls not in self.transforms:
- # no transform registered for this class of node
- return node
-
- transforms = self.transforms[cls]
- orig_node = node # copy the reference
- for transform_func, predicate in transforms:
- if predicate is None or predicate(node):
- ret = transform_func(node)
- # if the transformation function returns something, it's
- # expected to be a replacement for the node
- if ret is not None:
- if node is not orig_node:
- # node has already be modified by some previous
- # transformation, warn about it
- warn('node %s substituted multiple times' % node)
- node = ret
- return node
-
- def cache_module(self, module):
- """Cache a module if no module with the same name is known yet."""
- self.astroid_cache.setdefault(module.name, module)
-
- def clear_cache(self, astroid_builtin=None):
- # XXX clear transforms
- self.astroid_cache.clear()
- # force bootstrap again, else we may ends up with cache inconsistency
- # between the manager and CONST_PROXY, making
- # unittest_lookup.LookupTC.test_builtin_lookup fail depending on the
- # test order
- import astroid.raw_building
- astroid.raw_building._astroid_bootstrapping(
- astroid_builtin=astroid_builtin)
-
-
-class Project(object):
- """a project handle a set of modules / packages"""
- def __init__(self, name=''):
- self.name = name
- self.path = None
- self.modules = []
- self.locals = {}
- self.__getitem__ = self.locals.__getitem__
- self.__iter__ = self.locals.__iter__
- self.values = self.locals.values
- self.keys = self.locals.keys
- self.items = self.locals.items
-
- def add_module(self, node):
- self.locals[node.name] = node
- self.modules.append(node)
-
- def get_module(self, name):
- return self.locals[name]
-
- def get_children(self):
- return self.modules
-
- def __repr__(self):
- return '<Project %r at %s (%s modules)>' % (self.name, id(self),
- len(self.modules))
-
-
diff --git a/chromium/third_party/logilab/logilab/astroid/mixins.py b/chromium/third_party/logilab/logilab/astroid/mixins.py
deleted file mode 100644
index dbf1673a321..00000000000
--- a/chromium/third_party/logilab/logilab/astroid/mixins.py
+++ /dev/null
@@ -1,124 +0,0 @@
-# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of astroid.
-#
-# astroid is free software: you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as published by the
-# Free Software Foundation, either version 2.1 of the License, or (at your
-# option) any later version.
-#
-# astroid 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 Lesser General Public License
-# for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with astroid. If not, see <http://www.gnu.org/licenses/>.
-"""This module contains some mixins for the different nodes.
-"""
-
-from logilab.common.decorators import cachedproperty
-
-from astroid.exceptions import (AstroidBuildingException, InferenceError,
- NotFoundError)
-
-
-class BlockRangeMixIn(object):
- """override block range """
-
- @cachedproperty
- def blockstart_tolineno(self):
- return self.lineno
-
- def _elsed_block_range(self, lineno, orelse, last=None):
- """handle block line numbers range for try/finally, for, if and while
- statements
- """
- if lineno == self.fromlineno:
- return lineno, lineno
- if orelse:
- if lineno >= orelse[0].fromlineno:
- return lineno, orelse[-1].tolineno
- return lineno, orelse[0].fromlineno - 1
- return lineno, last or self.tolineno
-
-
-class FilterStmtsMixin(object):
- """Mixin for statement filtering and assignment type"""
-
- def _get_filtered_stmts(self, _, node, _stmts, mystmt):
- """method used in _filter_stmts to get statemtents and trigger break"""
- if self.statement() is mystmt:
- # original node's statement is the assignment, only keep
- # current node (gen exp, list comp)
- return [node], True
- return _stmts, False
-
- def ass_type(self):
- return self
-
-
-class AssignTypeMixin(object):
-
- def ass_type(self):
- return self
-
- def _get_filtered_stmts(self, lookup_node, node, _stmts, mystmt):
- """method used in filter_stmts"""
- if self is mystmt:
- return _stmts, True
- if self.statement() is mystmt:
- # original node's statement is the assignment, only keep
- # current node (gen exp, list comp)
- return [node], True
- return _stmts, False
-
-
-class ParentAssignTypeMixin(AssignTypeMixin):
-
- def ass_type(self):
- return self.parent.ass_type()
-
-
-class FromImportMixIn(FilterStmtsMixin):
- """MixIn for From and Import Nodes"""
-
- def _infer_name(self, frame, name):
- return name
-
- def do_import_module(self, modname=None):
- """return the ast for a module whose name is <modname> imported by <self>
- """
- # handle special case where we are on a package node importing a module
- # using the same name as the package, which may end in an infinite loop
- # on relative imports
- # XXX: no more needed ?
- mymodule = self.root()
- level = getattr(self, 'level', None) # Import as no level
- if modname is None:
- modname = self.modname
- # XXX we should investigate deeper if we really want to check
- # importing itself: modname and mymodule.name be relative or absolute
- if mymodule.relative_to_absolute_name(modname, level) == mymodule.name:
- # FIXME: we used to raise InferenceError here, but why ?
- return mymodule
- try:
- return mymodule.import_module(modname, level=level)
- except AstroidBuildingException:
- raise InferenceError(modname)
- except SyntaxError as ex:
- raise InferenceError(str(ex))
-
- def real_name(self, asname):
- """get name from 'as' name"""
- for name, _asname in self.names:
- if name == '*':
- return asname
- if not _asname:
- name = name.split('.', 1)[0]
- _asname = name
- if asname == _asname:
- return name
- raise NotFoundError(asname)
-
diff --git a/chromium/third_party/logilab/logilab/astroid/modutils.py b/chromium/third_party/logilab/logilab/astroid/modutils.py
deleted file mode 100644
index 68a2086dc4d..00000000000
--- a/chromium/third_party/logilab/logilab/astroid/modutils.py
+++ /dev/null
@@ -1,670 +0,0 @@
-# copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of astroid.
-#
-# astroid is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# astroid 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with astroid. If not, see <http://www.gnu.org/licenses/>.
-"""Python modules manipulation utility functions.
-
-:type PY_SOURCE_EXTS: tuple(str)
-:var PY_SOURCE_EXTS: list of possible python source file extension
-
-:type STD_LIB_DIRS: set of str
-:var STD_LIB_DIRS: directories where standard modules are located
-
-:type BUILTIN_MODULES: dict
-:var BUILTIN_MODULES: dictionary with builtin module names has key
-"""
-from __future__ import with_statement
-
-__docformat__ = "restructuredtext en"
-
-import imp
-import os
-import sys
-from distutils.sysconfig import get_python_lib
-from distutils.errors import DistutilsPlatformError
-import zipimport
-
-try:
- import pkg_resources
-except ImportError:
- pkg_resources = None
-
-from logilab.common import _handle_blacklist
-
-PY_ZIPMODULE = object()
-
-if sys.platform.startswith('win'):
- PY_SOURCE_EXTS = ('py', 'pyw')
- PY_COMPILED_EXTS = ('dll', 'pyd')
-else:
- PY_SOURCE_EXTS = ('py',)
- PY_COMPILED_EXTS = ('so',)
-
-# Notes about STD_LIB_DIRS
-# Consider arch-specific installation for STD_LIB_DIRS definition
-# :mod:`distutils.sysconfig` contains to much hardcoded values to rely on
-#
-# :see: `Problems with /usr/lib64 builds <http://bugs.python.org/issue1294959>`_
-# :see: `FHS <http://www.pathname.com/fhs/pub/fhs-2.3.html#LIBLTQUALGTALTERNATEFORMATESSENTIAL>`_
-try:
- # The explicit sys.prefix is to work around a patch in virtualenv that
- # replaces the 'real' sys.prefix (i.e. the location of the binary)
- # with the prefix from which the virtualenv was created. This throws
- # off the detection logic for standard library modules, thus the
- # workaround.
- STD_LIB_DIRS = {
- get_python_lib(standard_lib=True, prefix=sys.prefix),
- # Take care of installations where exec_prefix != prefix.
- get_python_lib(standard_lib=True, prefix=sys.exec_prefix),
- get_python_lib(standard_lib=True)}
- if os.name == 'nt':
- STD_LIB_DIRS.add(os.path.join(sys.prefix, 'dlls'))
- try:
- # real_prefix is defined when running inside virtualenv.
- STD_LIB_DIRS.add(os.path.join(sys.real_prefix, 'dlls'))
- except AttributeError:
- pass
-# get_python_lib(standard_lib=1) is not available on pypy, set STD_LIB_DIR to
-# non-valid path, see https://bugs.pypy.org/issue1164
-except DistutilsPlatformError:
- STD_LIB_DIRS = set()
-
-EXT_LIB_DIR = get_python_lib()
-
-BUILTIN_MODULES = dict(zip(sys.builtin_module_names,
- [1]*len(sys.builtin_module_names)))
-
-
-class NoSourceFile(Exception):
- """exception raised when we are not able to get a python
- source file for a precompiled file
- """
-
-def _normalize_path(path):
- return os.path.normcase(os.path.abspath(path))
-
-
-_NORM_PATH_CACHE = {}
-
-def _cache_normalize_path(path):
- """abspath with caching"""
- # _module_file calls abspath on every path in sys.path every time it's
- # called; on a larger codebase this easily adds up to half a second just
- # assembling path components. This cache alleviates that.
- try:
- return _NORM_PATH_CACHE[path]
- except KeyError:
- if not path: # don't cache result for ''
- return _normalize_path(path)
- result = _NORM_PATH_CACHE[path] = _normalize_path(path)
- return result
-
-def load_module_from_name(dotted_name, path=None, use_sys=1):
- """Load a Python module from its name.
-
- :type dotted_name: str
- :param dotted_name: python name of a module or package
-
- :type path: list or None
- :param path:
- optional list of path where the module or package should be
- searched (use sys.path if nothing or None is given)
-
- :type use_sys: bool
- :param use_sys:
- boolean indicating whether the sys.modules dictionary should be
- used or not
-
-
- :raise ImportError: if the module or package is not found
-
- :rtype: module
- :return: the loaded module
- """
- return load_module_from_modpath(dotted_name.split('.'), path, use_sys)
-
-
-def load_module_from_modpath(parts, path=None, use_sys=1):
- """Load a python module from its splitted name.
-
- :type parts: list(str) or tuple(str)
- :param parts:
- python name of a module or package splitted on '.'
-
- :type path: list or None
- :param path:
- optional list of path where the module or package should be
- searched (use sys.path if nothing or None is given)
-
- :type use_sys: bool
- :param use_sys:
- boolean indicating whether the sys.modules dictionary should be used or not
-
- :raise ImportError: if the module or package is not found
-
- :rtype: module
- :return: the loaded module
- """
- if use_sys:
- try:
- return sys.modules['.'.join(parts)]
- except KeyError:
- pass
- modpath = []
- prevmodule = None
- for part in parts:
- modpath.append(part)
- curname = '.'.join(modpath)
- module = None
- if len(modpath) != len(parts):
- # even with use_sys=False, should try to get outer packages from sys.modules
- module = sys.modules.get(curname)
- elif use_sys:
- # because it may have been indirectly loaded through a parent
- module = sys.modules.get(curname)
- if module is None:
- mp_file, mp_filename, mp_desc = imp.find_module(part, path)
- module = imp.load_module(curname, mp_file, mp_filename, mp_desc)
- # mp_file still needs to be closed.
- if mp_file:
- mp_file.close()
- if prevmodule:
- setattr(prevmodule, part, module)
- _file = getattr(module, '__file__', '')
- if not _file and len(modpath) != len(parts):
- raise ImportError('no module in %s' % '.'.join(parts[len(modpath):]))
- path = [os.path.dirname(_file)]
- prevmodule = module
- return module
-
-
-def load_module_from_file(filepath, path=None, use_sys=1, extrapath=None):
- """Load a Python module from it's path.
-
- :type filepath: str
- :param filepath: path to the python module or package
-
- :type path: list or None
- :param path:
- optional list of path where the module or package should be
- searched (use sys.path if nothing or None is given)
-
- :type use_sys: bool
- :param use_sys:
- boolean indicating whether the sys.modules dictionary should be
- used or not
-
-
- :raise ImportError: if the module or package is not found
-
- :rtype: module
- :return: the loaded module
- """
- modpath = modpath_from_file(filepath, extrapath)
- return load_module_from_modpath(modpath, path, use_sys)
-
-
-def _check_init(path, mod_path):
- """check there are some __init__.py all along the way"""
- for part in mod_path:
- path = os.path.join(path, part)
- if not _has_init(path):
- return False
- return True
-
-
-def modpath_from_file(filename, extrapath=None):
- """given a file path return the corresponding splitted module's name
- (i.e name of a module or package splitted on '.')
-
- :type filename: str
- :param filename: file's path for which we want the module's name
-
- :type extrapath: dict
- :param extrapath:
- optional extra search path, with path as key and package name for the path
- as value. This is usually useful to handle package splitted in multiple
- directories using __path__ trick.
-
-
- :raise ImportError:
- if the corresponding module's name has not been found
-
- :rtype: list(str)
- :return: the corresponding splitted module's name
- """
- base = os.path.splitext(os.path.abspath(filename))[0]
- if extrapath is not None:
- for path_ in extrapath:
- path = os.path.abspath(path_)
- if path and os.path.normcase(base[:len(path)]) == os.path.normcase(path):
- submodpath = [pkg for pkg in base[len(path):].split(os.sep)
- if pkg]
- if _check_init(path, submodpath[:-1]):
- return extrapath[path_].split('.') + submodpath
- for path in sys.path:
- path = _cache_normalize_path(path)
- if path and os.path.normcase(base).startswith(path):
- modpath = [pkg for pkg in base[len(path):].split(os.sep) if pkg]
- if _check_init(path, modpath[:-1]):
- return modpath
- raise ImportError('Unable to find module for %s in %s' % (
- filename, ', \n'.join(sys.path)))
-
-
-def file_from_modpath(modpath, path=None, context_file=None):
- return file_info_from_modpath(modpath, path, context_file)[0]
-
-def file_info_from_modpath(modpath, path=None, context_file=None):
- """given a mod path (i.e. splitted module / package name), return the
- corresponding file, giving priority to source file over precompiled
- file if it exists
-
- :type modpath: list or tuple
- :param modpath:
- splitted module's name (i.e name of a module or package splitted
- on '.')
- (this means explicit relative imports that start with dots have
- empty strings in this list!)
-
- :type path: list or None
- :param path:
- optional list of path where the module or package should be
- searched (use sys.path if nothing or None is given)
-
- :type context_file: str or None
- :param context_file:
- context file to consider, necessary if the identifier has been
- introduced using a relative import unresolvable in the actual
- context (i.e. modutils)
-
- :raise ImportError: if there is no such module in the directory
-
- :rtype: (str or None, import type)
- :return:
- the path to the module's file or None if it's an integrated
- builtin module such as 'sys'
- """
- if context_file is not None:
- context = os.path.dirname(context_file)
- else:
- context = context_file
- if modpath[0] == 'xml':
- # handle _xmlplus
- try:
- return _file_from_modpath(['_xmlplus'] + modpath[1:], path, context)
- except ImportError:
- return _file_from_modpath(modpath, path, context)
- elif modpath == ['os', 'path']:
- # FIXME: currently ignoring search_path...
- return os.path.__file__, imp.PY_SOURCE
- return _file_from_modpath(modpath, path, context)
-
-
-def get_module_part(dotted_name, context_file=None):
- """given a dotted name return the module part of the name :
-
- >>> get_module_part('logilab.common.modutils.get_module_part')
- 'logilab.common.modutils'
-
- :type dotted_name: str
- :param dotted_name: full name of the identifier we are interested in
-
- :type context_file: str or None
- :param context_file:
- context file to consider, necessary if the identifier has been
- introduced using a relative import unresolvable in the actual
- context (i.e. modutils)
-
-
- :raise ImportError: if there is no such module in the directory
-
- :rtype: str or None
- :return:
- the module part of the name or None if we have not been able at
- all to import the given name
-
- XXX: deprecated, since it doesn't handle package precedence over module
- (see #10066)
- """
- # os.path trick
- if dotted_name.startswith('os.path'):
- return 'os.path'
- parts = dotted_name.split('.')
- if context_file is not None:
- # first check for builtin module which won't be considered latter
- # in that case (path != None)
- if parts[0] in BUILTIN_MODULES:
- if len(parts) > 2:
- raise ImportError(dotted_name)
- return parts[0]
- # don't use += or insert, we want a new list to be created !
- path = None
- starti = 0
- if parts[0] == '':
- assert context_file is not None, \
- 'explicit relative import, but no context_file?'
- path = [] # prevent resolving the import non-relatively
- starti = 1
- while parts[starti] == '': # for all further dots: change context
- starti += 1
- context_file = os.path.dirname(context_file)
- for i in range(starti, len(parts)):
- try:
- file_from_modpath(parts[starti:i+1], path=path,
- context_file=context_file)
- except ImportError:
- if not i >= max(1, len(parts) - 2):
- raise
- return '.'.join(parts[:i])
- return dotted_name
-
-
-def get_module_files(src_directory, blacklist):
- """given a package directory return a list of all available python
- module's files in the package and its subpackages
-
- :type src_directory: str
- :param src_directory:
- path of the directory corresponding to the package
-
- :type blacklist: list or tuple
- :param blacklist:
- optional list of files or directory to ignore, default to the value of
- `logilab.common.STD_BLACKLIST`
-
- :rtype: list
- :return:
- the list of all available python module's files in the package and
- its subpackages
- """
- files = []
- for directory, dirnames, filenames in os.walk(src_directory):
- _handle_blacklist(blacklist, dirnames, filenames)
- # check for __init__.py
- if not '__init__.py' in filenames:
- dirnames[:] = ()
- continue
- for filename in filenames:
- if _is_python_file(filename):
- src = os.path.join(directory, filename)
- files.append(src)
- return files
-
-
-def get_source_file(filename, include_no_ext=False):
- """given a python module's file name return the matching source file
- name (the filename will be returned identically if it's a already an
- absolute path to a python source file...)
-
- :type filename: str
- :param filename: python module's file name
-
-
- :raise NoSourceFile: if no source file exists on the file system
-
- :rtype: str
- :return: the absolute path of the source file if it exists
- """
- base, orig_ext = os.path.splitext(os.path.abspath(filename))
- for ext in PY_SOURCE_EXTS:
- source_path = '%s.%s' % (base, ext)
- if os.path.exists(source_path):
- return source_path
- if include_no_ext and not orig_ext and os.path.exists(base):
- return base
- raise NoSourceFile(filename)
-
-
-def is_python_source(filename):
- """
- rtype: bool
- return: True if the filename is a python source file
- """
- return os.path.splitext(filename)[1][1:] in PY_SOURCE_EXTS
-
-
-def is_standard_module(modname, std_path=None):
- """try to guess if a module is a standard python module (by default,
- see `std_path` parameter's description)
-
- :type modname: str
- :param modname: name of the module we are interested in
-
- :type std_path: list(str) or tuple(str)
- :param std_path: list of path considered has standard
-
-
- :rtype: bool
- :return:
- true if the module:
- - is located on the path listed in one of the directory in `std_path`
- - is a built-in module
- """
- modname = modname.split('.')[0]
- try:
- filename = file_from_modpath([modname])
- except ImportError:
- # import failed, i'm probably not so wrong by supposing it's
- # not standard...
- return False
- # modules which are not living in a file are considered standard
- # (sys and __builtin__ for instance)
- if filename is None:
- return True
- filename = _normalize_path(filename)
- if filename.startswith(_cache_normalize_path(EXT_LIB_DIR)):
- return False
- if std_path is None:
- std_path = STD_LIB_DIRS
- for path in std_path:
- if filename.startswith(_cache_normalize_path(path)):
- return True
- return False
-
-
-
-def is_relative(modname, from_file):
- """return true if the given module name is relative to the given
- file name
-
- :type modname: str
- :param modname: name of the module we are interested in
-
- :type from_file: str
- :param from_file:
- path of the module from which modname has been imported
-
- :rtype: bool
- :return:
- true if the module has been imported relatively to `from_file`
- """
- if not os.path.isdir(from_file):
- from_file = os.path.dirname(from_file)
- if from_file in sys.path:
- return False
- try:
- stream, _, _ = imp.find_module(modname.split('.')[0], [from_file])
-
- # Close the stream to avoid ResourceWarnings.
- if stream:
- stream.close()
- return True
- except ImportError:
- return False
-
-
-# internal only functions #####################################################
-
-def _file_from_modpath(modpath, path=None, context=None):
- """given a mod path (i.e. splitted module / package name), return the
- corresponding file
-
- this function is used internally, see `file_from_modpath`'s
- documentation for more information
- """
- assert len(modpath) > 0
- if context is not None:
- try:
- mtype, mp_filename = _module_file(modpath, [context])
- except ImportError:
- mtype, mp_filename = _module_file(modpath, path)
- else:
- mtype, mp_filename = _module_file(modpath, path)
- if mtype == imp.PY_COMPILED:
- try:
- return get_source_file(mp_filename), imp.PY_SOURCE
- except NoSourceFile:
- return mp_filename, imp.PY_COMPILED
- elif mtype == imp.C_BUILTIN:
- # integrated builtin module
- return None, imp.C_BUILTIN
- elif mtype == imp.PKG_DIRECTORY:
- mp_filename = _has_init(mp_filename)
- mtype = imp.PY_SOURCE
- return mp_filename, mtype
-
-def _search_zip(modpath, pic):
- for filepath, importer in pic.items():
- if importer is not None:
- if importer.find_module(modpath[0]):
- if not importer.find_module(os.path.sep.join(modpath)):
- raise ImportError('No module named %s in %s/%s' % (
- '.'.join(modpath[1:]), filepath, modpath))
- return PY_ZIPMODULE, os.path.abspath(filepath) + os.path.sep + os.path.sep.join(modpath), filepath
- raise ImportError('No module named %s' % '.'.join(modpath))
-
-
-def _module_file(modpath, path=None):
- """get a module type / file path
-
- :type modpath: list or tuple
- :param modpath:
- splitted module's name (i.e name of a module or package splitted
- on '.'), with leading empty strings for explicit relative import
-
- :type path: list or None
- :param path:
- optional list of path where the module or package should be
- searched (use sys.path if nothing or None is given)
-
-
- :rtype: tuple(int, str)
- :return: the module type flag and the file path for a module
- """
- # egg support compat
- try:
- pic = sys.path_importer_cache
- _path = (path is None and sys.path or path)
- for __path in _path:
- if not __path in pic:
- try:
- pic[__path] = zipimport.zipimporter(__path)
- except zipimport.ZipImportError:
- pic[__path] = None
- checkeggs = True
- except AttributeError:
- checkeggs = False
- # pkg_resources support (aka setuptools namespace packages)
- if (pkg_resources is not None
- and modpath[0] in pkg_resources._namespace_packages
- and modpath[0] in sys.modules
- and len(modpath) > 1):
- # setuptools has added into sys.modules a module object with proper
- # __path__, get back information from there
- module = sys.modules[modpath.pop(0)]
- path = module.__path__
- imported = []
- while modpath:
- modname = modpath[0]
- # take care to changes in find_module implementation wrt builtin modules
- #
- # Python 2.6.6 (r266:84292, Sep 11 2012, 08:34:23)
- # >>> imp.find_module('posix')
- # (None, 'posix', ('', '', 6))
- #
- # Python 3.3.1 (default, Apr 26 2013, 12:08:46)
- # >>> imp.find_module('posix')
- # (None, None, ('', '', 6))
- try:
- stream, mp_filename, mp_desc = imp.find_module(modname, path)
- except ImportError:
- if checkeggs:
- return _search_zip(modpath, pic)[:2]
- raise
- else:
- # Don't forget to close the stream to avoid
- # spurious ResourceWarnings.
- if stream:
- stream.close()
-
- if checkeggs and mp_filename:
- fullabspath = [_cache_normalize_path(x) for x in _path]
- try:
- pathindex = fullabspath.index(os.path.dirname(_normalize_path(mp_filename)))
- emtype, emp_filename, zippath = _search_zip(modpath, pic)
- if pathindex > _path.index(zippath):
- # an egg takes priority
- return emtype, emp_filename
- except ValueError:
- # XXX not in _path
- pass
- except ImportError:
- pass
- checkeggs = False
- imported.append(modpath.pop(0))
- mtype = mp_desc[2]
- if modpath:
- if mtype != imp.PKG_DIRECTORY:
- raise ImportError('No module %s in %s' % ('.'.join(modpath),
- '.'.join(imported)))
- # XXX guess if package is using pkgutil.extend_path by looking for
- # those keywords in the first four Kbytes
- try:
- with open(os.path.join(mp_filename, '__init__.py'), 'rb') as stream:
- data = stream.read(4096)
- except IOError:
- path = [mp_filename]
- else:
- if b'pkgutil' in data and b'extend_path' in data:
- # extend_path is called, search sys.path for module/packages
- # of this name see pkgutil.extend_path documentation
- path = [os.path.join(p, *imported) for p in sys.path
- if os.path.isdir(os.path.join(p, *imported))]
- else:
- path = [mp_filename]
- return mtype, mp_filename
-
-def _is_python_file(filename):
- """return true if the given filename should be considered as a python file
-
- .pyc and .pyo are ignored
- """
- for ext in ('.py', '.so', '.pyd', '.pyw'):
- if filename.endswith(ext):
- return True
- return False
-
-
-def _has_init(directory):
- """if the given directory has a valid __init__ file, return its path,
- else return None
- """
- mod_or_pack = os.path.join(directory, '__init__')
- for ext in PY_SOURCE_EXTS + ('pyc', 'pyo'):
- if os.path.exists(mod_or_pack + '.' + ext):
- return mod_or_pack + '.' + ext
- return None
diff --git a/chromium/third_party/logilab/logilab/astroid/node_classes.py b/chromium/third_party/logilab/logilab/astroid/node_classes.py
deleted file mode 100644
index f21f41cd44c..00000000000
--- a/chromium/third_party/logilab/logilab/astroid/node_classes.py
+++ /dev/null
@@ -1,966 +0,0 @@
-# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of astroid.
-#
-# astroid is free software: you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as published by the
-# Free Software Foundation, either version 2.1 of the License, or (at your
-# option) any later version.
-#
-# astroid 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 Lesser General Public License
-# for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with astroid. If not, see <http://www.gnu.org/licenses/>.
-"""Module for some node classes. More nodes in scoped_nodes.py
-"""
-
-import sys
-
-import six
-import logilab
-from logilab.common.decorators import cachedproperty
-
-from astroid.exceptions import NoDefault
-from astroid.bases import (NodeNG, Statement, Instance, InferenceContext,
- _infer_stmts, YES, BUILTINS)
-from astroid.mixins import (BlockRangeMixIn, AssignTypeMixin,
- ParentAssignTypeMixin, FromImportMixIn)
-
-PY3K = sys.version_info >= (3, 0)
-
-
-def unpack_infer(stmt, context=None):
- """recursively generate nodes inferred by the given statement.
- If the inferred value is a list or a tuple, recurse on the elements
- """
- if isinstance(stmt, (List, Tuple)):
- for elt in stmt.elts:
- for infered_elt in unpack_infer(elt, context):
- yield infered_elt
- return
- # if infered is a final node, return it and stop
- infered = next(stmt.infer(context))
- if infered is stmt:
- yield infered
- return
- # else, infer recursivly, except YES object that should be returned as is
- for infered in stmt.infer(context):
- if infered is YES:
- yield infered
- else:
- for inf_inf in unpack_infer(infered, context):
- yield inf_inf
-
-
-def are_exclusive(stmt1, stmt2, exceptions=None):
- """return true if the two given statements are mutually exclusive
-
- `exceptions` may be a list of exception names. If specified, discard If
- branches and check one of the statement is in an exception handler catching
- one of the given exceptions.
-
- algorithm :
- 1) index stmt1's parents
- 2) climb among stmt2's parents until we find a common parent
- 3) if the common parent is a If or TryExcept statement, look if nodes are
- in exclusive branches
- """
- # index stmt1's parents
- stmt1_parents = {}
- children = {}
- node = stmt1.parent
- previous = stmt1
- while node:
- stmt1_parents[node] = 1
- children[node] = previous
- previous = node
- node = node.parent
- # climb among stmt2's parents until we find a common parent
- node = stmt2.parent
- previous = stmt2
- while node:
- if node in stmt1_parents:
- # if the common parent is a If or TryExcept statement, look if
- # nodes are in exclusive branches
- if isinstance(node, If) and exceptions is None:
- if (node.locate_child(previous)[1]
- is not node.locate_child(children[node])[1]):
- return True
- elif isinstance(node, TryExcept):
- c2attr, c2node = node.locate_child(previous)
- c1attr, c1node = node.locate_child(children[node])
- if c1node is not c2node:
- if ((c2attr == 'body' and c1attr == 'handlers' and children[node].catch(exceptions)) or
- (c2attr == 'handlers' and c1attr == 'body' and previous.catch(exceptions)) or
- (c2attr == 'handlers' and c1attr == 'orelse') or
- (c2attr == 'orelse' and c1attr == 'handlers')):
- return True
- elif c2attr == 'handlers' and c1attr == 'handlers':
- return previous is not children[node]
- return False
- previous = node
- node = node.parent
- return False
-
-
-class LookupMixIn(object):
- """Mixin looking up a name in the right scope
- """
-
- def lookup(self, name):
- """lookup a variable name
-
- return the scope node and the list of assignments associated to the
- given name according to the scope where it has been found (locals,
- globals or builtin)
-
- The lookup is starting from self's scope. If self is not a frame itself
- and the name is found in the inner frame locals, statements will be
- filtered to remove ignorable statements according to self's location
- """
- return self.scope().scope_lookup(self, name)
-
- def ilookup(self, name):
- """infered lookup
-
- return an iterator on infered values of the statements returned by
- the lookup method
- """
- frame, stmts = self.lookup(name)
- return _infer_stmts(stmts, None, frame)
-
- def _filter_stmts(self, stmts, frame, offset):
- """filter statements to remove ignorable statements.
-
- If self is not a frame itself and the name is found in the inner
- frame locals, statements will be filtered to remove ignorable
- statements according to self's location
- """
- # if offset == -1, my actual frame is not the inner frame but its parent
- #
- # class A(B): pass
- #
- # we need this to resolve B correctly
- if offset == -1:
- myframe = self.frame().parent.frame()
- else:
- myframe = self.frame()
- # If the frame of this node is the same as the statement
- # of this node, then the node is part of a class or
- # a function definition and the frame of this node should be the
- # the upper frame, not the frame of the definition.
- # For more information why this is important,
- # see Pylint issue #295.
- # For example, for 'b', the statement is the same
- # as the frame / scope:
- #
- # def test(b=1):
- # ...
-
- if self.statement() is myframe and myframe.parent:
- myframe = myframe.parent.frame()
- if not myframe is frame or self is frame:
- return stmts
- mystmt = self.statement()
- # line filtering if we are in the same frame
- #
- # take care node may be missing lineno information (this is the case for
- # nodes inserted for living objects)
- if myframe is frame and mystmt.fromlineno is not None:
- assert mystmt.fromlineno is not None, mystmt
- mylineno = mystmt.fromlineno + offset
- else:
- # disabling lineno filtering
- mylineno = 0
- _stmts = []
- _stmt_parents = []
- for node in stmts:
- stmt = node.statement()
- # line filtering is on and we have reached our location, break
- if mylineno > 0 and stmt.fromlineno > mylineno:
- break
- assert hasattr(node, 'ass_type'), (node, node.scope(),
- node.scope().locals)
- ass_type = node.ass_type()
-
- if node.has_base(self):
- break
-
- _stmts, done = ass_type._get_filtered_stmts(self, node, _stmts, mystmt)
- if done:
- break
-
- optional_assign = ass_type.optional_assign
- if optional_assign and ass_type.parent_of(self):
- # we are inside a loop, loop var assigment is hidding previous
- # assigment
- _stmts = [node]
- _stmt_parents = [stmt.parent]
- continue
-
- # XXX comment various branches below!!!
- try:
- pindex = _stmt_parents.index(stmt.parent)
- except ValueError:
- pass
- else:
- # we got a parent index, this means the currently visited node
- # is at the same block level as a previously visited node
- if _stmts[pindex].ass_type().parent_of(ass_type):
- # both statements are not at the same block level
- continue
- # if currently visited node is following previously considered
- # assignement and both are not exclusive, we can drop the
- # previous one. For instance in the following code ::
- #
- # if a:
- # x = 1
- # else:
- # x = 2
- # print x
- #
- # we can't remove neither x = 1 nor x = 2 when looking for 'x'
- # of 'print x'; while in the following ::
- #
- # x = 1
- # x = 2
- # print x
- #
- # we can remove x = 1 when we see x = 2
- #
- # moreover, on loop assignment types, assignment won't
- # necessarily be done if the loop has no iteration, so we don't
- # want to clear previous assigments if any (hence the test on
- # optional_assign)
- if not (optional_assign or are_exclusive(_stmts[pindex], node)):
- del _stmt_parents[pindex]
- del _stmts[pindex]
- if isinstance(node, AssName):
- if not optional_assign and stmt.parent is mystmt.parent:
- _stmts = []
- _stmt_parents = []
- elif isinstance(node, DelName):
- _stmts = []
- _stmt_parents = []
- continue
- if not are_exclusive(self, node):
- _stmts.append(node)
- _stmt_parents.append(stmt.parent)
- return _stmts
-
-# Name classes
-
-class AssName(LookupMixIn, ParentAssignTypeMixin, NodeNG):
- """class representing an AssName node"""
-
-
-class DelName(LookupMixIn, ParentAssignTypeMixin, NodeNG):
- """class representing a DelName node"""
-
-
-class Name(LookupMixIn, NodeNG):
- """class representing a Name node"""
-
-
-
-
-##################### node classes ########################################
-
-class Arguments(NodeNG, AssignTypeMixin):
- """class representing an Arguments node"""
- if PY3K:
- # Python 3.4+ uses a different approach regarding annotations,
- # each argument is a new class, _ast.arg, which exposes an
- # 'annotation' attribute. In astroid though, arguments are exposed
- # as is in the Arguments node and the only way to expose annotations
- # is by using something similar with Python 3.3:
- # - we expose 'varargannotation' and 'kwargannotation' of annotations
- # of varargs and kwargs.
- # - we expose 'annotation', a list with annotations for
- # for each normal argument. If an argument doesn't have an
- # annotation, its value will be None.
-
- _astroid_fields = ('args', 'defaults', 'kwonlyargs',
- 'kw_defaults', 'annotations',
- 'varargannotation', 'kwargannotation')
- annotations = None
- varargannotation = None
- kwargannotation = None
- else:
- _astroid_fields = ('args', 'defaults', 'kwonlyargs', 'kw_defaults')
- args = None
- defaults = None
- kwonlyargs = None
- kw_defaults = None
-
- def __init__(self, vararg=None, kwarg=None):
- self.vararg = vararg
- self.kwarg = kwarg
-
- def _infer_name(self, frame, name):
- if self.parent is frame:
- return name
- return None
-
- @cachedproperty
- def fromlineno(self):
- lineno = super(Arguments, self).fromlineno
- return max(lineno, self.parent.fromlineno)
-
- def format_args(self):
- """return arguments formatted as string"""
- result = []
- if self.args:
- result.append(_format_args(self.args, self.defaults))
- if self.vararg:
- result.append('*%s' % self.vararg)
- if self.kwarg:
- result.append('**%s' % self.kwarg)
- if self.kwonlyargs:
- if not self.vararg:
- result.append('*')
- result.append(_format_args(self.kwonlyargs, self.kw_defaults))
- return ', '.join(result)
-
- def default_value(self, argname):
- """return the default value for an argument
-
- :raise `NoDefault`: if there is no default value defined
- """
- i = _find_arg(argname, self.args)[0]
- if i is not None:
- idx = i - (len(self.args) - len(self.defaults))
- if idx >= 0:
- return self.defaults[idx]
- i = _find_arg(argname, self.kwonlyargs)[0]
- if i is not None and self.kw_defaults[i] is not None:
- return self.kw_defaults[i]
- raise NoDefault()
-
- def is_argument(self, name):
- """return True if the name is defined in arguments"""
- if name == self.vararg:
- return True
- if name == self.kwarg:
- return True
- return self.find_argname(name, True)[1] is not None
-
- def find_argname(self, argname, rec=False):
- """return index and Name node with given name"""
- if self.args: # self.args may be None in some cases (builtin function)
- return _find_arg(argname, self.args, rec)
- return None, None
-
- def get_children(self):
- """override get_children to skip over None elements in kw_defaults"""
- for child in super(Arguments, self).get_children():
- if child is not None:
- yield child
-
-
-def _find_arg(argname, args, rec=False):
- for i, arg in enumerate(args):
- if isinstance(arg, Tuple):
- if rec:
- found = _find_arg(argname, arg.elts)
- if found[0] is not None:
- return found
- elif arg.name == argname:
- return i, arg
- return None, None
-
-
-def _format_args(args, defaults=None):
- values = []
- if args is None:
- return ''
- if defaults is not None:
- default_offset = len(args) - len(defaults)
- for i, arg in enumerate(args):
- if isinstance(arg, Tuple):
- values.append('(%s)' % _format_args(arg.elts))
- else:
- values.append(arg.name)
- if defaults is not None and i >= default_offset:
- if defaults[i-default_offset] is not None:
- values[-1] += '=' + defaults[i-default_offset].as_string()
- return ', '.join(values)
-
-
-class AssAttr(NodeNG, ParentAssignTypeMixin):
- """class representing an AssAttr node"""
- _astroid_fields = ('expr',)
- expr = None
-
-class Assert(Statement):
- """class representing an Assert node"""
- _astroid_fields = ('test', 'fail',)
- test = None
- fail = None
-
-class Assign(Statement, AssignTypeMixin):
- """class representing an Assign node"""
- _astroid_fields = ('targets', 'value',)
- targets = None
- value = None
-
-class AugAssign(Statement, AssignTypeMixin):
- """class representing an AugAssign node"""
- _astroid_fields = ('target', 'value',)
- target = None
- value = None
-
-class Backquote(NodeNG):
- """class representing a Backquote node"""
- _astroid_fields = ('value',)
- value = None
-
-class BinOp(NodeNG):
- """class representing a BinOp node"""
- _astroid_fields = ('left', 'right',)
- left = None
- right = None
-
-class BoolOp(NodeNG):
- """class representing a BoolOp node"""
- _astroid_fields = ('values',)
- values = None
-
-class Break(Statement):
- """class representing a Break node"""
-
-
-class CallFunc(NodeNG):
- """class representing a CallFunc node"""
- _astroid_fields = ('func', 'args', 'starargs', 'kwargs')
- func = None
- args = None
- starargs = None
- kwargs = None
-
- def __init__(self):
- self.starargs = None
- self.kwargs = None
-
-class Compare(NodeNG):
- """class representing a Compare node"""
- _astroid_fields = ('left', 'ops',)
- left = None
- ops = None
-
- def get_children(self):
- """override get_children for tuple fields"""
- yield self.left
- for _, comparator in self.ops:
- yield comparator # we don't want the 'op'
-
- def last_child(self):
- """override last_child"""
- # XXX maybe if self.ops:
- return self.ops[-1][1]
- #return self.left
-
-class Comprehension(NodeNG):
- """class representing a Comprehension node"""
- _astroid_fields = ('target', 'iter', 'ifs')
- target = None
- iter = None
- ifs = None
-
- optional_assign = True
- def ass_type(self):
- return self
-
- def _get_filtered_stmts(self, lookup_node, node, stmts, mystmt):
- """method used in filter_stmts"""
- if self is mystmt:
- if isinstance(lookup_node, (Const, Name)):
- return [lookup_node], True
-
- elif self.statement() is mystmt:
- # original node's statement is the assignment, only keeps
- # current node (gen exp, list comp)
-
- return [node], True
-
- return stmts, False
-
-
-class Const(NodeNG, Instance):
- """represent a constant node like num, str, bool, None, bytes"""
-
- def __init__(self, value=None):
- self.value = value
-
- def getitem(self, index, context=None):
- if isinstance(self.value, six.string_types):
- return Const(self.value[index])
- raise TypeError('%r (value=%s)' % (self, self.value))
-
- def has_dynamic_getattr(self):
- return False
-
- def itered(self):
- if isinstance(self.value, six.string_types):
- return self.value
- raise TypeError()
-
- def pytype(self):
- return self._proxied.qname()
-
-
-class Continue(Statement):
- """class representing a Continue node"""
-
-
-class Decorators(NodeNG):
- """class representing a Decorators node"""
- _astroid_fields = ('nodes',)
- nodes = None
-
- def __init__(self, nodes=None):
- self.nodes = nodes
-
- def scope(self):
- # skip the function node to go directly to the upper level scope
- return self.parent.parent.scope()
-
-class DelAttr(NodeNG, ParentAssignTypeMixin):
- """class representing a DelAttr node"""
- _astroid_fields = ('expr',)
- expr = None
-
-
-class Delete(Statement, AssignTypeMixin):
- """class representing a Delete node"""
- _astroid_fields = ('targets',)
- targets = None
-
-
-class Dict(NodeNG, Instance):
- """class representing a Dict node"""
- _astroid_fields = ('items',)
-
- def __init__(self, items=None):
- if items is None:
- self.items = []
- else:
- self.items = [(const_factory(k), const_factory(v))
- for k, v in items.items()]
-
- def pytype(self):
- return '%s.dict' % BUILTINS
-
- def get_children(self):
- """get children of a Dict node"""
- # overrides get_children
- for key, value in self.items:
- yield key
- yield value
-
- def last_child(self):
- """override last_child"""
- if self.items:
- return self.items[-1][1]
- return None
-
- def itered(self):
- return self.items[::2]
-
- def getitem(self, lookup_key, context=None):
- for key, value in self.items:
- for inferedkey in key.infer(context):
- if inferedkey is YES:
- continue
- if isinstance(inferedkey, Const) \
- and inferedkey.value == lookup_key:
- return value
- # This should raise KeyError, but all call sites only catch
- # IndexError. Let's leave it like that for now.
- raise IndexError(lookup_key)
-
-
-class Discard(Statement):
- """class representing a Discard node"""
- _astroid_fields = ('value',)
- value = None
-
-
-class Ellipsis(NodeNG):
- """class representing an Ellipsis node"""
-
-
-class EmptyNode(NodeNG):
- """class representing an EmptyNode node"""
-
-
-class ExceptHandler(Statement, AssignTypeMixin):
- """class representing an ExceptHandler node"""
- _astroid_fields = ('type', 'name', 'body',)
- type = None
- name = None
- body = None
-
- @cachedproperty
- def blockstart_tolineno(self):
- if self.name:
- return self.name.tolineno
- elif self.type:
- return self.type.tolineno
- else:
- return self.lineno
-
- def catch(self, exceptions):
- if self.type is None or exceptions is None:
- return True
- for node in self.type.nodes_of_class(Name):
- if node.name in exceptions:
- return True
-
-
-class Exec(Statement):
- """class representing an Exec node"""
- _astroid_fields = ('expr', 'globals', 'locals',)
- expr = None
- globals = None
- locals = None
-
-
-class ExtSlice(NodeNG):
- """class representing an ExtSlice node"""
- _astroid_fields = ('dims',)
- dims = None
-
-class For(BlockRangeMixIn, AssignTypeMixin, Statement):
- """class representing a For node"""
- _astroid_fields = ('target', 'iter', 'body', 'orelse',)
- target = None
- iter = None
- body = None
- orelse = None
-
- optional_assign = True
- @cachedproperty
- def blockstart_tolineno(self):
- return self.iter.tolineno
-
-
-class From(FromImportMixIn, Statement):
- """class representing a From node"""
-
- def __init__(self, fromname, names, level=0):
- self.modname = fromname
- self.names = names
- self.level = level
-
-class Getattr(NodeNG):
- """class representing a Getattr node"""
- _astroid_fields = ('expr',)
- expr = None
-
-
-class Global(Statement):
- """class representing a Global node"""
-
- def __init__(self, names):
- self.names = names
-
- def _infer_name(self, frame, name):
- return name
-
-
-class If(BlockRangeMixIn, Statement):
- """class representing an If node"""
- _astroid_fields = ('test', 'body', 'orelse')
- test = None
- body = None
- orelse = None
-
- @cachedproperty
- def blockstart_tolineno(self):
- return self.test.tolineno
-
- def block_range(self, lineno):
- """handle block line numbers range for if statements"""
- if lineno == self.body[0].fromlineno:
- return lineno, lineno
- if lineno <= self.body[-1].tolineno:
- return lineno, self.body[-1].tolineno
- return self._elsed_block_range(lineno, self.orelse,
- self.body[0].fromlineno - 1)
-
-
-class IfExp(NodeNG):
- """class representing an IfExp node"""
- _astroid_fields = ('test', 'body', 'orelse')
- test = None
- body = None
- orelse = None
-
-
-class Import(FromImportMixIn, Statement):
- """class representing an Import node"""
-
-
-class Index(NodeNG):
- """class representing an Index node"""
- _astroid_fields = ('value',)
- value = None
-
-
-class Keyword(NodeNG):
- """class representing a Keyword node"""
- _astroid_fields = ('value',)
- value = None
-
-
-class List(NodeNG, Instance, ParentAssignTypeMixin):
- """class representing a List node"""
- _astroid_fields = ('elts',)
-
- def __init__(self, elts=None):
- if elts is None:
- self.elts = []
- else:
- self.elts = [const_factory(e) for e in elts]
-
- def pytype(self):
- return '%s.list' % BUILTINS
-
- def getitem(self, index, context=None):
- return self.elts[index]
-
- def itered(self):
- return self.elts
-
-
-class Nonlocal(Statement):
- """class representing a Nonlocal node"""
-
- def __init__(self, names):
- self.names = names
-
- def _infer_name(self, frame, name):
- return name
-
-
-class Pass(Statement):
- """class representing a Pass node"""
-
-
-class Print(Statement):
- """class representing a Print node"""
- _astroid_fields = ('dest', 'values',)
- dest = None
- values = None
-
-
-class Raise(Statement):
- """class representing a Raise node"""
- exc = None
- if sys.version_info < (3, 0):
- _astroid_fields = ('exc', 'inst', 'tback')
- inst = None
- tback = None
- else:
- _astroid_fields = ('exc', 'cause')
- exc = None
- cause = None
-
- def raises_not_implemented(self):
- if not self.exc:
- return
- for name in self.exc.nodes_of_class(Name):
- if name.name == 'NotImplementedError':
- return True
-
-
-class Return(Statement):
- """class representing a Return node"""
- _astroid_fields = ('value',)
- value = None
-
-
-class Set(NodeNG, Instance, ParentAssignTypeMixin):
- """class representing a Set node"""
- _astroid_fields = ('elts',)
-
- def __init__(self, elts=None):
- if elts is None:
- self.elts = []
- else:
- self.elts = [const_factory(e) for e in elts]
-
- def pytype(self):
- return '%s.set' % BUILTINS
-
- def itered(self):
- return self.elts
-
-
-class Slice(NodeNG):
- """class representing a Slice node"""
- _astroid_fields = ('lower', 'upper', 'step')
- lower = None
- upper = None
- step = None
-
-class Starred(NodeNG, ParentAssignTypeMixin):
- """class representing a Starred node"""
- _astroid_fields = ('value',)
- value = None
-
-
-class Subscript(NodeNG):
- """class representing a Subscript node"""
- _astroid_fields = ('value', 'slice')
- value = None
- slice = None
-
-
-class TryExcept(BlockRangeMixIn, Statement):
- """class representing a TryExcept node"""
- _astroid_fields = ('body', 'handlers', 'orelse',)
- body = None
- handlers = None
- orelse = None
-
- def _infer_name(self, frame, name):
- return name
-
- def block_range(self, lineno):
- """handle block line numbers range for try/except statements"""
- last = None
- for exhandler in self.handlers:
- if exhandler.type and lineno == exhandler.type.fromlineno:
- return lineno, lineno
- if exhandler.body[0].fromlineno <= lineno <= exhandler.body[-1].tolineno:
- return lineno, exhandler.body[-1].tolineno
- if last is None:
- last = exhandler.body[0].fromlineno - 1
- return self._elsed_block_range(lineno, self.orelse, last)
-
-
-class TryFinally(BlockRangeMixIn, Statement):
- """class representing a TryFinally node"""
- _astroid_fields = ('body', 'finalbody',)
- body = None
- finalbody = None
-
- def block_range(self, lineno):
- """handle block line numbers range for try/finally statements"""
- child = self.body[0]
- # py2.5 try: except: finally:
- if (isinstance(child, TryExcept) and child.fromlineno == self.fromlineno
- and lineno > self.fromlineno and lineno <= child.tolineno):
- return child.block_range(lineno)
- return self._elsed_block_range(lineno, self.finalbody)
-
-
-class Tuple(NodeNG, Instance, ParentAssignTypeMixin):
- """class representing a Tuple node"""
- _astroid_fields = ('elts',)
-
- def __init__(self, elts=None):
- if elts is None:
- self.elts = []
- else:
- self.elts = [const_factory(e) for e in elts]
-
- def pytype(self):
- return '%s.tuple' % BUILTINS
-
- def getitem(self, index, context=None):
- return self.elts[index]
-
- def itered(self):
- return self.elts
-
-
-class UnaryOp(NodeNG):
- """class representing an UnaryOp node"""
- _astroid_fields = ('operand',)
- operand = None
-
-
-class While(BlockRangeMixIn, Statement):
- """class representing a While node"""
- _astroid_fields = ('test', 'body', 'orelse',)
- test = None
- body = None
- orelse = None
-
- @cachedproperty
- def blockstart_tolineno(self):
- return self.test.tolineno
-
- def block_range(self, lineno):
- """handle block line numbers range for for and while statements"""
- return self. _elsed_block_range(lineno, self.orelse)
-
-
-class With(BlockRangeMixIn, AssignTypeMixin, Statement):
- """class representing a With node"""
- _astroid_fields = ('items', 'body')
- items = None
- body = None
-
- @cachedproperty
- def blockstart_tolineno(self):
- return self.items[-1][0].tolineno
-
- def get_children(self):
- for expr, var in self.items:
- yield expr
- if var:
- yield var
- for elt in self.body:
- yield elt
-
-class Yield(NodeNG):
- """class representing a Yield node"""
- _astroid_fields = ('value',)
- value = None
-
-class YieldFrom(Yield):
- """ Class representing a YieldFrom node. """
-
-# constants ##############################################################
-
-CONST_CLS = {
- list: List,
- tuple: Tuple,
- dict: Dict,
- set: Set,
- type(None): Const,
- }
-
-def _update_const_classes():
- """update constant classes, so the keys of CONST_CLS can be reused"""
- klasses = (bool, int, float, complex, str)
- if sys.version_info < (3, 0):
- klasses += (unicode, long)
- if sys.version_info >= (2, 6):
- klasses += (bytes,)
- for kls in klasses:
- CONST_CLS[kls] = Const
-_update_const_classes()
-
-def const_factory(value):
- """return an astroid node for a python value"""
- # XXX we should probably be stricter here and only consider stuff in
- # CONST_CLS or do better treatment: in case where value is not in CONST_CLS,
- # we should rather recall the builder on this value than returning an empty
- # node (another option being that const_factory shouldn't be called with something
- # not in CONST_CLS)
- assert not isinstance(value, NodeNG)
- try:
- return CONST_CLS[value.__class__](value)
- except (KeyError, AttributeError):
- node = EmptyNode()
- node.object = value
- return node
diff --git a/chromium/third_party/logilab/logilab/astroid/nodes.py b/chromium/third_party/logilab/logilab/astroid/nodes.py
deleted file mode 100644
index 263ab476c6a..00000000000
--- a/chromium/third_party/logilab/logilab/astroid/nodes.py
+++ /dev/null
@@ -1,73 +0,0 @@
-# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of astroid.
-#
-# astroid is free software: you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as published by the
-# Free Software Foundation, either version 2.1 of the License, or (at your
-# option) any later version.
-#
-# astroid 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 Lesser General Public License
-# for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with astroid. If not, see <http://www.gnu.org/licenses/>.
-"""
-on all nodes :
- .is_statement, returning true if the node should be considered as a
- statement node
- .root(), returning the root node of the tree (i.e. a Module)
- .previous_sibling(), returning previous sibling statement node
- .next_sibling(), returning next sibling statement node
- .statement(), returning the first parent node marked as statement node
- .frame(), returning the first node defining a new local scope (i.e.
- Module, Function or Class)
- .set_local(name, node), define an identifier <name> on the first parent frame,
- with the node defining it. This is used by the astroid builder and should not
- be used from out there.
-
-on From and Import :
- .real_name(name),
-
-
-"""
-
-__docformat__ = "restructuredtext en"
-
-from astroid.node_classes import Arguments, AssAttr, Assert, Assign, \
- AssName, AugAssign, Backquote, BinOp, BoolOp, Break, CallFunc, Compare, \
- Comprehension, Const, Continue, Decorators, DelAttr, DelName, Delete, \
- Dict, Discard, Ellipsis, EmptyNode, ExceptHandler, Exec, ExtSlice, For, \
- From, Getattr, Global, If, IfExp, Import, Index, Keyword, \
- List, Name, Nonlocal, Pass, Print, Raise, Return, Set, Slice, Starred, Subscript, \
- TryExcept, TryFinally, Tuple, UnaryOp, While, With, Yield, YieldFrom, \
- const_factory
-from astroid.scoped_nodes import Module, GenExpr, Lambda, DictComp, \
- ListComp, SetComp, Function, Class
-
-ALL_NODE_CLASSES = (
- Arguments, AssAttr, Assert, Assign, AssName, AugAssign,
- Backquote, BinOp, BoolOp, Break,
- CallFunc, Class, Compare, Comprehension, Const, Continue,
- Decorators, DelAttr, DelName, Delete,
- Dict, DictComp, Discard,
- Ellipsis, EmptyNode, ExceptHandler, Exec, ExtSlice,
- For, From, Function,
- Getattr, GenExpr, Global,
- If, IfExp, Import, Index,
- Keyword,
- Lambda, List, ListComp,
- Name, Nonlocal,
- Module,
- Pass, Print,
- Raise, Return,
- Set, SetComp, Slice, Starred, Subscript,
- TryExcept, TryFinally, Tuple,
- UnaryOp,
- While, With,
- Yield, YieldFrom
- )
-
diff --git a/chromium/third_party/logilab/logilab/astroid/protocols.py b/chromium/third_party/logilab/logilab/astroid/protocols.py
deleted file mode 100644
index 4dd515fd00f..00000000000
--- a/chromium/third_party/logilab/logilab/astroid/protocols.py
+++ /dev/null
@@ -1,361 +0,0 @@
-# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of astroid.
-#
-# astroid is free software: you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as published by the
-# Free Software Foundation, either version 2.1 of the License, or (at your
-# option) any later version.
-#
-# astroid 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 Lesser General Public License
-# for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with astroid. If not, see <http://www.gnu.org/licenses/>.
-"""this module contains a set of functions to handle python protocols for nodes
-where it makes sense.
-"""
-
-__doctype__ = "restructuredtext en"
-
-from astroid.exceptions import InferenceError, NoDefault, NotFoundError
-from astroid.node_classes import unpack_infer
-from astroid.bases import InferenceContext, \
- raise_if_nothing_infered, yes_if_nothing_infered, Instance, YES
-from astroid.nodes import const_factory
-from astroid import nodes
-
-BIN_OP_METHOD = {'+': '__add__',
- '-': '__sub__',
- '/': '__div__',
- '//': '__floordiv__',
- '*': '__mul__',
- '**': '__power__',
- '%': '__mod__',
- '&': '__and__',
- '|': '__or__',
- '^': '__xor__',
- '<<': '__lshift__',
- '>>': '__rshift__',
- }
-
-UNARY_OP_METHOD = {'+': '__pos__',
- '-': '__neg__',
- '~': '__invert__',
- 'not': None, # XXX not '__nonzero__'
- }
-
-# unary operations ############################################################
-
-def tl_infer_unary_op(self, operator):
- if operator == 'not':
- return const_factory(not bool(self.elts))
- raise TypeError() # XXX log unsupported operation
-nodes.Tuple.infer_unary_op = tl_infer_unary_op
-nodes.List.infer_unary_op = tl_infer_unary_op
-
-
-def dict_infer_unary_op(self, operator):
- if operator == 'not':
- return const_factory(not bool(self.items))
- raise TypeError() # XXX log unsupported operation
-nodes.Dict.infer_unary_op = dict_infer_unary_op
-
-
-def const_infer_unary_op(self, operator):
- if operator == 'not':
- return const_factory(not self.value)
- # XXX log potentially raised TypeError
- elif operator == '+':
- return const_factory(+self.value)
- else: # operator == '-':
- return const_factory(-self.value)
-nodes.Const.infer_unary_op = const_infer_unary_op
-
-
-# binary operations ###########################################################
-
-BIN_OP_IMPL = {'+': lambda a, b: a + b,
- '-': lambda a, b: a - b,
- '/': lambda a, b: a / b,
- '//': lambda a, b: a // b,
- '*': lambda a, b: a * b,
- '**': lambda a, b: a ** b,
- '%': lambda a, b: a % b,
- '&': lambda a, b: a & b,
- '|': lambda a, b: a | b,
- '^': lambda a, b: a ^ b,
- '<<': lambda a, b: a << b,
- '>>': lambda a, b: a >> b,
- }
-for key, impl in list(BIN_OP_IMPL.items()):
- BIN_OP_IMPL[key+'='] = impl
-
-def const_infer_binary_op(self, operator, other, context):
- for other in other.infer(context):
- if isinstance(other, nodes.Const):
- try:
- impl = BIN_OP_IMPL[operator]
-
- try:
- yield const_factory(impl(self.value, other.value))
- except Exception:
- # ArithmeticError is not enough: float >> float is a TypeError
- # TODO : let pylint know about the problem
- pass
- except TypeError:
- # XXX log TypeError
- continue
- elif other is YES:
- yield other
- else:
- try:
- for val in other.infer_binary_op(operator, self, context):
- yield val
- except AttributeError:
- yield YES
-nodes.Const.infer_binary_op = yes_if_nothing_infered(const_infer_binary_op)
-
-
-def tl_infer_binary_op(self, operator, other, context):
- for other in other.infer(context):
- if isinstance(other, self.__class__) and operator == '+':
- node = self.__class__()
- elts = [n for elt in self.elts for n in elt.infer(context)
- if not n is YES]
- elts += [n for elt in other.elts for n in elt.infer(context)
- if not n is YES]
- node.elts = elts
- yield node
- elif isinstance(other, nodes.Const) and operator == '*':
- if not isinstance(other.value, int):
- yield YES
- continue
- node = self.__class__()
- elts = [n for elt in self.elts for n in elt.infer(context)
- if not n is YES] * other.value
- node.elts = elts
- yield node
- elif isinstance(other, Instance) and not isinstance(other, nodes.Const):
- yield YES
- # XXX else log TypeError
-nodes.Tuple.infer_binary_op = yes_if_nothing_infered(tl_infer_binary_op)
-nodes.List.infer_binary_op = yes_if_nothing_infered(tl_infer_binary_op)
-
-
-def dict_infer_binary_op(self, operator, other, context):
- for other in other.infer(context):
- if isinstance(other, Instance) and isinstance(other._proxied, nodes.Class):
- yield YES
- # XXX else log TypeError
-nodes.Dict.infer_binary_op = yes_if_nothing_infered(dict_infer_binary_op)
-
-def instance_infer_binary_op(self, operator, other, context):
- try:
- methods = self.getattr(BIN_OP_METHOD[operator])
- except (NotFoundError, KeyError):
- # Unknown operator
- yield YES
- else:
- for method in methods:
- if not isinstance(method, nodes.Function):
- continue
- for result in method.infer_call_result(self, context):
- if result is not YES:
- yield result
- # We are interested only in the first infered method,
- # don't go looking in the rest of the methods of the ancestors.
- break
-
-Instance.infer_binary_op = yes_if_nothing_infered(instance_infer_binary_op)
-
-
-# assignment ##################################################################
-
-"""the assigned_stmts method is responsible to return the assigned statement
-(e.g. not inferred) according to the assignment type.
-
-The `asspath` argument is used to record the lhs path of the original node.
-For instance if we want assigned statements for 'c' in 'a, (b,c)', asspath
-will be [1, 1] once arrived to the Assign node.
-
-The `context` argument is the current inference context which should be given
-to any intermediary inference necessary.
-"""
-
-def _resolve_looppart(parts, asspath, context):
- """recursive function to resolve multiple assignments on loops"""
- asspath = asspath[:]
- index = asspath.pop(0)
- for part in parts:
- if part is YES:
- continue
- # XXX handle __iter__ and log potentially detected errors
- if not hasattr(part, 'itered'):
- continue
- try:
- itered = part.itered()
- except TypeError:
- continue # XXX log error
- for stmt in itered:
- try:
- assigned = stmt.getitem(index, context)
- except (AttributeError, IndexError):
- continue
- except TypeError: # stmt is unsubscriptable Const
- continue
- if not asspath:
- # we achieved to resolved the assignment path,
- # don't infer the last part
- yield assigned
- elif assigned is YES:
- break
- else:
- # we are not yet on the last part of the path
- # search on each possibly inferred value
- try:
- for infered in _resolve_looppart(assigned.infer(context),
- asspath, context):
- yield infered
- except InferenceError:
- break
-
-
-def for_assigned_stmts(self, node, context=None, asspath=None):
- if asspath is None:
- for lst in self.iter.infer(context):
- if isinstance(lst, (nodes.Tuple, nodes.List)):
- for item in lst.elts:
- yield item
- else:
- for infered in _resolve_looppart(self.iter.infer(context),
- asspath, context):
- yield infered
-
-nodes.For.assigned_stmts = raise_if_nothing_infered(for_assigned_stmts)
-nodes.Comprehension.assigned_stmts = raise_if_nothing_infered(for_assigned_stmts)
-
-
-def mulass_assigned_stmts(self, node, context=None, asspath=None):
- if asspath is None:
- asspath = []
- asspath.insert(0, self.elts.index(node))
- return self.parent.assigned_stmts(self, context, asspath)
-nodes.Tuple.assigned_stmts = mulass_assigned_stmts
-nodes.List.assigned_stmts = mulass_assigned_stmts
-
-
-def assend_assigned_stmts(self, context=None):
- return self.parent.assigned_stmts(self, context=context)
-nodes.AssName.assigned_stmts = assend_assigned_stmts
-nodes.AssAttr.assigned_stmts = assend_assigned_stmts
-
-
-def _arguments_infer_argname(self, name, context):
- # arguments information may be missing, in which case we can't do anything
- # more
- if not (self.args or self.vararg or self.kwarg):
- yield YES
- return
- # first argument of instance/class method
- if self.args and getattr(self.args[0], 'name', None) == name:
- functype = self.parent.type
- if functype == 'method':
- yield Instance(self.parent.parent.frame())
- return
- if functype == 'classmethod':
- yield self.parent.parent.frame()
- return
- if name == self.vararg:
- vararg = const_factory(())
- vararg.parent = self
- yield vararg
- return
- if name == self.kwarg:
- kwarg = const_factory({})
- kwarg.parent = self
- yield kwarg
- return
- # if there is a default value, yield it. And then yield YES to reflect
- # we can't guess given argument value
- try:
- if context is None:
- context = InferenceContext()
- for infered in self.default_value(name).infer(context):
- yield infered
- yield YES
- except NoDefault:
- yield YES
-
-
-def arguments_assigned_stmts(self, node, context, asspath=None):
- if context.callcontext:
- # reset call context/name
- callcontext = context.callcontext
- return callcontext.infer_argument(self.parent, node.name, context)
- return _arguments_infer_argname(self, node.name, context)
-nodes.Arguments.assigned_stmts = arguments_assigned_stmts
-
-
-def assign_assigned_stmts(self, node, context=None, asspath=None):
- if not asspath:
- yield self.value
- return
- for infered in _resolve_asspart(self.value.infer(context), asspath, context):
- yield infered
-nodes.Assign.assigned_stmts = raise_if_nothing_infered(assign_assigned_stmts)
-nodes.AugAssign.assigned_stmts = raise_if_nothing_infered(assign_assigned_stmts)
-
-
-def _resolve_asspart(parts, asspath, context):
- """recursive function to resolve multiple assignments"""
- asspath = asspath[:]
- index = asspath.pop(0)
- for part in parts:
- if hasattr(part, 'getitem'):
- try:
- assigned = part.getitem(index, context)
- # XXX raise a specific exception to avoid potential hiding of
- # unexpected exception ?
- except (TypeError, IndexError):
- return
- if not asspath:
- # we achieved to resolved the assignment path, don't infer the
- # last part
- yield assigned
- elif assigned is YES:
- return
- else:
- # we are not yet on the last part of the path search on each
- # possibly inferred value
- try:
- for infered in _resolve_asspart(assigned.infer(context),
- asspath, context):
- yield infered
- except InferenceError:
- return
-
-
-def excepthandler_assigned_stmts(self, node, context=None, asspath=None):
- for assigned in unpack_infer(self.type):
- if isinstance(assigned, nodes.Class):
- assigned = Instance(assigned)
- yield assigned
-nodes.ExceptHandler.assigned_stmts = raise_if_nothing_infered(excepthandler_assigned_stmts)
-
-
-def with_assigned_stmts(self, node, context=None, asspath=None):
- if asspath is None:
- for _, vars in self.items:
- if vars is None:
- continue
- for lst in vars.infer(context):
- if isinstance(lst, (nodes.Tuple, nodes.List)):
- for item in lst.nodes:
- yield item
-nodes.With.assigned_stmts = raise_if_nothing_infered(with_assigned_stmts)
-
-
diff --git a/chromium/third_party/logilab/logilab/astroid/raw_building.py b/chromium/third_party/logilab/logilab/astroid/raw_building.py
deleted file mode 100644
index d5e8b3d32bb..00000000000
--- a/chromium/third_party/logilab/logilab/astroid/raw_building.py
+++ /dev/null
@@ -1,366 +0,0 @@
-# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of astroid.
-#
-# astroid is free software: you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as published by the
-# Free Software Foundation, either version 2.1 of the License, or (at your
-# option) any later version.
-#
-# astroid 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 Lesser General Public License
-# for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with astroid. If not, see <http://www.gnu.org/licenses/>.
-"""this module contains a set of functions to create astroid trees from scratch
-(build_* functions) or from living object (object_build_* functions)
-"""
-
-__docformat__ = "restructuredtext en"
-
-import sys
-from os.path import abspath
-from inspect import (getargspec, isdatadescriptor, isfunction, ismethod,
- ismethoddescriptor, isclass, isbuiltin, ismodule)
-import six
-
-from astroid.node_classes import CONST_CLS
-from astroid.nodes import (Module, Class, Const, const_factory, From,
- Function, EmptyNode, Name, Arguments)
-from astroid.bases import BUILTINS, Generator
-from astroid.manager import AstroidManager
-MANAGER = AstroidManager()
-
-_CONSTANTS = tuple(CONST_CLS) # the keys of CONST_CLS eg python builtin types
-
-def _io_discrepancy(member):
- # _io module names itself `io`: http://bugs.python.org/issue18602
- member_self = getattr(member, '__self__', None)
- return (member_self and
- ismodule(member_self) and
- member_self.__name__ == '_io' and
- member.__module__ == 'io')
-
-def _attach_local_node(parent, node, name):
- node.name = name # needed by add_local_node
- parent.add_local_node(node)
-
-_marker = object()
-
-def attach_dummy_node(node, name, object=_marker):
- """create a dummy node and register it in the locals of the given
- node with the specified name
- """
- enode = EmptyNode()
- enode.object = object
- _attach_local_node(node, enode, name)
-
-def _has_underlying_object(self):
- return hasattr(self, 'object') and self.object is not _marker
-
-EmptyNode.has_underlying_object = _has_underlying_object
-
-def attach_const_node(node, name, value):
- """create a Const node and register it in the locals of the given
- node with the specified name
- """
- if not name in node.special_attributes:
- _attach_local_node(node, const_factory(value), name)
-
-def attach_import_node(node, modname, membername):
- """create a From node and register it in the locals of the given
- node with the specified name
- """
- from_node = From(modname, [(membername, None)])
- _attach_local_node(node, from_node, membername)
-
-
-def build_module(name, doc=None):
- """create and initialize a astroid Module node"""
- node = Module(name, doc, pure_python=False)
- node.package = False
- node.parent = None
- return node
-
-def build_class(name, basenames=(), doc=None):
- """create and initialize a astroid Class node"""
- node = Class(name, doc)
- for base in basenames:
- basenode = Name()
- basenode.name = base
- node.bases.append(basenode)
- basenode.parent = node
- return node
-
-def build_function(name, args=None, defaults=None, flag=0, doc=None):
- """create and initialize a astroid Function node"""
- args, defaults = args or [], defaults or []
- # first argument is now a list of decorators
- func = Function(name, doc)
- func.args = argsnode = Arguments()
- argsnode.args = []
- for arg in args:
- argsnode.args.append(Name())
- argsnode.args[-1].name = arg
- argsnode.args[-1].parent = argsnode
- argsnode.defaults = []
- for default in defaults:
- argsnode.defaults.append(const_factory(default))
- argsnode.defaults[-1].parent = argsnode
- argsnode.kwarg = None
- argsnode.vararg = None
- argsnode.parent = func
- if args:
- register_arguments(func)
- return func
-
-
-def build_from_import(fromname, names):
- """create and initialize an astroid From import statement"""
- return From(fromname, [(name, None) for name in names])
-
-def register_arguments(func, args=None):
- """add given arguments to local
-
- args is a list that may contains nested lists
- (i.e. def func(a, (b, c, d)): ...)
- """
- if args is None:
- args = func.args.args
- if func.args.vararg:
- func.set_local(func.args.vararg, func.args)
- if func.args.kwarg:
- func.set_local(func.args.kwarg, func.args)
- for arg in args:
- if isinstance(arg, Name):
- func.set_local(arg.name, arg)
- else:
- register_arguments(func, arg.elts)
-
-def object_build_class(node, member, localname):
- """create astroid for a living class object"""
- basenames = [base.__name__ for base in member.__bases__]
- return _base_class_object_build(node, member, basenames,
- localname=localname)
-
-def object_build_function(node, member, localname):
- """create astroid for a living function object"""
- args, varargs, varkw, defaults = getargspec(member)
- if varargs is not None:
- args.append(varargs)
- if varkw is not None:
- args.append(varkw)
- func = build_function(getattr(member, '__name__', None) or localname, args,
- defaults, member.func_code.co_flags, member.__doc__)
- node.add_local_node(func, localname)
-
-def object_build_datadescriptor(node, member, name):
- """create astroid for a living data descriptor object"""
- return _base_class_object_build(node, member, [], name)
-
-def object_build_methoddescriptor(node, member, localname):
- """create astroid for a living method descriptor object"""
- # FIXME get arguments ?
- func = build_function(getattr(member, '__name__', None) or localname,
- doc=member.__doc__)
- # set node's arguments to None to notice that we have no information, not
- # and empty argument list
- func.args.args = None
- node.add_local_node(func, localname)
-
-def _base_class_object_build(node, member, basenames, name=None, localname=None):
- """create astroid for a living class object, with a given set of base names
- (e.g. ancestors)
- """
- klass = build_class(name or getattr(member, '__name__', None) or localname,
- basenames, member.__doc__)
- klass._newstyle = isinstance(member, type)
- node.add_local_node(klass, localname)
- try:
- # limit the instantiation trick since it's too dangerous
- # (such as infinite test execution...)
- # this at least resolves common case such as Exception.args,
- # OSError.errno
- if issubclass(member, Exception):
- instdict = member().__dict__
- else:
- raise TypeError
- except:
- pass
- else:
- for name, obj in instdict.items():
- valnode = EmptyNode()
- valnode.object = obj
- valnode.parent = klass
- valnode.lineno = 1
- klass.instance_attrs[name] = [valnode]
- return klass
-
-
-
-
-class InspectBuilder(object):
- """class for building nodes from living object
-
- this is actually a really minimal representation, including only Module,
- Function and Class nodes and some others as guessed.
- """
-
- # astroid from living objects ###############################################
-
- def __init__(self):
- self._done = {}
- self._module = None
-
- def inspect_build(self, module, modname=None, path=None):
- """build astroid from a living module (i.e. using inspect)
- this is used when there is no python source code available (either
- because it's a built-in module or because the .py is not available)
- """
- self._module = module
- if modname is None:
- modname = module.__name__
- try:
- node = build_module(modname, module.__doc__)
- except AttributeError:
- # in jython, java modules have no __doc__ (see #109562)
- node = build_module(modname)
- node.file = node.path = path and abspath(path) or path
- node.name = modname
- MANAGER.cache_module(node)
- node.package = hasattr(module, '__path__')
- self._done = {}
- self.object_build(node, module)
- return node
-
- def object_build(self, node, obj):
- """recursive method which create a partial ast from real objects
- (only function, class, and method are handled)
- """
- if obj in self._done:
- return self._done[obj]
- self._done[obj] = node
- for name in dir(obj):
- try:
- member = getattr(obj, name)
- except AttributeError:
- # damned ExtensionClass.Base, I know you're there !
- attach_dummy_node(node, name)
- continue
- if ismethod(member):
- member = six.get_method_function(member)
- if isfunction(member):
- # verify this is not an imported function
- filename = getattr(six.get_function_code(member),
- 'co_filename', None)
- if filename is None:
- assert isinstance(member, object)
- object_build_methoddescriptor(node, member, name)
- elif filename != getattr(self._module, '__file__', None):
- attach_dummy_node(node, name, member)
- else:
- object_build_function(node, member, name)
- elif isbuiltin(member):
- if (not _io_discrepancy(member) and
- self.imported_member(node, member, name)):
- continue
- object_build_methoddescriptor(node, member, name)
- elif isclass(member):
- if self.imported_member(node, member, name):
- continue
- if member in self._done:
- class_node = self._done[member]
- if not class_node in node.locals.get(name, ()):
- node.add_local_node(class_node, name)
- else:
- class_node = object_build_class(node, member, name)
- # recursion
- self.object_build(class_node, member)
- if name == '__class__' and class_node.parent is None:
- class_node.parent = self._done[self._module]
- elif ismethoddescriptor(member):
- assert isinstance(member, object)
- object_build_methoddescriptor(node, member, name)
- elif isdatadescriptor(member):
- assert isinstance(member, object)
- object_build_datadescriptor(node, member, name)
- elif type(member) in _CONSTANTS:
- attach_const_node(node, name, member)
- else:
- # create an empty node so that the name is actually defined
- attach_dummy_node(node, name, member)
-
- def imported_member(self, node, member, name):
- """verify this is not an imported class or handle it"""
- # /!\ some classes like ExtensionClass doesn't have a __module__
- # attribute ! Also, this may trigger an exception on badly built module
- # (see http://www.logilab.org/ticket/57299 for instance)
- try:
- modname = getattr(member, '__module__', None)
- except:
- # XXX use logging
- print('unexpected error while building astroid from living object')
- import traceback
- traceback.print_exc()
- modname = None
- if modname is None:
- if name in ('__new__', '__subclasshook__'):
- # Python 2.5.1 (r251:54863, Sep 1 2010, 22:03:14)
- # >>> print object.__new__.__module__
- # None
- modname = BUILTINS
- else:
- attach_dummy_node(node, name, member)
- return True
- if {'gtk': 'gtk._gtk'}.get(modname, modname) != self._module.__name__:
- # check if it sounds valid and then add an import node, else use a
- # dummy node
- try:
- getattr(sys.modules[modname], name)
- except (KeyError, AttributeError):
- attach_dummy_node(node, name, member)
- else:
- attach_import_node(node, modname, name)
- return True
- return False
-
-
-### astroid bootstrapping ######################################################
-Astroid_BUILDER = InspectBuilder()
-
-_CONST_PROXY = {}
-def _astroid_bootstrapping(astroid_builtin=None):
- """astroid boot strapping the builtins module"""
- # this boot strapping is necessary since we need the Const nodes to
- # inspect_build builtins, and then we can proxy Const
- if astroid_builtin is None:
- from logilab.common.compat import builtins
- astroid_builtin = Astroid_BUILDER.inspect_build(builtins)
-
- for cls, node_cls in CONST_CLS.items():
- if cls is type(None):
- proxy = build_class('NoneType')
- proxy.parent = astroid_builtin
- else:
- proxy = astroid_builtin.getattr(cls.__name__)[0]
- if cls in (dict, list, set, tuple):
- node_cls._proxied = proxy
- else:
- _CONST_PROXY[cls] = proxy
-
-_astroid_bootstrapping()
-
-# TODO : find a nicer way to handle this situation;
-# However __proxied introduced an
-# infinite recursion (see https://bugs.launchpad.net/pylint/+bug/456870)
-def _set_proxied(const):
- return _CONST_PROXY[const.value.__class__]
-Const._proxied = property(_set_proxied)
-
-from types import GeneratorType
-Generator._proxied = Class(GeneratorType.__name__, GeneratorType.__doc__)
-Astroid_BUILDER.object_build(Generator._proxied, GeneratorType)
-
diff --git a/chromium/third_party/logilab/logilab/astroid/rebuilder.py b/chromium/third_party/logilab/logilab/astroid/rebuilder.py
deleted file mode 100644
index 14c606e7c0d..00000000000
--- a/chromium/third_party/logilab/logilab/astroid/rebuilder.py
+++ /dev/null
@@ -1,906 +0,0 @@
-# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of astroid.
-#
-# astroid is free software: you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as published by the
-# Free Software Foundation, either version 2.1 of the License, or (at your
-# option) any later version.
-#
-# astroid 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 Lesser General Public License
-# for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with astroid. If not, see <http://www.gnu.org/licenses/>.
-"""this module contains utilities for rebuilding a _ast tree in
-order to get a single Astroid representation
-"""
-
-import sys
-from _ast import (
- Expr as Discard, Str,
- # binary operators
- Add, Div, FloorDiv, Mod, Mult, Pow, Sub, BitAnd, BitOr, BitXor,
- LShift, RShift,
- # logical operators
- And, Or,
- # unary operators
- UAdd, USub, Not, Invert,
- # comparison operators
- Eq, Gt, GtE, In, Is, IsNot, Lt, LtE, NotEq, NotIn,
- )
-
-from astroid import nodes as new
-
-
-_BIN_OP_CLASSES = {Add: '+',
- BitAnd: '&',
- BitOr: '|',
- BitXor: '^',
- Div: '/',
- FloorDiv: '//',
- Mod: '%',
- Mult: '*',
- Pow: '**',
- Sub: '-',
- LShift: '<<',
- RShift: '>>',
- }
-
-_BOOL_OP_CLASSES = {And: 'and',
- Or: 'or',
- }
-
-_UNARY_OP_CLASSES = {UAdd: '+',
- USub: '-',
- Not: 'not',
- Invert: '~',
- }
-
-_CMP_OP_CLASSES = {Eq: '==',
- Gt: '>',
- GtE: '>=',
- In: 'in',
- Is: 'is',
- IsNot: 'is not',
- Lt: '<',
- LtE: '<=',
- NotEq: '!=',
- NotIn: 'not in',
- }
-
-CONST_NAME_TRANSFORMS = {'None': None,
- 'True': True,
- 'False': False,
- }
-
-REDIRECT = {'arguments': 'Arguments',
- 'Attribute': 'Getattr',
- 'comprehension': 'Comprehension',
- 'Call': 'CallFunc',
- 'ClassDef': 'Class',
- "ListCompFor": 'Comprehension',
- "GenExprFor": 'Comprehension',
- 'excepthandler': 'ExceptHandler',
- 'Expr': 'Discard',
- 'FunctionDef': 'Function',
- 'GeneratorExp': 'GenExpr',
- 'ImportFrom': 'From',
- 'keyword': 'Keyword',
- 'Repr': 'Backquote',
- }
-PY3K = sys.version_info >= (3, 0)
-PY34 = sys.version_info >= (3, 4)
-
-def _init_set_doc(node, newnode):
- newnode.doc = None
- try:
- if isinstance(node.body[0], Discard) and isinstance(node.body[0].value, Str):
- newnode.doc = node.body[0].value.s
- node.body = node.body[1:]
-
- except IndexError:
- pass # ast built from scratch
-
-def _lineno_parent(oldnode, newnode, parent):
- newnode.parent = parent
- newnode.lineno = oldnode.lineno
- newnode.col_offset = oldnode.col_offset
-
-def _set_infos(oldnode, newnode, parent):
- newnode.parent = parent
- if hasattr(oldnode, 'lineno'):
- newnode.lineno = oldnode.lineno
- if hasattr(oldnode, 'col_offset'):
- newnode.col_offset = oldnode.col_offset
-
-def _create_yield_node(node, parent, rebuilder, factory):
- newnode = factory()
- _lineno_parent(node, newnode, parent)
- if node.value is not None:
- newnode.value = rebuilder.visit(node.value, newnode)
- return newnode
-
-
-class TreeRebuilder(object):
- """Rebuilds the _ast tree to become an Astroid tree"""
-
- def __init__(self, manager):
- self._manager = manager
- self.asscontext = None
- self._global_names = []
- self._from_nodes = []
- self._delayed_assattr = []
- self._visit_meths = {}
- self._transform = manager.transform
-
- def visit_module(self, node, modname, modpath, package):
- """visit a Module node by returning a fresh instance of it"""
- newnode = new.Module(modname, None)
- newnode.package = package
- newnode.parent = None
- _init_set_doc(node, newnode)
- newnode.body = [self.visit(child, newnode) for child in node.body]
- newnode.file = newnode.path = modpath
- return self._transform(newnode)
-
- def visit(self, node, parent):
- cls = node.__class__
- if cls in self._visit_meths:
- visit_method = self._visit_meths[cls]
- else:
- cls_name = cls.__name__
- visit_name = 'visit_' + REDIRECT.get(cls_name, cls_name).lower()
- visit_method = getattr(self, visit_name)
- self._visit_meths[cls] = visit_method
- return self._transform(visit_method(node, parent))
-
- def _save_assignment(self, node, name=None):
- """save assignement situation since node.parent is not available yet"""
- if self._global_names and node.name in self._global_names[-1]:
- node.root().set_local(node.name, node)
- else:
- node.parent.set_local(node.name, node)
-
-
- def visit_arguments(self, node, parent):
- """visit a Arguments node by returning a fresh instance of it"""
- newnode = new.Arguments()
- newnode.parent = parent
- self.asscontext = "Ass"
- newnode.args = [self.visit(child, newnode) for child in node.args]
- self.asscontext = None
- newnode.defaults = [self.visit(child, newnode) for child in node.defaults]
- newnode.kwonlyargs = []
- newnode.kw_defaults = []
- vararg, kwarg = node.vararg, node.kwarg
- # change added in 82732 (7c5c678e4164), vararg and kwarg
- # are instances of `_ast.arg`, not strings
- if vararg:
- if PY34:
- if vararg.annotation:
- newnode.varargannotation = self.visit(vararg.annotation,
- newnode)
- vararg = vararg.arg
- elif PY3K and node.varargannotation:
- newnode.varargannotation = self.visit(node.varargannotation,
- newnode)
- if kwarg:
- if PY34:
- if kwarg.annotation:
- newnode.kwargannotation = self.visit(kwarg.annotation,
- newnode)
- kwarg = kwarg.arg
- elif PY3K:
- if node.kwargannotation:
- newnode.kwargannotation = self.visit(node.kwargannotation,
- newnode)
- newnode.vararg = vararg
- newnode.kwarg = kwarg
- # save argument names in locals:
- if vararg:
- newnode.parent.set_local(vararg, newnode)
- if kwarg:
- newnode.parent.set_local(kwarg, newnode)
- return newnode
-
- def visit_assattr(self, node, parent):
- """visit a AssAttr node by returning a fresh instance of it"""
- assc, self.asscontext = self.asscontext, None
- newnode = new.AssAttr()
- _lineno_parent(node, newnode, parent)
- newnode.expr = self.visit(node.expr, newnode)
- self.asscontext = assc
- self._delayed_assattr.append(newnode)
- return newnode
-
- def visit_assert(self, node, parent):
- """visit a Assert node by returning a fresh instance of it"""
- newnode = new.Assert()
- _lineno_parent(node, newnode, parent)
- newnode.test = self.visit(node.test, newnode)
- if node.msg is not None:
- newnode.fail = self.visit(node.msg, newnode)
- return newnode
-
- def visit_assign(self, node, parent):
- """visit a Assign node by returning a fresh instance of it"""
- newnode = new.Assign()
- _lineno_parent(node, newnode, parent)
- self.asscontext = "Ass"
- newnode.targets = [self.visit(child, newnode) for child in node.targets]
- self.asscontext = None
- newnode.value = self.visit(node.value, newnode)
- # set some function or metaclass infos XXX explain ?
- klass = newnode.parent.frame()
- if (isinstance(klass, new.Class)
- and isinstance(newnode.value, new.CallFunc)
- and isinstance(newnode.value.func, new.Name)):
- func_name = newnode.value.func.name
- for ass_node in newnode.targets:
- try:
- meth = klass[ass_node.name]
- if isinstance(meth, new.Function):
- if func_name in ('classmethod', 'staticmethod'):
- meth.type = func_name
- elif func_name == 'classproperty': # see lgc.decorators
- meth.type = 'classmethod'
- meth.extra_decorators.append(newnode.value)
- except (AttributeError, KeyError):
- continue
- return newnode
-
- def visit_assname(self, node, parent, node_name=None):
- '''visit a node and return a AssName node'''
- newnode = new.AssName()
- _set_infos(node, newnode, parent)
- newnode.name = node_name
- self._save_assignment(newnode)
- return newnode
-
- def visit_augassign(self, node, parent):
- """visit a AugAssign node by returning a fresh instance of it"""
- newnode = new.AugAssign()
- _lineno_parent(node, newnode, parent)
- newnode.op = _BIN_OP_CLASSES[node.op.__class__] + "="
- self.asscontext = "Ass"
- newnode.target = self.visit(node.target, newnode)
- self.asscontext = None
- newnode.value = self.visit(node.value, newnode)
- return newnode
-
- def visit_backquote(self, node, parent):
- """visit a Backquote node by returning a fresh instance of it"""
- newnode = new.Backquote()
- _lineno_parent(node, newnode, parent)
- newnode.value = self.visit(node.value, newnode)
- return newnode
-
- def visit_binop(self, node, parent):
- """visit a BinOp node by returning a fresh instance of it"""
- newnode = new.BinOp()
- _lineno_parent(node, newnode, parent)
- newnode.left = self.visit(node.left, newnode)
- newnode.right = self.visit(node.right, newnode)
- newnode.op = _BIN_OP_CLASSES[node.op.__class__]
- return newnode
-
- def visit_boolop(self, node, parent):
- """visit a BoolOp node by returning a fresh instance of it"""
- newnode = new.BoolOp()
- _lineno_parent(node, newnode, parent)
- newnode.values = [self.visit(child, newnode) for child in node.values]
- newnode.op = _BOOL_OP_CLASSES[node.op.__class__]
- return newnode
-
- def visit_break(self, node, parent):
- """visit a Break node by returning a fresh instance of it"""
- newnode = new.Break()
- _set_infos(node, newnode, parent)
- return newnode
-
- def visit_callfunc(self, node, parent):
- """visit a CallFunc node by returning a fresh instance of it"""
- newnode = new.CallFunc()
- _lineno_parent(node, newnode, parent)
- newnode.func = self.visit(node.func, newnode)
- newnode.args = [self.visit(child, newnode) for child in node.args]
- if node.starargs is not None:
- newnode.starargs = self.visit(node.starargs, newnode)
- if node.kwargs is not None:
- newnode.kwargs = self.visit(node.kwargs, newnode)
- for child in node.keywords:
- newnode.args.append(self.visit(child, newnode))
- return newnode
-
- def visit_class(self, node, parent):
- """visit a Class node to become astroid"""
- newnode = new.Class(node.name, None)
- _lineno_parent(node, newnode, parent)
- _init_set_doc(node, newnode)
- newnode.bases = [self.visit(child, newnode) for child in node.bases]
- newnode.body = [self.visit(child, newnode) for child in node.body]
- if 'decorator_list' in node._fields and node.decorator_list:# py >= 2.6
- newnode.decorators = self.visit_decorators(node, newnode)
- newnode.parent.frame().set_local(newnode.name, newnode)
- return newnode
-
- def visit_const(self, node, parent):
- """visit a Const node by returning a fresh instance of it"""
- newnode = new.Const(node.value)
- _set_infos(node, newnode, parent)
- return newnode
-
- def visit_continue(self, node, parent):
- """visit a Continue node by returning a fresh instance of it"""
- newnode = new.Continue()
- _set_infos(node, newnode, parent)
- return newnode
-
- def visit_compare(self, node, parent):
- """visit a Compare node by returning a fresh instance of it"""
- newnode = new.Compare()
- _lineno_parent(node, newnode, parent)
- newnode.left = self.visit(node.left, newnode)
- newnode.ops = [(_CMP_OP_CLASSES[op.__class__], self.visit(expr, newnode))
- for (op, expr) in zip(node.ops, node.comparators)]
- return newnode
-
- def visit_comprehension(self, node, parent):
- """visit a Comprehension node by returning a fresh instance of it"""
- newnode = new.Comprehension()
- newnode.parent = parent
- self.asscontext = "Ass"
- newnode.target = self.visit(node.target, newnode)
- self.asscontext = None
- newnode.iter = self.visit(node.iter, newnode)
- newnode.ifs = [self.visit(child, newnode) for child in node.ifs]
- return newnode
-
- def visit_decorators(self, node, parent):
- """visit a Decorators node by returning a fresh instance of it"""
- # /!\ node is actually a _ast.Function node while
- # parent is a astroid.nodes.Function node
- newnode = new.Decorators()
- _lineno_parent(node, newnode, parent)
- if 'decorators' in node._fields: # py < 2.6, i.e. 2.5
- decorators = node.decorators
- else:
- decorators = node.decorator_list
- newnode.nodes = [self.visit(child, newnode) for child in decorators]
- return newnode
-
- def visit_delete(self, node, parent):
- """visit a Delete node by returning a fresh instance of it"""
- newnode = new.Delete()
- _lineno_parent(node, newnode, parent)
- self.asscontext = "Del"
- newnode.targets = [self.visit(child, newnode) for child in node.targets]
- self.asscontext = None
- return newnode
-
- def visit_dict(self, node, parent):
- """visit a Dict node by returning a fresh instance of it"""
- newnode = new.Dict()
- _lineno_parent(node, newnode, parent)
- newnode.items = [(self.visit(key, newnode), self.visit(value, newnode))
- for key, value in zip(node.keys, node.values)]
- return newnode
-
- def visit_dictcomp(self, node, parent):
- """visit a DictComp node by returning a fresh instance of it"""
- newnode = new.DictComp()
- _lineno_parent(node, newnode, parent)
- newnode.key = self.visit(node.key, newnode)
- newnode.value = self.visit(node.value, newnode)
- newnode.generators = [self.visit(child, newnode)
- for child in node.generators]
- return newnode
-
- def visit_discard(self, node, parent):
- """visit a Discard node by returning a fresh instance of it"""
- newnode = new.Discard()
- _lineno_parent(node, newnode, parent)
- newnode.value = self.visit(node.value, newnode)
- return newnode
-
- def visit_ellipsis(self, node, parent):
- """visit an Ellipsis node by returning a fresh instance of it"""
- newnode = new.Ellipsis()
- _set_infos(node, newnode, parent)
- return newnode
-
- def visit_emptynode(self, node, parent):
- """visit an EmptyNode node by returning a fresh instance of it"""
- newnode = new.EmptyNode()
- _set_infos(node, newnode, parent)
- return newnode
-
- def visit_excepthandler(self, node, parent):
- """visit an ExceptHandler node by returning a fresh instance of it"""
- newnode = new.ExceptHandler()
- _lineno_parent(node, newnode, parent)
- if node.type is not None:
- newnode.type = self.visit(node.type, newnode)
- if node.name is not None:
- # /!\ node.name can be a tuple
- self.asscontext = "Ass"
- newnode.name = self.visit(node.name, newnode)
- self.asscontext = None
- newnode.body = [self.visit(child, newnode) for child in node.body]
- return newnode
-
- def visit_exec(self, node, parent):
- """visit an Exec node by returning a fresh instance of it"""
- newnode = new.Exec()
- _lineno_parent(node, newnode, parent)
- newnode.expr = self.visit(node.body, newnode)
- if node.globals is not None:
- newnode.globals = self.visit(node.globals, newnode)
- if node.locals is not None:
- newnode.locals = self.visit(node.locals, newnode)
- return newnode
-
- def visit_extslice(self, node, parent):
- """visit an ExtSlice node by returning a fresh instance of it"""
- newnode = new.ExtSlice()
- newnode.parent = parent
- newnode.dims = [self.visit(dim, newnode) for dim in node.dims]
- return newnode
-
- def visit_for(self, node, parent):
- """visit a For node by returning a fresh instance of it"""
- newnode = new.For()
- _lineno_parent(node, newnode, parent)
- self.asscontext = "Ass"
- newnode.target = self.visit(node.target, newnode)
- self.asscontext = None
- newnode.iter = self.visit(node.iter, newnode)
- newnode.body = [self.visit(child, newnode) for child in node.body]
- newnode.orelse = [self.visit(child, newnode) for child in node.orelse]
- return newnode
-
- def visit_from(self, node, parent):
- """visit a From node by returning a fresh instance of it"""
- names = [(alias.name, alias.asname) for alias in node.names]
- newnode = new.From(node.module or '', names, node.level or None)
- _set_infos(node, newnode, parent)
- # store From names to add them to locals after building
- self._from_nodes.append(newnode)
- return newnode
-
- def visit_function(self, node, parent):
- """visit an Function node to become astroid"""
- self._global_names.append({})
- newnode = new.Function(node.name, None)
- _lineno_parent(node, newnode, parent)
- _init_set_doc(node, newnode)
- newnode.args = self.visit(node.args, newnode)
- newnode.body = [self.visit(child, newnode) for child in node.body]
- if 'decorators' in node._fields: # py < 2.6
- attr = 'decorators'
- else:
- attr = 'decorator_list'
- decorators = getattr(node, attr)
- if decorators:
- newnode.decorators = self.visit_decorators(node, newnode)
- if PY3K and node.returns:
- newnode.returns = self.visit(node.returns, newnode)
- self._global_names.pop()
- frame = newnode.parent.frame()
- if isinstance(frame, new.Class):
- if newnode.name == '__new__':
- newnode._type = 'classmethod'
- else:
- newnode._type = 'method'
- if newnode.decorators is not None:
- for decorator_expr in newnode.decorators.nodes:
- if isinstance(decorator_expr, new.Name):
- if decorator_expr.name in ('classmethod', 'staticmethod'):
- newnode._type = decorator_expr.name
- elif decorator_expr.name == 'classproperty':
- newnode._type = 'classmethod'
- frame.set_local(newnode.name, newnode)
- return newnode
-
- def visit_genexpr(self, node, parent):
- """visit a GenExpr node by returning a fresh instance of it"""
- newnode = new.GenExpr()
- _lineno_parent(node, newnode, parent)
- newnode.elt = self.visit(node.elt, newnode)
- newnode.generators = [self.visit(child, newnode) for child in node.generators]
- return newnode
-
- def visit_getattr(self, node, parent):
- """visit a Getattr node by returning a fresh instance of it"""
- if self.asscontext == "Del":
- # FIXME : maybe we should reintroduce and visit_delattr ?
- # for instance, deactivating asscontext
- newnode = new.DelAttr()
- elif self.asscontext == "Ass":
- # FIXME : maybe we should call visit_assattr ?
- newnode = new.AssAttr()
- self._delayed_assattr.append(newnode)
- else:
- newnode = new.Getattr()
- _lineno_parent(node, newnode, parent)
- asscontext, self.asscontext = self.asscontext, None
- newnode.expr = self.visit(node.value, newnode)
- self.asscontext = asscontext
- newnode.attrname = node.attr
- return newnode
-
- def visit_global(self, node, parent):
- """visit an Global node to become astroid"""
- newnode = new.Global(node.names)
- _set_infos(node, newnode, parent)
- if self._global_names: # global at the module level, no effect
- for name in node.names:
- self._global_names[-1].setdefault(name, []).append(newnode)
- return newnode
-
- def visit_if(self, node, parent):
- """visit a If node by returning a fresh instance of it"""
- newnode = new.If()
- _lineno_parent(node, newnode, parent)
- newnode.test = self.visit(node.test, newnode)
- newnode.body = [self.visit(child, newnode) for child in node.body]
- newnode.orelse = [self.visit(child, newnode) for child in node.orelse]
- return newnode
-
- def visit_ifexp(self, node, parent):
- """visit a IfExp node by returning a fresh instance of it"""
- newnode = new.IfExp()
- _lineno_parent(node, newnode, parent)
- newnode.test = self.visit(node.test, newnode)
- newnode.body = self.visit(node.body, newnode)
- newnode.orelse = self.visit(node.orelse, newnode)
- return newnode
-
- def visit_import(self, node, parent):
- """visit a Import node by returning a fresh instance of it"""
- newnode = new.Import()
- _set_infos(node, newnode, parent)
- newnode.names = [(alias.name, alias.asname) for alias in node.names]
- # save import names in parent's locals:
- for (name, asname) in newnode.names:
- name = asname or name
- newnode.parent.set_local(name.split('.')[0], newnode)
- return newnode
-
- def visit_index(self, node, parent):
- """visit a Index node by returning a fresh instance of it"""
- newnode = new.Index()
- newnode.parent = parent
- newnode.value = self.visit(node.value, newnode)
- return newnode
-
- def visit_keyword(self, node, parent):
- """visit a Keyword node by returning a fresh instance of it"""
- newnode = new.Keyword()
- newnode.parent = parent
- newnode.arg = node.arg
- newnode.value = self.visit(node.value, newnode)
- return newnode
-
- def visit_lambda(self, node, parent):
- """visit a Lambda node by returning a fresh instance of it"""
- newnode = new.Lambda()
- _lineno_parent(node, newnode, parent)
- newnode.args = self.visit(node.args, newnode)
- newnode.body = self.visit(node.body, newnode)
- return newnode
-
- def visit_list(self, node, parent):
- """visit a List node by returning a fresh instance of it"""
- newnode = new.List()
- _lineno_parent(node, newnode, parent)
- newnode.elts = [self.visit(child, newnode) for child in node.elts]
- return newnode
-
- def visit_listcomp(self, node, parent):
- """visit a ListComp node by returning a fresh instance of it"""
- newnode = new.ListComp()
- _lineno_parent(node, newnode, parent)
- newnode.elt = self.visit(node.elt, newnode)
- newnode.generators = [self.visit(child, newnode)
- for child in node.generators]
- return newnode
-
- def visit_name(self, node, parent):
- """visit a Name node by returning a fresh instance of it"""
- # True and False can be assigned to something in py2x, so we have to
- # check first the asscontext
- if self.asscontext == "Del":
- newnode = new.DelName()
- elif self.asscontext is not None: # Ass
- assert self.asscontext == "Ass"
- newnode = new.AssName()
- elif node.id in CONST_NAME_TRANSFORMS:
- newnode = new.Const(CONST_NAME_TRANSFORMS[node.id])
- _set_infos(node, newnode, parent)
- return newnode
- else:
- newnode = new.Name()
- _lineno_parent(node, newnode, parent)
- newnode.name = node.id
- # XXX REMOVE me :
- if self.asscontext in ('Del', 'Ass'): # 'Aug' ??
- self._save_assignment(newnode)
- return newnode
-
- def visit_bytes(self, node, parent):
- """visit a Bytes node by returning a fresh instance of Const"""
- newnode = new.Const(node.s)
- _set_infos(node, newnode, parent)
- return newnode
-
- def visit_num(self, node, parent):
- """visit a Num node by returning a fresh instance of Const"""
- newnode = new.Const(node.n)
- _set_infos(node, newnode, parent)
- return newnode
-
- def visit_pass(self, node, parent):
- """visit a Pass node by returning a fresh instance of it"""
- newnode = new.Pass()
- _set_infos(node, newnode, parent)
- return newnode
-
- def visit_str(self, node, parent):
- """visit a Str node by returning a fresh instance of Const"""
- newnode = new.Const(node.s)
- _set_infos(node, newnode, parent)
- return newnode
-
- def visit_print(self, node, parent):
- """visit a Print node by returning a fresh instance of it"""
- newnode = new.Print()
- _lineno_parent(node, newnode, parent)
- newnode.nl = node.nl
- if node.dest is not None:
- newnode.dest = self.visit(node.dest, newnode)
- newnode.values = [self.visit(child, newnode) for child in node.values]
- return newnode
-
- def visit_raise(self, node, parent):
- """visit a Raise node by returning a fresh instance of it"""
- newnode = new.Raise()
- _lineno_parent(node, newnode, parent)
- if node.type is not None:
- newnode.exc = self.visit(node.type, newnode)
- if node.inst is not None:
- newnode.inst = self.visit(node.inst, newnode)
- if node.tback is not None:
- newnode.tback = self.visit(node.tback, newnode)
- return newnode
-
- def visit_return(self, node, parent):
- """visit a Return node by returning a fresh instance of it"""
- newnode = new.Return()
- _lineno_parent(node, newnode, parent)
- if node.value is not None:
- newnode.value = self.visit(node.value, newnode)
- return newnode
-
- def visit_set(self, node, parent):
- """visit a Set node by returning a fresh instance of it"""
- newnode = new.Set()
- _lineno_parent(node, newnode, parent)
- newnode.elts = [self.visit(child, newnode) for child in node.elts]
- return newnode
-
- def visit_setcomp(self, node, parent):
- """visit a SetComp node by returning a fresh instance of it"""
- newnode = new.SetComp()
- _lineno_parent(node, newnode, parent)
- newnode.elt = self.visit(node.elt, newnode)
- newnode.generators = [self.visit(child, newnode)
- for child in node.generators]
- return newnode
-
- def visit_slice(self, node, parent):
- """visit a Slice node by returning a fresh instance of it"""
- newnode = new.Slice()
- newnode.parent = parent
- if node.lower is not None:
- newnode.lower = self.visit(node.lower, newnode)
- if node.upper is not None:
- newnode.upper = self.visit(node.upper, newnode)
- if node.step is not None:
- newnode.step = self.visit(node.step, newnode)
- return newnode
-
- def visit_subscript(self, node, parent):
- """visit a Subscript node by returning a fresh instance of it"""
- newnode = new.Subscript()
- _lineno_parent(node, newnode, parent)
- subcontext, self.asscontext = self.asscontext, None
- newnode.value = self.visit(node.value, newnode)
- newnode.slice = self.visit(node.slice, newnode)
- self.asscontext = subcontext
- return newnode
-
- def visit_tryexcept(self, node, parent):
- """visit a TryExcept node by returning a fresh instance of it"""
- newnode = new.TryExcept()
- _lineno_parent(node, newnode, parent)
- newnode.body = [self.visit(child, newnode) for child in node.body]
- newnode.handlers = [self.visit(child, newnode) for child in node.handlers]
- newnode.orelse = [self.visit(child, newnode) for child in node.orelse]
- return newnode
-
- def visit_tryfinally(self, node, parent):
- """visit a TryFinally node by returning a fresh instance of it"""
- newnode = new.TryFinally()
- _lineno_parent(node, newnode, parent)
- newnode.body = [self.visit(child, newnode) for child in node.body]
- newnode.finalbody = [self.visit(n, newnode) for n in node.finalbody]
- return newnode
-
- def visit_tuple(self, node, parent):
- """visit a Tuple node by returning a fresh instance of it"""
- newnode = new.Tuple()
- _lineno_parent(node, newnode, parent)
- newnode.elts = [self.visit(child, newnode) for child in node.elts]
- return newnode
-
- def visit_unaryop(self, node, parent):
- """visit a UnaryOp node by returning a fresh instance of it"""
- newnode = new.UnaryOp()
- _lineno_parent(node, newnode, parent)
- newnode.operand = self.visit(node.operand, newnode)
- newnode.op = _UNARY_OP_CLASSES[node.op.__class__]
- return newnode
-
- def visit_while(self, node, parent):
- """visit a While node by returning a fresh instance of it"""
- newnode = new.While()
- _lineno_parent(node, newnode, parent)
- newnode.test = self.visit(node.test, newnode)
- newnode.body = [self.visit(child, newnode) for child in node.body]
- newnode.orelse = [self.visit(child, newnode) for child in node.orelse]
- return newnode
-
- def visit_with(self, node, parent):
- newnode = new.With()
- _lineno_parent(node, newnode, parent)
- expr = self.visit(node.context_expr, newnode)
- self.asscontext = "Ass"
- if node.optional_vars is not None:
- vars = self.visit(node.optional_vars, newnode)
- else:
- vars = None
- self.asscontext = None
- newnode.items = [(expr, vars)]
- newnode.body = [self.visit(child, newnode) for child in node.body]
- return newnode
-
- def visit_yield(self, node, parent):
- """visit a Yield node by returning a fresh instance of it"""
- return _create_yield_node(node, parent, self, new.Yield)
-
-class TreeRebuilder3k(TreeRebuilder):
- """extend and overwrite TreeRebuilder for python3k"""
-
- def visit_arg(self, node, parent):
- """visit a arg node by returning a fresh AssName instance"""
- # the <arg> node is coming from py>=3.0, but we use AssName in py2.x
- # XXX or we should instead introduce a Arg node in astroid ?
- return self.visit_assname(node, parent, node.arg)
-
- def visit_nameconstant(self, node, parent):
- # in Python 3.4 we have NameConstant for True / False / None
- newnode = new.Const(node.value)
- _set_infos(node, newnode, parent)
- return newnode
-
- def visit_arguments(self, node, parent):
- newnode = super(TreeRebuilder3k, self).visit_arguments(node, parent)
- self.asscontext = "Ass"
- newnode.kwonlyargs = [self.visit(child, newnode) for child in node.kwonlyargs]
- self.asscontext = None
- newnode.kw_defaults = [self.visit(child, newnode) if child else None for child in node.kw_defaults]
- newnode.annotations = [
- self.visit(arg.annotation, newnode) if arg.annotation else None
- for arg in node.args]
- return newnode
-
- def visit_excepthandler(self, node, parent):
- """visit an ExceptHandler node by returning a fresh instance of it"""
- newnode = new.ExceptHandler()
- _lineno_parent(node, newnode, parent)
- if node.type is not None:
- newnode.type = self.visit(node.type, newnode)
- if node.name is not None:
- newnode.name = self.visit_assname(node, newnode, node.name)
- newnode.body = [self.visit(child, newnode) for child in node.body]
- return newnode
-
- def visit_nonlocal(self, node, parent):
- """visit a Nonlocal node and return a new instance of it"""
- newnode = new.Nonlocal(node.names)
- _set_infos(node, newnode, parent)
- return newnode
-
- def visit_raise(self, node, parent):
- """visit a Raise node by returning a fresh instance of it"""
- newnode = new.Raise()
- _lineno_parent(node, newnode, parent)
- # no traceback; anyway it is not used in Pylint
- if node.exc is not None:
- newnode.exc = self.visit(node.exc, newnode)
- if node.cause is not None:
- newnode.cause = self.visit(node.cause, newnode)
- return newnode
-
- def visit_starred(self, node, parent):
- """visit a Starred node and return a new instance of it"""
- newnode = new.Starred()
- _lineno_parent(node, newnode, parent)
- newnode.value = self.visit(node.value, newnode)
- return newnode
-
- def visit_try(self, node, parent):
- # python 3.3 introduce a new Try node replacing TryFinally/TryExcept nodes
- if node.finalbody:
- newnode = new.TryFinally()
- _lineno_parent(node, newnode, parent)
- newnode.finalbody = [self.visit(n, newnode) for n in node.finalbody]
- if node.handlers:
- excnode = new.TryExcept()
- _lineno_parent(node, excnode, newnode)
- excnode.body = [self.visit(child, excnode) for child in node.body]
- excnode.handlers = [self.visit(child, excnode) for child in node.handlers]
- excnode.orelse = [self.visit(child, excnode) for child in node.orelse]
- newnode.body = [excnode]
- else:
- newnode.body = [self.visit(child, newnode) for child in node.body]
- elif node.handlers:
- newnode = new.TryExcept()
- _lineno_parent(node, newnode, parent)
- newnode.body = [self.visit(child, newnode) for child in node.body]
- newnode.handlers = [self.visit(child, newnode) for child in node.handlers]
- newnode.orelse = [self.visit(child, newnode) for child in node.orelse]
- return newnode
-
- def visit_with(self, node, parent):
- if 'items' not in node._fields:
- # python < 3.3
- return super(TreeRebuilder3k, self).visit_with(node, parent)
-
- newnode = new.With()
- _lineno_parent(node, newnode, parent)
- def visit_child(child):
- expr = self.visit(child.context_expr, newnode)
- self.asscontext = 'Ass'
- if child.optional_vars:
- var = self.visit(child.optional_vars, newnode)
- else:
- var = None
- self.asscontext = None
- return expr, var
- newnode.items = [visit_child(child)
- for child in node.items]
- newnode.body = [self.visit(child, newnode) for child in node.body]
- return newnode
-
- def visit_yieldfrom(self, node, parent):
- return _create_yield_node(node, parent, self, new.YieldFrom)
-
- def visit_class(self, node, parent):
- newnode = super(TreeRebuilder3k, self).visit_class(node, parent)
- newnode._newstyle = True
- for keyword in node.keywords:
- if keyword.arg == 'metaclass':
- newnode._metaclass = self.visit(keyword, newnode).value
- break
- return newnode
-
-if sys.version_info >= (3, 0):
- TreeRebuilder = TreeRebuilder3k
-
-
diff --git a/chromium/third_party/logilab/logilab/astroid/scoped_nodes.py b/chromium/third_party/logilab/logilab/astroid/scoped_nodes.py
deleted file mode 100644
index db39b8b4216..00000000000
--- a/chromium/third_party/logilab/logilab/astroid/scoped_nodes.py
+++ /dev/null
@@ -1,1459 +0,0 @@
-# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of astroid.
-#
-# astroid is free software: you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as published by the
-# Free Software Foundation, either version 2.1 of the License, or (at your
-# option) any later version.
-#
-# astroid 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 Lesser General Public License
-# for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with astroid. If not, see <http://www.gnu.org/licenses/>.
-"""This module contains the classes for "scoped" node, i.e. which are opening a
-new local scope in the language definition : Module, Class, Function (and
-Lambda, GenExpr, DictComp and SetComp to some extent).
-"""
-from __future__ import with_statement
-
-__doctype__ = "restructuredtext en"
-
-import sys
-import warnings
-from itertools import chain
-try:
- from io import BytesIO
-except ImportError:
- from cStringIO import StringIO as BytesIO
-
-import six
-from logilab.common.compat import builtins
-from logilab.common.decorators import cached, cachedproperty
-
-from astroid.exceptions import NotFoundError, \
- AstroidBuildingException, InferenceError, ResolveError
-from astroid.node_classes import Const, DelName, DelAttr, \
- Dict, From, List, Pass, Raise, Return, Tuple, Yield, YieldFrom, \
- LookupMixIn, const_factory as cf, unpack_infer, Name, CallFunc
-from astroid.bases import NodeNG, InferenceContext, Instance,\
- YES, Generator, UnboundMethod, BoundMethod, _infer_stmts, \
- BUILTINS
-from astroid.mixins import FilterStmtsMixin
-from astroid.bases import Statement
-from astroid.manager import AstroidManager
-
-ITER_METHODS = ('__iter__', '__getitem__')
-PY3K = sys.version_info >= (3, 0)
-
-def _c3_merge(sequences):
- """Merges MROs in *sequences* to a single MRO using the C3 algorithm.
-
- Adapted from http://www.python.org/download/releases/2.3/mro/.
-
- """
- result = []
- while True:
- sequences = [s for s in sequences if s] # purge empty sequences
- if not sequences:
- return result
- for s1 in sequences: # find merge candidates among seq heads
- candidate = s1[0]
- for s2 in sequences:
- if candidate in s2[1:]:
- candidate = None
- break # reject the current head, it appears later
- else:
- break
- if not candidate:
- # Show all the remaining bases, which were considered as
- # candidates for the next mro sequence.
- bases = ["({})".format(", ".join(base.name
- for base in subsequence))
- for subsequence in sequences]
- raise ResolveError("Cannot create a consistent method resolution "
- "order for bases %s" % ", ".join(bases))
- result.append(candidate)
- # remove the chosen candidate
- for seq in sequences:
- if seq[0] == candidate:
- del seq[0]
-
-
-def _verify_duplicates_mro(sequences):
- for sequence in sequences:
- names = [node.qname() for node in sequence]
- if len(names) != len(set(names)):
- raise ResolveError('Duplicates found in the mro.')
-
-
-def remove_nodes(func, cls):
- def wrapper(*args, **kwargs):
- nodes = [n for n in func(*args, **kwargs) if not isinstance(n, cls)]
- if not nodes:
- raise NotFoundError()
- return nodes
- return wrapper
-
-
-def function_to_method(n, klass):
- if isinstance(n, Function):
- if n.type == 'classmethod':
- return BoundMethod(n, klass)
- if n.type != 'staticmethod':
- return UnboundMethod(n)
- return n
-
-def std_special_attributes(self, name, add_locals=True):
- if add_locals:
- locals = self.locals
- else:
- locals = {}
- if name == '__name__':
- return [cf(self.name)] + locals.get(name, [])
- if name == '__doc__':
- return [cf(self.doc)] + locals.get(name, [])
- if name == '__dict__':
- return [Dict()] + locals.get(name, [])
- raise NotFoundError(name)
-
-MANAGER = AstroidManager()
-def builtin_lookup(name):
- """lookup a name into the builtin module
- return the list of matching statements and the astroid for the builtin
- module
- """
- builtin_astroid = MANAGER.ast_from_module(builtins)
- if name == '__dict__':
- return builtin_astroid, ()
- try:
- stmts = builtin_astroid.locals[name]
- except KeyError:
- stmts = ()
- return builtin_astroid, stmts
-
-
-# TODO move this Mixin to mixins.py; problem: 'Function' in _scope_lookup
-class LocalsDictNodeNG(LookupMixIn, NodeNG):
- """ this class provides locals handling common to Module, Function
- and Class nodes, including a dict like interface for direct access
- to locals information
- """
-
- # attributes below are set by the builder module or by raw factories
-
- # dictionary of locals with name as key and node defining the local as
- # value
-
- def qname(self):
- """return the 'qualified' name of the node, eg module.name,
- module.class.name ...
- """
- if self.parent is None:
- return self.name
- return '%s.%s' % (self.parent.frame().qname(), self.name)
-
- def frame(self):
- """return the first parent frame node (i.e. Module, Function or Class)
- """
- return self
-
- def scope(self):
- """return the first node defining a new scope (i.e. Module,
- Function, Class, Lambda but also GenExpr, DictComp and SetComp)
- """
- return self
-
-
- def _scope_lookup(self, node, name, offset=0):
- """XXX method for interfacing the scope lookup"""
- try:
- stmts = node._filter_stmts(self.locals[name], self, offset)
- except KeyError:
- stmts = ()
- if stmts:
- return self, stmts
- if self.parent: # i.e. not Module
- # nested scope: if parent scope is a function, that's fine
- # else jump to the module
- pscope = self.parent.scope()
- if not pscope.is_function:
- pscope = pscope.root()
- return pscope.scope_lookup(node, name)
- return builtin_lookup(name) # Module
-
-
-
- def set_local(self, name, stmt):
- """define <name> in locals (<stmt> is the node defining the name)
- if the node is a Module node (i.e. has globals), add the name to
- globals
-
- if the name is already defined, ignore it
- """
- #assert not stmt in self.locals.get(name, ()), (self, stmt)
- self.locals.setdefault(name, []).append(stmt)
-
- __setitem__ = set_local
-
- def _append_node(self, child):
- """append a child, linking it in the tree"""
- self.body.append(child)
- child.parent = self
-
- def add_local_node(self, child_node, name=None):
- """append a child which should alter locals to the given node"""
- if name != '__class__':
- # add __class__ node as a child will cause infinite recursion later!
- self._append_node(child_node)
- self.set_local(name or child_node.name, child_node)
-
-
- def __getitem__(self, item):
- """method from the `dict` interface returning the first node
- associated with the given name in the locals dictionary
-
- :type item: str
- :param item: the name of the locally defined object
- :raises KeyError: if the name is not defined
- """
- return self.locals[item][0]
-
- def __iter__(self):
- """method from the `dict` interface returning an iterator on
- `self.keys()`
- """
- return iter(self.keys())
-
- def keys(self):
- """method from the `dict` interface returning a tuple containing
- locally defined names
- """
- return list(self.locals.keys())
-
- def values(self):
- """method from the `dict` interface returning a tuple containing
- locally defined nodes which are instance of `Function` or `Class`
- """
- return [self[key] for key in self.keys()]
-
- def items(self):
- """method from the `dict` interface returning a list of tuple
- containing each locally defined name with its associated node,
- which is an instance of `Function` or `Class`
- """
- return list(zip(self.keys(), self.values()))
-
-
- def __contains__(self, name):
- return name in self.locals
- has_key = __contains__
-
-# Module #####################################################################
-
-class Module(LocalsDictNodeNG):
- _astroid_fields = ('body',)
-
- fromlineno = 0
- lineno = 0
-
- # attributes below are set by the builder module or by raw factories
-
- # the file from which as been extracted the astroid representation. It may
- # be None if the representation has been built from a built-in module
- file = None
- # Alternatively, if built from a string/bytes, this can be set
- file_bytes = None
- # encoding of python source file, so we can get unicode out of it (python2
- # only)
- file_encoding = None
- # the module name
- name = None
- # boolean for astroid built from source (i.e. ast)
- pure_python = None
- # boolean for package module
- package = None
- # dictionary of globals with name as key and node defining the global
- # as value
- globals = None
-
- # Future imports
- future_imports = None
-
- # names of python special attributes (handled by getattr impl.)
- special_attributes = set(('__name__', '__doc__', '__file__', '__path__',
- '__dict__'))
- # names of module attributes available through the global scope
- scope_attrs = set(('__name__', '__doc__', '__file__', '__path__'))
-
- def __init__(self, name, doc, pure_python=True):
- self.name = name
- self.doc = doc
- self.pure_python = pure_python
- self.locals = self.globals = {}
- self.body = []
- self.future_imports = set()
-
- def _get_stream(self):
- if self.file_bytes is not None:
- return BytesIO(self.file_bytes)
- if self.file is not None:
- stream = open(self.file, 'rb')
- return stream
- return None
-
- @property
- def file_stream(self):
- warnings.warn("file_stream property is deprecated and "
- "it is slated for removal in astroid 1.6."
- "Use the new method 'stream' instead.",
- PendingDeprecationWarning,
- stacklevel=2)
- return self._get_stream()
-
- def stream(self):
- """Get a stream to the underlying file or bytes."""
- return self._get_stream()
-
- def close(self):
- """Close the underlying file streams."""
- warnings.warn("close method is deprecated and it is "
- "slated for removal in astroid 1.6, along "
- "with 'file_stream' property. "
- "Its behaviour is replaced by managing each "
- "file stream returned by the 'stream' method.",
- PendingDeprecationWarning,
- stacklevel=2)
-
- def block_range(self, lineno):
- """return block line numbers.
-
- start from the beginning whatever the given lineno
- """
- return self.fromlineno, self.tolineno
-
- def scope_lookup(self, node, name, offset=0):
- if name in self.scope_attrs and not name in self.locals:
- try:
- return self, self.getattr(name)
- except NotFoundError:
- return self, ()
- return self._scope_lookup(node, name, offset)
-
- def pytype(self):
- return '%s.module' % BUILTINS
-
- def display_type(self):
- return 'Module'
-
- def getattr(self, name, context=None, ignore_locals=False):
- if name in self.special_attributes:
- if name == '__file__':
- return [cf(self.file)] + self.locals.get(name, [])
- if name == '__path__' and self.package:
- return [List()] + self.locals.get(name, [])
- return std_special_attributes(self, name)
- if not ignore_locals and name in self.locals:
- return self.locals[name]
- if self.package:
- try:
- return [self.import_module(name, relative_only=True)]
- except AstroidBuildingException:
- raise NotFoundError(name)
- except SyntaxError:
- raise NotFoundError(name)
- except Exception:# XXX pylint tests never pass here; do we need it?
- import traceback
- traceback.print_exc()
- raise NotFoundError(name)
- getattr = remove_nodes(getattr, DelName)
-
- def igetattr(self, name, context=None):
- """inferred getattr"""
- # set lookup name since this is necessary to infer on import nodes for
- # instance
- if not context:
- context = InferenceContext()
- try:
- return _infer_stmts(self.getattr(name, context), context, frame=self, lookupname=name)
- except NotFoundError:
- raise InferenceError(name)
-
- def fully_defined(self):
- """return True if this module has been built from a .py file
- and so contains a complete representation including the code
- """
- return self.file is not None and self.file.endswith('.py')
-
- def statement(self):
- """return the first parent node marked as statement node
- consider a module as a statement...
- """
- return self
-
- def previous_sibling(self):
- """module has no sibling"""
- return
-
- def next_sibling(self):
- """module has no sibling"""
- return
-
- if sys.version_info < (2, 8):
- @cachedproperty
- def _absolute_import_activated(self):
- for stmt in self.locals.get('absolute_import', ()):
- if isinstance(stmt, From) and stmt.modname == '__future__':
- return True
- return False
- else:
- _absolute_import_activated = True
-
- def absolute_import_activated(self):
- return self._absolute_import_activated
-
- def import_module(self, modname, relative_only=False, level=None):
- """import the given module considering self as context"""
- if relative_only and level is None:
- level = 0
- absmodname = self.relative_to_absolute_name(modname, level)
- try:
- return MANAGER.ast_from_module_name(absmodname)
- except AstroidBuildingException:
- # we only want to import a sub module or package of this module,
- # skip here
- if relative_only:
- raise
- return MANAGER.ast_from_module_name(modname)
-
- def relative_to_absolute_name(self, modname, level):
- """return the absolute module name for a relative import.
-
- The relative import can be implicit or explicit.
- """
- # XXX this returns non sens when called on an absolute import
- # like 'pylint.checkers.astroid.utils'
- # XXX doesn't return absolute name if self.name isn't absolute name
- if self.absolute_import_activated() and level is None:
- return modname
- if level:
- if self.package:
- level = level - 1
- package_name = self.name.rsplit('.', level)[0]
- elif self.package:
- package_name = self.name
- else:
- package_name = self.name.rsplit('.', 1)[0]
- if package_name:
- if not modname:
- return package_name
- return '%s.%s' % (package_name, modname)
- return modname
-
-
- def wildcard_import_names(self):
- """return the list of imported names when this module is 'wildcard
- imported'
-
- It doesn't include the '__builtins__' name which is added by the
- current CPython implementation of wildcard imports.
- """
- # take advantage of a living module if it exists
- try:
- living = sys.modules[self.name]
- except KeyError:
- pass
- else:
- try:
- return living.__all__
- except AttributeError:
- return [name for name in living.__dict__.keys()
- if not name.startswith('_')]
- # else lookup the astroid
- #
- # We separate the different steps of lookup in try/excepts
- # to avoid catching too many Exceptions
- default = [name for name in self.keys() if not name.startswith('_')]
- try:
- all = self['__all__']
- except KeyError:
- return default
- try:
- explicit = next(all.assigned_stmts())
- except InferenceError:
- return default
- except AttributeError:
- # not an assignment node
- # XXX infer?
- return default
-
- # Try our best to detect the exported name.
- infered = []
- try:
- explicit = next(explicit.infer())
- except InferenceError:
- return default
- if not isinstance(explicit, (Tuple, List)):
- return default
-
- str_const = lambda node: (isinstance(node, Const) and
- isinstance(node.value, six.string_types))
- for node in explicit.elts:
- if str_const(node):
- infered.append(node.value)
- else:
- try:
- infered_node = next(node.infer())
- except InferenceError:
- continue
- if str_const(infered_node):
- infered.append(infered_node.value)
- return infered
-
-
-
-class ComprehensionScope(LocalsDictNodeNG):
- def frame(self):
- return self.parent.frame()
-
- scope_lookup = LocalsDictNodeNG._scope_lookup
-
-
-class GenExpr(ComprehensionScope):
- _astroid_fields = ('elt', 'generators')
-
- def __init__(self):
- self.locals = {}
- self.elt = None
- self.generators = []
-
-
-class DictComp(ComprehensionScope):
- _astroid_fields = ('key', 'value', 'generators')
-
- def __init__(self):
- self.locals = {}
- self.key = None
- self.value = None
- self.generators = []
-
-
-class SetComp(ComprehensionScope):
- _astroid_fields = ('elt', 'generators')
-
- def __init__(self):
- self.locals = {}
- self.elt = None
- self.generators = []
-
-
-class _ListComp(NodeNG):
- """class representing a ListComp node"""
- _astroid_fields = ('elt', 'generators')
- elt = None
- generators = None
-
-if sys.version_info >= (3, 0):
- class ListComp(_ListComp, ComprehensionScope):
- """class representing a ListComp node"""
- def __init__(self):
- self.locals = {}
-else:
- class ListComp(_ListComp):
- """class representing a ListComp node"""
-
-# Function ###################################################################
-
-def _infer_decorator_callchain(node):
- """Detect decorator call chaining and see if the end result is a
- static or a classmethod.
- """
- if not isinstance(node, Function):
- return
- if not node.parent:
- return
- try:
- # TODO: We don't handle multiple inference results right now,
- # because there's no flow to reason when the return
- # is what we are looking for, a static or a class method.
- result = next(node.infer_call_result(node.parent))
- except (StopIteration, InferenceError):
- return
- if isinstance(result, Instance):
- result = result._proxied
- if isinstance(result, Class):
- if result.is_subtype_of('%s.classmethod' % BUILTINS):
- return 'classmethod'
- if result.is_subtype_of('%s.staticmethod' % BUILTINS):
- return 'staticmethod'
-
-
-def _function_type(self):
- """
- Function type, possible values are:
- method, function, staticmethod, classmethod.
- """
- # Can't infer that this node is decorated
- # with a subclass of `classmethod` where `type` is first set,
- # so do it here.
- if self.decorators:
- for node in self.decorators.nodes:
- if isinstance(node, CallFunc):
- # Handle the following case:
- # @some_decorator(arg1, arg2)
- # def func(...)
- #
- try:
- current = next(node.func.infer())
- except InferenceError:
- continue
- _type = _infer_decorator_callchain(current)
- if _type is not None:
- return _type
-
- try:
- for infered in node.infer():
- # Check to see if this returns a static or a class method.
- _type = _infer_decorator_callchain(infered)
- if _type is not None:
- return _type
-
- if not isinstance(infered, Class):
- continue
- for ancestor in infered.ancestors():
- if not isinstance(ancestor, Class):
- continue
- if ancestor.is_subtype_of('%s.classmethod' % BUILTINS):
- return 'classmethod'
- elif ancestor.is_subtype_of('%s.staticmethod' % BUILTINS):
- return 'staticmethod'
- except InferenceError:
- pass
- return self._type
-
-
-class Lambda(LocalsDictNodeNG, FilterStmtsMixin):
- _astroid_fields = ('args', 'body',)
- name = '<lambda>'
-
- # function's type, 'function' | 'method' | 'staticmethod' | 'classmethod'
- type = 'function'
-
- def __init__(self):
- self.locals = {}
- self.args = []
- self.body = []
-
- def pytype(self):
- if 'method' in self.type:
- return '%s.instancemethod' % BUILTINS
- return '%s.function' % BUILTINS
-
- def display_type(self):
- if 'method' in self.type:
- return 'Method'
- return 'Function'
-
- def callable(self):
- return True
-
- def argnames(self):
- """return a list of argument names"""
- if self.args.args: # maybe None with builtin functions
- names = _rec_get_names(self.args.args)
- else:
- names = []
- if self.args.vararg:
- names.append(self.args.vararg)
- if self.args.kwarg:
- names.append(self.args.kwarg)
- return names
-
- def infer_call_result(self, caller, context=None):
- """infer what a function is returning when called"""
- return self.body.infer(context)
-
- def scope_lookup(self, node, name, offset=0):
- if node in self.args.defaults or node in self.args.kw_defaults:
- frame = self.parent.frame()
- # line offset to avoid that def func(f=func) resolve the default
- # value to the defined function
- offset = -1
- else:
- # check this is not used in function decorators
- frame = self
- return frame._scope_lookup(node, name, offset)
-
-
-class Function(Statement, Lambda):
- if PY3K:
- _astroid_fields = ('decorators', 'args', 'body', 'returns')
- returns = None
- else:
- _astroid_fields = ('decorators', 'args', 'body')
-
- special_attributes = set(('__name__', '__doc__', '__dict__'))
- is_function = True
- # attributes below are set by the builder module or by raw factories
- blockstart_tolineno = None
- decorators = None
- _type = "function"
- type = cachedproperty(_function_type)
-
- def __init__(self, name, doc):
- self.locals = {}
- self.args = []
- self.body = []
- self.name = name
- self.doc = doc
- self.extra_decorators = []
- self.instance_attrs = {}
-
- @cachedproperty
- def fromlineno(self):
- # lineno is the line number of the first decorator, we want the def
- # statement lineno
- lineno = self.lineno
- if self.decorators is not None:
- lineno += sum(node.tolineno - node.lineno + 1
- for node in self.decorators.nodes)
-
- return lineno
-
- @cachedproperty
- def blockstart_tolineno(self):
- return self.args.tolineno
-
- def block_range(self, lineno):
- """return block line numbers.
-
- start from the "def" position whatever the given lineno
- """
- return self.fromlineno, self.tolineno
-
- def getattr(self, name, context=None):
- """this method doesn't look in the instance_attrs dictionary since it's
- done by an Instance proxy at inference time.
- """
- if name == '__module__':
- return [cf(self.root().qname())]
- if name in self.instance_attrs:
- return self.instance_attrs[name]
- return std_special_attributes(self, name, False)
-
- def is_method(self):
- """return true if the function node should be considered as a method"""
- # check we are defined in a Class, because this is usually expected
- # (e.g. pylint...) when is_method() return True
- return self.type != 'function' and isinstance(self.parent.frame(), Class)
-
- def decoratornames(self):
- """return a list of decorator qualified names"""
- result = set()
- decoratornodes = []
- if self.decorators is not None:
- decoratornodes += self.decorators.nodes
- decoratornodes += self.extra_decorators
- for decnode in decoratornodes:
- for infnode in decnode.infer():
- result.add(infnode.qname())
- return result
- decoratornames = cached(decoratornames)
-
- def is_bound(self):
- """return true if the function is bound to an Instance or a class"""
- return self.type == 'classmethod'
-
- def is_abstract(self, pass_is_abstract=True):
- """Returns True if the method is abstract.
-
- A method is considered abstract if
- - the only statement is 'raise NotImplementedError', or
- - the only statement is 'pass' and pass_is_abstract is True, or
- - the method is annotated with abc.astractproperty/abc.abstractmethod
- """
- if self.decorators:
- for node in self.decorators.nodes:
- try:
- infered = next(node.infer())
- except InferenceError:
- continue
- if infered and infered.qname() in ('abc.abstractproperty',
- 'abc.abstractmethod'):
- return True
-
- for child_node in self.body:
- if isinstance(child_node, Raise):
- if child_node.raises_not_implemented():
- return True
- if pass_is_abstract and isinstance(child_node, Pass):
- return True
- return False
- # empty function is the same as function with a single "pass" statement
- if pass_is_abstract:
- return True
-
- def is_generator(self):
- """return true if this is a generator function"""
- # XXX should be flagged, not computed
- return next(self.nodes_of_class((Yield, YieldFrom),
- skip_klass=(Function, Lambda)), False)
-
- def infer_call_result(self, caller, context=None):
- """infer what a function is returning when called"""
- if self.is_generator():
- yield Generator()
- return
- # This is really a gigantic hack to work around metaclass generators
- # that return transient class-generating functions. Pylint's AST structure
- # cannot handle a base class object that is only used for calling __new__,
- # but does not contribute to the inheritance structure itself. We inject
- # a fake class into the hierarchy here for several well-known metaclass
- # generators, and filter it out later.
- if (self.name == 'with_metaclass' and
- len(self.args.args) == 1 and
- self.args.vararg is not None):
- metaclass = next(caller.args[0].infer(context))
- if isinstance(metaclass, Class):
- c = Class('temporary_class', None)
- c.hide = True
- c.parent = self
- c.bases = [next(b.infer(context)) for b in caller.args[1:]]
- c._metaclass = metaclass
- yield c
- return
- returns = self.nodes_of_class(Return, skip_klass=Function)
- for returnnode in returns:
- if returnnode.value is None:
- yield Const(None)
- else:
- try:
- for infered in returnnode.value.infer(context):
- yield infered
- except InferenceError:
- yield YES
-
-
-def _rec_get_names(args, names=None):
- """return a list of all argument names"""
- if names is None:
- names = []
- for arg in args:
- if isinstance(arg, Tuple):
- _rec_get_names(arg.elts, names)
- else:
- names.append(arg.name)
- return names
-
-
-# Class ######################################################################
-
-
-def _is_metaclass(klass, seen=None):
- """ Return if the given class can be
- used as a metaclass.
- """
- if klass.name == 'type':
- return True
- if seen is None:
- seen = set()
- for base in klass.bases:
- try:
- for baseobj in base.infer():
- if baseobj in seen:
- continue
- else:
- seen.add(baseobj)
- if isinstance(baseobj, Instance):
- # not abstract
- return False
- if baseobj is YES:
- continue
- if baseobj is klass:
- continue
- if not isinstance(baseobj, Class):
- continue
- if baseobj._type == 'metaclass':
- return True
- if _is_metaclass(baseobj, seen):
- return True
- except InferenceError:
- continue
- return False
-
-
-def _class_type(klass, ancestors=None):
- """return a Class node type to differ metaclass, interface and exception
- from 'regular' classes
- """
- # XXX we have to store ancestors in case we have a ancestor loop
- if klass._type is not None:
- return klass._type
- if _is_metaclass(klass):
- klass._type = 'metaclass'
- elif klass.name.endswith('Interface'):
- klass._type = 'interface'
- elif klass.name.endswith('Exception'):
- klass._type = 'exception'
- else:
- if ancestors is None:
- ancestors = set()
- if klass in ancestors:
- # XXX we are in loop ancestors, and have found no type
- klass._type = 'class'
- return 'class'
- ancestors.add(klass)
- for base in klass.ancestors(recurs=False):
- name = _class_type(base, ancestors)
- if name != 'class':
- if name == 'metaclass' and not _is_metaclass(klass):
- # don't propagate it if the current class
- # can't be a metaclass
- continue
- klass._type = base.type
- break
- if klass._type is None:
- klass._type = 'class'
- return klass._type
-
-def _iface_hdlr(iface_node):
- """a handler function used by interfaces to handle suspicious
- interface nodes
- """
- return True
-
-
-class Class(Statement, LocalsDictNodeNG, FilterStmtsMixin):
-
- # some of the attributes below are set by the builder module or
- # by a raw factories
-
- # a dictionary of class instances attributes
- _astroid_fields = ('decorators', 'bases', 'body') # name
-
- decorators = None
- special_attributes = set(('__name__', '__doc__', '__dict__', '__module__',
- '__bases__', '__mro__', '__subclasses__'))
- blockstart_tolineno = None
-
- _type = None
- _metaclass_hack = False
- hide = False
- type = property(_class_type,
- doc="class'type, possible values are 'class' | "
- "'metaclass' | 'interface' | 'exception'")
-
- def __init__(self, name, doc):
- self.instance_attrs = {}
- self.locals = {}
- self.bases = []
- self.body = []
- self.name = name
- self.doc = doc
-
- def _newstyle_impl(self, context=None):
- if context is None:
- context = InferenceContext()
- if self._newstyle is not None:
- return self._newstyle
- for base in self.ancestors(recurs=False, context=context):
- if base._newstyle_impl(context):
- self._newstyle = True
- break
- klass = self._explicit_metaclass()
- # could be any callable, we'd need to infer the result of klass(name,
- # bases, dict). punt if it's not a class node.
- if klass is not None and isinstance(klass, Class):
- self._newstyle = klass._newstyle_impl(context)
- if self._newstyle is None:
- self._newstyle = False
- return self._newstyle
-
- _newstyle = None
- newstyle = property(_newstyle_impl,
- doc="boolean indicating if it's a new style class"
- "or not")
-
- @cachedproperty
- def blockstart_tolineno(self):
- if self.bases:
- return self.bases[-1].tolineno
- else:
- return self.fromlineno
-
- def block_range(self, lineno):
- """return block line numbers.
-
- start from the "class" position whatever the given lineno
- """
- return self.fromlineno, self.tolineno
-
- def pytype(self):
- if self.newstyle:
- return '%s.type' % BUILTINS
- return '%s.classobj' % BUILTINS
-
- def display_type(self):
- return 'Class'
-
- def callable(self):
- return True
-
- def is_subtype_of(self, type_name, context=None):
- if self.qname() == type_name:
- return True
- for anc in self.ancestors(context=context):
- if anc.qname() == type_name:
- return True
-
- def infer_call_result(self, caller, context=None):
- """infer what a class is returning when called"""
- if self.is_subtype_of('%s.type' % (BUILTINS,), context) and len(caller.args) == 3:
- name_node = next(caller.args[0].infer(context))
- if (isinstance(name_node, Const) and
- isinstance(name_node.value, six.string_types)):
- name = name_node.value
- else:
- yield YES
- return
- result = Class(name, None)
- bases = next(caller.args[1].infer(context))
- if isinstance(bases, (Tuple, List)):
- result.bases = bases.itered()
- else:
- # There is currently no AST node that can represent an 'unknown'
- # node (YES is not an AST node), therefore we simply return YES here
- # although we know at least the name of the class.
- yield YES
- return
- result.parent = caller.parent
- yield result
- else:
- yield Instance(self)
-
- def scope_lookup(self, node, name, offset=0):
- if node in self.bases:
- frame = self.parent.frame()
- # line offset to avoid that class A(A) resolve the ancestor to
- # the defined class
- offset = -1
- else:
- frame = self
- return frame._scope_lookup(node, name, offset)
-
- # list of parent class as a list of string (i.e. names as they appear
- # in the class definition) XXX bw compat
- def basenames(self):
- return [bnode.as_string() for bnode in self.bases]
- basenames = property(basenames)
-
- def ancestors(self, recurs=True, context=None):
- """return an iterator on the node base classes in a prefixed
- depth first order
-
- :param recurs:
- boolean indicating if it should recurse or return direct
- ancestors only
- """
- # FIXME: should be possible to choose the resolution order
- # FIXME: inference make infinite loops possible here
- yielded = set([self])
- if context is None:
- context = InferenceContext()
- if sys.version_info[0] >= 3:
- if not self.bases and self.qname() != 'builtins.object':
- yield builtin_lookup("object")[1][0]
- return
-
- for stmt in self.bases:
- try:
- for baseobj in stmt.infer(context):
- if not isinstance(baseobj, Class):
- if isinstance(baseobj, Instance):
- baseobj = baseobj._proxied
- else:
- # duh ?
- continue
- if not baseobj.hide:
- if baseobj in yielded:
- continue # cf xxx above
- yielded.add(baseobj)
- yield baseobj
- if recurs:
- for grandpa in baseobj.ancestors(recurs=True,
- context=context):
- if grandpa in yielded:
- continue # cf xxx above
- yielded.add(grandpa)
- yield grandpa
- except InferenceError:
- # XXX log error ?
- continue
-
- def local_attr_ancestors(self, name, context=None):
- """return an iterator on astroid representation of parent classes
- which have <name> defined in their locals
- """
- for astroid in self.ancestors(context=context):
- if name in astroid:
- yield astroid
-
- def instance_attr_ancestors(self, name, context=None):
- """return an iterator on astroid representation of parent classes
- which have <name> defined in their instance attribute dictionary
- """
- for astroid in self.ancestors(context=context):
- if name in astroid.instance_attrs:
- yield astroid
-
- def has_base(self, node):
- return node in self.bases
-
- def local_attr(self, name, context=None):
- """return the list of assign node associated to name in this class
- locals or in its parents
-
- :raises `NotFoundError`:
- if no attribute with this name has been find in this class or
- its parent classes
- """
- try:
- return self.locals[name]
- except KeyError:
- # get if from the first parent implementing it if any
- for class_node in self.local_attr_ancestors(name, context):
- return class_node.locals[name]
- raise NotFoundError(name)
- local_attr = remove_nodes(local_attr, DelAttr)
-
- def instance_attr(self, name, context=None):
- """return the astroid nodes associated to name in this class instance
- attributes dictionary and in its parents
-
- :raises `NotFoundError`:
- if no attribute with this name has been find in this class or
- its parent classes
- """
- # Return a copy, so we don't modify self.instance_attrs,
- # which could lead to infinite loop.
- values = list(self.instance_attrs.get(name, []))
- # get all values from parents
- for class_node in self.instance_attr_ancestors(name, context):
- values += class_node.instance_attrs[name]
- if not values:
- raise NotFoundError(name)
- return values
- instance_attr = remove_nodes(instance_attr, DelAttr)
-
- def instanciate_class(self):
- """return Instance of Class node, else return self"""
- return Instance(self)
-
- def getattr(self, name, context=None):
- """this method doesn't look in the instance_attrs dictionary since it's
- done by an Instance proxy at inference time.
-
- It may return a YES object if the attribute has not been actually
- found but a __getattr__ or __getattribute__ method is defined
- """
- values = self.locals.get(name, [])
- if name in self.special_attributes:
- if name == '__module__':
- return [cf(self.root().qname())] + values
- # FIXME: do we really need the actual list of ancestors?
- # returning [Tuple()] + values don't break any test
- # this is ticket http://www.logilab.org/ticket/52785
- # XXX need proper meta class handling + MRO implementation
- if name == '__bases__' or (name == '__mro__' and self.newstyle):
- node = Tuple()
- node.items = self.ancestors(recurs=True, context=context)
- return [node] + values
- return std_special_attributes(self, name)
- # don't modify the list in self.locals!
- values = list(values)
- for classnode in self.ancestors(recurs=True, context=context):
- values += classnode.locals.get(name, [])
- if not values:
- raise NotFoundError(name)
- return values
-
- def igetattr(self, name, context=None):
- """inferred getattr, need special treatment in class to handle
- descriptors
- """
- # set lookup name since this is necessary to infer on import nodes for
- # instance
- if not context:
- context = InferenceContext()
- try:
- for infered in _infer_stmts(self.getattr(name, context), context,
- frame=self, lookupname=name):
- # yield YES object instead of descriptors when necessary
- if not isinstance(infered, Const) and isinstance(infered, Instance):
- try:
- infered._proxied.getattr('__get__', context)
- except NotFoundError:
- yield infered
- else:
- yield YES
- else:
- yield function_to_method(infered, self)
- except NotFoundError:
- if not name.startswith('__') and self.has_dynamic_getattr(context):
- # class handle some dynamic attributes, return a YES object
- yield YES
- else:
- raise InferenceError(name)
-
- def has_dynamic_getattr(self, context=None):
- """return True if the class has a custom __getattr__ or
- __getattribute__ method
- """
- # need to explicitly handle optparse.Values (setattr is not detected)
- if self.name == 'Values' and self.root().name == 'optparse':
- return True
- try:
- self.getattr('__getattr__', context)
- return True
- except NotFoundError:
- #if self.newstyle: XXX cause an infinite recursion error
- try:
- getattribute = self.getattr('__getattribute__', context)[0]
- if getattribute.root().name != BUILTINS:
- # class has a custom __getattribute__ defined
- return True
- except NotFoundError:
- pass
- return False
-
- def methods(self):
- """return an iterator on all methods defined in the class and
- its ancestors
- """
- done = {}
- for astroid in chain(iter((self,)), self.ancestors()):
- for meth in astroid.mymethods():
- if meth.name in done:
- continue
- done[meth.name] = None
- yield meth
-
- def mymethods(self):
- """return an iterator on all methods defined in the class"""
- for member in self.values():
- if isinstance(member, Function):
- yield member
-
- def interfaces(self, herited=True, handler_func=_iface_hdlr):
- """return an iterator on interfaces implemented by the given
- class node
- """
- # FIXME: what if __implements__ = (MyIFace, MyParent.__implements__)...
- try:
- implements = Instance(self).getattr('__implements__')[0]
- except NotFoundError:
- return
- if not herited and not implements.frame() is self:
- return
- found = set()
- missing = False
- for iface in unpack_infer(implements):
- if iface is YES:
- missing = True
- continue
- if not iface in found and handler_func(iface):
- found.add(iface)
- yield iface
- if missing:
- raise InferenceError()
-
- _metaclass = None
- def _explicit_metaclass(self):
- """ Return the explicit defined metaclass
- for the current class.
-
- An explicit defined metaclass is defined
- either by passing the ``metaclass`` keyword argument
- in the class definition line (Python 3) or (Python 2) by
- having a ``__metaclass__`` class attribute, or if there are
- no explicit bases but there is a global ``__metaclass__`` variable.
- """
- for base in self.bases:
- try:
- for baseobj in base.infer():
- if isinstance(baseobj, Class) and baseobj.hide:
- self._metaclass = baseobj._metaclass
- self._metaclass_hack = True
- break
- except InferenceError:
- pass
-
- if self._metaclass:
- # Expects this from Py3k TreeRebuilder
- try:
- return next(node for node in self._metaclass.infer()
- if node is not YES)
- except (InferenceError, StopIteration):
- return None
- if sys.version_info >= (3, ):
- return None
-
- if '__metaclass__' in self.locals:
- assignment = self.locals['__metaclass__'][-1]
- elif self.bases:
- return None
- elif '__metaclass__' in self.root().locals:
- assignments = [ass for ass in self.root().locals['__metaclass__']
- if ass.lineno < self.lineno]
- if not assignments:
- return None
- assignment = assignments[-1]
- else:
- return None
-
- try:
- infered = next(assignment.infer())
- except InferenceError:
- return
- if infered is YES: # don't expose this
- return None
- return infered
-
- def metaclass(self):
- """ Return the metaclass of this class.
-
- If this class does not define explicitly a metaclass,
- then the first defined metaclass in ancestors will be used
- instead.
- """
- klass = self._explicit_metaclass()
- if klass is None:
- for parent in self.ancestors():
- klass = parent.metaclass()
- if klass is not None:
- break
- return klass
-
- def has_metaclass_hack(self):
- return self._metaclass_hack
-
- def _islots(self):
- """ Return an iterator with the inferred slots. """
- if '__slots__' not in self.locals:
- return
- for slots in self.igetattr('__slots__'):
- # check if __slots__ is a valid type
- for meth in ITER_METHODS:
- try:
- slots.getattr(meth)
- break
- except NotFoundError:
- continue
- else:
- continue
-
- if isinstance(slots, Const):
- # a string. Ignore the following checks,
- # but yield the node, only if it has a value
- if slots.value:
- yield slots
- continue
- if not hasattr(slots, 'itered'):
- # we can't obtain the values, maybe a .deque?
- continue
-
- if isinstance(slots, Dict):
- values = [item[0] for item in slots.items]
- else:
- values = slots.itered()
- if values is YES:
- continue
-
- for elt in values:
- try:
- for infered in elt.infer():
- if infered is YES:
- continue
- if (not isinstance(infered, Const) or
- not isinstance(infered.value,
- six.string_types)):
- continue
- if not infered.value:
- continue
- yield infered
- except InferenceError:
- continue
-
- # Cached, because inferring them all the time is expensive
- @cached
- def slots(self):
- """Get all the slots for this node.
-
- If the class doesn't define any slot, through `__slots__`
- variable, then this function will return a None.
- Also, it will return None in the case the slots weren't inferred.
- Otherwise, it will return a list of slot names.
- """
- slots = self._islots()
- try:
- first = next(slots)
- except StopIteration:
- # The class doesn't have a __slots__ definition.
- return None
- return [first] + list(slots)
-
- def _inferred_bases(self, recurs=True, context=None):
- # TODO(cpopa): really similar with .ancestors,
- # but the difference is when one base is inferred,
- # only the first object is wanted. That's because
- # we aren't interested in superclasses, as in the following
- # example:
- #
- # class SomeSuperClass(object): pass
- # class SomeClass(SomeSuperClass): pass
- # class Test(SomeClass): pass
- #
- # Inferring SomeClass from the Test's bases will give
- # us both SomeClass and SomeSuperClass, but we are interested
- # only in SomeClass.
-
- if context is None:
- context = InferenceContext()
- if sys.version_info[0] >= 3:
- if not self.bases and self.qname() != 'builtins.object':
- yield builtin_lookup("object")[1][0]
- return
-
- for stmt in self.bases:
- try:
- baseobj = next(stmt.infer(context=context))
- except InferenceError:
- # XXX log error ?
- continue
- if isinstance(baseobj, Instance):
- baseobj = baseobj._proxied
- if not isinstance(baseobj, Class):
- continue
- if not baseobj.hide:
- yield baseobj
-
- def mro(self, context=None):
- """Get the method resolution order, using C3 linearization.
-
- It returns the list of ancestors sorted by the mro.
- This will raise `NotImplementedError` for old-style classes, since
- they don't have the concept of MRO.
- """
- if not self.newstyle:
- raise NotImplementedError(
- "Could not obtain mro for old-style classes.")
-
- bases = list(self._inferred_bases(context=context))
- unmerged_mro = [[self]] + [base.mro() for base in bases] + [bases]
-
- _verify_duplicates_mro(unmerged_mro)
- return _c3_merge(unmerged_mro)
diff --git a/chromium/third_party/logilab/logilab/astroid/test_utils.py b/chromium/third_party/logilab/logilab/astroid/test_utils.py
deleted file mode 100644
index 19bd7b96b6b..00000000000
--- a/chromium/third_party/logilab/logilab/astroid/test_utils.py
+++ /dev/null
@@ -1,218 +0,0 @@
-"""Utility functions for test code that uses astroid ASTs as input."""
-import functools
-import sys
-import textwrap
-
-from astroid import nodes
-from astroid import builder
-# The name of the transient function that is used to
-# wrap expressions to be extracted when calling
-# extract_node.
-_TRANSIENT_FUNCTION = '__'
-
-# The comment used to select a statement to be extracted
-# when calling extract_node.
-_STATEMENT_SELECTOR = '#@'
-
-
-def _extract_expressions(node):
- """Find expressions in a call to _TRANSIENT_FUNCTION and extract them.
-
- The function walks the AST recursively to search for expressions that
- are wrapped into a call to _TRANSIENT_FUNCTION. If it finds such an
- expression, it completely removes the function call node from the tree,
- replacing it by the wrapped expression inside the parent.
-
- :param node: An astroid node.
- :type node: astroid.bases.NodeNG
- :yields: The sequence of wrapped expressions on the modified tree
- expression can be found.
- """
- if (isinstance(node, nodes.CallFunc)
- and isinstance(node.func, nodes.Name)
- and node.func.name == _TRANSIENT_FUNCTION):
- real_expr = node.args[0]
- real_expr.parent = node.parent
- # Search for node in all _astng_fields (the fields checked when
- # get_children is called) of its parent. Some of those fields may
- # be lists or tuples, in which case the elements need to be checked.
- # When we find it, replace it by real_expr, so that the AST looks
- # like no call to _TRANSIENT_FUNCTION ever took place.
- for name in node.parent._astroid_fields:
- child = getattr(node.parent, name)
- if isinstance(child, (list, tuple)):
- for idx, compound_child in enumerate(child):
- if compound_child is node:
- child[idx] = real_expr
- elif child is node:
- setattr(node.parent, name, real_expr)
- yield real_expr
- else:
- for child in node.get_children():
- for result in _extract_expressions(child):
- yield result
-
-
-def _find_statement_by_line(node, line):
- """Extracts the statement on a specific line from an AST.
-
- If the line number of node matches line, it will be returned;
- otherwise its children are iterated and the function is called
- recursively.
-
- :param node: An astroid node.
- :type node: astroid.bases.NodeNG
- :param line: The line number of the statement to extract.
- :type line: int
- :returns: The statement on the line, or None if no statement for the line
- can be found.
- :rtype: astroid.bases.NodeNG or None
- """
- if isinstance(node, (nodes.Class, nodes.Function)):
- # This is an inaccuracy in the AST: the nodes that can be
- # decorated do not carry explicit information on which line
- # the actual definition (class/def), but .fromline seems to
- # be close enough.
- node_line = node.fromlineno
- else:
- node_line = node.lineno
-
- if node_line == line:
- return node
-
- for child in node.get_children():
- result = _find_statement_by_line(child, line)
- if result:
- return result
-
- return None
-
-def extract_node(code, module_name=''):
- """Parses some Python code as a module and extracts a designated AST node.
-
- Statements:
- To extract one or more statement nodes, append #@ to the end of the line
-
- Examples:
- >>> def x():
- >>> def y():
- >>> return 1 #@
-
- The return statement will be extracted.
-
- >>> class X(object):
- >>> def meth(self): #@
- >>> pass
-
- The funcion object 'meth' will be extracted.
-
- Expressions:
- To extract arbitrary expressions, surround them with the fake
- function call __(...). After parsing, the surrounded expression
- will be returned and the whole AST (accessible via the returned
- node's parent attribute) will look like the function call was
- never there in the first place.
-
- Examples:
- >>> a = __(1)
-
- The const node will be extracted.
-
- >>> def x(d=__(foo.bar)): pass
-
- The node containing the default argument will be extracted.
-
- >>> def foo(a, b):
- >>> return 0 < __(len(a)) < b
-
- The node containing the function call 'len' will be extracted.
-
- If no statements or expressions are selected, the last toplevel
- statement will be returned.
-
- If the selected statement is a discard statement, (i.e. an expression
- turned into a statement), the wrapped expression is returned instead.
-
- For convenience, singleton lists are unpacked.
-
- :param str code: A piece of Python code that is parsed as
- a module. Will be passed through textwrap.dedent first.
- :param str module_name: The name of the module.
- :returns: The designated node from the parse tree, or a list of nodes.
- :rtype: astroid.bases.NodeNG, or a list of nodes.
- """
- def _extract(node):
- if isinstance(node, nodes.Discard):
- return node.value
- else:
- return node
-
- requested_lines = []
- for idx, line in enumerate(code.splitlines()):
- if line.strip().endswith(_STATEMENT_SELECTOR):
- requested_lines.append(idx + 1)
-
- tree = build_module(code, module_name=module_name)
- extracted = []
- if requested_lines:
- for line in requested_lines:
- extracted.append(_find_statement_by_line(tree, line))
-
- # Modifies the tree.
- extracted.extend(_extract_expressions(tree))
-
- if not extracted:
- extracted.append(tree.body[-1])
-
- extracted = [_extract(node) for node in extracted]
- if len(extracted) == 1:
- return extracted[0]
- else:
- return extracted
-
-
-def build_module(code, module_name='', path=None):
- """Parses a string module with a builder.
- :param code: The code for the module.
- :type code: str
- :param module_name: The name for the module
- :type module_name: str
- :param path: The path for the module
- :type module_name: str
- :returns: The module AST.
- :rtype: astroid.bases.NodeNG
- """
- code = textwrap.dedent(code)
- return builder.AstroidBuilder(None).string_build(code, modname=module_name, path=path)
-
-
-def require_version(minver=None, maxver=None):
- """ Compare version of python interpreter to the given one. Skip the test
- if older.
- """
- def parse(string, default=None):
- string = string or default
- try:
- return tuple(int(v) for v in string.split('.'))
- except ValueError:
- raise ValueError('%s is not a correct version : should be X.Y[.Z].' % version)
-
- def check_require_version(f):
- current = sys.version_info[:3]
- if parse(minver, "0") < current <= parse(maxver, "4"):
- return f
- else:
- str_version = '.'.join(str(v) for v in sys.version_info)
- @functools.wraps(f)
- def new_f(self, *args, **kwargs):
- if minver is not None:
- self.skipTest('Needs Python > %s. Current version is %s.' % (minver, str_version))
- elif maxver is not None:
- self.skipTest('Needs Python <= %s. Current version is %s.' % (maxver, str_version))
- return new_f
-
-
- return check_require_version
-
-def get_name_node(start_from, name, index=0):
- return [n for n in start_from.nodes_of_class(nodes.Name) if n.name == name][index]
diff --git a/chromium/third_party/logilab/logilab/astroid/utils.py b/chromium/third_party/logilab/logilab/astroid/utils.py
deleted file mode 100644
index ae72a92c480..00000000000
--- a/chromium/third_party/logilab/logilab/astroid/utils.py
+++ /dev/null
@@ -1,239 +0,0 @@
-# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of astroid.
-#
-# astroid is free software: you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as published by the
-# Free Software Foundation, either version 2.1 of the License, or (at your
-# option) any later version.
-#
-# astroid 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 Lesser General Public License
-# for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with astroid. If not, see <http://www.gnu.org/licenses/>.
-"""this module contains some utilities to navigate in the tree or to
-extract information from it
-"""
-from __future__ import print_function
-
-__docformat__ = "restructuredtext en"
-
-from astroid.exceptions import AstroidBuildingException
-from astroid.builder import parse
-
-
-class ASTWalker(object):
- """a walker visiting a tree in preorder, calling on the handler:
-
- * visit_<class name> on entering a node, where class name is the class of
- the node in lower case
-
- * leave_<class name> on leaving a node, where class name is the class of
- the node in lower case
- """
-
- def __init__(self, handler):
- self.handler = handler
- self._cache = {}
-
- def walk(self, node, _done=None):
- """walk on the tree from <node>, getting callbacks from handler"""
- if _done is None:
- _done = set()
- if node in _done:
- raise AssertionError((id(node), node, node.parent))
- _done.add(node)
- self.visit(node)
- for child_node in node.get_children():
- self.handler.set_context(node, child_node)
- assert child_node is not node
- self.walk(child_node, _done)
- self.leave(node)
- assert node.parent is not node
-
- def get_callbacks(self, node):
- """get callbacks from handler for the visited node"""
- klass = node.__class__
- methods = self._cache.get(klass)
- if methods is None:
- handler = self.handler
- kid = klass.__name__.lower()
- e_method = getattr(handler, 'visit_%s' % kid,
- getattr(handler, 'visit_default', None))
- l_method = getattr(handler, 'leave_%s' % kid,
- getattr(handler, 'leave_default', None))
- self._cache[klass] = (e_method, l_method)
- else:
- e_method, l_method = methods
- return e_method, l_method
-
- def visit(self, node):
- """walk on the tree from <node>, getting callbacks from handler"""
- method = self.get_callbacks(node)[0]
- if method is not None:
- method(node)
-
- def leave(self, node):
- """walk on the tree from <node>, getting callbacks from handler"""
- method = self.get_callbacks(node)[1]
- if method is not None:
- method(node)
-
-
-class LocalsVisitor(ASTWalker):
- """visit a project by traversing the locals dictionary"""
- def __init__(self):
- ASTWalker.__init__(self, self)
- self._visited = {}
-
- def visit(self, node):
- """launch the visit starting from the given node"""
- if node in self._visited:
- return
- self._visited[node] = 1 # FIXME: use set ?
- methods = self.get_callbacks(node)
- if methods[0] is not None:
- methods[0](node)
- if 'locals' in node.__dict__: # skip Instance and other proxy
- for local_node in node.values():
- self.visit(local_node)
- if methods[1] is not None:
- return methods[1](node)
-
-
-def _check_children(node):
- """a helper function to check children - parent relations"""
- for child in node.get_children():
- ok = False
- if child is None:
- print("Hm, child of %s is None" % node)
- continue
- if not hasattr(child, 'parent'):
- print(" ERROR: %s has child %s %x with no parent" % (
- node, child, id(child)))
- elif not child.parent:
- print(" ERROR: %s has child %s %x with parent %r" % (
- node, child, id(child), child.parent))
- elif child.parent is not node:
- print(" ERROR: %s %x has child %s %x with wrong parent %s" % (
- node, id(node), child, id(child), child.parent))
- else:
- ok = True
- if not ok:
- print("lines;", node.lineno, child.lineno)
- print("of module", node.root(), node.root().name)
- raise AstroidBuildingException
- _check_children(child)
-
-
-class TreeTester(object):
- '''A helper class to see _ast tree and compare with astroid tree
-
- indent: string for tree indent representation
- lineno: bool to tell if we should print the line numbers
-
- >>> tester = TreeTester('print')
- >>> print tester.native_tree_repr()
-
- <Module>
- . body = [
- . <Print>
- . . nl = True
- . ]
- >>> print tester.astroid_tree_repr()
- Module()
- body = [
- Print()
- dest =
- values = [
- ]
- ]
- '''
-
- indent = '. '
- lineno = False
-
- def __init__(self, sourcecode):
- self._string = ''
- self.sourcecode = sourcecode
- self._ast_node = None
- self.build_ast()
-
- def build_ast(self):
- """build the _ast tree from the source code"""
- self._ast_node = parse(self.sourcecode)
-
- def native_tree_repr(self, node=None, indent=''):
- """get a nice representation of the _ast tree"""
- self._string = ''
- if node is None:
- node = self._ast_node
- self._native_repr_tree(node, indent)
- return self._string
-
-
- def _native_repr_tree(self, node, indent, _done=None):
- """recursive method for the native tree representation"""
- from _ast import Load as _Load, Store as _Store, Del as _Del
- from _ast import AST as Node
- if _done is None:
- _done = set()
- if node in _done:
- self._string += '\nloop in tree: %r (%s)' % (
- node, getattr(node, 'lineno', None))
- return
- _done.add(node)
- self._string += '\n' + indent + '<%s>' % node.__class__.__name__
- indent += self.indent
- if not hasattr(node, '__dict__'):
- self._string += '\n' + self.indent + " ** node has no __dict__ " + str(node)
- return
- node_dict = node.__dict__
- if hasattr(node, '_attributes'):
- for a in node._attributes:
- attr = node_dict[a]
- if attr is None:
- continue
- if a in ("lineno", "col_offset") and not self.lineno:
- continue
- self._string += '\n' + indent + a + " = " + repr(attr)
- for field in node._fields or ():
- attr = node_dict[field]
- if attr is None:
- continue
- if isinstance(attr, list):
- if not attr:
- continue
- self._string += '\n' + indent + field + ' = ['
- for elt in attr:
- self._native_repr_tree(elt, indent, _done)
- self._string += '\n' + indent + ']'
- continue
- if isinstance(attr, (_Load, _Store, _Del)):
- continue
- if isinstance(attr, Node):
- self._string += '\n' + indent + field + " = "
- self._native_repr_tree(attr, indent, _done)
- else:
- self._string += '\n' + indent + field + " = " + repr(attr)
-
-
- def build_astroid_tree(self):
- """build astroid tree from the _ast tree
- """
- from astroid.builder import AstroidBuilder
- tree = AstroidBuilder().string_build(self.sourcecode)
- return tree
-
- def astroid_tree_repr(self, ids=False):
- """build the astroid tree and return a nice tree representation"""
- mod = self.build_astroid_tree()
- return mod.repr_tree(ids)
-
-
-__all__ = ('LocalsVisitor', 'ASTWalker',)
-
diff --git a/chromium/third_party/logilab/logilab/common/LICENSE.txt b/chromium/third_party/logilab/logilab/common/LICENSE.txt
deleted file mode 100644
index d511905c164..00000000000
--- a/chromium/third_party/logilab/logilab/common/LICENSE.txt
+++ /dev/null
@@ -1,339 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Lesser General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- 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 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.
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) year name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.
diff --git a/chromium/third_party/logilab/logilab/common/README.chromium b/chromium/third_party/logilab/logilab/common/README.chromium
deleted file mode 100644
index fdc9991403f..00000000000
--- a/chromium/third_party/logilab/logilab/common/README.chromium
+++ /dev/null
@@ -1,13 +0,0 @@
-URL: http://www.logilab.org/project/logilab-common
-Name: logilab-common
-Version: 0.63.2
-License: GPL v2
-License File: LICENSE.txt
-Security Critical: No
-
-Description:
-This directory contains the logilab-common module, required for logilab-astng
-and pylint.
-
-Local Modifications:
-None
diff --git a/chromium/third_party/logilab/logilab/common/__init__.py b/chromium/third_party/logilab/logilab/common/__init__.py
deleted file mode 100644
index 2d1324cb28a..00000000000
--- a/chromium/third_party/logilab/logilab/common/__init__.py
+++ /dev/null
@@ -1,175 +0,0 @@
-# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""Logilab common library (aka Logilab's extension to the standard library).
-
-:type STD_BLACKLIST: tuple
-:var STD_BLACKLIST: directories ignored by default by the functions in
- this package which have to recurse into directories
-
-:type IGNORED_EXTENSIONS: tuple
-:var IGNORED_EXTENSIONS: file extensions that may usually be ignored
-"""
-__docformat__ = "restructuredtext en"
-
-from six.moves import range
-
-from logilab.common.__pkginfo__ import version as __version__
-
-STD_BLACKLIST = ('CVS', '.svn', '.hg', 'debian', 'dist', 'build')
-
-IGNORED_EXTENSIONS = ('.pyc', '.pyo', '.elc', '~', '.swp', '.orig')
-
-# set this to False if you've mx DateTime installed but you don't want your db
-# adapter to use it (should be set before you got a connection)
-USE_MX_DATETIME = True
-
-
-class attrdict(dict):
- """A dictionary for which keys are also accessible as attributes."""
- def __getattr__(self, attr):
- try:
- return self[attr]
- except KeyError:
- raise AttributeError(attr)
-
-class dictattr(dict):
- def __init__(self, proxy):
- self.__proxy = proxy
-
- def __getitem__(self, attr):
- try:
- return getattr(self.__proxy, attr)
- except AttributeError:
- raise KeyError(attr)
-
-class nullobject(object):
- def __repr__(self):
- return '<nullobject>'
- def __bool__(self):
- return False
- __nonzero__ = __bool__
-
-class tempattr(object):
- def __init__(self, obj, attr, value):
- self.obj = obj
- self.attr = attr
- self.value = value
-
- def __enter__(self):
- self.oldvalue = getattr(self.obj, self.attr)
- setattr(self.obj, self.attr, self.value)
- return self.obj
-
- def __exit__(self, exctype, value, traceback):
- setattr(self.obj, self.attr, self.oldvalue)
-
-
-
-# flatten -----
-# XXX move in a specific module and use yield instead
-# do not mix flatten and translate
-#
-# def iterable(obj):
-# try: iter(obj)
-# except: return False
-# return True
-#
-# def is_string_like(obj):
-# try: obj +''
-# except (TypeError, ValueError): return False
-# return True
-#
-#def is_scalar(obj):
-# return is_string_like(obj) or not iterable(obj)
-#
-#def flatten(seq):
-# for item in seq:
-# if is_scalar(item):
-# yield item
-# else:
-# for subitem in flatten(item):
-# yield subitem
-
-def flatten(iterable, tr_func=None, results=None):
- """Flatten a list of list with any level.
-
- If tr_func is not None, it should be a one argument function that'll be called
- on each final element.
-
- :rtype: list
-
- >>> flatten([1, [2, 3]])
- [1, 2, 3]
- """
- if results is None:
- results = []
- for val in iterable:
- if isinstance(val, (list, tuple)):
- flatten(val, tr_func, results)
- elif tr_func is None:
- results.append(val)
- else:
- results.append(tr_func(val))
- return results
-
-
-# XXX is function below still used ?
-
-def make_domains(lists):
- """
- Given a list of lists, return a list of domain for each list to produce all
- combinations of possibles values.
-
- :rtype: list
-
- Example:
-
- >>> make_domains(['a', 'b'], ['c','d', 'e'])
- [['a', 'b', 'a', 'b', 'a', 'b'], ['c', 'c', 'd', 'd', 'e', 'e']]
- """
- domains = []
- for iterable in lists:
- new_domain = iterable[:]
- for i in range(len(domains)):
- domains[i] = domains[i]*len(iterable)
- if domains:
- missing = (len(domains[0]) - len(iterable)) / len(iterable)
- i = 0
- for j in range(len(iterable)):
- value = iterable[j]
- for dummy in range(missing):
- new_domain.insert(i, value)
- i += 1
- i += 1
- domains.append(new_domain)
- return domains
-
-
-# private stuff ################################################################
-
-def _handle_blacklist(blacklist, dirnames, filenames):
- """remove files/directories in the black list
-
- dirnames/filenames are usually from os.walk
- """
- for norecurs in blacklist:
- if norecurs in dirnames:
- dirnames.remove(norecurs)
- elif norecurs in filenames:
- filenames.remove(norecurs)
-
diff --git a/chromium/third_party/logilab/logilab/common/__pkginfo__.py b/chromium/third_party/logilab/logilab/common/__pkginfo__.py
deleted file mode 100644
index 55a2cc37e19..00000000000
--- a/chromium/third_party/logilab/logilab/common/__pkginfo__.py
+++ /dev/null
@@ -1,57 +0,0 @@
-# copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""logilab.common packaging information"""
-__docformat__ = "restructuredtext en"
-import sys
-import os
-
-distname = 'logilab-common'
-modname = 'common'
-subpackage_of = 'logilab'
-subpackage_master = True
-
-numversion = (0, 63, 2)
-version = '.'.join([str(num) for num in numversion])
-
-license = 'LGPL' # 2.1 or later
-description = "collection of low-level Python packages and modules used by Logilab projects"
-web = "http://www.logilab.org/project/%s" % distname
-mailinglist = "mailto://python-projects@lists.logilab.org"
-author = "Logilab"
-author_email = "contact@logilab.fr"
-
-
-from os.path import join
-scripts = [join('bin', 'pytest')]
-include_dirs = [join('test', 'data')]
-
-install_requires = [
- 'six >= 1.4.0',
- ]
-test_require = ['pytz']
-
-if sys.version_info < (2, 7):
- install_requires.append('unittest2 >= 0.5.1')
-if os.name == 'nt':
- install_requires.append('colorama')
-
-classifiers = ["Topic :: Utilities",
- "Programming Language :: Python",
- "Programming Language :: Python :: 2",
- "Programming Language :: Python :: 3",
- ]
diff --git a/chromium/third_party/logilab/logilab/common/cache.py b/chromium/third_party/logilab/logilab/common/cache.py
deleted file mode 100644
index 11ed1370d58..00000000000
--- a/chromium/third_party/logilab/logilab/common/cache.py
+++ /dev/null
@@ -1,114 +0,0 @@
-# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""Cache module, with a least recently used algorithm for the management of the
-deletion of entries.
-
-
-
-
-"""
-__docformat__ = "restructuredtext en"
-
-from threading import Lock
-
-from logilab.common.decorators import locked
-
-_marker = object()
-
-class Cache(dict):
- """A dictionary like cache.
-
- inv:
- len(self._usage) <= self.size
- len(self.data) <= self.size
- """
-
- def __init__(self, size=100):
- """ Warning : Cache.__init__() != dict.__init__().
- Constructor does not take any arguments beside size.
- """
- assert size >= 0, 'cache size must be >= 0 (0 meaning no caching)'
- self.size = size
- self._usage = []
- self._lock = Lock()
- super(Cache, self).__init__()
-
- def _acquire(self):
- self._lock.acquire()
-
- def _release(self):
- self._lock.release()
-
- def _update_usage(self, key):
- if not self._usage:
- self._usage.append(key)
- elif self._usage[-1] != key:
- try:
- self._usage.remove(key)
- except ValueError:
- # we are inserting a new key
- # check the size of the dictionary
- # and remove the oldest item in the cache
- if self.size and len(self._usage) >= self.size:
- super(Cache, self).__delitem__(self._usage[0])
- del self._usage[0]
- self._usage.append(key)
- else:
- pass # key is already the most recently used key
-
- def __getitem__(self, key):
- value = super(Cache, self).__getitem__(key)
- self._update_usage(key)
- return value
- __getitem__ = locked(_acquire, _release)(__getitem__)
-
- def __setitem__(self, key, item):
- # Just make sure that size > 0 before inserting a new item in the cache
- if self.size > 0:
- super(Cache, self).__setitem__(key, item)
- self._update_usage(key)
- __setitem__ = locked(_acquire, _release)(__setitem__)
-
- def __delitem__(self, key):
- super(Cache, self).__delitem__(key)
- self._usage.remove(key)
- __delitem__ = locked(_acquire, _release)(__delitem__)
-
- def clear(self):
- super(Cache, self).clear()
- self._usage = []
- clear = locked(_acquire, _release)(clear)
-
- def pop(self, key, default=_marker):
- if key in self:
- self._usage.remove(key)
- #if default is _marker:
- # return super(Cache, self).pop(key)
- return super(Cache, self).pop(key, default)
- pop = locked(_acquire, _release)(pop)
-
- def popitem(self):
- raise NotImplementedError()
-
- def setdefault(self, key, default=None):
- raise NotImplementedError()
-
- def update(self, other):
- raise NotImplementedError()
-
-
diff --git a/chromium/third_party/logilab/logilab/common/changelog.py b/chromium/third_party/logilab/logilab/common/changelog.py
deleted file mode 100644
index 2fff2ed6505..00000000000
--- a/chromium/third_party/logilab/logilab/common/changelog.py
+++ /dev/null
@@ -1,238 +0,0 @@
-# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""Manipulation of upstream change log files.
-
-The upstream change log files format handled is simpler than the one
-often used such as those generated by the default Emacs changelog mode.
-
-Sample ChangeLog format::
-
- Change log for project Yoo
- ==========================
-
- --
- * add a new functionality
-
- 2002-02-01 -- 0.1.1
- * fix bug #435454
- * fix bug #434356
-
- 2002-01-01 -- 0.1
- * initial release
-
-
-There is 3 entries in this change log, one for each released version and one
-for the next version (i.e. the current entry).
-Each entry contains a set of messages corresponding to changes done in this
-release.
-All the non empty lines before the first entry are considered as the change
-log title.
-"""
-
-__docformat__ = "restructuredtext en"
-
-import sys
-from stat import S_IWRITE
-
-from six import string_types
-
-BULLET = '*'
-SUBBULLET = '-'
-INDENT = ' ' * 4
-
-class NoEntry(Exception):
- """raised when we are unable to find an entry"""
-
-class EntryNotFound(Exception):
- """raised when we are unable to find a given entry"""
-
-class Version(tuple):
- """simple class to handle soft version number has a tuple while
- correctly printing it as X.Y.Z
- """
- def __new__(cls, versionstr):
- if isinstance(versionstr, string_types):
- versionstr = versionstr.strip(' :') # XXX (syt) duh?
- parsed = cls.parse(versionstr)
- else:
- parsed = versionstr
- return tuple.__new__(cls, parsed)
-
- @classmethod
- def parse(cls, versionstr):
- versionstr = versionstr.strip(' :')
- try:
- return [int(i) for i in versionstr.split('.')]
- except ValueError as ex:
- raise ValueError("invalid literal for version '%s' (%s)"%(versionstr, ex))
-
- def __str__(self):
- return '.'.join([str(i) for i in self])
-
-# upstream change log #########################################################
-
-class ChangeLogEntry(object):
- """a change log entry, i.e. a set of messages associated to a version and
- its release date
- """
- version_class = Version
-
- def __init__(self, date=None, version=None, **kwargs):
- self.__dict__.update(kwargs)
- if version:
- self.version = self.version_class(version)
- else:
- self.version = None
- self.date = date
- self.messages = []
-
- def add_message(self, msg):
- """add a new message"""
- self.messages.append(([msg], []))
-
- def complete_latest_message(self, msg_suite):
- """complete the latest added message
- """
- if not self.messages:
- raise ValueError('unable to complete last message as there is no previous message)')
- if self.messages[-1][1]: # sub messages
- self.messages[-1][1][-1].append(msg_suite)
- else: # message
- self.messages[-1][0].append(msg_suite)
-
- def add_sub_message(self, sub_msg, key=None):
- if not self.messages:
- raise ValueError('unable to complete last message as there is no previous message)')
- if key is None:
- self.messages[-1][1].append([sub_msg])
- else:
- raise NotImplementedError("sub message to specific key are not implemented yet")
-
- def write(self, stream=sys.stdout):
- """write the entry to file """
- stream.write('%s -- %s\n' % (self.date or '', self.version or ''))
- for msg, sub_msgs in self.messages:
- stream.write('%s%s %s\n' % (INDENT, BULLET, msg[0]))
- stream.write(''.join(msg[1:]))
- if sub_msgs:
- stream.write('\n')
- for sub_msg in sub_msgs:
- stream.write('%s%s %s\n' % (INDENT * 2, SUBBULLET, sub_msg[0]))
- stream.write(''.join(sub_msg[1:]))
- stream.write('\n')
-
- stream.write('\n\n')
-
-class ChangeLog(object):
- """object representation of a whole ChangeLog file"""
-
- entry_class = ChangeLogEntry
-
- def __init__(self, changelog_file, title=''):
- self.file = changelog_file
- self.title = title
- self.additional_content = ''
- self.entries = []
- self.load()
-
- def __repr__(self):
- return '<ChangeLog %s at %s (%s entries)>' % (self.file, id(self),
- len(self.entries))
-
- def add_entry(self, entry):
- """add a new entry to the change log"""
- self.entries.append(entry)
-
- def get_entry(self, version='', create=None):
- """ return a given changelog entry
- if version is omitted, return the current entry
- """
- if not self.entries:
- if version or not create:
- raise NoEntry()
- self.entries.append(self.entry_class())
- if not version:
- if self.entries[0].version and create is not None:
- self.entries.insert(0, self.entry_class())
- return self.entries[0]
- version = self.version_class(version)
- for entry in self.entries:
- if entry.version == version:
- return entry
- raise EntryNotFound()
-
- def add(self, msg, create=None):
- """add a new message to the latest opened entry"""
- entry = self.get_entry(create=create)
- entry.add_message(msg)
-
- def load(self):
- """ read a logilab's ChangeLog from file """
- try:
- stream = open(self.file)
- except IOError:
- return
- last = None
- expect_sub = False
- for line in stream.readlines():
- sline = line.strip()
- words = sline.split()
- # if new entry
- if len(words) == 1 and words[0] == '--':
- expect_sub = False
- last = self.entry_class()
- self.add_entry(last)
- # if old entry
- elif len(words) == 3 and words[1] == '--':
- expect_sub = False
- last = self.entry_class(words[0], words[2])
- self.add_entry(last)
- # if title
- elif sline and last is None:
- self.title = '%s%s' % (self.title, line)
- # if new entry
- elif sline and sline[0] == BULLET:
- expect_sub = False
- last.add_message(sline[1:].strip())
- # if new sub_entry
- elif expect_sub and sline and sline[0] == SUBBULLET:
- last.add_sub_message(sline[1:].strip())
- # if new line for current entry
- elif sline and last.messages:
- last.complete_latest_message(line)
- else:
- expect_sub = True
- self.additional_content += line
- stream.close()
-
- def format_title(self):
- return '%s\n\n' % self.title.strip()
-
- def save(self):
- """write back change log"""
- # filetutils isn't importable in appengine, so import locally
- from logilab.common.fileutils import ensure_fs_mode
- ensure_fs_mode(self.file, S_IWRITE)
- self.write(open(self.file, 'w'))
-
- def write(self, stream=sys.stdout):
- """write changelog to stream"""
- stream.write(self.format_title())
- for entry in self.entries:
- entry.write(stream)
-
diff --git a/chromium/third_party/logilab/logilab/common/clcommands.py b/chromium/third_party/logilab/logilab/common/clcommands.py
deleted file mode 100644
index 4778b99b024..00000000000
--- a/chromium/third_party/logilab/logilab/common/clcommands.py
+++ /dev/null
@@ -1,334 +0,0 @@
-# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""Helper functions to support command line tools providing more than
-one command.
-
-e.g called as "tool command [options] args..." where <options> and <args> are
-command'specific
-"""
-
-from __future__ import print_function
-
-__docformat__ = "restructuredtext en"
-
-import sys
-import logging
-from os.path import basename
-
-from logilab.common.configuration import Configuration
-from logilab.common.logging_ext import init_log, get_threshold
-from logilab.common.deprecation import deprecated
-
-
-class BadCommandUsage(Exception):
- """Raised when an unknown command is used or when a command is not
- correctly used (bad options, too much / missing arguments...).
-
- Trigger display of command usage.
- """
-
-class CommandError(Exception):
- """Raised when a command can't be processed and we want to display it and
- exit, without traceback nor usage displayed.
- """
-
-
-# command line access point ####################################################
-
-class CommandLine(dict):
- """Usage:
-
- >>> LDI = cli.CommandLine('ldi', doc='Logilab debian installer',
- version=version, rcfile=RCFILE)
- >>> LDI.register(MyCommandClass)
- >>> LDI.register(MyOtherCommandClass)
- >>> LDI.run(sys.argv[1:])
-
- Arguments:
-
- * `pgm`, the program name, default to `basename(sys.argv[0])`
-
- * `doc`, a short description of the command line tool
-
- * `copyright`, additional doc string that will be appended to the generated
- doc
-
- * `version`, version number of string of the tool. If specified, global
- --version option will be available.
-
- * `rcfile`, path to a configuration file. If specified, global --C/--rc-file
- option will be available? self.rcfile = rcfile
-
- * `logger`, logger to propagate to commands, default to
- `logging.getLogger(self.pgm))`
- """
- def __init__(self, pgm=None, doc=None, copyright=None, version=None,
- rcfile=None, logthreshold=logging.ERROR,
- check_duplicated_command=True):
- if pgm is None:
- pgm = basename(sys.argv[0])
- self.pgm = pgm
- self.doc = doc
- self.copyright = copyright
- self.version = version
- self.rcfile = rcfile
- self.logger = None
- self.logthreshold = logthreshold
- self.check_duplicated_command = check_duplicated_command
-
- def register(self, cls, force=False):
- """register the given :class:`Command` subclass"""
- assert not self.check_duplicated_command or force or not cls.name in self, \
- 'a command %s is already defined' % cls.name
- self[cls.name] = cls
- return cls
-
- def run(self, args):
- """main command line access point:
- * init logging
- * handle global options (-h/--help, --version, -C/--rc-file)
- * check command
- * run command
-
- Terminate by :exc:`SystemExit`
- """
- init_log(debug=True, # so that we use StreamHandler
- logthreshold=self.logthreshold,
- logformat='%(levelname)s: %(message)s')
- try:
- arg = args.pop(0)
- except IndexError:
- self.usage_and_exit(1)
- if arg in ('-h', '--help'):
- self.usage_and_exit(0)
- if self.version is not None and arg in ('--version'):
- print(self.version)
- sys.exit(0)
- rcfile = self.rcfile
- if rcfile is not None and arg in ('-C', '--rc-file'):
- try:
- rcfile = args.pop(0)
- arg = args.pop(0)
- except IndexError:
- self.usage_and_exit(1)
- try:
- command = self.get_command(arg)
- except KeyError:
- print('ERROR: no %s command' % arg)
- print()
- self.usage_and_exit(1)
- try:
- sys.exit(command.main_run(args, rcfile))
- except KeyboardInterrupt as exc:
- print('Interrupted', end=' ')
- if str(exc):
- print(': %s' % exc, end=' ')
- print()
- sys.exit(4)
- except BadCommandUsage as err:
- print('ERROR:', err)
- print()
- print(command.help())
- sys.exit(1)
-
- def create_logger(self, handler, logthreshold=None):
- logger = logging.Logger(self.pgm)
- logger.handlers = [handler]
- if logthreshold is None:
- logthreshold = get_threshold(self.logthreshold)
- logger.setLevel(logthreshold)
- return logger
-
- def get_command(self, cmd, logger=None):
- if logger is None:
- logger = self.logger
- if logger is None:
- logger = self.logger = logging.getLogger(self.pgm)
- logger.setLevel(get_threshold(self.logthreshold))
- return self[cmd](logger)
-
- def usage(self):
- """display usage for the main program (i.e. when no command supplied)
- and exit
- """
- print('usage:', self.pgm, end=' ')
- if self.rcfile:
- print('[--rc-file=<configuration file>]', end=' ')
- print('<command> [options] <command argument>...')
- if self.doc:
- print('\n%s' % self.doc)
- print('''
-Type "%(pgm)s <command> --help" for more information about a specific
-command. Available commands are :\n''' % self.__dict__)
- max_len = max([len(cmd) for cmd in self])
- padding = ' ' * max_len
- for cmdname, cmd in sorted(self.items()):
- if not cmd.hidden:
- print(' ', (cmdname + padding)[:max_len], cmd.short_description())
- if self.rcfile:
- print('''
-Use --rc-file=<configuration file> / -C <configuration file> before the command
-to specify a configuration file. Default to %s.
-''' % self.rcfile)
- print('''%(pgm)s -h/--help
- display this usage information and exit''' % self.__dict__)
- if self.version:
- print('''%(pgm)s -v/--version
- display version configuration and exit''' % self.__dict__)
- if self.copyright:
- print('\n', self.copyright)
-
- def usage_and_exit(self, status):
- self.usage()
- sys.exit(status)
-
-
-# base command classes #########################################################
-
-class Command(Configuration):
- """Base class for command line commands.
-
- Class attributes:
-
- * `name`, the name of the command
-
- * `min_args`, minimum number of arguments, None if unspecified
-
- * `max_args`, maximum number of arguments, None if unspecified
-
- * `arguments`, string describing arguments, used in command usage
-
- * `hidden`, boolean flag telling if the command should be hidden, e.g. does
- not appear in help's commands list
-
- * `options`, options list, as allowed by :mod:configuration
- """
-
- arguments = ''
- name = ''
- # hidden from help ?
- hidden = False
- # max/min args, None meaning unspecified
- min_args = None
- max_args = None
-
- @classmethod
- def description(cls):
- return cls.__doc__.replace(' ', '')
-
- @classmethod
- def short_description(cls):
- return cls.description().split('.')[0]
-
- def __init__(self, logger):
- usage = '%%prog %s %s\n\n%s' % (self.name, self.arguments,
- self.description())
- Configuration.__init__(self, usage=usage)
- self.logger = logger
-
- def check_args(self, args):
- """check command's arguments are provided"""
- if self.min_args is not None and len(args) < self.min_args:
- raise BadCommandUsage('missing argument')
- if self.max_args is not None and len(args) > self.max_args:
- raise BadCommandUsage('too many arguments')
-
- def main_run(self, args, rcfile=None):
- """Run the command and return status 0 if everything went fine.
-
- If :exc:`CommandError` is raised by the underlying command, simply log
- the error and return status 2.
-
- Any other exceptions, including :exc:`BadCommandUsage` will be
- propagated.
- """
- if rcfile:
- self.load_file_configuration(rcfile)
- args = self.load_command_line_configuration(args)
- try:
- self.check_args(args)
- self.run(args)
- except CommandError as err:
- self.logger.error(err)
- return 2
- return 0
-
- def run(self, args):
- """run the command with its specific arguments"""
- raise NotImplementedError()
-
-
-class ListCommandsCommand(Command):
- """list available commands, useful for bash completion."""
- name = 'listcommands'
- arguments = '[command]'
- hidden = True
-
- def run(self, args):
- """run the command with its specific arguments"""
- if args:
- command = args.pop()
- cmd = _COMMANDS[command]
- for optname, optdict in cmd.options:
- print('--help')
- print('--' + optname)
- else:
- commands = sorted(_COMMANDS.keys())
- for command in commands:
- cmd = _COMMANDS[command]
- if not cmd.hidden:
- print(command)
-
-
-# deprecated stuff #############################################################
-
-_COMMANDS = CommandLine()
-
-DEFAULT_COPYRIGHT = '''\
-Copyright (c) 2004-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-http://www.logilab.fr/ -- mailto:contact@logilab.fr'''
-
-@deprecated('use cls.register(cli)')
-def register_commands(commands):
- """register existing commands"""
- for command_klass in commands:
- _COMMANDS.register(command_klass)
-
-@deprecated('use args.pop(0)')
-def main_run(args, doc=None, copyright=None, version=None):
- """command line tool: run command specified by argument list (without the
- program name). Raise SystemExit with status 0 if everything went fine.
-
- >>> main_run(sys.argv[1:])
- """
- _COMMANDS.doc = doc
- _COMMANDS.copyright = copyright
- _COMMANDS.version = version
- _COMMANDS.run(args)
-
-@deprecated('use args.pop(0)')
-def pop_arg(args_list, expected_size_after=None, msg="Missing argument"):
- """helper function to get and check command line arguments"""
- try:
- value = args_list.pop(0)
- except IndexError:
- raise BadCommandUsage(msg)
- if expected_size_after is not None and len(args_list) > expected_size_after:
- raise BadCommandUsage('too many arguments')
- return value
-
diff --git a/chromium/third_party/logilab/logilab/common/cli.py b/chromium/third_party/logilab/logilab/common/cli.py
deleted file mode 100644
index cdeef974f48..00000000000
--- a/chromium/third_party/logilab/logilab/common/cli.py
+++ /dev/null
@@ -1,211 +0,0 @@
-# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""Command line interface helper classes.
-
-It provides some default commands, a help system, a default readline
-configuration with completion and persistent history.
-
-Example::
-
- class BookShell(CLIHelper):
-
- def __init__(self):
- # quit and help are builtins
- # CMD_MAP keys are commands, values are topics
- self.CMD_MAP['pionce'] = _("Sommeil")
- self.CMD_MAP['ronfle'] = _("Sommeil")
- CLIHelper.__init__(self)
-
- help_do_pionce = ("pionce", "pionce duree", _("met ton corps en veille"))
- def do_pionce(self):
- print('nap is good')
-
- help_do_ronfle = ("ronfle", "ronfle volume", _("met les autres en veille"))
- def do_ronfle(self):
- print('fuuuuuuuuuuuu rhhhhhrhrhrrh')
-
- cl = BookShell()
-"""
-
-from __future__ import print_function
-
-__docformat__ = "restructuredtext en"
-
-from six.moves import builtins, input
-
-if not hasattr(builtins, '_'):
- builtins._ = str
-
-
-def init_readline(complete_method, histfile=None):
- """Init the readline library if available."""
- try:
- import readline
- readline.parse_and_bind("tab: complete")
- readline.set_completer(complete_method)
- string = readline.get_completer_delims().replace(':', '')
- readline.set_completer_delims(string)
- if histfile is not None:
- try:
- readline.read_history_file(histfile)
- except IOError:
- pass
- import atexit
- atexit.register(readline.write_history_file, histfile)
- except:
- print('readline is not available :-(')
-
-
-class Completer :
- """Readline completer."""
-
- def __init__(self, commands):
- self.list = commands
-
- def complete(self, text, state):
- """Hook called by readline when <tab> is pressed."""
- n = len(text)
- matches = []
- for cmd in self.list :
- if cmd[:n] == text :
- matches.append(cmd)
- try:
- return matches[state]
- except IndexError:
- return None
-
-
-class CLIHelper:
- """An abstract command line interface client which recognize commands
- and provide an help system.
- """
-
- CMD_MAP = {'help': _("Others"),
- 'quit': _("Others"),
- }
- CMD_PREFIX = ''
-
- def __init__(self, histfile=None) :
- self._topics = {}
- self.commands = None
- self._completer = Completer(self._register_commands())
- init_readline(self._completer.complete, histfile)
-
- def run(self):
- """loop on user input, exit on EOF"""
- while True:
- try:
- line = input('>>> ')
- except EOFError:
- print
- break
- s_line = line.strip()
- if not s_line:
- continue
- args = s_line.split()
- if args[0] in self.commands:
- try:
- cmd = 'do_%s' % self.commands[args[0]]
- getattr(self, cmd)(*args[1:])
- except EOFError:
- break
- except:
- import traceback
- traceback.print_exc()
- else:
- try:
- self.handle_line(s_line)
- except:
- import traceback
- traceback.print_exc()
-
- def handle_line(self, stripped_line):
- """Method to overload in the concrete class (should handle
- lines which are not commands).
- """
- raise NotImplementedError()
-
-
- # private methods #########################################################
-
- def _register_commands(self):
- """ register available commands method and return the list of
- commands name
- """
- self.commands = {}
- self._command_help = {}
- commands = [attr[3:] for attr in dir(self) if attr[:3] == 'do_']
- for command in commands:
- topic = self.CMD_MAP[command]
- help_method = getattr(self, 'help_do_%s' % command)
- self._topics.setdefault(topic, []).append(help_method)
- self.commands[self.CMD_PREFIX + command] = command
- self._command_help[command] = help_method
- return self.commands.keys()
-
- def _print_help(self, cmd, syntax, explanation):
- print(_('Command %s') % cmd)
- print(_('Syntax: %s') % syntax)
- print('\t', explanation)
- print()
-
-
- # predefined commands #####################################################
-
- def do_help(self, command=None) :
- """base input of the help system"""
- if command in self._command_help:
- self._print_help(*self._command_help[command])
- elif command is None or command not in self._topics:
- print(_("Use help <topic> or help <command>."))
- print(_("Available topics are:"))
- topics = sorted(self._topics.keys())
- for topic in topics:
- print('\t', topic)
- print()
- print(_("Available commands are:"))
- commands = self.commands.keys()
- commands.sort()
- for command in commands:
- print('\t', command[len(self.CMD_PREFIX):])
-
- else:
- print(_('Available commands about %s:') % command)
- print
- for command_help_method in self._topics[command]:
- try:
- if callable(command_help_method):
- self._print_help(*command_help_method())
- else:
- self._print_help(*command_help_method)
- except:
- import traceback
- traceback.print_exc()
- print('ERROR in help method %s'% (
- command_help_method.__name__))
-
- help_do_help = ("help", "help [topic|command]",
- _("print help message for the given topic/command or \
-available topics when no argument"))
-
- def do_quit(self):
- """quit the CLI"""
- raise EOFError()
-
- def help_do_quit(self):
- return ("quit", "quit", _("quit the application"))
diff --git a/chromium/third_party/logilab/logilab/common/compat.py b/chromium/third_party/logilab/logilab/common/compat.py
deleted file mode 100644
index f2eb5905601..00000000000
--- a/chromium/third_party/logilab/logilab/common/compat.py
+++ /dev/null
@@ -1,78 +0,0 @@
-# pylint: disable=E0601,W0622,W0611
-# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""Wrappers around some builtins introduced in python 2.3, 2.4 and
-2.5, making them available in for earlier versions of python.
-
-See another compatibility snippets from other projects:
-
- :mod:`lib2to3.fixes`
- :mod:`coverage.backward`
- :mod:`unittest2.compatibility`
-"""
-
-
-__docformat__ = "restructuredtext en"
-
-import os
-import sys
-import types
-from warnings import warn
-
-# not used here, but imported to preserve API
-from six.moves import builtins
-
-if sys.version_info < (3, 0):
- str_to_bytes = str
- def str_encode(string, encoding):
- if isinstance(string, unicode):
- return string.encode(encoding)
- return str(string)
-else:
- def str_to_bytes(string):
- return str.encode(string)
- # we have to ignore the encoding in py3k to be able to write a string into a
- # TextIOWrapper or like object (which expect an unicode string)
- def str_encode(string, encoding):
- return str(string)
-
-# See also http://bugs.python.org/issue11776
-if sys.version_info[0] == 3:
- def method_type(callable, instance, klass):
- # api change. klass is no more considered
- return types.MethodType(callable, instance)
-else:
- # alias types otherwise
- method_type = types.MethodType
-
-# Pythons 2 and 3 differ on where to get StringIO
-if sys.version_info < (3, 0):
- from cStringIO import StringIO
- FileIO = file
- BytesIO = StringIO
- reload = reload
-else:
- from io import FileIO, BytesIO, StringIO
- from imp import reload
-
-from logilab.common.deprecation import deprecated
-
-# Other projects import these from here, keep providing them for
-# backwards compat
-any = deprecated('use builtin "any"')(any)
-all = deprecated('use builtin "all"')(all)
diff --git a/chromium/third_party/logilab/logilab/common/configuration.py b/chromium/third_party/logilab/logilab/common/configuration.py
deleted file mode 100644
index b2924277c94..00000000000
--- a/chromium/third_party/logilab/logilab/common/configuration.py
+++ /dev/null
@@ -1,1105 +0,0 @@
-# copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""Classes to handle advanced configuration in simple to complex applications.
-
-Allows to load the configuration from a file or from command line
-options, to generate a sample configuration file or to display
-program's usage. Fills the gap between optik/optparse and ConfigParser
-by adding data types (which are also available as a standalone optik
-extension in the `optik_ext` module).
-
-
-Quick start: simplest usage
----------------------------
-
-.. python ::
-
- >>> import sys
- >>> from logilab.common.configuration import Configuration
- >>> options = [('dothis', {'type':'yn', 'default': True, 'metavar': '<y or n>'}),
- ... ('value', {'type': 'string', 'metavar': '<string>'}),
- ... ('multiple', {'type': 'csv', 'default': ('yop',),
- ... 'metavar': '<comma separated values>',
- ... 'help': 'you can also document the option'}),
- ... ('number', {'type': 'int', 'default':2, 'metavar':'<int>'}),
- ... ]
- >>> config = Configuration(options=options, name='My config')
- >>> print config['dothis']
- True
- >>> print config['value']
- None
- >>> print config['multiple']
- ('yop',)
- >>> print config['number']
- 2
- >>> print config.help()
- Usage: [options]
-
- Options:
- -h, --help show this help message and exit
- --dothis=<y or n>
- --value=<string>
- --multiple=<comma separated values>
- you can also document the option [current: none]
- --number=<int>
-
- >>> f = open('myconfig.ini', 'w')
- >>> f.write('''[MY CONFIG]
- ... number = 3
- ... dothis = no
- ... multiple = 1,2,3
- ... ''')
- >>> f.close()
- >>> config.load_file_configuration('myconfig.ini')
- >>> print config['dothis']
- False
- >>> print config['value']
- None
- >>> print config['multiple']
- ['1', '2', '3']
- >>> print config['number']
- 3
- >>> sys.argv = ['mon prog', '--value', 'bacon', '--multiple', '4,5,6',
- ... 'nonoptionargument']
- >>> print config.load_command_line_configuration()
- ['nonoptionargument']
- >>> print config['value']
- bacon
- >>> config.generate_config()
- # class for simple configurations which don't need the
- # manager / providers model and prefer delegation to inheritance
- #
- # configuration values are accessible through a dict like interface
- #
- [MY CONFIG]
-
- dothis=no
-
- value=bacon
-
- # you can also document the option
- multiple=4,5,6
-
- number=3
-
- Note : starting with Python 2.7 ConfigParser is able to take into
- account the order of occurrences of the options into a file (by
- using an OrderedDict). If you have two options changing some common
- state, like a 'disable-all-stuff' and a 'enable-some-stuff-a', their
- order of appearance will be significant : the last specified in the
- file wins. For earlier version of python and logilab.common newer
- than 0.61 the behaviour is unspecified.
-
-"""
-
-from __future__ import print_function
-
-__docformat__ = "restructuredtext en"
-
-__all__ = ('OptionsManagerMixIn', 'OptionsProviderMixIn',
- 'ConfigurationMixIn', 'Configuration',
- 'OptionsManager2ConfigurationAdapter')
-
-import os
-import sys
-import re
-from os.path import exists, expanduser
-from copy import copy
-from warnings import warn
-
-from six import string_types
-from six.moves import range, configparser as cp, input
-
-from logilab.common.compat import str_encode as _encode
-from logilab.common.deprecation import deprecated
-from logilab.common.textutils import normalize_text, unquote
-from logilab.common import optik_ext
-
-OptionError = optik_ext.OptionError
-
-REQUIRED = []
-
-class UnsupportedAction(Exception):
- """raised by set_option when it doesn't know what to do for an action"""
-
-
-def _get_encoding(encoding, stream):
- encoding = encoding or getattr(stream, 'encoding', None)
- if not encoding:
- import locale
- encoding = locale.getpreferredencoding()
- return encoding
-
-
-# validation functions ########################################################
-
-# validators will return the validated value or raise optparse.OptionValueError
-# XXX add to documentation
-
-def choice_validator(optdict, name, value):
- """validate and return a converted value for option of type 'choice'
- """
- if not value in optdict['choices']:
- msg = "option %s: invalid value: %r, should be in %s"
- raise optik_ext.OptionValueError(msg % (name, value, optdict['choices']))
- return value
-
-def multiple_choice_validator(optdict, name, value):
- """validate and return a converted value for option of type 'choice'
- """
- choices = optdict['choices']
- values = optik_ext.check_csv(None, name, value)
- for value in values:
- if not value in choices:
- msg = "option %s: invalid value: %r, should be in %s"
- raise optik_ext.OptionValueError(msg % (name, value, choices))
- return values
-
-def csv_validator(optdict, name, value):
- """validate and return a converted value for option of type 'csv'
- """
- return optik_ext.check_csv(None, name, value)
-
-def yn_validator(optdict, name, value):
- """validate and return a converted value for option of type 'yn'
- """
- return optik_ext.check_yn(None, name, value)
-
-def named_validator(optdict, name, value):
- """validate and return a converted value for option of type 'named'
- """
- return optik_ext.check_named(None, name, value)
-
-def file_validator(optdict, name, value):
- """validate and return a filepath for option of type 'file'"""
- return optik_ext.check_file(None, name, value)
-
-def color_validator(optdict, name, value):
- """validate and return a valid color for option of type 'color'"""
- return optik_ext.check_color(None, name, value)
-
-def password_validator(optdict, name, value):
- """validate and return a string for option of type 'password'"""
- return optik_ext.check_password(None, name, value)
-
-def date_validator(optdict, name, value):
- """validate and return a mx DateTime object for option of type 'date'"""
- return optik_ext.check_date(None, name, value)
-
-def time_validator(optdict, name, value):
- """validate and return a time object for option of type 'time'"""
- return optik_ext.check_time(None, name, value)
-
-def bytes_validator(optdict, name, value):
- """validate and return an integer for option of type 'bytes'"""
- return optik_ext.check_bytes(None, name, value)
-
-
-VALIDATORS = {'string': unquote,
- 'int': int,
- 'float': float,
- 'file': file_validator,
- 'font': unquote,
- 'color': color_validator,
- 'regexp': re.compile,
- 'csv': csv_validator,
- 'yn': yn_validator,
- 'bool': yn_validator,
- 'named': named_validator,
- 'password': password_validator,
- 'date': date_validator,
- 'time': time_validator,
- 'bytes': bytes_validator,
- 'choice': choice_validator,
- 'multiple_choice': multiple_choice_validator,
- }
-
-def _call_validator(opttype, optdict, option, value):
- if opttype not in VALIDATORS:
- raise Exception('Unsupported type "%s"' % opttype)
- try:
- return VALIDATORS[opttype](optdict, option, value)
- except TypeError:
- try:
- return VALIDATORS[opttype](value)
- except optik_ext.OptionValueError:
- raise
- except:
- raise optik_ext.OptionValueError('%s value (%r) should be of type %s' %
- (option, value, opttype))
-
-# user input functions ########################################################
-
-# user input functions will ask the user for input on stdin then validate
-# the result and return the validated value or raise optparse.OptionValueError
-# XXX add to documentation
-
-def input_password(optdict, question='password:'):
- from getpass import getpass
- while True:
- value = getpass(question)
- value2 = getpass('confirm: ')
- if value == value2:
- return value
- print('password mismatch, try again')
-
-def input_string(optdict, question):
- value = input(question).strip()
- return value or None
-
-def _make_input_function(opttype):
- def input_validator(optdict, question):
- while True:
- value = input(question)
- if not value.strip():
- return None
- try:
- return _call_validator(opttype, optdict, None, value)
- except optik_ext.OptionValueError as ex:
- msg = str(ex).split(':', 1)[-1].strip()
- print('bad value: %s' % msg)
- return input_validator
-
-INPUT_FUNCTIONS = {
- 'string': input_string,
- 'password': input_password,
- }
-
-for opttype in VALIDATORS.keys():
- INPUT_FUNCTIONS.setdefault(opttype, _make_input_function(opttype))
-
-# utility functions ############################################################
-
-def expand_default(self, option):
- """monkey patch OptionParser.expand_default since we have a particular
- way to handle defaults to avoid overriding values in the configuration
- file
- """
- if self.parser is None or not self.default_tag:
- return option.help
- optname = option._long_opts[0][2:]
- try:
- provider = self.parser.options_manager._all_options[optname]
- except KeyError:
- value = None
- else:
- optdict = provider.get_option_def(optname)
- optname = provider.option_attrname(optname, optdict)
- value = getattr(provider.config, optname, optdict)
- value = format_option_value(optdict, value)
- if value is optik_ext.NO_DEFAULT or not value:
- value = self.NO_DEFAULT_VALUE
- return option.help.replace(self.default_tag, str(value))
-
-
-def _validate(value, optdict, name=''):
- """return a validated value for an option according to its type
-
- optional argument name is only used for error message formatting
- """
- try:
- _type = optdict['type']
- except KeyError:
- # FIXME
- return value
- return _call_validator(_type, optdict, name, value)
-convert = deprecated('[0.60] convert() was renamed _validate()')(_validate)
-
-# format and output functions ##################################################
-
-def comment(string):
- """return string as a comment"""
- lines = [line.strip() for line in string.splitlines()]
- return '# ' + ('%s# ' % os.linesep).join(lines)
-
-def format_time(value):
- if not value:
- return '0'
- if value != int(value):
- return '%.2fs' % value
- value = int(value)
- nbmin, nbsec = divmod(value, 60)
- if nbsec:
- return '%ss' % value
- nbhour, nbmin_ = divmod(nbmin, 60)
- if nbmin_:
- return '%smin' % nbmin
- nbday, nbhour_ = divmod(nbhour, 24)
- if nbhour_:
- return '%sh' % nbhour
- return '%sd' % nbday
-
-def format_bytes(value):
- if not value:
- return '0'
- if value != int(value):
- return '%.2fB' % value
- value = int(value)
- prevunit = 'B'
- for unit in ('KB', 'MB', 'GB', 'TB'):
- next, remain = divmod(value, 1024)
- if remain:
- return '%s%s' % (value, prevunit)
- prevunit = unit
- value = next
- return '%s%s' % (value, unit)
-
-def format_option_value(optdict, value):
- """return the user input's value from a 'compiled' value"""
- if isinstance(value, (list, tuple)):
- value = ','.join(value)
- elif isinstance(value, dict):
- value = ','.join(['%s:%s' % (k, v) for k, v in value.items()])
- elif hasattr(value, 'match'): # optdict.get('type') == 'regexp'
- # compiled regexp
- value = value.pattern
- elif optdict.get('type') == 'yn':
- value = value and 'yes' or 'no'
- elif isinstance(value, string_types) and value.isspace():
- value = "'%s'" % value
- elif optdict.get('type') == 'time' and isinstance(value, (float, int, long)):
- value = format_time(value)
- elif optdict.get('type') == 'bytes' and hasattr(value, '__int__'):
- value = format_bytes(value)
- return value
-
-def ini_format_section(stream, section, options, encoding=None, doc=None):
- """format an options section using the INI format"""
- encoding = _get_encoding(encoding, stream)
- if doc:
- print(_encode(comment(doc), encoding), file=stream)
- print('[%s]' % section, file=stream)
- ini_format(stream, options, encoding)
-
-def ini_format(stream, options, encoding):
- """format options using the INI format"""
- for optname, optdict, value in options:
- value = format_option_value(optdict, value)
- help = optdict.get('help')
- if help:
- help = normalize_text(help, line_len=79, indent='# ')
- print(file=stream)
- print(_encode(help, encoding), file=stream)
- else:
- print(file=stream)
- if value is None:
- print('#%s=' % optname, file=stream)
- else:
- value = _encode(value, encoding).strip()
- print('%s=%s' % (optname, value), file=stream)
-
-format_section = ini_format_section
-
-def rest_format_section(stream, section, options, encoding=None, doc=None):
- """format an options section using as ReST formatted output"""
- encoding = _get_encoding(encoding, stream)
- if section:
- print('%s\n%s' % (section, "'"*len(section)), file=stream)
- if doc:
- print(_encode(normalize_text(doc, line_len=79, indent=''), encoding), file=stream)
- print(file=stream)
- for optname, optdict, value in options:
- help = optdict.get('help')
- print(':%s:' % optname, file=stream)
- if help:
- help = normalize_text(help, line_len=79, indent=' ')
- print(_encode(help, encoding), file=stream)
- if value:
- value = _encode(format_option_value(optdict, value), encoding)
- print(file=stream)
- print(' Default: ``%s``' % value.replace("`` ", "```` ``"), file=stream)
-
-# Options Manager ##############################################################
-
-class OptionsManagerMixIn(object):
- """MixIn to handle a configuration from both a configuration file and
- command line options
- """
-
- def __init__(self, usage, config_file=None, version=None, quiet=0):
- self.config_file = config_file
- self.reset_parsers(usage, version=version)
- # list of registered options providers
- self.options_providers = []
- # dictionary associating option name to checker
- self._all_options = {}
- self._short_options = {}
- self._nocallback_options = {}
- self._mygroups = dict()
- # verbosity
- self.quiet = quiet
- self._maxlevel = 0
-
- def reset_parsers(self, usage='', version=None):
- # configuration file parser
- self.cfgfile_parser = cp.ConfigParser()
- # command line parser
- self.cmdline_parser = optik_ext.OptionParser(usage=usage, version=version)
- self.cmdline_parser.options_manager = self
- self._optik_option_attrs = set(self.cmdline_parser.option_class.ATTRS)
-
- def register_options_provider(self, provider, own_group=True):
- """register an options provider"""
- assert provider.priority <= 0, "provider's priority can't be >= 0"
- for i in range(len(self.options_providers)):
- if provider.priority > self.options_providers[i].priority:
- self.options_providers.insert(i, provider)
- break
- else:
- self.options_providers.append(provider)
- non_group_spec_options = [option for option in provider.options
- if 'group' not in option[1]]
- groups = getattr(provider, 'option_groups', ())
- if own_group and non_group_spec_options:
- self.add_option_group(provider.name.upper(), provider.__doc__,
- non_group_spec_options, provider)
- else:
- for opt, optdict in non_group_spec_options:
- self.add_optik_option(provider, self.cmdline_parser, opt, optdict)
- for gname, gdoc in groups:
- gname = gname.upper()
- goptions = [option for option in provider.options
- if option[1].get('group', '').upper() == gname]
- self.add_option_group(gname, gdoc, goptions, provider)
-
- def add_option_group(self, group_name, doc, options, provider):
- """add an option group including the listed options
- """
- assert options
- # add option group to the command line parser
- if group_name in self._mygroups:
- group = self._mygroups[group_name]
- else:
- group = optik_ext.OptionGroup(self.cmdline_parser,
- title=group_name.capitalize())
- self.cmdline_parser.add_option_group(group)
- group.level = provider.level
- self._mygroups[group_name] = group
- # add section to the config file
- if group_name != "DEFAULT":
- self.cfgfile_parser.add_section(group_name)
- # add provider's specific options
- for opt, optdict in options:
- self.add_optik_option(provider, group, opt, optdict)
-
- def add_optik_option(self, provider, optikcontainer, opt, optdict):
- if 'inputlevel' in optdict:
- warn('[0.50] "inputlevel" in option dictionary for %s is deprecated,'
- ' use "level"' % opt, DeprecationWarning)
- optdict['level'] = optdict.pop('inputlevel')
- args, optdict = self.optik_option(provider, opt, optdict)
- option = optikcontainer.add_option(*args, **optdict)
- self._all_options[opt] = provider
- self._maxlevel = max(self._maxlevel, option.level or 0)
-
- def optik_option(self, provider, opt, optdict):
- """get our personal option definition and return a suitable form for
- use with optik/optparse
- """
- optdict = copy(optdict)
- others = {}
- if 'action' in optdict:
- self._nocallback_options[provider] = opt
- else:
- optdict['action'] = 'callback'
- optdict['callback'] = self.cb_set_provider_option
- # default is handled here and *must not* be given to optik if you
- # want the whole machinery to work
- if 'default' in optdict:
- if ('help' in optdict
- and optdict.get('default') is not None
- and not optdict['action'] in ('store_true', 'store_false')):
- optdict['help'] += ' [current: %default]'
- del optdict['default']
- args = ['--' + str(opt)]
- if 'short' in optdict:
- self._short_options[optdict['short']] = opt
- args.append('-' + optdict['short'])
- del optdict['short']
- # cleanup option definition dict before giving it to optik
- for key in list(optdict.keys()):
- if not key in self._optik_option_attrs:
- optdict.pop(key)
- return args, optdict
-
- def cb_set_provider_option(self, option, opt, value, parser):
- """optik callback for option setting"""
- if opt.startswith('--'):
- # remove -- on long option
- opt = opt[2:]
- else:
- # short option, get its long equivalent
- opt = self._short_options[opt[1:]]
- # trick since we can't set action='store_true' on options
- if value is None:
- value = 1
- self.global_set_option(opt, value)
-
- def global_set_option(self, opt, value):
- """set option on the correct option provider"""
- self._all_options[opt].set_option(opt, value)
-
- def generate_config(self, stream=None, skipsections=(), encoding=None):
- """write a configuration file according to the current configuration
- into the given stream or stdout
- """
- options_by_section = {}
- sections = []
- for provider in self.options_providers:
- for section, options in provider.options_by_section():
- if section is None:
- section = provider.name
- if section in skipsections:
- continue
- options = [(n, d, v) for (n, d, v) in options
- if d.get('type') is not None]
- if not options:
- continue
- if not section in sections:
- sections.append(section)
- alloptions = options_by_section.setdefault(section, [])
- alloptions += options
- stream = stream or sys.stdout
- encoding = _get_encoding(encoding, stream)
- printed = False
- for section in sections:
- if printed:
- print('\n', file=stream)
- format_section(stream, section.upper(), options_by_section[section],
- encoding)
- printed = True
-
- def generate_manpage(self, pkginfo, section=1, stream=None):
- """write a man page for the current configuration into the given
- stream or stdout
- """
- self._monkeypatch_expand_default()
- try:
- optik_ext.generate_manpage(self.cmdline_parser, pkginfo,
- section, stream=stream or sys.stdout,
- level=self._maxlevel)
- finally:
- self._unmonkeypatch_expand_default()
-
- # initialization methods ##################################################
-
- def load_provider_defaults(self):
- """initialize configuration using default values"""
- for provider in self.options_providers:
- provider.load_defaults()
-
- def load_file_configuration(self, config_file=None):
- """load the configuration from file"""
- self.read_config_file(config_file)
- self.load_config_file()
-
- def read_config_file(self, config_file=None):
- """read the configuration file but do not load it (i.e. dispatching
- values to each options provider)
- """
- helplevel = 1
- while helplevel <= self._maxlevel:
- opt = '-'.join(['long'] * helplevel) + '-help'
- if opt in self._all_options:
- break # already processed
- def helpfunc(option, opt, val, p, level=helplevel):
- print(self.help(level))
- sys.exit(0)
- helpmsg = '%s verbose help.' % ' '.join(['more'] * helplevel)
- optdict = {'action' : 'callback', 'callback' : helpfunc,
- 'help' : helpmsg}
- provider = self.options_providers[0]
- self.add_optik_option(provider, self.cmdline_parser, opt, optdict)
- provider.options += ( (opt, optdict), )
- helplevel += 1
- if config_file is None:
- config_file = self.config_file
- if config_file is not None:
- config_file = expanduser(config_file)
- if config_file and exists(config_file):
- parser = self.cfgfile_parser
- parser.read([config_file])
- # normalize sections'title
- for sect, values in parser._sections.items():
- if not sect.isupper() and values:
- parser._sections[sect.upper()] = values
- elif not self.quiet:
- msg = 'No config file found, using default configuration'
- print(msg, file=sys.stderr)
- return
-
- def input_config(self, onlysection=None, inputlevel=0, stream=None):
- """interactively get configuration values by asking to the user and generate
- a configuration file
- """
- if onlysection is not None:
- onlysection = onlysection.upper()
- for provider in self.options_providers:
- for section, option, optdict in provider.all_options():
- if onlysection is not None and section != onlysection:
- continue
- if not 'type' in optdict:
- # ignore action without type (callback, store_true...)
- continue
- provider.input_option(option, optdict, inputlevel)
- # now we can generate the configuration file
- if stream is not None:
- self.generate_config(stream)
-
- def load_config_file(self):
- """dispatch values previously read from a configuration file to each
- options provider)
- """
- parser = self.cfgfile_parser
- for section in parser.sections():
- for option, value in parser.items(section):
- try:
- self.global_set_option(option, value)
- except (KeyError, OptionError):
- # TODO handle here undeclared options appearing in the config file
- continue
-
- def load_configuration(self, **kwargs):
- """override configuration according to given parameters
- """
- for opt, opt_value in kwargs.items():
- opt = opt.replace('_', '-')
- provider = self._all_options[opt]
- provider.set_option(opt, opt_value)
-
- def load_command_line_configuration(self, args=None):
- """override configuration according to command line parameters
-
- return additional arguments
- """
- self._monkeypatch_expand_default()
- try:
- if args is None:
- args = sys.argv[1:]
- else:
- args = list(args)
- (options, args) = self.cmdline_parser.parse_args(args=args)
- for provider in self._nocallback_options.keys():
- config = provider.config
- for attr in config.__dict__.keys():
- value = getattr(options, attr, None)
- if value is None:
- continue
- setattr(config, attr, value)
- return args
- finally:
- self._unmonkeypatch_expand_default()
-
-
- # help methods ############################################################
-
- def add_help_section(self, title, description, level=0):
- """add a dummy option section for help purpose """
- group = optik_ext.OptionGroup(self.cmdline_parser,
- title=title.capitalize(),
- description=description)
- group.level = level
- self._maxlevel = max(self._maxlevel, level)
- self.cmdline_parser.add_option_group(group)
-
- def _monkeypatch_expand_default(self):
- # monkey patch optik_ext to deal with our default values
- try:
- self.__expand_default_backup = optik_ext.HelpFormatter.expand_default
- optik_ext.HelpFormatter.expand_default = expand_default
- except AttributeError:
- # python < 2.4: nothing to be done
- pass
- def _unmonkeypatch_expand_default(self):
- # remove monkey patch
- if hasattr(optik_ext.HelpFormatter, 'expand_default'):
- # unpatch optik_ext to avoid side effects
- optik_ext.HelpFormatter.expand_default = self.__expand_default_backup
-
- def help(self, level=0):
- """return the usage string for available options """
- self.cmdline_parser.formatter.output_level = level
- self._monkeypatch_expand_default()
- try:
- return self.cmdline_parser.format_help()
- finally:
- self._unmonkeypatch_expand_default()
-
-
-class Method(object):
- """used to ease late binding of default method (so you can define options
- on the class using default methods on the configuration instance)
- """
- def __init__(self, methname):
- self.method = methname
- self._inst = None
-
- def bind(self, instance):
- """bind the method to its instance"""
- if self._inst is None:
- self._inst = instance
-
- def __call__(self, *args, **kwargs):
- assert self._inst, 'unbound method'
- return getattr(self._inst, self.method)(*args, **kwargs)
-
-# Options Provider #############################################################
-
-class OptionsProviderMixIn(object):
- """Mixin to provide options to an OptionsManager"""
-
- # those attributes should be overridden
- priority = -1
- name = 'default'
- options = ()
- level = 0
-
- def __init__(self):
- self.config = optik_ext.Values()
- for option in self.options:
- try:
- option, optdict = option
- except ValueError:
- raise Exception('Bad option: %r' % option)
- if isinstance(optdict.get('default'), Method):
- optdict['default'].bind(self)
- elif isinstance(optdict.get('callback'), Method):
- optdict['callback'].bind(self)
- self.load_defaults()
-
- def load_defaults(self):
- """initialize the provider using default values"""
- for opt, optdict in self.options:
- action = optdict.get('action')
- if action != 'callback':
- # callback action have no default
- default = self.option_default(opt, optdict)
- if default is REQUIRED:
- continue
- self.set_option(opt, default, action, optdict)
-
- def option_default(self, opt, optdict=None):
- """return the default value for an option"""
- if optdict is None:
- optdict = self.get_option_def(opt)
- default = optdict.get('default')
- if callable(default):
- default = default()
- return default
-
- def option_attrname(self, opt, optdict=None):
- """get the config attribute corresponding to opt
- """
- if optdict is None:
- optdict = self.get_option_def(opt)
- return optdict.get('dest', opt.replace('-', '_'))
- option_name = deprecated('[0.60] OptionsProviderMixIn.option_name() was renamed to option_attrname()')(option_attrname)
-
- def option_value(self, opt):
- """get the current value for the given option"""
- return getattr(self.config, self.option_attrname(opt), None)
-
- def set_option(self, opt, value, action=None, optdict=None):
- """method called to set an option (registered in the options list)
- """
- if optdict is None:
- optdict = self.get_option_def(opt)
- if value is not None:
- value = _validate(value, optdict, opt)
- if action is None:
- action = optdict.get('action', 'store')
- if optdict.get('type') == 'named': # XXX need specific handling
- optname = self.option_attrname(opt, optdict)
- currentvalue = getattr(self.config, optname, None)
- if currentvalue:
- currentvalue.update(value)
- value = currentvalue
- if action == 'store':
- setattr(self.config, self.option_attrname(opt, optdict), value)
- elif action in ('store_true', 'count'):
- setattr(self.config, self.option_attrname(opt, optdict), 0)
- elif action == 'store_false':
- setattr(self.config, self.option_attrname(opt, optdict), 1)
- elif action == 'append':
- opt = self.option_attrname(opt, optdict)
- _list = getattr(self.config, opt, None)
- if _list is None:
- if isinstance(value, (list, tuple)):
- _list = value
- elif value is not None:
- _list = []
- _list.append(value)
- setattr(self.config, opt, _list)
- elif isinstance(_list, tuple):
- setattr(self.config, opt, _list + (value,))
- else:
- _list.append(value)
- elif action == 'callback':
- optdict['callback'](None, opt, value, None)
- else:
- raise UnsupportedAction(action)
-
- def input_option(self, option, optdict, inputlevel=99):
- default = self.option_default(option, optdict)
- if default is REQUIRED:
- defaultstr = '(required): '
- elif optdict.get('level', 0) > inputlevel:
- return
- elif optdict['type'] == 'password' or default is None:
- defaultstr = ': '
- else:
- defaultstr = '(default: %s): ' % format_option_value(optdict, default)
- print(':%s:' % option)
- print(optdict.get('help') or option)
- inputfunc = INPUT_FUNCTIONS[optdict['type']]
- value = inputfunc(optdict, defaultstr)
- while default is REQUIRED and not value:
- print('please specify a value')
- value = inputfunc(optdict, '%s: ' % option)
- if value is None and default is not None:
- value = default
- self.set_option(option, value, optdict=optdict)
-
- def get_option_def(self, opt):
- """return the dictionary defining an option given it's name"""
- assert self.options
- for option in self.options:
- if option[0] == opt:
- return option[1]
- raise OptionError('no such option %s in section %r'
- % (opt, self.name), opt)
-
-
- def all_options(self):
- """return an iterator on available options for this provider
- option are actually described by a 3-uple:
- (section, option name, option dictionary)
- """
- for section, options in self.options_by_section():
- if section is None:
- if self.name is None:
- continue
- section = self.name.upper()
- for option, optiondict, value in options:
- yield section, option, optiondict
-
- def options_by_section(self):
- """return an iterator on options grouped by section
-
- (section, [list of (optname, optdict, optvalue)])
- """
- sections = {}
- for optname, optdict in self.options:
- sections.setdefault(optdict.get('group'), []).append(
- (optname, optdict, self.option_value(optname)))
- if None in sections:
- yield None, sections.pop(None)
- for section, options in sections.items():
- yield section.upper(), options
-
- def options_and_values(self, options=None):
- if options is None:
- options = self.options
- for optname, optdict in options:
- yield (optname, optdict, self.option_value(optname))
-
-# configuration ################################################################
-
-class ConfigurationMixIn(OptionsManagerMixIn, OptionsProviderMixIn):
- """basic mixin for simple configurations which don't need the
- manager / providers model
- """
- def __init__(self, *args, **kwargs):
- if not args:
- kwargs.setdefault('usage', '')
- kwargs.setdefault('quiet', 1)
- OptionsManagerMixIn.__init__(self, *args, **kwargs)
- OptionsProviderMixIn.__init__(self)
- if not getattr(self, 'option_groups', None):
- self.option_groups = []
- for option, optdict in self.options:
- try:
- gdef = (optdict['group'].upper(), '')
- except KeyError:
- continue
- if not gdef in self.option_groups:
- self.option_groups.append(gdef)
- self.register_options_provider(self, own_group=False)
-
- def register_options(self, options):
- """add some options to the configuration"""
- options_by_group = {}
- for optname, optdict in options:
- options_by_group.setdefault(optdict.get('group', self.name.upper()), []).append((optname, optdict))
- for group, options in options_by_group.items():
- self.add_option_group(group, None, options, self)
- self.options += tuple(options)
-
- def load_defaults(self):
- OptionsProviderMixIn.load_defaults(self)
-
- def __iter__(self):
- return iter(self.config.__dict__.iteritems())
-
- def __getitem__(self, key):
- try:
- return getattr(self.config, self.option_attrname(key))
- except (optik_ext.OptionValueError, AttributeError):
- raise KeyError(key)
-
- def __setitem__(self, key, value):
- self.set_option(key, value)
-
- def get(self, key, default=None):
- try:
- return getattr(self.config, self.option_attrname(key))
- except (OptionError, AttributeError):
- return default
-
-
-class Configuration(ConfigurationMixIn):
- """class for simple configurations which don't need the
- manager / providers model and prefer delegation to inheritance
-
- configuration values are accessible through a dict like interface
- """
-
- def __init__(self, config_file=None, options=None, name=None,
- usage=None, doc=None, version=None):
- if options is not None:
- self.options = options
- if name is not None:
- self.name = name
- if doc is not None:
- self.__doc__ = doc
- super(Configuration, self).__init__(config_file=config_file, usage=usage, version=version)
-
-
-class OptionsManager2ConfigurationAdapter(object):
- """Adapt an option manager to behave like a
- `logilab.common.configuration.Configuration` instance
- """
- def __init__(self, provider):
- self.config = provider
-
- def __getattr__(self, key):
- return getattr(self.config, key)
-
- def __getitem__(self, key):
- provider = self.config._all_options[key]
- try:
- return getattr(provider.config, provider.option_attrname(key))
- except AttributeError:
- raise KeyError(key)
-
- def __setitem__(self, key, value):
- self.config.global_set_option(self.config.option_attrname(key), value)
-
- def get(self, key, default=None):
- provider = self.config._all_options[key]
- try:
- return getattr(provider.config, provider.option_attrname(key))
- except AttributeError:
- return default
-
-# other functions ##############################################################
-
-def read_old_config(newconfig, changes, configfile):
- """initialize newconfig from a deprecated configuration file
-
- possible changes:
- * ('renamed', oldname, newname)
- * ('moved', option, oldgroup, newgroup)
- * ('typechanged', option, oldtype, newvalue)
- """
- # build an index of changes
- changesindex = {}
- for action in changes:
- if action[0] == 'moved':
- option, oldgroup, newgroup = action[1:]
- changesindex.setdefault(option, []).append((action[0], oldgroup, newgroup))
- continue
- if action[0] == 'renamed':
- oldname, newname = action[1:]
- changesindex.setdefault(newname, []).append((action[0], oldname))
- continue
- if action[0] == 'typechanged':
- option, oldtype, newvalue = action[1:]
- changesindex.setdefault(option, []).append((action[0], oldtype, newvalue))
- continue
- if action[1] in ('added', 'removed'):
- continue # nothing to do here
- raise Exception('unknown change %s' % action[0])
- # build a config object able to read the old config
- options = []
- for optname, optdef in newconfig.options:
- for action in changesindex.pop(optname, ()):
- if action[0] == 'moved':
- oldgroup, newgroup = action[1:]
- optdef = optdef.copy()
- optdef['group'] = oldgroup
- elif action[0] == 'renamed':
- optname = action[1]
- elif action[0] == 'typechanged':
- oldtype = action[1]
- optdef = optdef.copy()
- optdef['type'] = oldtype
- options.append((optname, optdef))
- if changesindex:
- raise Exception('unapplied changes: %s' % changesindex)
- oldconfig = Configuration(options=options, name=newconfig.name)
- # read the old config
- oldconfig.load_file_configuration(configfile)
- # apply values reverting changes
- changes.reverse()
- done = set()
- for action in changes:
- if action[0] == 'renamed':
- oldname, newname = action[1:]
- newconfig[newname] = oldconfig[oldname]
- done.add(newname)
- elif action[0] == 'typechanged':
- optname, oldtype, newvalue = action[1:]
- newconfig[optname] = newvalue
- done.add(optname)
- for optname, optdef in newconfig.options:
- if optdef.get('type') and not optname in done:
- newconfig.set_option(optname, oldconfig[optname], optdict=optdef)
-
-
-def merge_options(options, optgroup=None):
- """preprocess a list of options and remove duplicates, returning a new list
- (tuple actually) of options.
-
- Options dictionaries are copied to avoid later side-effect. Also, if
- `otpgroup` argument is specified, ensure all options are in the given group.
- """
- alloptions = {}
- options = list(options)
- for i in range(len(options)-1, -1, -1):
- optname, optdict = options[i]
- if optname in alloptions:
- options.pop(i)
- alloptions[optname].update(optdict)
- else:
- optdict = optdict.copy()
- options[i] = (optname, optdict)
- alloptions[optname] = optdict
- if optgroup is not None:
- alloptions[optname]['group'] = optgroup
- return tuple(options)
diff --git a/chromium/third_party/logilab/logilab/common/contexts.py b/chromium/third_party/logilab/logilab/common/contexts.py
deleted file mode 100644
index d78c3274e78..00000000000
--- a/chromium/third_party/logilab/logilab/common/contexts.py
+++ /dev/null
@@ -1,5 +0,0 @@
-from warnings import warn
-warn('logilab.common.contexts module is deprecated, use logilab.common.shellutils instead',
- DeprecationWarning, stacklevel=1)
-
-from logilab.common.shellutils import tempfile, pushd
diff --git a/chromium/third_party/logilab/logilab/common/corbautils.py b/chromium/third_party/logilab/logilab/common/corbautils.py
deleted file mode 100644
index 65c301d36fd..00000000000
--- a/chromium/third_party/logilab/logilab/common/corbautils.py
+++ /dev/null
@@ -1,117 +0,0 @@
-# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""A set of utility function to ease the use of OmniORBpy.
-
-
-
-
-"""
-__docformat__ = "restructuredtext en"
-
-from omniORB import CORBA, PortableServer
-import CosNaming
-
-orb = None
-
-def get_orb():
- """
- returns a reference to the ORB.
- The first call to the method initialized the ORB
- This method is mainly used internally in the module.
- """
-
- global orb
- if orb is None:
- import sys
- orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
- return orb
-
-def get_root_context():
- """
- returns a reference to the NameService object.
- This method is mainly used internally in the module.
- """
-
- orb = get_orb()
- nss = orb.resolve_initial_references("NameService")
- rootContext = nss._narrow(CosNaming.NamingContext)
- assert rootContext is not None, "Failed to narrow root naming context"
- return rootContext
-
-def register_object_name(object, namepath):
- """
- Registers a object in the NamingService.
- The name path is a list of 2-uples (id,kind) giving the path.
-
- For instance if the path of an object is [('foo',''),('bar','')],
- it is possible to get a reference to the object using the URL
- 'corbaname::hostname#foo/bar'.
- [('logilab','rootmodule'),('chatbot','application'),('chatter','server')]
- is mapped to
- 'corbaname::hostname#logilab.rootmodule/chatbot.application/chatter.server'
-
- The get_object_reference() function can be used to resolve such a URL.
- """
- context = get_root_context()
- for id, kind in namepath[:-1]:
- name = [CosNaming.NameComponent(id, kind)]
- try:
- context = context.bind_new_context(name)
- except CosNaming.NamingContext.AlreadyBound as ex:
- context = context.resolve(name)._narrow(CosNaming.NamingContext)
- assert context is not None, \
- 'test context exists but is not a NamingContext'
-
- id, kind = namepath[-1]
- name = [CosNaming.NameComponent(id, kind)]
- try:
- context.bind(name, object._this())
- except CosNaming.NamingContext.AlreadyBound as ex:
- context.rebind(name, object._this())
-
-def activate_POA():
- """
- This methods activates the Portable Object Adapter.
- You need to call it to enable the reception of messages in your code,
- on both the client and the server.
- """
- orb = get_orb()
- poa = orb.resolve_initial_references('RootPOA')
- poaManager = poa._get_the_POAManager()
- poaManager.activate()
-
-def run_orb():
- """
- Enters the ORB mainloop on the server.
- You should not call this method on the client.
- """
- get_orb().run()
-
-def get_object_reference(url):
- """
- Resolves a corbaname URL to an object proxy.
- See register_object_name() for examples URLs
- """
- return get_orb().string_to_object(url)
-
-def get_object_string(host, namepath):
- """given an host name and a name path as described in register_object_name,
- return a corba string identifier
- """
- strname = '/'.join(['.'.join(path_elt) for path_elt in namepath])
- return 'corbaname::%s#%s' % (host, strname)
diff --git a/chromium/third_party/logilab/logilab/common/daemon.py b/chromium/third_party/logilab/logilab/common/daemon.py
deleted file mode 100644
index 40319a43a7c..00000000000
--- a/chromium/third_party/logilab/logilab/common/daemon.py
+++ /dev/null
@@ -1,101 +0,0 @@
-# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""A daemonize function (for Unices)"""
-
-__docformat__ = "restructuredtext en"
-
-import os
-import errno
-import signal
-import sys
-import time
-import warnings
-
-from six.moves import range
-
-def setugid(user):
- """Change process user and group ID
-
- Argument is a numeric user id or a user name"""
- try:
- from pwd import getpwuid
- passwd = getpwuid(int(user))
- except ValueError:
- from pwd import getpwnam
- passwd = getpwnam(user)
-
- if hasattr(os, 'initgroups'): # python >= 2.7
- os.initgroups(passwd.pw_name, passwd.pw_gid)
- else:
- import ctypes
- if ctypes.CDLL(None).initgroups(passwd.pw_name, passwd.pw_gid) < 0:
- err = ctypes.c_int.in_dll(ctypes.pythonapi,"errno").value
- raise OSError(err, os.strerror(err), 'initgroups')
- os.setgid(passwd.pw_gid)
- os.setuid(passwd.pw_uid)
- os.environ['HOME'] = passwd.pw_dir
-
-
-def daemonize(pidfile=None, uid=None, umask=0o77):
- """daemonize a Unix process. Set paranoid umask by default.
-
- Return 1 in the original process, 2 in the first fork, and None for the
- second fork (eg daemon process).
- """
- # http://www.faqs.org/faqs/unix-faq/programmer/faq/
- #
- # fork so the parent can exit
- if os.fork(): # launch child and...
- return 1
- # disconnect from tty and create a new session
- os.setsid()
- # fork again so the parent, (the session group leader), can exit.
- # as a non-session group leader, we can never regain a controlling
- # terminal.
- if os.fork(): # launch child again.
- return 2
- # move to the root to avoit mount pb
- os.chdir('/')
- # redirect standard descriptors
- null = os.open('/dev/null', os.O_RDWR)
- for i in range(3):
- try:
- os.dup2(null, i)
- except OSError as e:
- if e.errno != errno.EBADF:
- raise
- os.close(null)
- # filter warnings
- warnings.filterwarnings('ignore')
- # write pid in a file
- if pidfile:
- # ensure the directory where the pid-file should be set exists (for
- # instance /var/run/cubicweb may be deleted on computer restart)
- piddir = os.path.dirname(pidfile)
- if not os.path.exists(piddir):
- os.makedirs(piddir)
- f = file(pidfile, 'w')
- f.write(str(os.getpid()))
- f.close()
- # set umask if specified
- if umask is not None:
- os.umask(umask)
- # change process uid
- if uid:
- setugid(uid)
- return None
diff --git a/chromium/third_party/logilab/logilab/common/date.py b/chromium/third_party/logilab/logilab/common/date.py
deleted file mode 100644
index a093a8a9bbc..00000000000
--- a/chromium/third_party/logilab/logilab/common/date.py
+++ /dev/null
@@ -1,335 +0,0 @@
-# copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""Date manipulation helper functions."""
-from __future__ import division
-
-__docformat__ = "restructuredtext en"
-
-import math
-import re
-import sys
-from locale import getlocale, LC_TIME
-from datetime import date, time, datetime, timedelta
-from time import strptime as time_strptime
-from calendar import monthrange, timegm
-
-from six.moves import range
-
-try:
- from mx.DateTime import RelativeDateTime, Date, DateTimeType
-except ImportError:
- endOfMonth = None
- DateTimeType = datetime
-else:
- endOfMonth = RelativeDateTime(months=1, day=-1)
-
-# NOTE: should we implement a compatibility layer between date representations
-# as we have in lgc.db ?
-
-FRENCH_FIXED_HOLIDAYS = {
- 'jour_an': '%s-01-01',
- 'fete_travail': '%s-05-01',
- 'armistice1945': '%s-05-08',
- 'fete_nat': '%s-07-14',
- 'assomption': '%s-08-15',
- 'toussaint': '%s-11-01',
- 'armistice1918': '%s-11-11',
- 'noel': '%s-12-25',
- }
-
-FRENCH_MOBILE_HOLIDAYS = {
- 'paques2004': '2004-04-12',
- 'ascension2004': '2004-05-20',
- 'pentecote2004': '2004-05-31',
-
- 'paques2005': '2005-03-28',
- 'ascension2005': '2005-05-05',
- 'pentecote2005': '2005-05-16',
-
- 'paques2006': '2006-04-17',
- 'ascension2006': '2006-05-25',
- 'pentecote2006': '2006-06-05',
-
- 'paques2007': '2007-04-09',
- 'ascension2007': '2007-05-17',
- 'pentecote2007': '2007-05-28',
-
- 'paques2008': '2008-03-24',
- 'ascension2008': '2008-05-01',
- 'pentecote2008': '2008-05-12',
-
- 'paques2009': '2009-04-13',
- 'ascension2009': '2009-05-21',
- 'pentecote2009': '2009-06-01',
-
- 'paques2010': '2010-04-05',
- 'ascension2010': '2010-05-13',
- 'pentecote2010': '2010-05-24',
-
- 'paques2011': '2011-04-25',
- 'ascension2011': '2011-06-02',
- 'pentecote2011': '2011-06-13',
-
- 'paques2012': '2012-04-09',
- 'ascension2012': '2012-05-17',
- 'pentecote2012': '2012-05-28',
- }
-
-# XXX this implementation cries for multimethod dispatching
-
-def get_step(dateobj, nbdays=1):
- # assume date is either a python datetime or a mx.DateTime object
- if isinstance(dateobj, date):
- return ONEDAY * nbdays
- return nbdays # mx.DateTime is ok with integers
-
-def datefactory(year, month, day, sampledate):
- # assume date is either a python datetime or a mx.DateTime object
- if isinstance(sampledate, datetime):
- return datetime(year, month, day)
- if isinstance(sampledate, date):
- return date(year, month, day)
- return Date(year, month, day)
-
-def weekday(dateobj):
- # assume date is either a python datetime or a mx.DateTime object
- if isinstance(dateobj, date):
- return dateobj.weekday()
- return dateobj.day_of_week
-
-def str2date(datestr, sampledate):
- # NOTE: datetime.strptime is not an option until we drop py2.4 compat
- year, month, day = [int(chunk) for chunk in datestr.split('-')]
- return datefactory(year, month, day, sampledate)
-
-def days_between(start, end):
- if isinstance(start, date):
- delta = end - start
- # datetime.timedelta.days is always an integer (floored)
- if delta.seconds:
- return delta.days + 1
- return delta.days
- else:
- return int(math.ceil((end - start).days))
-
-def get_national_holidays(begin, end):
- """return french national days off between begin and end"""
- begin = datefactory(begin.year, begin.month, begin.day, begin)
- end = datefactory(end.year, end.month, end.day, end)
- holidays = [str2date(datestr, begin)
- for datestr in FRENCH_MOBILE_HOLIDAYS.values()]
- for year in range(begin.year, end.year+1):
- for datestr in FRENCH_FIXED_HOLIDAYS.values():
- date = str2date(datestr % year, begin)
- if date not in holidays:
- holidays.append(date)
- return [day for day in holidays if begin <= day < end]
-
-def add_days_worked(start, days):
- """adds date but try to only take days worked into account"""
- step = get_step(start)
- weeks, plus = divmod(days, 5)
- end = start + ((weeks * 7) + plus) * step
- if weekday(end) >= 5: # saturday or sunday
- end += (2 * step)
- end += len([x for x in get_national_holidays(start, end + step)
- if weekday(x) < 5]) * step
- if weekday(end) >= 5: # saturday or sunday
- end += (2 * step)
- return end
-
-def nb_open_days(start, end):
- assert start <= end
- step = get_step(start)
- days = days_between(start, end)
- weeks, plus = divmod(days, 7)
- if weekday(start) > weekday(end):
- plus -= 2
- elif weekday(end) == 6:
- plus -= 1
- open_days = weeks * 5 + plus
- nb_week_holidays = len([x for x in get_national_holidays(start, end+step)
- if weekday(x) < 5 and x < end])
- open_days -= nb_week_holidays
- if open_days < 0:
- return 0
- return open_days
-
-def date_range(begin, end, incday=None, incmonth=None):
- """yields each date between begin and end
-
- :param begin: the start date
- :param end: the end date
- :param incr: the step to use to iterate over dates. Default is
- one day.
- :param include: None (means no exclusion) or a function taking a
- date as parameter, and returning True if the date
- should be included.
-
- When using mx datetime, you should *NOT* use incmonth argument, use instead
- oneDay, oneHour, oneMinute, oneSecond, oneWeek or endOfMonth (to enumerate
- months) as `incday` argument
- """
- assert not (incday and incmonth)
- begin = todate(begin)
- end = todate(end)
- if incmonth:
- while begin < end:
- yield begin
- begin = next_month(begin, incmonth)
- else:
- incr = get_step(begin, incday or 1)
- while begin < end:
- yield begin
- begin += incr
-
-# makes py datetime usable #####################################################
-
-ONEDAY = timedelta(days=1)
-ONEWEEK = timedelta(days=7)
-
-try:
- strptime = datetime.strptime
-except AttributeError: # py < 2.5
- from time import strptime as time_strptime
- def strptime(value, format):
- return datetime(*time_strptime(value, format)[:6])
-
-def strptime_time(value, format='%H:%M'):
- return time(*time_strptime(value, format)[3:6])
-
-def todate(somedate):
- """return a date from a date (leaving unchanged) or a datetime"""
- if isinstance(somedate, datetime):
- return date(somedate.year, somedate.month, somedate.day)
- assert isinstance(somedate, (date, DateTimeType)), repr(somedate)
- return somedate
-
-def totime(somedate):
- """return a time from a time (leaving unchanged), date or datetime"""
- # XXX mx compat
- if not isinstance(somedate, time):
- return time(somedate.hour, somedate.minute, somedate.second)
- assert isinstance(somedate, (time)), repr(somedate)
- return somedate
-
-def todatetime(somedate):
- """return a date from a date (leaving unchanged) or a datetime"""
- # take care, datetime is a subclass of date
- if isinstance(somedate, datetime):
- return somedate
- assert isinstance(somedate, (date, DateTimeType)), repr(somedate)
- return datetime(somedate.year, somedate.month, somedate.day)
-
-def datetime2ticks(somedate):
- return timegm(somedate.timetuple()) * 1000
-
-def ticks2datetime(ticks):
- miliseconds, microseconds = divmod(ticks, 1000)
- try:
- return datetime.fromtimestamp(miliseconds)
- except (ValueError, OverflowError):
- epoch = datetime.fromtimestamp(0)
- nb_days, seconds = divmod(int(miliseconds), 86400)
- delta = timedelta(nb_days, seconds=seconds, microseconds=microseconds)
- try:
- return epoch + delta
- except (ValueError, OverflowError):
- raise
-
-def days_in_month(somedate):
- return monthrange(somedate.year, somedate.month)[1]
-
-def days_in_year(somedate):
- feb = date(somedate.year, 2, 1)
- if days_in_month(feb) == 29:
- return 366
- else:
- return 365
-
-def previous_month(somedate, nbmonth=1):
- while nbmonth:
- somedate = first_day(somedate) - ONEDAY
- nbmonth -= 1
- return somedate
-
-def next_month(somedate, nbmonth=1):
- while nbmonth:
- somedate = last_day(somedate) + ONEDAY
- nbmonth -= 1
- return somedate
-
-def first_day(somedate):
- return date(somedate.year, somedate.month, 1)
-
-def last_day(somedate):
- return date(somedate.year, somedate.month, days_in_month(somedate))
-
-def ustrftime(somedate, fmt='%Y-%m-%d'):
- """like strftime, but returns a unicode string instead of an encoded
- string which may be problematic with localized date.
- """
- if sys.version_info >= (3, 3):
- # datetime.date.strftime() supports dates since year 1 in Python >=3.3.
- return somedate.strftime(fmt)
- else:
- try:
- if sys.version_info < (3, 0):
- encoding = getlocale(LC_TIME)[1] or 'ascii'
- return unicode(somedate.strftime(str(fmt)), encoding)
- else:
- return somedate.strftime(fmt)
- except ValueError:
- if somedate.year >= 1900:
- raise
- # datetime is not happy with dates before 1900
- # we try to work around this, assuming a simple
- # format string
- fields = {'Y': somedate.year,
- 'm': somedate.month,
- 'd': somedate.day,
- }
- if isinstance(somedate, datetime):
- fields.update({'H': somedate.hour,
- 'M': somedate.minute,
- 'S': somedate.second})
- fmt = re.sub('%([YmdHMS])', r'%(\1)02d', fmt)
- return unicode(fmt) % fields
-
-def utcdatetime(dt):
- if dt.tzinfo is None:
- return dt
- return (dt.replace(tzinfo=None) - dt.utcoffset())
-
-def utctime(dt):
- if dt.tzinfo is None:
- return dt
- return (dt + dt.utcoffset() + dt.dst()).replace(tzinfo=None)
-
-def datetime_to_seconds(date):
- """return the number of seconds since the begining of the day for that date
- """
- return date.second+60*date.minute + 3600*date.hour
-
-def timedelta_to_days(delta):
- """return the time delta as a number of seconds"""
- return delta.days + delta.seconds / (3600*24)
-
-def timedelta_to_seconds(delta):
- """return the time delta as a fraction of days"""
- return delta.days*(3600*24) + delta.seconds
diff --git a/chromium/third_party/logilab/logilab/common/dbf.py b/chromium/third_party/logilab/logilab/common/dbf.py
deleted file mode 100644
index ab142b23cfc..00000000000
--- a/chromium/third_party/logilab/logilab/common/dbf.py
+++ /dev/null
@@ -1,231 +0,0 @@
-# -*- coding: utf-8 -*-
-# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""This is a DBF reader which reads Visual Fox Pro DBF format with Memo field
-
-Usage:
-
->>> rec = readDbf('test.dbf')
->>> for line in rec:
->>> print line['name']
-
-
-:date: 13/07/2007
-
-http://www.physics.ox.ac.uk/users/santoso/Software.Repository.html
-page says code is "available as is without any warranty or support".
-"""
-from __future__ import print_function
-
-import struct
-import os, os.path
-import sys
-import csv
-import tempfile
-
-from six.moves import range
-
-class Dbase:
- def __init__(self):
- self.fdb = None
- self.fmemo = None
- self.db_data = None
- self.memo_data = None
- self.fields = None
- self.num_records = 0
- self.header = None
- self.memo_file = ''
- self.memo_header = None
- self.memo_block_size = 0
- self.memo_header_len = 0
-
- def _drop_after_NULL(self, txt):
- for i in range(0, len(txt)):
- if ord(struct.unpack('c', txt[i])[0])==0:
- return txt[:i]
- return txt
-
- def _reverse_endian(self, num):
- if not len(num):
- return 0
- val = struct.unpack('<L', num)
- val = struct.pack('>L', val[0])
- val = struct.unpack('>L', val)
- return val[0]
-
- def _assign_ids(self, lst, ids):
- result = {}
- idx = 0
- for item in lst:
- id = ids[idx]
- result[id] = item
- idx += 1
- return result
-
- def open(self, db_name):
- filesize = os.path.getsize(db_name)
- if filesize <= 68:
- raise IOError('The file is not large enough to be a dbf file')
-
- self.fdb = open(db_name, 'rb')
-
- self.memo_file = ''
- if os.path.isfile(db_name[0:-1] + 't'):
- self.memo_file = db_name[0:-1] + 't'
- elif os.path.isfile(db_name[0:-3] + 'fpt'):
- self.memo_file = db_name[0:-3] + 'fpt'
-
- if self.memo_file:
- #Read memo file
- self.fmemo = open(self.memo_file, 'rb')
- self.memo_data = self.fmemo.read()
- self.memo_header = self._assign_ids(struct.unpack('>6x1H', self.memo_data[:8]), ['Block size'])
- block_size = self.memo_header['Block size']
- if not block_size:
- block_size = 512
- self.memo_block_size = block_size
- self.memo_header_len = block_size
- memo_size = os.path.getsize(self.memo_file)
-
- #Start reading data file
- data = self.fdb.read(32)
- self.header = self._assign_ids(struct.unpack('<B 3B L 2H 20x', data), ['id', 'Year', 'Month', 'Day', '# of Records', 'Header Size', 'Record Size'])
- self.header['id'] = hex(self.header['id'])
-
- self.num_records = self.header['# of Records']
- data = self.fdb.read(self.header['Header Size']-34)
- self.fields = {}
- x = 0
- header_pattern = '<11s c 4x B B 14x'
- ids = ['Field Name', 'Field Type', 'Field Length', 'Field Precision']
- pattern_len = 32
- for offset in range(0, len(data), 32):
- if ord(data[offset])==0x0d:
- break
- x += 1
- data_subset = data[offset: offset+pattern_len]
- if len(data_subset) < pattern_len:
- data_subset += ' '*(pattern_len-len(data_subset))
- self.fields[x] = self._assign_ids(struct.unpack(header_pattern, data_subset), ids)
- self.fields[x]['Field Name'] = self._drop_after_NULL(self.fields[x]['Field Name'])
-
- self.fdb.read(3)
- if self.header['# of Records']:
- data_size = (self.header['# of Records'] * self.header['Record Size']) - 1
- self.db_data = self.fdb.read(data_size)
- else:
- self.db_data = ''
- self.row_format = '<'
- self.row_ids = []
- self.row_len = 0
- for key in self.fields:
- field = self.fields[key]
- self.row_format += '%ds ' % (field['Field Length'])
- self.row_ids.append(field['Field Name'])
- self.row_len += field['Field Length']
-
- def close(self):
- if self.fdb:
- self.fdb.close()
- if self.fmemo:
- self.fmemo.close()
-
- def get_numrecords(self):
- return self.num_records
-
- def get_record_with_names(self, rec_no):
- """
- This function accept record number from 0 to N-1
- """
- if rec_no < 0 or rec_no > self.num_records:
- raise Exception('Unable to extract data outside the range')
-
- offset = self.header['Record Size'] * rec_no
- data = self.db_data[offset:offset+self.row_len]
- record = self._assign_ids(struct.unpack(self.row_format, data), self.row_ids)
-
- if self.memo_file:
- for key in self.fields:
- field = self.fields[key]
- f_type = field['Field Type']
- f_name = field['Field Name']
- c_data = record[f_name]
-
- if f_type=='M' or f_type=='G' or f_type=='B' or f_type=='P':
- c_data = self._reverse_endian(c_data)
- if c_data:
- record[f_name] = self.read_memo(c_data-1).strip()
- else:
- record[f_name] = c_data.strip()
- return record
-
- def read_memo_record(self, num, in_length):
- """
- Read the record of given number. The second parameter is the length of
- the record to read. It can be undefined, meaning read the whole record,
- and it can be negative, meaning at most the length
- """
- if in_length < 0:
- in_length = -self.memo_block_size
-
- offset = self.memo_header_len + num * self.memo_block_size
- self.fmemo.seek(offset)
- if in_length<0:
- in_length = -in_length
- if in_length==0:
- return ''
- return self.fmemo.read(in_length)
-
- def read_memo(self, num):
- result = ''
- buffer = self.read_memo_record(num, -1)
- if len(buffer)<=0:
- return ''
- length = struct.unpack('>L', buffer[4:4+4])[0] + 8
-
- block_size = self.memo_block_size
- if length < block_size:
- return buffer[8:length]
- rest_length = length - block_size
- rest_data = self.read_memo_record(num+1, rest_length)
- if len(rest_data)<=0:
- return ''
- return buffer[8:] + rest_data
-
-def readDbf(filename):
- """
- Read the DBF file specified by the filename and
- return the records as a list of dictionary.
-
- :param: filename File name of the DBF
- :return: List of rows
- """
- db = Dbase()
- db.open(filename)
- num = db.get_numrecords()
- rec = []
- for i in range(0, num):
- record = db.get_record_with_names(i)
- rec.append(record)
- db.close()
- return rec
-
-if __name__=='__main__':
- rec = readDbf('dbf/sptable.dbf')
- for line in rec:
- print('%s %s' % (line['GENUS'].strip(), line['SPECIES'].strip()))
diff --git a/chromium/third_party/logilab/logilab/common/debugger.py b/chromium/third_party/logilab/logilab/common/debugger.py
deleted file mode 100644
index 1f540a18982..00000000000
--- a/chromium/third_party/logilab/logilab/common/debugger.py
+++ /dev/null
@@ -1,214 +0,0 @@
-# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""Customized version of pdb's default debugger.
-
-- sets up a history file
-- uses ipython if available to colorize lines of code
-- overrides list command to search for current block instead
- of using 5 lines of context
-
-
-
-
-"""
-
-from __future__ import print_function
-
-__docformat__ = "restructuredtext en"
-
-try:
- import readline
-except ImportError:
- readline = None
-import os
-import os.path as osp
-import sys
-from pdb import Pdb
-import inspect
-
-from logilab.common.compat import StringIO
-
-try:
- from IPython import PyColorize
-except ImportError:
- def colorize(source, *args):
- """fallback colorize function"""
- return source
- def colorize_source(source, *args):
- return source
-else:
- def colorize(source, start_lineno, curlineno):
- """colorize and annotate source with linenos
- (as in pdb's list command)
- """
- parser = PyColorize.Parser()
- output = StringIO()
- parser.format(source, output)
- annotated = []
- for index, line in enumerate(output.getvalue().splitlines()):
- lineno = index + start_lineno
- if lineno == curlineno:
- annotated.append('%4s\t->\t%s' % (lineno, line))
- else:
- annotated.append('%4s\t\t%s' % (lineno, line))
- return '\n'.join(annotated)
-
- def colorize_source(source):
- """colorize given source"""
- parser = PyColorize.Parser()
- output = StringIO()
- parser.format(source, output)
- return output.getvalue()
-
-
-def getsource(obj):
- """Return the text of the source code for an object.
-
- The argument may be a module, class, method, function, traceback, frame,
- or code object. The source code is returned as a single string. An
- IOError is raised if the source code cannot be retrieved."""
- lines, lnum = inspect.getsourcelines(obj)
- return ''.join(lines), lnum
-
-
-################################################################
-class Debugger(Pdb):
- """custom debugger
-
- - sets up a history file
- - uses ipython if available to colorize lines of code
- - overrides list command to search for current block instead
- of using 5 lines of context
- """
- def __init__(self, tcbk=None):
- Pdb.__init__(self)
- self.reset()
- if tcbk:
- while tcbk.tb_next is not None:
- tcbk = tcbk.tb_next
- self._tcbk = tcbk
- self._histfile = os.path.expanduser("~/.pdbhist")
-
- def setup_history_file(self):
- """if readline is available, read pdb history file
- """
- if readline is not None:
- try:
- # XXX try..except shouldn't be necessary
- # read_history_file() can accept None
- readline.read_history_file(self._histfile)
- except IOError:
- pass
-
- def start(self):
- """starts the interactive mode"""
- self.interaction(self._tcbk.tb_frame, self._tcbk)
-
- def setup(self, frame, tcbk):
- """setup hook: set up history file"""
- self.setup_history_file()
- Pdb.setup(self, frame, tcbk)
-
- def set_quit(self):
- """quit hook: save commands in the history file"""
- if readline is not None:
- readline.write_history_file(self._histfile)
- Pdb.set_quit(self)
-
- def complete_p(self, text, line, begin_idx, end_idx):
- """provide variable names completion for the ``p`` command"""
- namespace = dict(self.curframe.f_globals)
- namespace.update(self.curframe.f_locals)
- if '.' in text:
- return self.attr_matches(text, namespace)
- return [varname for varname in namespace if varname.startswith(text)]
-
-
- def attr_matches(self, text, namespace):
- """implementation coming from rlcompleter.Completer.attr_matches
- Compute matches when text contains a dot.
-
- Assuming the text is of the form NAME.NAME....[NAME], and is
- evaluatable in self.namespace, it will be evaluated and its attributes
- (as revealed by dir()) are used as possible completions. (For class
- instances, class members are also considered.)
-
- WARNING: this can still invoke arbitrary C code, if an object
- with a __getattr__ hook is evaluated.
-
- """
- import re
- m = re.match(r"(\w+(\.\w+)*)\.(\w*)", text)
- if not m:
- return
- expr, attr = m.group(1, 3)
- object = eval(expr, namespace)
- words = dir(object)
- if hasattr(object, '__class__'):
- words.append('__class__')
- words = words + self.get_class_members(object.__class__)
- matches = []
- n = len(attr)
- for word in words:
- if word[:n] == attr and word != "__builtins__":
- matches.append("%s.%s" % (expr, word))
- return matches
-
- def get_class_members(self, klass):
- """implementation coming from rlcompleter.get_class_members"""
- ret = dir(klass)
- if hasattr(klass, '__bases__'):
- for base in klass.__bases__:
- ret = ret + self.get_class_members(base)
- return ret
-
- ## specific / overridden commands
- def do_list(self, arg):
- """overrides default list command to display the surrounding block
- instead of 5 lines of context
- """
- self.lastcmd = 'list'
- if not arg:
- try:
- source, start_lineno = getsource(self.curframe)
- print(colorize(''.join(source), start_lineno,
- self.curframe.f_lineno))
- except KeyboardInterrupt:
- pass
- except IOError:
- Pdb.do_list(self, arg)
- else:
- Pdb.do_list(self, arg)
- do_l = do_list
-
- def do_open(self, arg):
- """opens source file corresponding to the current stack level"""
- filename = self.curframe.f_code.co_filename
- lineno = self.curframe.f_lineno
- cmd = 'emacsclient --no-wait +%s %s' % (lineno, filename)
- os.system(cmd)
-
- do_o = do_open
-
-def pm():
- """use our custom debugger"""
- dbg = Debugger(sys.last_traceback)
- dbg.start()
-
-def set_trace():
- Debugger().set_trace(sys._getframe().f_back)
diff --git a/chromium/third_party/logilab/logilab/common/decorators.py b/chromium/third_party/logilab/logilab/common/decorators.py
deleted file mode 100644
index beafa202204..00000000000
--- a/chromium/third_party/logilab/logilab/common/decorators.py
+++ /dev/null
@@ -1,281 +0,0 @@
-# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-""" A few useful function/method decorators. """
-
-from __future__ import print_function
-
-__docformat__ = "restructuredtext en"
-
-import sys
-import types
-from time import clock, time
-from inspect import isgeneratorfunction, getargspec
-
-from logilab.common.compat import method_type
-
-# XXX rewrite so we can use the decorator syntax when keyarg has to be specified
-
-class cached_decorator(object):
- def __init__(self, cacheattr=None, keyarg=None):
- self.cacheattr = cacheattr
- self.keyarg = keyarg
- def __call__(self, callableobj=None):
- assert not isgeneratorfunction(callableobj), \
- 'cannot cache generator function: %s' % callableobj
- if len(getargspec(callableobj).args) == 1 or self.keyarg == 0:
- cache = _SingleValueCache(callableobj, self.cacheattr)
- elif self.keyarg:
- cache = _MultiValuesKeyArgCache(callableobj, self.keyarg, self.cacheattr)
- else:
- cache = _MultiValuesCache(callableobj, self.cacheattr)
- return cache.closure()
-
-class _SingleValueCache(object):
- def __init__(self, callableobj, cacheattr=None):
- self.callable = callableobj
- if cacheattr is None:
- self.cacheattr = '_%s_cache_' % callableobj.__name__
- else:
- assert cacheattr != callableobj.__name__
- self.cacheattr = cacheattr
-
- def __call__(__me, self, *args):
- try:
- return self.__dict__[__me.cacheattr]
- except KeyError:
- value = __me.callable(self, *args)
- setattr(self, __me.cacheattr, value)
- return value
-
- def closure(self):
- def wrapped(*args, **kwargs):
- return self.__call__(*args, **kwargs)
- wrapped.cache_obj = self
- try:
- wrapped.__doc__ = self.callable.__doc__
- wrapped.__name__ = self.callable.__name__
- except:
- pass
- return wrapped
-
- def clear(self, holder):
- holder.__dict__.pop(self.cacheattr, None)
-
-
-class _MultiValuesCache(_SingleValueCache):
- def _get_cache(self, holder):
- try:
- _cache = holder.__dict__[self.cacheattr]
- except KeyError:
- _cache = {}
- setattr(holder, self.cacheattr, _cache)
- return _cache
-
- def __call__(__me, self, *args, **kwargs):
- _cache = __me._get_cache(self)
- try:
- return _cache[args]
- except KeyError:
- _cache[args] = __me.callable(self, *args)
- return _cache[args]
-
-class _MultiValuesKeyArgCache(_MultiValuesCache):
- def __init__(self, callableobj, keyarg, cacheattr=None):
- super(_MultiValuesKeyArgCache, self).__init__(callableobj, cacheattr)
- self.keyarg = keyarg
-
- def __call__(__me, self, *args, **kwargs):
- _cache = __me._get_cache(self)
- key = args[__me.keyarg-1]
- try:
- return _cache[key]
- except KeyError:
- _cache[key] = __me.callable(self, *args, **kwargs)
- return _cache[key]
-
-
-def cached(callableobj=None, keyarg=None, **kwargs):
- """Simple decorator to cache result of method call."""
- kwargs['keyarg'] = keyarg
- decorator = cached_decorator(**kwargs)
- if callableobj is None:
- return decorator
- else:
- return decorator(callableobj)
-
-
-class cachedproperty(object):
- """ Provides a cached property equivalent to the stacking of
- @cached and @property, but more efficient.
-
- After first usage, the <property_name> becomes part of the object's
- __dict__. Doing:
-
- del obj.<property_name> empties the cache.
-
- Idea taken from the pyramid_ framework and the mercurial_ project.
-
- .. _pyramid: http://pypi.python.org/pypi/pyramid
- .. _mercurial: http://pypi.python.org/pypi/Mercurial
- """
- __slots__ = ('wrapped',)
-
- def __init__(self, wrapped):
- try:
- wrapped.__name__
- except AttributeError:
- raise TypeError('%s must have a __name__ attribute' %
- wrapped)
- self.wrapped = wrapped
-
- @property
- def __doc__(self):
- doc = getattr(self.wrapped, '__doc__', None)
- return ('<wrapped by the cachedproperty decorator>%s'
- % ('\n%s' % doc if doc else ''))
-
- def __get__(self, inst, objtype=None):
- if inst is None:
- return self
- val = self.wrapped(inst)
- setattr(inst, self.wrapped.__name__, val)
- return val
-
-
-def get_cache_impl(obj, funcname):
- cls = obj.__class__
- member = getattr(cls, funcname)
- if isinstance(member, property):
- member = member.fget
- return member.cache_obj
-
-def clear_cache(obj, funcname):
- """Clear a cache handled by the :func:`cached` decorator. If 'x' class has
- @cached on its method `foo`, type
-
- >>> clear_cache(x, 'foo')
-
- to purge this method's cache on the instance.
- """
- get_cache_impl(obj, funcname).clear(obj)
-
-def copy_cache(obj, funcname, cacheobj):
- """Copy cache for <funcname> from cacheobj to obj."""
- cacheattr = get_cache_impl(obj, funcname).cacheattr
- try:
- setattr(obj, cacheattr, cacheobj.__dict__[cacheattr])
- except KeyError:
- pass
-
-
-class wproperty(object):
- """Simple descriptor expecting to take a modifier function as first argument
- and looking for a _<function name> to retrieve the attribute.
- """
- def __init__(self, setfunc):
- self.setfunc = setfunc
- self.attrname = '_%s' % setfunc.__name__
-
- def __set__(self, obj, value):
- self.setfunc(obj, value)
-
- def __get__(self, obj, cls):
- assert obj is not None
- return getattr(obj, self.attrname)
-
-
-class classproperty(object):
- """this is a simple property-like class but for class attributes.
- """
- def __init__(self, get):
- self.get = get
- def __get__(self, inst, cls):
- return self.get(cls)
-
-
-class iclassmethod(object):
- '''Descriptor for method which should be available as class method if called
- on the class or instance method if called on an instance.
- '''
- def __init__(self, func):
- self.func = func
- def __get__(self, instance, objtype):
- if instance is None:
- return method_type(self.func, objtype, objtype.__class__)
- return method_type(self.func, instance, objtype)
- def __set__(self, instance, value):
- raise AttributeError("can't set attribute")
-
-
-def timed(f):
- def wrap(*args, **kwargs):
- t = time()
- c = clock()
- res = f(*args, **kwargs)
- print('%s clock: %.9f / time: %.9f' % (f.__name__,
- clock() - c, time() - t))
- return res
- return wrap
-
-
-def locked(acquire, release):
- """Decorator taking two methods to acquire/release a lock as argument,
- returning a decorator function which will call the inner method after
- having called acquire(self) et will call release(self) afterwards.
- """
- def decorator(f):
- def wrapper(self, *args, **kwargs):
- acquire(self)
- try:
- return f(self, *args, **kwargs)
- finally:
- release(self)
- return wrapper
- return decorator
-
-
-def monkeypatch(klass, methodname=None):
- """Decorator extending class with the decorated callable. This is basically
- a syntactic sugar vs class assignment.
-
- >>> class A:
- ... pass
- >>> @monkeypatch(A)
- ... def meth(self):
- ... return 12
- ...
- >>> a = A()
- >>> a.meth()
- 12
- >>> @monkeypatch(A, 'foo')
- ... def meth(self):
- ... return 12
- ...
- >>> a.foo()
- 12
- """
- def decorator(func):
- try:
- name = methodname or func.__name__
- except AttributeError:
- raise AttributeError('%s has no __name__ attribute: '
- 'you should provide an explicit `methodname`'
- % func)
- setattr(klass, name, func)
- return func
- return decorator
diff --git a/chromium/third_party/logilab/logilab/common/deprecation.py b/chromium/third_party/logilab/logilab/common/deprecation.py
deleted file mode 100644
index 1c81b6385d0..00000000000
--- a/chromium/third_party/logilab/logilab/common/deprecation.py
+++ /dev/null
@@ -1,189 +0,0 @@
-# copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""Deprecation utilities."""
-
-__docformat__ = "restructuredtext en"
-
-import sys
-from warnings import warn
-
-from logilab.common.changelog import Version
-
-
-class DeprecationWrapper(object):
- """proxy to print a warning on access to any attribute of the wrapped object
- """
- def __init__(self, proxied, msg=None):
- self._proxied = proxied
- self._msg = msg
-
- def __getattr__(self, attr):
- warn(self._msg, DeprecationWarning, stacklevel=2)
- return getattr(self._proxied, attr)
-
- def __setattr__(self, attr, value):
- if attr in ('_proxied', '_msg'):
- self.__dict__[attr] = value
- else:
- warn(self._msg, DeprecationWarning, stacklevel=2)
- setattr(self._proxied, attr, value)
-
-
-class DeprecationManager(object):
- """Manage the deprecation message handling. Messages are dropped for
- versions more recent than the 'compatible' version. Example::
-
- deprecator = deprecation.DeprecationManager("module_name")
- deprecator.compatibility('1.3')
-
- deprecator.warn('1.2', "message.")
-
- @deprecator.deprecated('1.2', 'Message')
- def any_func():
- pass
-
- class AnyClass(object):
- __metaclass__ = deprecator.class_deprecated('1.2')
- """
- def __init__(self, module_name=None):
- """
- """
- self.module_name = module_name
- self.compatible_version = None
-
- def compatibility(self, compatible_version):
- """Set the compatible version.
- """
- self.compatible_version = Version(compatible_version)
-
- def deprecated(self, version=None, reason=None, stacklevel=2, name=None, doc=None):
- """Display a deprecation message only if the version is older than the
- compatible version.
- """
- def decorator(func):
- message = reason or 'The function "%s" is deprecated'
- if '%s' in message:
- message %= func.__name__
- def wrapped(*args, **kwargs):
- self.warn(version, message, stacklevel+1)
- return func(*args, **kwargs)
- return wrapped
- return decorator
-
- def class_deprecated(self, version=None):
- class metaclass(type):
- """metaclass to print a warning on instantiation of a deprecated class"""
-
- def __call__(cls, *args, **kwargs):
- msg = getattr(cls, "__deprecation_warning__",
- "%(cls)s is deprecated") % {'cls': cls.__name__}
- self.warn(version, msg, stacklevel=3)
- return type.__call__(cls, *args, **kwargs)
- return metaclass
-
- def moved(self, version, modpath, objname):
- """use to tell that a callable has been moved to a new module.
-
- It returns a callable wrapper, so that when its called a warning is printed
- telling where the object can be found, import is done (and not before) and
- the actual object is called.
-
- NOTE: the usage is somewhat limited on classes since it will fail if the
- wrapper is use in a class ancestors list, use the `class_moved` function
- instead (which has no lazy import feature though).
- """
- def callnew(*args, **kwargs):
- from logilab.common.modutils import load_module_from_name
- message = "object %s has been moved to module %s" % (objname, modpath)
- self.warn(version, message)
- m = load_module_from_name(modpath)
- return getattr(m, objname)(*args, **kwargs)
- return callnew
-
- def class_renamed(self, version, old_name, new_class, message=None):
- clsdict = {}
- if message is None:
- message = '%s is deprecated, use %s' % (old_name, new_class.__name__)
- clsdict['__deprecation_warning__'] = message
- try:
- # new-style class
- return self.class_deprecated(version)(old_name, (new_class,), clsdict)
- except (NameError, TypeError):
- # old-style class
- warn = self.warn
- class DeprecatedClass(new_class):
- """FIXME: There might be a better way to handle old/new-style class
- """
- def __init__(self, *args, **kwargs):
- warn(version, message, stacklevel=3)
- new_class.__init__(self, *args, **kwargs)
- return DeprecatedClass
-
- def class_moved(self, version, new_class, old_name=None, message=None):
- """nice wrapper around class_renamed when a class has been moved into
- another module
- """
- if old_name is None:
- old_name = new_class.__name__
- if message is None:
- message = 'class %s is now available as %s.%s' % (
- old_name, new_class.__module__, new_class.__name__)
- return self.class_renamed(version, old_name, new_class, message)
-
- def warn(self, version=None, reason="", stacklevel=2):
- """Display a deprecation message only if the version is older than the
- compatible version.
- """
- if (self.compatible_version is None
- or version is None
- or Version(version) < self.compatible_version):
- if self.module_name and version:
- reason = '[%s %s] %s' % (self.module_name, version, reason)
- elif self.module_name:
- reason = '[%s] %s' % (self.module_name, reason)
- elif version:
- reason = '[%s] %s' % (version, reason)
- warn(reason, DeprecationWarning, stacklevel=stacklevel)
-
-_defaultdeprecator = DeprecationManager()
-
-def deprecated(reason=None, stacklevel=2, name=None, doc=None):
- return _defaultdeprecator.deprecated(None, reason, stacklevel, name, doc)
-
-class_deprecated = _defaultdeprecator.class_deprecated()
-
-def moved(modpath, objname):
- return _defaultdeprecator.moved(None, modpath, objname)
-moved.__doc__ = _defaultdeprecator.moved.__doc__
-
-def class_renamed(old_name, new_class, message=None):
- """automatically creates a class which fires a DeprecationWarning
- when instantiated.
-
- >>> Set = class_renamed('Set', set, 'Set is now replaced by set')
- >>> s = Set()
- sample.py:57: DeprecationWarning: Set is now replaced by set
- s = Set()
- >>>
- """
- return _defaultdeprecator.class_renamed(None, old_name, new_class, message)
-
-def class_moved(new_class, old_name=None, message=None):
- return _defaultdeprecator.class_moved(None, new_class, old_name, message)
-class_moved.__doc__ = _defaultdeprecator.class_moved.__doc__
-
diff --git a/chromium/third_party/logilab/logilab/common/fileutils.py b/chromium/third_party/logilab/logilab/common/fileutils.py
deleted file mode 100644
index b30cf5f87fd..00000000000
--- a/chromium/third_party/logilab/logilab/common/fileutils.py
+++ /dev/null
@@ -1,404 +0,0 @@
-# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""File and file-path manipulation utilities.
-
-:group path manipulation: first_level_directory, relative_path, is_binary,\
-get_by_ext, remove_dead_links
-:group file manipulation: norm_read, norm_open, lines, stream_lines, lines,\
-write_open_mode, ensure_fs_mode, export
-:sort: path manipulation, file manipulation
-"""
-
-from __future__ import print_function
-
-__docformat__ = "restructuredtext en"
-
-import sys
-import shutil
-import mimetypes
-from os.path import isabs, isdir, islink, split, exists, normpath, join
-from os.path import abspath
-from os import sep, mkdir, remove, listdir, stat, chmod, walk
-from stat import ST_MODE, S_IWRITE
-
-from logilab.common import STD_BLACKLIST as BASE_BLACKLIST, IGNORED_EXTENSIONS
-from logilab.common.shellutils import find
-from logilab.common.deprecation import deprecated
-from logilab.common.compat import FileIO
-
-def first_level_directory(path):
- """Return the first level directory of a path.
-
- >>> first_level_directory('home/syt/work')
- 'home'
- >>> first_level_directory('/home/syt/work')
- '/'
- >>> first_level_directory('work')
- 'work'
- >>>
-
- :type path: str
- :param path: the path for which we want the first level directory
-
- :rtype: str
- :return: the first level directory appearing in `path`
- """
- head, tail = split(path)
- while head and tail:
- head, tail = split(head)
- if tail:
- return tail
- # path was absolute, head is the fs root
- return head
-
-def abspath_listdir(path):
- """Lists path's content using absolute paths.
-
- >>> os.listdir('/home')
- ['adim', 'alf', 'arthur', 'auc']
- >>> abspath_listdir('/home')
- ['/home/adim', '/home/alf', '/home/arthur', '/home/auc']
- """
- path = abspath(path)
- return [join(path, filename) for filename in listdir(path)]
-
-
-def is_binary(filename):
- """Return true if filename may be a binary file, according to it's
- extension.
-
- :type filename: str
- :param filename: the name of the file
-
- :rtype: bool
- :return:
- true if the file is a binary file (actually if it's mime type
- isn't beginning by text/)
- """
- try:
- return not mimetypes.guess_type(filename)[0].startswith('text')
- except AttributeError:
- return 1
-
-
-def write_open_mode(filename):
- """Return the write mode that should used to open file.
-
- :type filename: str
- :param filename: the name of the file
-
- :rtype: str
- :return: the mode that should be use to open the file ('w' or 'wb')
- """
- if is_binary(filename):
- return 'wb'
- return 'w'
-
-
-def ensure_fs_mode(filepath, desired_mode=S_IWRITE):
- """Check that the given file has the given mode(s) set, else try to
- set it.
-
- :type filepath: str
- :param filepath: path of the file
-
- :type desired_mode: int
- :param desired_mode:
- ORed flags describing the desired mode. Use constants from the
- `stat` module for file permission's modes
- """
- mode = stat(filepath)[ST_MODE]
- if not mode & desired_mode:
- chmod(filepath, mode | desired_mode)
-
-
-# XXX (syt) unused? kill?
-class ProtectedFile(FileIO):
- """A special file-object class that automatically does a 'chmod +w' when
- needed.
-
- XXX: for now, the way it is done allows 'normal file-objects' to be
- created during the ProtectedFile object lifetime.
- One way to circumvent this would be to chmod / unchmod on each
- write operation.
-
- One other way would be to :
-
- - catch the IOError in the __init__
-
- - if IOError, then create a StringIO object
-
- - each write operation writes in this StringIO object
-
- - on close()/del(), write/append the StringIO content to the file and
- do the chmod only once
- """
- def __init__(self, filepath, mode):
- self.original_mode = stat(filepath)[ST_MODE]
- self.mode_changed = False
- if mode in ('w', 'a', 'wb', 'ab'):
- if not self.original_mode & S_IWRITE:
- chmod(filepath, self.original_mode | S_IWRITE)
- self.mode_changed = True
- FileIO.__init__(self, filepath, mode)
-
- def _restore_mode(self):
- """restores the original mode if needed"""
- if self.mode_changed:
- chmod(self.name, self.original_mode)
- # Don't re-chmod in case of several restore
- self.mode_changed = False
-
- def close(self):
- """restore mode before closing"""
- self._restore_mode()
- FileIO.close(self)
-
- def __del__(self):
- if not self.closed:
- self.close()
-
-
-class UnresolvableError(Exception):
- """Exception raised by relative path when it's unable to compute relative
- path between two paths.
- """
-
-def relative_path(from_file, to_file):
- """Try to get a relative path from `from_file` to `to_file`
- (path will be absolute if to_file is an absolute file). This function
- is useful to create link in `from_file` to `to_file`. This typical use
- case is used in this function description.
-
- If both files are relative, they're expected to be relative to the same
- directory.
-
- >>> relative_path( from_file='toto/index.html', to_file='index.html')
- '../index.html'
- >>> relative_path( from_file='index.html', to_file='toto/index.html')
- 'toto/index.html'
- >>> relative_path( from_file='tutu/index.html', to_file='toto/index.html')
- '../toto/index.html'
- >>> relative_path( from_file='toto/index.html', to_file='/index.html')
- '/index.html'
- >>> relative_path( from_file='/toto/index.html', to_file='/index.html')
- '../index.html'
- >>> relative_path( from_file='/toto/index.html', to_file='/toto/summary.html')
- 'summary.html'
- >>> relative_path( from_file='index.html', to_file='index.html')
- ''
- >>> relative_path( from_file='/index.html', to_file='toto/index.html')
- Traceback (most recent call last):
- File "<string>", line 1, in ?
- File "<stdin>", line 37, in relative_path
- UnresolvableError
- >>> relative_path( from_file='/index.html', to_file='/index.html')
- ''
- >>>
-
- :type from_file: str
- :param from_file: source file (where links will be inserted)
-
- :type to_file: str
- :param to_file: target file (on which links point)
-
- :raise UnresolvableError: if it has been unable to guess a correct path
-
- :rtype: str
- :return: the relative path of `to_file` from `from_file`
- """
- from_file = normpath(from_file)
- to_file = normpath(to_file)
- if from_file == to_file:
- return ''
- if isabs(to_file):
- if not isabs(from_file):
- return to_file
- elif isabs(from_file):
- raise UnresolvableError()
- from_parts = from_file.split(sep)
- to_parts = to_file.split(sep)
- idem = 1
- result = []
- while len(from_parts) > 1:
- dirname = from_parts.pop(0)
- if idem and len(to_parts) > 1 and dirname == to_parts[0]:
- to_parts.pop(0)
- else:
- idem = 0
- result.append('..')
- result += to_parts
- return sep.join(result)
-
-
-def norm_read(path):
- """Return the content of the file with normalized line feeds.
-
- :type path: str
- :param path: path to the file to read
-
- :rtype: str
- :return: the content of the file with normalized line feeds
- """
- return open(path, 'U').read()
-norm_read = deprecated("use \"open(path, 'U').read()\"")(norm_read)
-
-def norm_open(path):
- """Return a stream for a file with content with normalized line feeds.
-
- :type path: str
- :param path: path to the file to open
-
- :rtype: file or StringIO
- :return: the opened file with normalized line feeds
- """
- return open(path, 'U')
-norm_open = deprecated("use \"open(path, 'U')\"")(norm_open)
-
-def lines(path, comments=None):
- """Return a list of non empty lines in the file located at `path`.
-
- :type path: str
- :param path: path to the file
-
- :type comments: str or None
- :param comments:
- optional string which can be used to comment a line in the file
- (i.e. lines starting with this string won't be returned)
-
- :rtype: list
- :return:
- a list of stripped line in the file, without empty and commented
- lines
-
- :warning: at some point this function will probably return an iterator
- """
- stream = open(path, 'U')
- result = stream_lines(stream, comments)
- stream.close()
- return result
-
-
-def stream_lines(stream, comments=None):
- """Return a list of non empty lines in the given `stream`.
-
- :type stream: object implementing 'xreadlines' or 'readlines'
- :param stream: file like object
-
- :type comments: str or None
- :param comments:
- optional string which can be used to comment a line in the file
- (i.e. lines starting with this string won't be returned)
-
- :rtype: list
- :return:
- a list of stripped line in the file, without empty and commented
- lines
-
- :warning: at some point this function will probably return an iterator
- """
- try:
- readlines = stream.xreadlines
- except AttributeError:
- readlines = stream.readlines
- result = []
- for line in readlines():
- line = line.strip()
- if line and (comments is None or not line.startswith(comments)):
- result.append(line)
- return result
-
-
-def export(from_dir, to_dir,
- blacklist=BASE_BLACKLIST, ignore_ext=IGNORED_EXTENSIONS,
- verbose=0):
- """Make a mirror of `from_dir` in `to_dir`, omitting directories and
- files listed in the black list or ending with one of the given
- extensions.
-
- :type from_dir: str
- :param from_dir: directory to export
-
- :type to_dir: str
- :param to_dir: destination directory
-
- :type blacklist: list or tuple
- :param blacklist:
- list of files or directories to ignore, default to the content of
- `BASE_BLACKLIST`
-
- :type ignore_ext: list or tuple
- :param ignore_ext:
- list of extensions to ignore, default to the content of
- `IGNORED_EXTENSIONS`
-
- :type verbose: bool
- :param verbose:
- flag indicating whether information about exported files should be
- printed to stderr, default to False
- """
- try:
- mkdir(to_dir)
- except OSError:
- pass # FIXME we should use "exists" if the point is about existing dir
- # else (permission problems?) shouldn't return / raise ?
- for directory, dirnames, filenames in walk(from_dir):
- for norecurs in blacklist:
- try:
- dirnames.remove(norecurs)
- except ValueError:
- continue
- for dirname in dirnames:
- src = join(directory, dirname)
- dest = to_dir + src[len(from_dir):]
- if isdir(src):
- if not exists(dest):
- mkdir(dest)
- for filename in filenames:
- # don't include binary files
- # endswith does not accept tuple in 2.4
- if any([filename.endswith(ext) for ext in ignore_ext]):
- continue
- src = join(directory, filename)
- dest = to_dir + src[len(from_dir):]
- if verbose:
- print(src, '->', dest, file=sys.stderr)
- if exists(dest):
- remove(dest)
- shutil.copy2(src, dest)
-
-
-def remove_dead_links(directory, verbose=0):
- """Recursively traverse directory and remove all dead links.
-
- :type directory: str
- :param directory: directory to cleanup
-
- :type verbose: bool
- :param verbose:
- flag indicating whether information about deleted links should be
- printed to stderr, default to False
- """
- for dirpath, dirname, filenames in walk(directory):
- for filename in dirnames + filenames:
- src = join(dirpath, filename)
- if islink(src) and not exists(src):
- if verbose:
- print('remove dead link', src)
- remove(src)
-
diff --git a/chromium/third_party/logilab/logilab/common/graph.py b/chromium/third_party/logilab/logilab/common/graph.py
deleted file mode 100644
index cef1c984cd5..00000000000
--- a/chromium/third_party/logilab/logilab/common/graph.py
+++ /dev/null
@@ -1,282 +0,0 @@
-# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""Graph manipulation utilities.
-
-(dot generation adapted from pypy/translator/tool/make_dot.py)
-"""
-
-__docformat__ = "restructuredtext en"
-
-__metaclass__ = type
-
-import os.path as osp
-import os
-import sys
-import tempfile
-import codecs
-import errno
-
-def escape(value):
- """Make <value> usable in a dot file."""
- lines = [line.replace('"', '\\"') for line in value.split('\n')]
- data = '\\l'.join(lines)
- return '\\n' + data
-
-def target_info_from_filename(filename):
- """Transforms /some/path/foo.png into ('/some/path', 'foo.png', 'png')."""
- basename = osp.basename(filename)
- storedir = osp.dirname(osp.abspath(filename))
- target = filename.split('.')[-1]
- return storedir, basename, target
-
-
-class DotBackend:
- """Dot File backend."""
- def __init__(self, graphname, rankdir=None, size=None, ratio=None,
- charset='utf-8', renderer='dot', additionnal_param={}):
- self.graphname = graphname
- self.renderer = renderer
- self.lines = []
- self._source = None
- self.emit("digraph %s {" % normalize_node_id(graphname))
- if rankdir:
- self.emit('rankdir=%s' % rankdir)
- if ratio:
- self.emit('ratio=%s' % ratio)
- if size:
- self.emit('size="%s"' % size)
- if charset:
- assert charset.lower() in ('utf-8', 'iso-8859-1', 'latin1'), \
- 'unsupported charset %s' % charset
- self.emit('charset="%s"' % charset)
- for param in sorted(additionnal_param.items()):
- self.emit('='.join(param))
-
- def get_source(self):
- """returns self._source"""
- if self._source is None:
- self.emit("}\n")
- self._source = '\n'.join(self.lines)
- del self.lines
- return self._source
-
- source = property(get_source)
-
- def generate(self, outputfile=None, dotfile=None, mapfile=None):
- """Generates a graph file.
-
- :param outputfile: filename and path [defaults to graphname.png]
- :param dotfile: filename and path [defaults to graphname.dot]
-
- :rtype: str
- :return: a path to the generated file
- """
- import subprocess # introduced in py 2.4
- name = self.graphname
- if not dotfile:
- # if 'outputfile' is a dot file use it as 'dotfile'
- if outputfile and outputfile.endswith(".dot"):
- dotfile = outputfile
- else:
- dotfile = '%s.dot' % name
- if outputfile is not None:
- storedir, basename, target = target_info_from_filename(outputfile)
- if target != "dot":
- pdot, dot_sourcepath = tempfile.mkstemp(".dot", name)
- os.close(pdot)
- else:
- dot_sourcepath = osp.join(storedir, dotfile)
- else:
- target = 'png'
- pdot, dot_sourcepath = tempfile.mkstemp(".dot", name)
- ppng, outputfile = tempfile.mkstemp(".png", name)
- os.close(pdot)
- os.close(ppng)
- pdot = codecs.open(dot_sourcepath, 'w', encoding='utf8')
- pdot.write(self.source)
- pdot.close()
- if target != 'dot':
- if sys.platform == 'win32':
- use_shell = True
- else:
- use_shell = False
- try:
- if mapfile:
- subprocess.call([self.renderer, '-Tcmapx', '-o', mapfile, '-T', target, dot_sourcepath, '-o', outputfile],
- shell=use_shell)
- else:
- subprocess.call([self.renderer, '-T', target,
- dot_sourcepath, '-o', outputfile],
- shell=use_shell)
- except OSError as e:
- if e.errno == errno.ENOENT:
- e.strerror = 'File not found: {0}'.format(self.renderer)
- raise
- os.unlink(dot_sourcepath)
- return outputfile
-
- def emit(self, line):
- """Adds <line> to final output."""
- self.lines.append(line)
-
- def emit_edge(self, name1, name2, **props):
- """emit an edge from <name1> to <name2>.
- edge properties: see http://www.graphviz.org/doc/info/attrs.html
- """
- attrs = ['%s="%s"' % (prop, value) for prop, value in props.items()]
- n_from, n_to = normalize_node_id(name1), normalize_node_id(name2)
- self.emit('%s -> %s [%s];' % (n_from, n_to, ', '.join(sorted(attrs))) )
-
- def emit_node(self, name, **props):
- """emit a node with given properties.
- node properties: see http://www.graphviz.org/doc/info/attrs.html
- """
- attrs = ['%s="%s"' % (prop, value) for prop, value in props.items()]
- self.emit('%s [%s];' % (normalize_node_id(name), ', '.join(sorted(attrs))))
-
-def normalize_node_id(nid):
- """Returns a suitable DOT node id for `nid`."""
- return '"%s"' % nid
-
-class GraphGenerator:
- def __init__(self, backend):
- # the backend is responsible to output the graph in a particular format
- self.backend = backend
-
- # XXX doesn't like space in outpufile / mapfile
- def generate(self, visitor, propshdlr, outputfile=None, mapfile=None):
- # the visitor
- # the property handler is used to get node and edge properties
- # according to the graph and to the backend
- self.propshdlr = propshdlr
- for nodeid, node in visitor.nodes():
- props = propshdlr.node_properties(node)
- self.backend.emit_node(nodeid, **props)
- for subjnode, objnode, edge in visitor.edges():
- props = propshdlr.edge_properties(edge, subjnode, objnode)
- self.backend.emit_edge(subjnode, objnode, **props)
- return self.backend.generate(outputfile=outputfile, mapfile=mapfile)
-
-
-class UnorderableGraph(Exception):
- pass
-
-def ordered_nodes(graph):
- """takes a dependency graph dict as arguments and return an ordered tuple of
- nodes starting with nodes without dependencies and up to the outermost node.
-
- If there is some cycle in the graph, :exc:`UnorderableGraph` will be raised.
-
- Also the given graph dict will be emptied.
- """
- # check graph consistency
- cycles = get_cycles(graph)
- if cycles:
- cycles = '\n'.join([' -> '.join(cycle) for cycle in cycles])
- raise UnorderableGraph('cycles in graph: %s' % cycles)
- vertices = set(graph)
- to_vertices = set()
- for edges in graph.values():
- to_vertices |= set(edges)
- missing_vertices = to_vertices - vertices
- if missing_vertices:
- raise UnorderableGraph('missing vertices: %s' % ', '.join(missing_vertices))
- # order vertices
- order = []
- order_set = set()
- old_len = None
- while graph:
- if old_len == len(graph):
- raise UnorderableGraph('unknown problem with %s' % graph)
- old_len = len(graph)
- deps_ok = []
- for node, node_deps in graph.items():
- for dep in node_deps:
- if dep not in order_set:
- break
- else:
- deps_ok.append(node)
- order.append(deps_ok)
- order_set |= set(deps_ok)
- for node in deps_ok:
- del graph[node]
- result = []
- for grp in reversed(order):
- result.extend(sorted(grp))
- return tuple(result)
-
-
-def get_cycles(graph_dict, vertices=None):
- '''given a dictionary representing an ordered graph (i.e. key are vertices
- and values is a list of destination vertices representing edges), return a
- list of detected cycles
- '''
- if not graph_dict:
- return ()
- result = []
- if vertices is None:
- vertices = graph_dict.keys()
- for vertice in vertices:
- _get_cycles(graph_dict, [], set(), result, vertice)
- return result
-
-def _get_cycles(graph_dict, path, visited, result, vertice):
- """recursive function doing the real work for get_cycles"""
- if vertice in path:
- cycle = [vertice]
- for node in path[::-1]:
- if node == vertice:
- break
- cycle.insert(0, node)
- # make a canonical representation
- start_from = min(cycle)
- index = cycle.index(start_from)
- cycle = cycle[index:] + cycle[0:index]
- # append it to result if not already in
- if not cycle in result:
- result.append(cycle)
- return
- path.append(vertice)
- try:
- for node in graph_dict[vertice]:
- # don't check already visited nodes again
- if node not in visited:
- _get_cycles(graph_dict, path, visited, result, node)
- visited.add(node)
- except KeyError:
- pass
- path.pop()
-
-def has_path(graph_dict, fromnode, tonode, path=None):
- """generic function taking a simple graph definition as a dictionary, with
- node has key associated to a list of nodes directly reachable from it.
-
- Return None if no path exists to go from `fromnode` to `tonode`, else the
- first path found (as a list including the destination node at last)
- """
- if path is None:
- path = []
- elif fromnode in path:
- return None
- path.append(fromnode)
- for destnode in graph_dict[fromnode]:
- if destnode == tonode or has_path(graph_dict, destnode, tonode, path):
- return path[1:] + [tonode]
- path.pop()
- return None
-
diff --git a/chromium/third_party/logilab/logilab/common/interface.py b/chromium/third_party/logilab/logilab/common/interface.py
deleted file mode 100644
index 3ea4ab7e374..00000000000
--- a/chromium/third_party/logilab/logilab/common/interface.py
+++ /dev/null
@@ -1,71 +0,0 @@
-# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""Bases class for interfaces to provide 'light' interface handling.
-
- TODO:
- _ implements a check method which check that an object implements the
- interface
- _ Attribute objects
-
- This module requires at least python 2.2
-"""
-__docformat__ = "restructuredtext en"
-
-
-class Interface(object):
- """Base class for interfaces."""
- def is_implemented_by(cls, instance):
- return implements(instance, cls)
- is_implemented_by = classmethod(is_implemented_by)
-
-
-def implements(obj, interface):
- """Return true if the give object (maybe an instance or class) implements
- the interface.
- """
- kimplements = getattr(obj, '__implements__', ())
- if not isinstance(kimplements, (list, tuple)):
- kimplements = (kimplements,)
- for implementedinterface in kimplements:
- if issubclass(implementedinterface, interface):
- return True
- return False
-
-
-def extend(klass, interface, _recurs=False):
- """Add interface to klass'__implements__ if not already implemented in.
-
- If klass is subclassed, ensure subclasses __implements__ it as well.
-
- NOTE: klass should be e new class.
- """
- if not implements(klass, interface):
- try:
- kimplements = klass.__implements__
- kimplementsklass = type(kimplements)
- kimplements = list(kimplements)
- except AttributeError:
- kimplementsklass = tuple
- kimplements = []
- kimplements.append(interface)
- klass.__implements__ = kimplementsklass(kimplements)
- for subklass in klass.__subclasses__():
- extend(subklass, interface, _recurs=True)
- elif _recurs:
- for subklass in klass.__subclasses__():
- extend(subklass, interface, _recurs=True)
diff --git a/chromium/third_party/logilab/logilab/common/logging_ext.py b/chromium/third_party/logilab/logilab/common/logging_ext.py
deleted file mode 100644
index 3b6a580a0cd..00000000000
--- a/chromium/third_party/logilab/logilab/common/logging_ext.py
+++ /dev/null
@@ -1,195 +0,0 @@
-# -*- coding: utf-8 -*-
-# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""Extends the logging module from the standard library."""
-
-__docformat__ = "restructuredtext en"
-
-import os
-import sys
-import logging
-
-from six import string_types
-
-from logilab.common.textutils import colorize_ansi
-
-
-def set_log_methods(cls, logger):
- """bind standard logger's methods as methods on the class"""
- cls.__logger = logger
- for attr in ('debug', 'info', 'warning', 'error', 'critical', 'exception'):
- setattr(cls, attr, getattr(logger, attr))
-
-
-def xxx_cyan(record):
- if 'XXX' in record.message:
- return 'cyan'
-
-class ColorFormatter(logging.Formatter):
- """
- A color Formatter for the logging standard module.
-
- By default, colorize CRITICAL and ERROR in red, WARNING in orange, INFO in
- green and DEBUG in yellow.
-
- self.colors is customizable via the 'color' constructor argument (dictionary).
-
- self.colorfilters is a list of functions that get the LogRecord
- and return a color name or None.
- """
-
- def __init__(self, fmt=None, datefmt=None, colors=None):
- logging.Formatter.__init__(self, fmt, datefmt)
- self.colorfilters = []
- self.colors = {'CRITICAL': 'red',
- 'ERROR': 'red',
- 'WARNING': 'magenta',
- 'INFO': 'green',
- 'DEBUG': 'yellow',
- }
- if colors is not None:
- assert isinstance(colors, dict)
- self.colors.update(colors)
-
- def format(self, record):
- msg = logging.Formatter.format(self, record)
- if record.levelname in self.colors:
- color = self.colors[record.levelname]
- return colorize_ansi(msg, color)
- else:
- for cf in self.colorfilters:
- color = cf(record)
- if color:
- return colorize_ansi(msg, color)
- return msg
-
-def set_color_formatter(logger=None, **kw):
- """
- Install a color formatter on the 'logger'. If not given, it will
- defaults to the default logger.
-
- Any additional keyword will be passed as-is to the ColorFormatter
- constructor.
- """
- if logger is None:
- logger = logging.getLogger()
- if not logger.handlers:
- logging.basicConfig()
- format_msg = logger.handlers[0].formatter._fmt
- fmt = ColorFormatter(format_msg, **kw)
- fmt.colorfilters.append(xxx_cyan)
- logger.handlers[0].setFormatter(fmt)
-
-
-LOG_FORMAT = '%(asctime)s - (%(name)s) %(levelname)s: %(message)s'
-LOG_DATE_FORMAT = '%Y-%m-%d %H:%M:%S'
-
-def get_handler(debug=False, syslog=False, logfile=None, rotation_parameters=None):
- """get an apropriate handler according to given parameters"""
- if os.environ.get('APYCOT_ROOT'):
- handler = logging.StreamHandler(sys.stdout)
- if debug:
- handler = logging.StreamHandler()
- elif logfile is None:
- if syslog:
- from logging import handlers
- handler = handlers.SysLogHandler()
- else:
- handler = logging.StreamHandler()
- else:
- try:
- if rotation_parameters is None:
- if os.name == 'posix' and sys.version_info >= (2, 6):
- from logging.handlers import WatchedFileHandler
- handler = WatchedFileHandler(logfile)
- else:
- handler = logging.FileHandler(logfile)
- else:
- from logging.handlers import TimedRotatingFileHandler
- handler = TimedRotatingFileHandler(
- logfile, **rotation_parameters)
- except IOError:
- handler = logging.StreamHandler()
- return handler
-
-def get_threshold(debug=False, logthreshold=None):
- if logthreshold is None:
- if debug:
- logthreshold = logging.DEBUG
- else:
- logthreshold = logging.ERROR
- elif isinstance(logthreshold, string_types):
- logthreshold = getattr(logging, THRESHOLD_MAP.get(logthreshold,
- logthreshold))
- return logthreshold
-
-def _colorable_terminal():
- isatty = hasattr(sys.__stdout__, 'isatty') and sys.__stdout__.isatty()
- if not isatty:
- return False
- if os.name == 'nt':
- try:
- from colorama import init as init_win32_colors
- except ImportError:
- return False
- init_win32_colors()
- return True
-
-def get_formatter(logformat=LOG_FORMAT, logdateformat=LOG_DATE_FORMAT):
- if _colorable_terminal():
- fmt = ColorFormatter(logformat, logdateformat)
- def col_fact(record):
- if 'XXX' in record.message:
- return 'cyan'
- if 'kick' in record.message:
- return 'red'
- fmt.colorfilters.append(col_fact)
- else:
- fmt = logging.Formatter(logformat, logdateformat)
- return fmt
-
-def init_log(debug=False, syslog=False, logthreshold=None, logfile=None,
- logformat=LOG_FORMAT, logdateformat=LOG_DATE_FORMAT, fmt=None,
- rotation_parameters=None, handler=None):
- """init the log service"""
- logger = logging.getLogger()
- if handler is None:
- handler = get_handler(debug, syslog, logfile, rotation_parameters)
- # only addHandler and removeHandler method while I would like a setHandler
- # method, so do it this way :$
- logger.handlers = [handler]
- logthreshold = get_threshold(debug, logthreshold)
- logger.setLevel(logthreshold)
- if fmt is None:
- if debug:
- fmt = get_formatter(logformat=logformat, logdateformat=logdateformat)
- else:
- fmt = logging.Formatter(logformat, logdateformat)
- handler.setFormatter(fmt)
- return handler
-
-# map logilab.common.logger thresholds to logging thresholds
-THRESHOLD_MAP = {'LOG_DEBUG': 'DEBUG',
- 'LOG_INFO': 'INFO',
- 'LOG_NOTICE': 'INFO',
- 'LOG_WARN': 'WARNING',
- 'LOG_WARNING': 'WARNING',
- 'LOG_ERR': 'ERROR',
- 'LOG_ERROR': 'ERROR',
- 'LOG_CRIT': 'CRITICAL',
- }
diff --git a/chromium/third_party/logilab/logilab/common/modutils.py b/chromium/third_party/logilab/logilab/common/modutils.py
deleted file mode 100644
index a426a3aeba7..00000000000
--- a/chromium/third_party/logilab/logilab/common/modutils.py
+++ /dev/null
@@ -1,702 +0,0 @@
-# -*- coding: utf-8 -*-
-# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""Python modules manipulation utility functions.
-
-:type PY_SOURCE_EXTS: tuple(str)
-:var PY_SOURCE_EXTS: list of possible python source file extension
-
-:type STD_LIB_DIR: str
-:var STD_LIB_DIR: directory where standard modules are located
-
-:type BUILTIN_MODULES: dict
-:var BUILTIN_MODULES: dictionary with builtin module names has key
-"""
-
-__docformat__ = "restructuredtext en"
-
-import sys
-import os
-from os.path import splitext, join, abspath, isdir, dirname, exists, basename
-from imp import find_module, load_module, C_BUILTIN, PY_COMPILED, PKG_DIRECTORY
-from distutils.sysconfig import get_config_var, get_python_lib, get_python_version
-from distutils.errors import DistutilsPlatformError
-
-from six.moves import range
-
-try:
- import zipimport
-except ImportError:
- zipimport = None
-
-ZIPFILE = object()
-
-from logilab.common import STD_BLACKLIST, _handle_blacklist
-
-# Notes about STD_LIB_DIR
-# Consider arch-specific installation for STD_LIB_DIR definition
-# :mod:`distutils.sysconfig` contains to much hardcoded values to rely on
-#
-# :see: `Problems with /usr/lib64 builds <http://bugs.python.org/issue1294959>`_
-# :see: `FHS <http://www.pathname.com/fhs/pub/fhs-2.3.html#LIBLTQUALGTALTERNATEFORMATESSENTIAL>`_
-if sys.platform.startswith('win'):
- PY_SOURCE_EXTS = ('py', 'pyw')
- PY_COMPILED_EXTS = ('dll', 'pyd')
-else:
- PY_SOURCE_EXTS = ('py',)
- PY_COMPILED_EXTS = ('so',)
-
-try:
- STD_LIB_DIR = get_python_lib(standard_lib=1)
-# get_python_lib(standard_lib=1) is not available on pypy, set STD_LIB_DIR to
-# non-valid path, see https://bugs.pypy.org/issue1164
-except DistutilsPlatformError:
- STD_LIB_DIR = '//'
-
-EXT_LIB_DIR = get_python_lib()
-
-BUILTIN_MODULES = dict(zip(sys.builtin_module_names,
- [1]*len(sys.builtin_module_names)))
-
-
-class NoSourceFile(Exception):
- """exception raised when we are not able to get a python
- source file for a precompiled file
- """
-
-class LazyObject(object):
- def __init__(self, module, obj):
- self.module = module
- self.obj = obj
- self._imported = None
-
- def _getobj(self):
- if self._imported is None:
- self._imported = getattr(load_module_from_name(self.module),
- self.obj)
- return self._imported
-
- def __getattribute__(self, attr):
- try:
- return super(LazyObject, self).__getattribute__(attr)
- except AttributeError as ex:
- return getattr(self._getobj(), attr)
-
- def __call__(self, *args, **kwargs):
- return self._getobj()(*args, **kwargs)
-
-
-def load_module_from_name(dotted_name, path=None, use_sys=1):
- """Load a Python module from its name.
-
- :type dotted_name: str
- :param dotted_name: python name of a module or package
-
- :type path: list or None
- :param path:
- optional list of path where the module or package should be
- searched (use sys.path if nothing or None is given)
-
- :type use_sys: bool
- :param use_sys:
- boolean indicating whether the sys.modules dictionary should be
- used or not
-
-
- :raise ImportError: if the module or package is not found
-
- :rtype: module
- :return: the loaded module
- """
- return load_module_from_modpath(dotted_name.split('.'), path, use_sys)
-
-
-def load_module_from_modpath(parts, path=None, use_sys=1):
- """Load a python module from its splitted name.
-
- :type parts: list(str) or tuple(str)
- :param parts:
- python name of a module or package splitted on '.'
-
- :type path: list or None
- :param path:
- optional list of path where the module or package should be
- searched (use sys.path if nothing or None is given)
-
- :type use_sys: bool
- :param use_sys:
- boolean indicating whether the sys.modules dictionary should be used or not
-
- :raise ImportError: if the module or package is not found
-
- :rtype: module
- :return: the loaded module
- """
- if use_sys:
- try:
- return sys.modules['.'.join(parts)]
- except KeyError:
- pass
- modpath = []
- prevmodule = None
- for part in parts:
- modpath.append(part)
- curname = '.'.join(modpath)
- module = None
- if len(modpath) != len(parts):
- # even with use_sys=False, should try to get outer packages from sys.modules
- module = sys.modules.get(curname)
- elif use_sys:
- # because it may have been indirectly loaded through a parent
- module = sys.modules.get(curname)
- if module is None:
- mp_file, mp_filename, mp_desc = find_module(part, path)
- module = load_module(curname, mp_file, mp_filename, mp_desc)
- if prevmodule:
- setattr(prevmodule, part, module)
- _file = getattr(module, '__file__', '')
- if not _file and len(modpath) != len(parts):
- raise ImportError('no module in %s' % '.'.join(parts[len(modpath):]) )
- path = [dirname( _file )]
- prevmodule = module
- return module
-
-
-def load_module_from_file(filepath, path=None, use_sys=1, extrapath=None):
- """Load a Python module from it's path.
-
- :type filepath: str
- :param filepath: path to the python module or package
-
- :type path: list or None
- :param path:
- optional list of path where the module or package should be
- searched (use sys.path if nothing or None is given)
-
- :type use_sys: bool
- :param use_sys:
- boolean indicating whether the sys.modules dictionary should be
- used or not
-
-
- :raise ImportError: if the module or package is not found
-
- :rtype: module
- :return: the loaded module
- """
- modpath = modpath_from_file(filepath, extrapath)
- return load_module_from_modpath(modpath, path, use_sys)
-
-
-def _check_init(path, mod_path):
- """check there are some __init__.py all along the way"""
- for part in mod_path:
- path = join(path, part)
- if not _has_init(path):
- return False
- return True
-
-
-def modpath_from_file(filename, extrapath=None):
- """given a file path return the corresponding splitted module's name
- (i.e name of a module or package splitted on '.')
-
- :type filename: str
- :param filename: file's path for which we want the module's name
-
- :type extrapath: dict
- :param extrapath:
- optional extra search path, with path as key and package name for the path
- as value. This is usually useful to handle package splitted in multiple
- directories using __path__ trick.
-
-
- :raise ImportError:
- if the corresponding module's name has not been found
-
- :rtype: list(str)
- :return: the corresponding splitted module's name
- """
- base = splitext(abspath(filename))[0]
- if extrapath is not None:
- for path_ in extrapath:
- path = abspath(path_)
- if path and base[:len(path)] == path:
- submodpath = [pkg for pkg in base[len(path):].split(os.sep)
- if pkg]
- if _check_init(path, submodpath[:-1]):
- return extrapath[path_].split('.') + submodpath
- for path in sys.path:
- path = abspath(path)
- if path and base.startswith(path):
- modpath = [pkg for pkg in base[len(path):].split(os.sep) if pkg]
- if _check_init(path, modpath[:-1]):
- return modpath
- raise ImportError('Unable to find module for %s in %s' % (
- filename, ', \n'.join(sys.path)))
-
-
-
-def file_from_modpath(modpath, path=None, context_file=None):
- """given a mod path (i.e. splitted module / package name), return the
- corresponding file, giving priority to source file over precompiled
- file if it exists
-
- :type modpath: list or tuple
- :param modpath:
- splitted module's name (i.e name of a module or package splitted
- on '.')
- (this means explicit relative imports that start with dots have
- empty strings in this list!)
-
- :type path: list or None
- :param path:
- optional list of path where the module or package should be
- searched (use sys.path if nothing or None is given)
-
- :type context_file: str or None
- :param context_file:
- context file to consider, necessary if the identifier has been
- introduced using a relative import unresolvable in the actual
- context (i.e. modutils)
-
- :raise ImportError: if there is no such module in the directory
-
- :rtype: str or None
- :return:
- the path to the module's file or None if it's an integrated
- builtin module such as 'sys'
- """
- if context_file is not None:
- context = dirname(context_file)
- else:
- context = context_file
- if modpath[0] == 'xml':
- # handle _xmlplus
- try:
- return _file_from_modpath(['_xmlplus'] + modpath[1:], path, context)
- except ImportError:
- return _file_from_modpath(modpath, path, context)
- elif modpath == ['os', 'path']:
- # FIXME: currently ignoring search_path...
- return os.path.__file__
- return _file_from_modpath(modpath, path, context)
-
-
-
-def get_module_part(dotted_name, context_file=None):
- """given a dotted name return the module part of the name :
-
- >>> get_module_part('logilab.common.modutils.get_module_part')
- 'logilab.common.modutils'
-
- :type dotted_name: str
- :param dotted_name: full name of the identifier we are interested in
-
- :type context_file: str or None
- :param context_file:
- context file to consider, necessary if the identifier has been
- introduced using a relative import unresolvable in the actual
- context (i.e. modutils)
-
-
- :raise ImportError: if there is no such module in the directory
-
- :rtype: str or None
- :return:
- the module part of the name or None if we have not been able at
- all to import the given name
-
- XXX: deprecated, since it doesn't handle package precedence over module
- (see #10066)
- """
- # os.path trick
- if dotted_name.startswith('os.path'):
- return 'os.path'
- parts = dotted_name.split('.')
- if context_file is not None:
- # first check for builtin module which won't be considered latter
- # in that case (path != None)
- if parts[0] in BUILTIN_MODULES:
- if len(parts) > 2:
- raise ImportError(dotted_name)
- return parts[0]
- # don't use += or insert, we want a new list to be created !
- path = None
- starti = 0
- if parts[0] == '':
- assert context_file is not None, \
- 'explicit relative import, but no context_file?'
- path = [] # prevent resolving the import non-relatively
- starti = 1
- while parts[starti] == '': # for all further dots: change context
- starti += 1
- context_file = dirname(context_file)
- for i in range(starti, len(parts)):
- try:
- file_from_modpath(parts[starti:i+1],
- path=path, context_file=context_file)
- except ImportError:
- if not i >= max(1, len(parts) - 2):
- raise
- return '.'.join(parts[:i])
- return dotted_name
-
-
-def get_modules(package, src_directory, blacklist=STD_BLACKLIST):
- """given a package directory return a list of all available python
- modules in the package and its subpackages
-
- :type package: str
- :param package: the python name for the package
-
- :type src_directory: str
- :param src_directory:
- path of the directory corresponding to the package
-
- :type blacklist: list or tuple
- :param blacklist:
- optional list of files or directory to ignore, default to
- the value of `logilab.common.STD_BLACKLIST`
-
- :rtype: list
- :return:
- the list of all available python modules in the package and its
- subpackages
- """
- modules = []
- for directory, dirnames, filenames in os.walk(src_directory):
- _handle_blacklist(blacklist, dirnames, filenames)
- # check for __init__.py
- if not '__init__.py' in filenames:
- dirnames[:] = ()
- continue
- if directory != src_directory:
- dir_package = directory[len(src_directory):].replace(os.sep, '.')
- modules.append(package + dir_package)
- for filename in filenames:
- if _is_python_file(filename) and filename != '__init__.py':
- src = join(directory, filename)
- module = package + src[len(src_directory):-3]
- modules.append(module.replace(os.sep, '.'))
- return modules
-
-
-
-def get_module_files(src_directory, blacklist=STD_BLACKLIST):
- """given a package directory return a list of all available python
- module's files in the package and its subpackages
-
- :type src_directory: str
- :param src_directory:
- path of the directory corresponding to the package
-
- :type blacklist: list or tuple
- :param blacklist:
- optional list of files or directory to ignore, default to the value of
- `logilab.common.STD_BLACKLIST`
-
- :rtype: list
- :return:
- the list of all available python module's files in the package and
- its subpackages
- """
- files = []
- for directory, dirnames, filenames in os.walk(src_directory):
- _handle_blacklist(blacklist, dirnames, filenames)
- # check for __init__.py
- if not '__init__.py' in filenames:
- dirnames[:] = ()
- continue
- for filename in filenames:
- if _is_python_file(filename):
- src = join(directory, filename)
- files.append(src)
- return files
-
-
-def get_source_file(filename, include_no_ext=False):
- """given a python module's file name return the matching source file
- name (the filename will be returned identically if it's a already an
- absolute path to a python source file...)
-
- :type filename: str
- :param filename: python module's file name
-
-
- :raise NoSourceFile: if no source file exists on the file system
-
- :rtype: str
- :return: the absolute path of the source file if it exists
- """
- base, orig_ext = splitext(abspath(filename))
- for ext in PY_SOURCE_EXTS:
- source_path = '%s.%s' % (base, ext)
- if exists(source_path):
- return source_path
- if include_no_ext and not orig_ext and exists(base):
- return base
- raise NoSourceFile(filename)
-
-
-def cleanup_sys_modules(directories):
- """remove submodules of `directories` from `sys.modules`"""
- cleaned = []
- for modname, module in list(sys.modules.items()):
- modfile = getattr(module, '__file__', None)
- if modfile:
- for directory in directories:
- if modfile.startswith(directory):
- cleaned.append(modname)
- del sys.modules[modname]
- break
- return cleaned
-
-
-def is_python_source(filename):
- """
- rtype: bool
- return: True if the filename is a python source file
- """
- return splitext(filename)[1][1:] in PY_SOURCE_EXTS
-
-
-
-def is_standard_module(modname, std_path=(STD_LIB_DIR,)):
- """try to guess if a module is a standard python module (by default,
- see `std_path` parameter's description)
-
- :type modname: str
- :param modname: name of the module we are interested in
-
- :type std_path: list(str) or tuple(str)
- :param std_path: list of path considered has standard
-
-
- :rtype: bool
- :return:
- true if the module:
- - is located on the path listed in one of the directory in `std_path`
- - is a built-in module
- """
- modname = modname.split('.')[0]
- try:
- filename = file_from_modpath([modname])
- except ImportError as ex:
- # import failed, i'm probably not so wrong by supposing it's
- # not standard...
- return 0
- # modules which are not living in a file are considered standard
- # (sys and __builtin__ for instance)
- if filename is None:
- return 1
- filename = abspath(filename)
- if filename.startswith(EXT_LIB_DIR):
- return 0
- for path in std_path:
- if filename.startswith(abspath(path)):
- return 1
- return False
-
-
-
-def is_relative(modname, from_file):
- """return true if the given module name is relative to the given
- file name
-
- :type modname: str
- :param modname: name of the module we are interested in
-
- :type from_file: str
- :param from_file:
- path of the module from which modname has been imported
-
- :rtype: bool
- :return:
- true if the module has been imported relatively to `from_file`
- """
- if not isdir(from_file):
- from_file = dirname(from_file)
- if from_file in sys.path:
- return False
- try:
- find_module(modname.split('.')[0], [from_file])
- return True
- except ImportError:
- return False
-
-
-# internal only functions #####################################################
-
-def _file_from_modpath(modpath, path=None, context=None):
- """given a mod path (i.e. splitted module / package name), return the
- corresponding file
-
- this function is used internally, see `file_from_modpath`'s
- documentation for more information
- """
- assert len(modpath) > 0
- if context is not None:
- try:
- mtype, mp_filename = _module_file(modpath, [context])
- except ImportError:
- mtype, mp_filename = _module_file(modpath, path)
- else:
- mtype, mp_filename = _module_file(modpath, path)
- if mtype == PY_COMPILED:
- try:
- return get_source_file(mp_filename)
- except NoSourceFile:
- return mp_filename
- elif mtype == C_BUILTIN:
- # integrated builtin module
- return None
- elif mtype == PKG_DIRECTORY:
- mp_filename = _has_init(mp_filename)
- return mp_filename
-
-def _search_zip(modpath, pic):
- for filepath, importer in pic.items():
- if importer is not None:
- if importer.find_module(modpath[0]):
- if not importer.find_module('/'.join(modpath)):
- raise ImportError('No module named %s in %s/%s' % (
- '.'.join(modpath[1:]), filepath, modpath))
- return ZIPFILE, abspath(filepath) + '/' + '/'.join(modpath), filepath
- raise ImportError('No module named %s' % '.'.join(modpath))
-
-try:
- import pkg_resources
-except ImportError:
- pkg_resources = None
-
-def _module_file(modpath, path=None):
- """get a module type / file path
-
- :type modpath: list or tuple
- :param modpath:
- splitted module's name (i.e name of a module or package splitted
- on '.'), with leading empty strings for explicit relative import
-
- :type path: list or None
- :param path:
- optional list of path where the module or package should be
- searched (use sys.path if nothing or None is given)
-
-
- :rtype: tuple(int, str)
- :return: the module type flag and the file path for a module
- """
- # egg support compat
- try:
- pic = sys.path_importer_cache
- _path = (path is None and sys.path or path)
- for __path in _path:
- if not __path in pic:
- try:
- pic[__path] = zipimport.zipimporter(__path)
- except zipimport.ZipImportError:
- pic[__path] = None
- checkeggs = True
- except AttributeError:
- checkeggs = False
- # pkg_resources support (aka setuptools namespace packages)
- if (pkg_resources is not None
- and modpath[0] in pkg_resources._namespace_packages
- and modpath[0] in sys.modules
- and len(modpath) > 1):
- # setuptools has added into sys.modules a module object with proper
- # __path__, get back information from there
- module = sys.modules[modpath.pop(0)]
- path = module.__path__
- imported = []
- while modpath:
- modname = modpath[0]
- # take care to changes in find_module implementation wrt builtin modules
- #
- # Python 2.6.6 (r266:84292, Sep 11 2012, 08:34:23)
- # >>> imp.find_module('posix')
- # (None, 'posix', ('', '', 6))
- #
- # Python 3.3.1 (default, Apr 26 2013, 12:08:46)
- # >>> imp.find_module('posix')
- # (None, None, ('', '', 6))
- try:
- _, mp_filename, mp_desc = find_module(modname, path)
- except ImportError:
- if checkeggs:
- return _search_zip(modpath, pic)[:2]
- raise
- else:
- if checkeggs and mp_filename:
- fullabspath = [abspath(x) for x in _path]
- try:
- pathindex = fullabspath.index(dirname(abspath(mp_filename)))
- emtype, emp_filename, zippath = _search_zip(modpath, pic)
- if pathindex > _path.index(zippath):
- # an egg takes priority
- return emtype, emp_filename
- except ValueError:
- # XXX not in _path
- pass
- except ImportError:
- pass
- checkeggs = False
- imported.append(modpath.pop(0))
- mtype = mp_desc[2]
- if modpath:
- if mtype != PKG_DIRECTORY:
- raise ImportError('No module %s in %s' % ('.'.join(modpath),
- '.'.join(imported)))
- # XXX guess if package is using pkgutil.extend_path by looking for
- # those keywords in the first four Kbytes
- try:
- with open(join(mp_filename, '__init__.py')) as stream:
- data = stream.read(4096)
- except IOError:
- path = [mp_filename]
- else:
- if 'pkgutil' in data and 'extend_path' in data:
- # extend_path is called, search sys.path for module/packages
- # of this name see pkgutil.extend_path documentation
- path = [join(p, *imported) for p in sys.path
- if isdir(join(p, *imported))]
- else:
- path = [mp_filename]
- return mtype, mp_filename
-
-def _is_python_file(filename):
- """return true if the given filename should be considered as a python file
-
- .pyc and .pyo are ignored
- """
- for ext in ('.py', '.so', '.pyd', '.pyw'):
- if filename.endswith(ext):
- return True
- return False
-
-
-def _has_init(directory):
- """if the given directory has a valid __init__ file, return its path,
- else return None
- """
- mod_or_pack = join(directory, '__init__')
- for ext in PY_SOURCE_EXTS + ('pyc', 'pyo'):
- if exists(mod_or_pack + '.' + ext):
- return mod_or_pack + '.' + ext
- return None
diff --git a/chromium/third_party/logilab/logilab/common/optik_ext.py b/chromium/third_party/logilab/logilab/common/optik_ext.py
deleted file mode 100644
index 1fd2a7f8cc0..00000000000
--- a/chromium/third_party/logilab/logilab/common/optik_ext.py
+++ /dev/null
@@ -1,392 +0,0 @@
-# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""Add an abstraction level to transparently import optik classes from optparse
-(python >= 2.3) or the optik package.
-
-It also defines three new types for optik/optparse command line parser :
-
- * regexp
- argument of this type will be converted using re.compile
- * csv
- argument of this type will be converted using split(',')
- * yn
- argument of this type will be true if 'y' or 'yes', false if 'n' or 'no'
- * named
- argument of this type are in the form <NAME>=<VALUE> or <NAME>:<VALUE>
- * password
- argument of this type wont be converted but this is used by other tools
- such as interactive prompt for configuration to double check value and
- use an invisible field
- * multiple_choice
- same as default "choice" type but multiple choices allowed
- * file
- argument of this type wont be converted but checked that the given file exists
- * color
- argument of this type wont be converted but checked its either a
- named color or a color specified using hexadecimal notation (preceded by a #)
- * time
- argument of this type will be converted to a float value in seconds
- according to time units (ms, s, min, h, d)
- * bytes
- argument of this type will be converted to a float value in bytes
- according to byte units (b, kb, mb, gb, tb)
-"""
-from __future__ import print_function
-
-__docformat__ = "restructuredtext en"
-
-import re
-import sys
-import time
-from copy import copy
-from os.path import exists
-
-# python >= 2.3
-from optparse import OptionParser as BaseParser, Option as BaseOption, \
- OptionGroup, OptionContainer, OptionValueError, OptionError, \
- Values, HelpFormatter, NO_DEFAULT, SUPPRESS_HELP
-
-try:
- from mx import DateTime
- HAS_MX_DATETIME = True
-except ImportError:
- HAS_MX_DATETIME = False
-
-from logilab.common.textutils import splitstrip, TIME_UNITS, BYTE_UNITS, \
- apply_units
-
-
-def check_regexp(option, opt, value):
- """check a regexp value by trying to compile it
- return the compiled regexp
- """
- if hasattr(value, 'pattern'):
- return value
- try:
- return re.compile(value)
- except ValueError:
- raise OptionValueError(
- "option %s: invalid regexp value: %r" % (opt, value))
-
-def check_csv(option, opt, value):
- """check a csv value by trying to split it
- return the list of separated values
- """
- if isinstance(value, (list, tuple)):
- return value
- try:
- return splitstrip(value)
- except ValueError:
- raise OptionValueError(
- "option %s: invalid csv value: %r" % (opt, value))
-
-def check_yn(option, opt, value):
- """check a yn value
- return true for yes and false for no
- """
- if isinstance(value, int):
- return bool(value)
- if value in ('y', 'yes'):
- return True
- if value in ('n', 'no'):
- return False
- msg = "option %s: invalid yn value %r, should be in (y, yes, n, no)"
- raise OptionValueError(msg % (opt, value))
-
-def check_named(option, opt, value):
- """check a named value
- return a dictionary containing (name, value) associations
- """
- if isinstance(value, dict):
- return value
- values = []
- for value in check_csv(option, opt, value):
- if value.find('=') != -1:
- values.append(value.split('=', 1))
- elif value.find(':') != -1:
- values.append(value.split(':', 1))
- if values:
- return dict(values)
- msg = "option %s: invalid named value %r, should be <NAME>=<VALUE> or \
-<NAME>:<VALUE>"
- raise OptionValueError(msg % (opt, value))
-
-def check_password(option, opt, value):
- """check a password value (can't be empty)
- """
- # no actual checking, monkey patch if you want more
- return value
-
-def check_file(option, opt, value):
- """check a file value
- return the filepath
- """
- if exists(value):
- return value
- msg = "option %s: file %r does not exist"
- raise OptionValueError(msg % (opt, value))
-
-# XXX use python datetime
-def check_date(option, opt, value):
- """check a file value
- return the filepath
- """
- try:
- return DateTime.strptime(value, "%Y/%m/%d")
- except DateTime.Error :
- raise OptionValueError(
- "expected format of %s is yyyy/mm/dd" % opt)
-
-def check_color(option, opt, value):
- """check a color value and returns it
- /!\ does *not* check color labels (like 'red', 'green'), only
- checks hexadecimal forms
- """
- # Case (1) : color label, we trust the end-user
- if re.match('[a-z0-9 ]+$', value, re.I):
- return value
- # Case (2) : only accepts hexadecimal forms
- if re.match('#[a-f0-9]{6}', value, re.I):
- return value
- # Else : not a color label neither a valid hexadecimal form => error
- msg = "option %s: invalid color : %r, should be either hexadecimal \
- value or predefined color"
- raise OptionValueError(msg % (opt, value))
-
-def check_time(option, opt, value):
- if isinstance(value, (int, long, float)):
- return value
- return apply_units(value, TIME_UNITS)
-
-def check_bytes(option, opt, value):
- if hasattr(value, '__int__'):
- return value
- return apply_units(value, BYTE_UNITS)
-
-
-class Option(BaseOption):
- """override optik.Option to add some new option types
- """
- TYPES = BaseOption.TYPES + ('regexp', 'csv', 'yn', 'named', 'password',
- 'multiple_choice', 'file', 'color',
- 'time', 'bytes')
- ATTRS = BaseOption.ATTRS + ['hide', 'level']
- TYPE_CHECKER = copy(BaseOption.TYPE_CHECKER)
- TYPE_CHECKER['regexp'] = check_regexp
- TYPE_CHECKER['csv'] = check_csv
- TYPE_CHECKER['yn'] = check_yn
- TYPE_CHECKER['named'] = check_named
- TYPE_CHECKER['multiple_choice'] = check_csv
- TYPE_CHECKER['file'] = check_file
- TYPE_CHECKER['color'] = check_color
- TYPE_CHECKER['password'] = check_password
- TYPE_CHECKER['time'] = check_time
- TYPE_CHECKER['bytes'] = check_bytes
- if HAS_MX_DATETIME:
- TYPES += ('date',)
- TYPE_CHECKER['date'] = check_date
-
- def __init__(self, *opts, **attrs):
- BaseOption.__init__(self, *opts, **attrs)
- if hasattr(self, "hide") and self.hide:
- self.help = SUPPRESS_HELP
-
- def _check_choice(self):
- """FIXME: need to override this due to optik misdesign"""
- if self.type in ("choice", "multiple_choice"):
- if self.choices is None:
- raise OptionError(
- "must supply a list of choices for type 'choice'", self)
- elif not isinstance(self.choices, (tuple, list)):
- raise OptionError(
- "choices must be a list of strings ('%s' supplied)"
- % str(type(self.choices)).split("'")[1], self)
- elif self.choices is not None:
- raise OptionError(
- "must not supply choices for type %r" % self.type, self)
- BaseOption.CHECK_METHODS[2] = _check_choice
-
-
- def process(self, opt, value, values, parser):
- # First, convert the value(s) to the right type. Howl if any
- # value(s) are bogus.
- value = self.convert_value(opt, value)
- if self.type == 'named':
- existant = getattr(values, self.dest)
- if existant:
- existant.update(value)
- value = existant
- # And then take whatever action is expected of us.
- # This is a separate method to make life easier for
- # subclasses to add new actions.
- return self.take_action(
- self.action, self.dest, opt, value, values, parser)
-
-
-class OptionParser(BaseParser):
- """override optik.OptionParser to use our Option class
- """
- def __init__(self, option_class=Option, *args, **kwargs):
- BaseParser.__init__(self, option_class=Option, *args, **kwargs)
-
- def format_option_help(self, formatter=None):
- if formatter is None:
- formatter = self.formatter
- outputlevel = getattr(formatter, 'output_level', 0)
- formatter.store_option_strings(self)
- result = []
- result.append(formatter.format_heading("Options"))
- formatter.indent()
- if self.option_list:
- result.append(OptionContainer.format_option_help(self, formatter))
- result.append("\n")
- for group in self.option_groups:
- if group.level <= outputlevel and (
- group.description or level_options(group, outputlevel)):
- result.append(group.format_help(formatter))
- result.append("\n")
- formatter.dedent()
- # Drop the last "\n", or the header if no options or option groups:
- return "".join(result[:-1])
-
-
-OptionGroup.level = 0
-
-def level_options(group, outputlevel):
- return [option for option in group.option_list
- if (getattr(option, 'level', 0) or 0) <= outputlevel
- and not option.help is SUPPRESS_HELP]
-
-def format_option_help(self, formatter):
- result = []
- outputlevel = getattr(formatter, 'output_level', 0) or 0
- for option in level_options(self, outputlevel):
- result.append(formatter.format_option(option))
- return "".join(result)
-OptionContainer.format_option_help = format_option_help
-
-
-class ManHelpFormatter(HelpFormatter):
- """Format help using man pages ROFF format"""
-
- def __init__ (self,
- indent_increment=0,
- max_help_position=24,
- width=79,
- short_first=0):
- HelpFormatter.__init__ (
- self, indent_increment, max_help_position, width, short_first)
-
- def format_heading(self, heading):
- return '.SH %s\n' % heading.upper()
-
- def format_description(self, description):
- return description
-
- def format_option(self, option):
- try:
- optstring = option.option_strings
- except AttributeError:
- optstring = self.format_option_strings(option)
- if option.help:
- help_text = self.expand_default(option)
- help = ' '.join([l.strip() for l in help_text.splitlines()])
- else:
- help = ''
- return '''.IP "%s"
-%s
-''' % (optstring, help)
-
- def format_head(self, optparser, pkginfo, section=1):
- long_desc = ""
- try:
- pgm = optparser._get_prog_name()
- except AttributeError:
- # py >= 2.4.X (dunno which X exactly, at least 2)
- pgm = optparser.get_prog_name()
- short_desc = self.format_short_description(pgm, pkginfo.description)
- if hasattr(pkginfo, "long_desc"):
- long_desc = self.format_long_description(pgm, pkginfo.long_desc)
- return '%s\n%s\n%s\n%s' % (self.format_title(pgm, section),
- short_desc, self.format_synopsis(pgm),
- long_desc)
-
- def format_title(self, pgm, section):
- date = '-'.join([str(num) for num in time.localtime()[:3]])
- return '.TH %s %s "%s" %s' % (pgm, section, date, pgm)
-
- def format_short_description(self, pgm, short_desc):
- return '''.SH NAME
-.B %s
-\- %s
-''' % (pgm, short_desc.strip())
-
- def format_synopsis(self, pgm):
- return '''.SH SYNOPSIS
-.B %s
-[
-.I OPTIONS
-] [
-.I <arguments>
-]
-''' % pgm
-
- def format_long_description(self, pgm, long_desc):
- long_desc = '\n'.join([line.lstrip()
- for line in long_desc.splitlines()])
- long_desc = long_desc.replace('\n.\n', '\n\n')
- if long_desc.lower().startswith(pgm):
- long_desc = long_desc[len(pgm):]
- return '''.SH DESCRIPTION
-.B %s
-%s
-''' % (pgm, long_desc.strip())
-
- def format_tail(self, pkginfo):
- tail = '''.SH SEE ALSO
-/usr/share/doc/pythonX.Y-%s/
-
-.SH BUGS
-Please report bugs on the project\'s mailing list:
-%s
-
-.SH AUTHOR
-%s <%s>
-''' % (getattr(pkginfo, 'debian_name', pkginfo.modname),
- pkginfo.mailinglist, pkginfo.author, pkginfo.author_email)
-
- if hasattr(pkginfo, "copyright"):
- tail += '''
-.SH COPYRIGHT
-%s
-''' % pkginfo.copyright
-
- return tail
-
-def generate_manpage(optparser, pkginfo, section=1, stream=sys.stdout, level=0):
- """generate a man page from an optik parser"""
- formatter = ManHelpFormatter()
- formatter.output_level = level
- formatter.parser = optparser
- print(formatter.format_head(optparser, pkginfo, section), file=stream)
- print(optparser.format_option_help(formatter), file=stream)
- print(formatter.format_tail(pkginfo), file=stream)
-
-
-__all__ = ('OptionParser', 'Option', 'OptionGroup', 'OptionValueError',
- 'Values')
diff --git a/chromium/third_party/logilab/logilab/common/optparser.py b/chromium/third_party/logilab/logilab/common/optparser.py
deleted file mode 100644
index aa17750ed42..00000000000
--- a/chromium/third_party/logilab/logilab/common/optparser.py
+++ /dev/null
@@ -1,92 +0,0 @@
-# -*- coding: utf-8 -*-
-# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""Extend OptionParser with commands.
-
-Example:
-
->>> parser = OptionParser()
->>> parser.usage = '%prog COMMAND [options] <arg> ...'
->>> parser.add_command('build', 'mymod.build')
->>> parser.add_command('clean', run_clean, add_opt_clean)
->>> run, options, args = parser.parse_command(sys.argv[1:])
->>> return run(options, args[1:])
-
-With mymod.build that defines two functions run and add_options
-"""
-from __future__ import print_function
-
-__docformat__ = "restructuredtext en"
-
-from warnings import warn
-warn('lgc.optparser module is deprecated, use lgc.clcommands instead', DeprecationWarning,
- stacklevel=2)
-
-import sys
-import optparse
-
-class OptionParser(optparse.OptionParser):
-
- def __init__(self, *args, **kwargs):
- optparse.OptionParser.__init__(self, *args, **kwargs)
- self._commands = {}
- self.min_args, self.max_args = 0, 1
-
- def add_command(self, name, mod_or_funcs, help=''):
- """name of the command, name of module or tuple of functions
- (run, add_options)
- """
- assert isinstance(mod_or_funcs, str) or isinstance(mod_or_funcs, tuple), \
- "mod_or_funcs has to be a module name or a tuple of functions"
- self._commands[name] = (mod_or_funcs, help)
-
- def print_main_help(self):
- optparse.OptionParser.print_help(self)
- print('\ncommands:')
- for cmdname, (_, help) in self._commands.items():
- print('% 10s - %s' % (cmdname, help))
-
- def parse_command(self, args):
- if len(args) == 0:
- self.print_main_help()
- sys.exit(1)
- cmd = args[0]
- args = args[1:]
- if cmd not in self._commands:
- if cmd in ('-h', '--help'):
- self.print_main_help()
- sys.exit(0)
- elif self.version is not None and cmd == "--version":
- self.print_version()
- sys.exit(0)
- self.error('unknown command')
- self.prog = '%s %s' % (self.prog, cmd)
- mod_or_f, help = self._commands[cmd]
- # optparse inserts self.description between usage and options help
- self.description = help
- if isinstance(mod_or_f, str):
- exec('from %s import run, add_options' % mod_or_f)
- else:
- run, add_options = mod_or_f
- add_options(self)
- (options, args) = self.parse_args(args)
- if not (self.min_args <= len(args) <= self.max_args):
- self.error('incorrect number of arguments')
- return run, options, args
-
-
diff --git a/chromium/third_party/logilab/logilab/common/proc.py b/chromium/third_party/logilab/logilab/common/proc.py
deleted file mode 100644
index c27356c6b88..00000000000
--- a/chromium/third_party/logilab/logilab/common/proc.py
+++ /dev/null
@@ -1,277 +0,0 @@
-# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""module providing:
-* process information (linux specific: rely on /proc)
-* a class for resource control (memory / time / cpu time)
-
-This module doesn't work on windows platforms (only tested on linux)
-
-:organization: Logilab
-
-
-
-"""
-__docformat__ = "restructuredtext en"
-
-import os
-import stat
-from resource import getrlimit, setrlimit, RLIMIT_CPU, RLIMIT_AS
-from signal import signal, SIGXCPU, SIGKILL, SIGUSR2, SIGUSR1
-from threading import Timer, currentThread, Thread, Event
-from time import time
-
-from logilab.common.tree import Node
-
-class NoSuchProcess(Exception): pass
-
-def proc_exists(pid):
- """check the a pid is registered in /proc
- raise NoSuchProcess exception if not
- """
- if not os.path.exists('/proc/%s' % pid):
- raise NoSuchProcess()
-
-PPID = 3
-UTIME = 13
-STIME = 14
-CUTIME = 15
-CSTIME = 16
-VSIZE = 22
-
-class ProcInfo(Node):
- """provide access to process information found in /proc"""
-
- def __init__(self, pid):
- self.pid = int(pid)
- Node.__init__(self, self.pid)
- proc_exists(self.pid)
- self.file = '/proc/%s/stat' % self.pid
- self.ppid = int(self.status()[PPID])
-
- def memory_usage(self):
- """return the memory usage of the process in Ko"""
- try :
- return int(self.status()[VSIZE])
- except IOError:
- return 0
-
- def lineage_memory_usage(self):
- return self.memory_usage() + sum([child.lineage_memory_usage()
- for child in self.children])
-
- def time(self, children=0):
- """return the number of jiffies that this process has been scheduled
- in user and kernel mode"""
- status = self.status()
- time = int(status[UTIME]) + int(status[STIME])
- if children:
- time += int(status[CUTIME]) + int(status[CSTIME])
- return time
-
- def status(self):
- """return the list of fields found in /proc/<pid>/stat"""
- return open(self.file).read().split()
-
- def name(self):
- """return the process name found in /proc/<pid>/stat
- """
- return self.status()[1].strip('()')
-
- def age(self):
- """return the age of the process
- """
- return os.stat(self.file)[stat.ST_MTIME]
-
-class ProcInfoLoader:
- """manage process information"""
-
- def __init__(self):
- self._loaded = {}
-
- def list_pids(self):
- """return a list of existent process ids"""
- for subdir in os.listdir('/proc'):
- if subdir.isdigit():
- yield int(subdir)
-
- def load(self, pid):
- """get a ProcInfo object for a given pid"""
- pid = int(pid)
- try:
- return self._loaded[pid]
- except KeyError:
- procinfo = ProcInfo(pid)
- procinfo.manager = self
- self._loaded[pid] = procinfo
- return procinfo
-
-
- def load_all(self):
- """load all processes information"""
- for pid in self.list_pids():
- try:
- procinfo = self.load(pid)
- if procinfo.parent is None and procinfo.ppid:
- pprocinfo = self.load(procinfo.ppid)
- pprocinfo.append(procinfo)
- except NoSuchProcess:
- pass
-
-
-try:
- class ResourceError(BaseException):
- """Error raise when resource limit is reached"""
- limit = "Unknown Resource Limit"
-except NameError:
- class ResourceError(Exception):
- """Error raise when resource limit is reached"""
- limit = "Unknown Resource Limit"
-
-
-class XCPUError(ResourceError):
- """Error raised when CPU Time limit is reached"""
- limit = "CPU Time"
-
-class LineageMemoryError(ResourceError):
- """Error raised when the total amount of memory used by a process and
- it's child is reached"""
- limit = "Lineage total Memory"
-
-class TimeoutError(ResourceError):
- """Error raised when the process is running for to much time"""
- limit = "Real Time"
-
-# Can't use subclass because the StandardError MemoryError raised
-RESOURCE_LIMIT_EXCEPTION = (ResourceError, MemoryError)
-
-
-class MemorySentinel(Thread):
- """A class checking a process don't use too much memory in a separated
- daemonic thread
- """
- def __init__(self, interval, memory_limit, gpid=os.getpid()):
- Thread.__init__(self, target=self._run, name="Test.Sentinel")
- self.memory_limit = memory_limit
- self._stop = Event()
- self.interval = interval
- self.setDaemon(True)
- self.gpid = gpid
-
- def stop(self):
- """stop ap"""
- self._stop.set()
-
- def _run(self):
- pil = ProcInfoLoader()
- while not self._stop.isSet():
- if self.memory_limit <= pil.load(self.gpid).lineage_memory_usage():
- os.killpg(self.gpid, SIGUSR1)
- self._stop.wait(self.interval)
-
-
-class ResourceController:
-
- def __init__(self, max_cpu_time=None, max_time=None, max_memory=None,
- max_reprieve=60):
- if SIGXCPU == -1:
- raise RuntimeError("Unsupported platform")
- self.max_time = max_time
- self.max_memory = max_memory
- self.max_cpu_time = max_cpu_time
- self._reprieve = max_reprieve
- self._timer = None
- self._msentinel = None
- self._old_max_memory = None
- self._old_usr1_hdlr = None
- self._old_max_cpu_time = None
- self._old_usr2_hdlr = None
- self._old_sigxcpu_hdlr = None
- self._limit_set = 0
- self._abort_try = 0
- self._start_time = None
- self._elapse_time = 0
-
- def _hangle_sig_timeout(self, sig, frame):
- raise TimeoutError()
-
- def _hangle_sig_memory(self, sig, frame):
- if self._abort_try < self._reprieve:
- self._abort_try += 1
- raise LineageMemoryError("Memory limit reached")
- else:
- os.killpg(os.getpid(), SIGKILL)
-
- def _handle_sigxcpu(self, sig, frame):
- if self._abort_try < self._reprieve:
- self._abort_try += 1
- raise XCPUError("Soft CPU time limit reached")
- else:
- os.killpg(os.getpid(), SIGKILL)
-
- def _time_out(self):
- if self._abort_try < self._reprieve:
- self._abort_try += 1
- os.killpg(os.getpid(), SIGUSR2)
- if self._limit_set > 0:
- self._timer = Timer(1, self._time_out)
- self._timer.start()
- else:
- os.killpg(os.getpid(), SIGKILL)
-
- def setup_limit(self):
- """set up the process limit"""
- assert currentThread().getName() == 'MainThread'
- os.setpgrp()
- if self._limit_set <= 0:
- if self.max_time is not None:
- self._old_usr2_hdlr = signal(SIGUSR2, self._hangle_sig_timeout)
- self._timer = Timer(max(1, int(self.max_time) - self._elapse_time),
- self._time_out)
- self._start_time = int(time())
- self._timer.start()
- if self.max_cpu_time is not None:
- self._old_max_cpu_time = getrlimit(RLIMIT_CPU)
- cpu_limit = (int(self.max_cpu_time), self._old_max_cpu_time[1])
- self._old_sigxcpu_hdlr = signal(SIGXCPU, self._handle_sigxcpu)
- setrlimit(RLIMIT_CPU, cpu_limit)
- if self.max_memory is not None:
- self._msentinel = MemorySentinel(1, int(self.max_memory) )
- self._old_max_memory = getrlimit(RLIMIT_AS)
- self._old_usr1_hdlr = signal(SIGUSR1, self._hangle_sig_memory)
- as_limit = (int(self.max_memory), self._old_max_memory[1])
- setrlimit(RLIMIT_AS, as_limit)
- self._msentinel.start()
- self._limit_set += 1
-
- def clean_limit(self):
- """reinstall the old process limit"""
- if self._limit_set > 0:
- if self.max_time is not None:
- self._timer.cancel()
- self._elapse_time += int(time())-self._start_time
- self._timer = None
- signal(SIGUSR2, self._old_usr2_hdlr)
- if self.max_cpu_time is not None:
- setrlimit(RLIMIT_CPU, self._old_max_cpu_time)
- signal(SIGXCPU, self._old_sigxcpu_hdlr)
- if self.max_memory is not None:
- self._msentinel.stop()
- self._msentinel = None
- setrlimit(RLIMIT_AS, self._old_max_memory)
- signal(SIGUSR1, self._old_usr1_hdlr)
- self._limit_set -= 1
diff --git a/chromium/third_party/logilab/logilab/common/pyro_ext.py b/chromium/third_party/logilab/logilab/common/pyro_ext.py
deleted file mode 100644
index 5204b1b266d..00000000000
--- a/chromium/third_party/logilab/logilab/common/pyro_ext.py
+++ /dev/null
@@ -1,180 +0,0 @@
-# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""Python Remote Object utilities
-
-Main functions available:
-
-* `register_object` to expose arbitrary object through pyro using delegation
- approach and register it in the nameserver.
-* `ns_unregister` unregister an object identifier from the nameserver.
-* `ns_get_proxy` get a pyro proxy from a nameserver object identifier.
-"""
-
-__docformat__ = "restructuredtext en"
-
-import logging
-import tempfile
-
-from Pyro import core, naming, errors, util, config
-
-_LOGGER = logging.getLogger('pyro')
-_MARKER = object()
-
-config.PYRO_STORAGE = tempfile.gettempdir()
-
-def ns_group_and_id(idstr, defaultnsgroup=_MARKER):
- try:
- nsgroup, nsid = idstr.rsplit('.', 1)
- except ValueError:
- if defaultnsgroup is _MARKER:
- nsgroup = config.PYRO_NS_DEFAULTGROUP
- else:
- nsgroup = defaultnsgroup
- nsid = idstr
- if nsgroup is not None and not nsgroup.startswith(':'):
- nsgroup = ':' + nsgroup
- return nsgroup, nsid
-
-def host_and_port(hoststr):
- if not hoststr:
- return None, None
- try:
- hoststr, port = hoststr.split(':')
- except ValueError:
- port = None
- else:
- port = int(port)
- return hoststr, port
-
-_DAEMONS = {}
-_PYRO_OBJS = {}
-def _get_daemon(daemonhost, start=True):
- if not daemonhost in _DAEMONS:
- if not start:
- raise Exception('no daemon for %s' % daemonhost)
- if not _DAEMONS:
- core.initServer(banner=0)
- host, port = host_and_port(daemonhost)
- daemon = core.Daemon(host=host, port=port)
- _DAEMONS[daemonhost] = daemon
- return _DAEMONS[daemonhost]
-
-
-def locate_ns(nshost):
- """locate and return the pyro name server to the daemon"""
- core.initClient(banner=False)
- return naming.NameServerLocator().getNS(*host_and_port(nshost))
-
-
-def register_object(object, nsid, defaultnsgroup=_MARKER,
- daemonhost=None, nshost=None, use_pyrons=True):
- """expose the object as a pyro object and register it in the name-server
-
- if use_pyrons is False, then the object is exposed, but no
- attempt to register it to a pyro nameserver is made.
-
- return the pyro daemon object
- """
- nsgroup, nsid = ns_group_and_id(nsid, defaultnsgroup)
- daemon = _get_daemon(daemonhost)
- if use_pyrons:
- nsd = locate_ns(nshost)
- # make sure our namespace group exists
- try:
- nsd.createGroup(nsgroup)
- except errors.NamingError:
- pass
- daemon.useNameServer(nsd)
- # use Delegation approach
- impl = core.ObjBase()
- impl.delegateTo(object)
- qnsid = '%s.%s' % (nsgroup, nsid)
- uri = daemon.connect(impl, qnsid)
- _PYRO_OBJS[qnsid] = str(uri)
- _LOGGER.info('registered %s a pyro object using group %s and id %s',
- object, nsgroup, nsid)
- return daemon
-
-def get_object_uri(qnsid):
- return _PYRO_OBJS[qnsid]
-
-def ns_unregister(nsid, defaultnsgroup=_MARKER, nshost=None):
- """unregister the object with the given nsid from the pyro name server"""
- nsgroup, nsid = ns_group_and_id(nsid, defaultnsgroup)
- try:
- nsd = locate_ns(nshost)
- except errors.PyroError as ex:
- # name server not responding
- _LOGGER.error('can\'t locate pyro name server: %s', ex)
- else:
- try:
- nsd.unregister('%s.%s' % (nsgroup, nsid))
- _LOGGER.info('%s unregistered from pyro name server', nsid)
- except errors.NamingError:
- _LOGGER.warning('%s not registered in pyro name server', nsid)
-
-
-def ns_reregister(nsid, defaultnsgroup=_MARKER, nshost=None):
- """reregister a pyro object into the name server. You only have to specify
- the name-server id of the object (though you MUST have gone through
- `register_object` for the given object previously).
-
- This is especially useful for long running server while the name server may
- have been restarted, and its records lost.
- """
- nsgroup, nsid = ns_group_and_id(nsid, defaultnsgroup)
- qnsid = '%s.%s' % (nsgroup, nsid)
- nsd = locate_ns(nshost)
- try:
- nsd.unregister(qnsid)
- except errors.NamingError:
- # make sure our namespace group exists
- try:
- nsd.createGroup(nsgroup)
- except errors.NamingError:
- pass
- nsd.register(qnsid, _PYRO_OBJS[qnsid])
-
-def ns_get_proxy(nsid, defaultnsgroup=_MARKER, nshost=None):
- """
- if nshost is None, the nameserver is found by a broadcast.
- """
- # resolve the Pyro object
- nsgroup, nsid = ns_group_and_id(nsid, defaultnsgroup)
- try:
- nsd = locate_ns(nshost)
- pyrouri = nsd.resolve('%s.%s' % (nsgroup, nsid))
- except errors.ProtocolError as ex:
- raise errors.PyroError(
- 'Could not connect to the Pyro name server (host: %s)' % nshost)
- except errors.NamingError:
- raise errors.PyroError(
- 'Could not get proxy for %s (not registered in Pyro), '
- 'you may have to restart your server-side application' % nsid)
- return core.getProxyForURI(pyrouri)
-
-def get_proxy(pyro_uri):
- """get a proxy for the passed pyro uri without using a nameserver
- """
- return core.getProxyForURI(pyro_uri)
-
-def set_pyro_log_threshold(level):
- pyrologger = logging.getLogger('Pyro.%s' % str(id(util.Log)))
- # remove handlers so only the root handler is used
- pyrologger.handlers = []
- pyrologger.setLevel(level)
diff --git a/chromium/third_party/logilab/logilab/common/pytest.py b/chromium/third_party/logilab/logilab/common/pytest.py
deleted file mode 100644
index 58515a9d676..00000000000
--- a/chromium/third_party/logilab/logilab/common/pytest.py
+++ /dev/null
@@ -1,1199 +0,0 @@
-# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""pytest is a tool that eases test running and debugging.
-
-To be able to use pytest, you should either write tests using
-the logilab.common.testlib's framework or the unittest module of the
-Python's standard library.
-
-You can customize pytest's behaviour by defining a ``pytestconf.py`` file
-somewhere in your test directory. In this file, you can add options or
-change the way tests are run.
-
-To add command line options, you must define a ``update_parser`` function in
-your ``pytestconf.py`` file. The function must accept a single parameter
-that will be the OptionParser's instance to customize.
-
-If you wish to customize the tester, you'll have to define a class named
-``CustomPyTester``. This class should extend the default `PyTester` class
-defined in the pytest module. Take a look at the `PyTester` and `DjangoTester`
-classes for more information about what can be done.
-
-For instance, if you wish to add a custom -l option to specify a loglevel, you
-could define the following ``pytestconf.py`` file ::
-
- import logging
- from logilab.common.pytest import PyTester
-
- def update_parser(parser):
- parser.add_option('-l', '--loglevel', dest='loglevel', action='store',
- choices=('debug', 'info', 'warning', 'error', 'critical'),
- default='critical', help="the default log level possible choices are "
- "('debug', 'info', 'warning', 'error', 'critical')")
- return parser
-
-
- class CustomPyTester(PyTester):
- def __init__(self, cvg, options):
- super(CustomPyTester, self).__init__(cvg, options)
- loglevel = options.loglevel.upper()
- logger = logging.getLogger('erudi')
- logger.setLevel(logging.getLevelName(loglevel))
-
-
-In your TestCase class you can then get the value of a specific option with
-the ``optval`` method::
-
- class MyTestCase(TestCase):
- def test_foo(self):
- loglevel = self.optval('loglevel')
- # ...
-
-
-You can also tag your tag your test for fine filtering
-
-With those tag::
-
- from logilab.common.testlib import tag, TestCase
-
- class Exemple(TestCase):
-
- @tag('rouge', 'carre')
- def toto(self):
- pass
-
- @tag('carre', 'vert')
- def tata(self):
- pass
-
- @tag('rouge')
- def titi(test):
- pass
-
-you can filter the function with a simple python expression
-
- * ``toto`` and ``titi`` match ``rouge``
- * ``toto``, ``tata`` and ``titi``, match ``rouge or carre``
- * ``tata`` and ``titi`` match``rouge ^ carre``
- * ``titi`` match ``rouge and not carre``
-"""
-
-from __future__ import print_function
-
-__docformat__ = "restructuredtext en"
-
-PYTEST_DOC = """%prog [OPTIONS] [testfile [testpattern]]
-
-examples:
-
-pytest path/to/mytests.py
-pytest path/to/mytests.py TheseTests
-pytest path/to/mytests.py TheseTests.test_thisone
-pytest path/to/mytests.py -m '(not long and database) or regr'
-
-pytest one (will run both test_thisone and test_thatone)
-pytest path/to/mytests.py -s not (will skip test_notthisone)
-"""
-
-ENABLE_DBC = False
-FILE_RESTART = ".pytest.restart"
-
-import os, sys, re
-import os.path as osp
-from time import time, clock
-import warnings
-import types
-from inspect import isgeneratorfunction, isclass
-from contextlib import contextmanager
-
-from logilab.common.fileutils import abspath_listdir
-from logilab.common import textutils
-from logilab.common import testlib, STD_BLACKLIST
-# use the same unittest module as testlib
-from logilab.common.testlib import unittest, start_interactive_mode
-from logilab.common.deprecation import deprecated
-import doctest
-
-import unittest as unittest_legacy
-if not getattr(unittest_legacy, "__package__", None):
- try:
- import unittest2.suite as unittest_suite
- except ImportError:
- sys.exit("You have to install python-unittest2 to use this module")
-else:
- import unittest.suite as unittest_suite
-
-try:
- import django
- from logilab.common.modutils import modpath_from_file, load_module_from_modpath
- DJANGO_FOUND = True
-except ImportError:
- DJANGO_FOUND = False
-
-CONF_FILE = 'pytestconf.py'
-
-## coverage pausing tools
-
-@contextmanager
-def replace_trace(trace=None):
- """A context manager that temporary replaces the trace function"""
- oldtrace = sys.gettrace()
- sys.settrace(trace)
- try:
- yield
- finally:
- # specific hack to work around a bug in pycoverage, see
- # https://bitbucket.org/ned/coveragepy/issue/123
- if (oldtrace is not None and not callable(oldtrace) and
- hasattr(oldtrace, 'pytrace')):
- oldtrace = oldtrace.pytrace
- sys.settrace(oldtrace)
-
-
-def pause_trace():
- """A context manager that temporary pauses any tracing"""
- return replace_trace()
-
-class TraceController(object):
- ctx_stack = []
-
- @classmethod
- @deprecated('[lgc 0.63.1] Use the pause_trace() context manager')
- def pause_tracing(cls):
- cls.ctx_stack.append(pause_trace())
- cls.ctx_stack[-1].__enter__()
-
- @classmethod
- @deprecated('[lgc 0.63.1] Use the pause_trace() context manager')
- def resume_tracing(cls):
- cls.ctx_stack.pop().__exit__(None, None, None)
-
-
-pause_tracing = TraceController.pause_tracing
-resume_tracing = TraceController.resume_tracing
-
-
-def nocoverage(func):
- """Function decorator that pauses tracing functions"""
- if hasattr(func, 'uncovered'):
- return func
- func.uncovered = True
-
- def not_covered(*args, **kwargs):
- with pause_trace():
- return func(*args, **kwargs)
- not_covered.uncovered = True
- return not_covered
-
-## end of coverage pausing tools
-
-
-TESTFILE_RE = re.compile("^((unit)?test.*|smoketest)\.py$")
-def this_is_a_testfile(filename):
- """returns True if `filename` seems to be a test file"""
- return TESTFILE_RE.match(osp.basename(filename))
-
-TESTDIR_RE = re.compile("^(unit)?tests?$")
-def this_is_a_testdir(dirpath):
- """returns True if `filename` seems to be a test directory"""
- return TESTDIR_RE.match(osp.basename(dirpath))
-
-
-def load_pytest_conf(path, parser):
- """loads a ``pytestconf.py`` file and update default parser
- and / or tester.
- """
- namespace = {}
- exec(open(path, 'rb').read(), namespace)
- if 'update_parser' in namespace:
- namespace['update_parser'](parser)
- return namespace.get('CustomPyTester', PyTester)
-
-
-def project_root(parser, projdir=os.getcwd()):
- """try to find project's root and add it to sys.path"""
- previousdir = curdir = osp.abspath(projdir)
- testercls = PyTester
- conf_file_path = osp.join(curdir, CONF_FILE)
- if osp.isfile(conf_file_path):
- testercls = load_pytest_conf(conf_file_path, parser)
- while this_is_a_testdir(curdir) or \
- osp.isfile(osp.join(curdir, '__init__.py')):
- newdir = osp.normpath(osp.join(curdir, os.pardir))
- if newdir == curdir:
- break
- previousdir = curdir
- curdir = newdir
- conf_file_path = osp.join(curdir, CONF_FILE)
- if osp.isfile(conf_file_path):
- testercls = load_pytest_conf(conf_file_path, parser)
- return previousdir, testercls
-
-
-class GlobalTestReport(object):
- """this class holds global test statistics"""
- def __init__(self):
- self.ran = 0
- self.skipped = 0
- self.failures = 0
- self.errors = 0
- self.ttime = 0
- self.ctime = 0
- self.modulescount = 0
- self.errmodules = []
-
- def feed(self, filename, testresult, ttime, ctime):
- """integrates new test information into internal statistics"""
- ran = testresult.testsRun
- self.ran += ran
- self.skipped += len(getattr(testresult, 'skipped', ()))
- self.failures += len(testresult.failures)
- self.errors += len(testresult.errors)
- self.ttime += ttime
- self.ctime += ctime
- self.modulescount += 1
- if not testresult.wasSuccessful():
- problems = len(testresult.failures) + len(testresult.errors)
- self.errmodules.append((filename[:-3], problems, ran))
-
- def failed_to_test_module(self, filename):
- """called when the test module could not be imported by unittest
- """
- self.errors += 1
- self.modulescount += 1
- self.ran += 1
- self.errmodules.append((filename[:-3], 1, 1))
-
- def skip_module(self, filename):
- self.modulescount += 1
- self.ran += 1
- self.errmodules.append((filename[:-3], 0, 0))
-
- def __str__(self):
- """this is just presentation stuff"""
- line1 = ['Ran %s test cases in %.2fs (%.2fs CPU)'
- % (self.ran, self.ttime, self.ctime)]
- if self.errors:
- line1.append('%s errors' % self.errors)
- if self.failures:
- line1.append('%s failures' % self.failures)
- if self.skipped:
- line1.append('%s skipped' % self.skipped)
- modulesok = self.modulescount - len(self.errmodules)
- if self.errors or self.failures:
- line2 = '%s modules OK (%s failed)' % (modulesok,
- len(self.errmodules))
- descr = ', '.join(['%s [%s/%s]' % info for info in self.errmodules])
- line3 = '\nfailures: %s' % descr
- elif modulesok:
- line2 = 'All %s modules OK' % modulesok
- line3 = ''
- else:
- return ''
- return '%s\n%s%s' % (', '.join(line1), line2, line3)
-
-
-
-def remove_local_modules_from_sys(testdir):
- """remove all modules from cache that come from `testdir`
-
- This is used to avoid strange side-effects when using the
- testall() mode of pytest.
- For instance, if we run pytest on this tree::
-
- A/test/test_utils.py
- B/test/test_utils.py
-
- we **have** to clean sys.modules to make sure the correct test_utils
- module is ran in B
- """
- for modname, mod in list(sys.modules.items()):
- if mod is None:
- continue
- if not hasattr(mod, '__file__'):
- # this is the case of some built-in modules like sys, imp, marshal
- continue
- modfile = mod.__file__
- # if modfile is not an absolute path, it was probably loaded locally
- # during the tests
- if not osp.isabs(modfile) or modfile.startswith(testdir):
- del sys.modules[modname]
-
-
-
-class PyTester(object):
- """encapsulates testrun logic"""
-
- def __init__(self, cvg, options):
- self.report = GlobalTestReport()
- self.cvg = cvg
- self.options = options
- self.firstwrite = True
- self._errcode = None
-
- def show_report(self):
- """prints the report and returns appropriate exitcode"""
- # everything has been ran, print report
- print("*" * 79)
- print(self.report)
-
- def get_errcode(self):
- # errcode set explicitly
- if self._errcode is not None:
- return self._errcode
- return self.report.failures + self.report.errors
-
- def set_errcode(self, errcode):
- self._errcode = errcode
- errcode = property(get_errcode, set_errcode)
-
- def testall(self, exitfirst=False):
- """walks through current working directory, finds something
- which can be considered as a testdir and runs every test there
- """
- here = os.getcwd()
- for dirname, dirs, _ in os.walk(here):
- for skipped in STD_BLACKLIST:
- if skipped in dirs:
- dirs.remove(skipped)
- basename = osp.basename(dirname)
- if this_is_a_testdir(basename):
- print("going into", dirname)
- # we found a testdir, let's explore it !
- if not self.testonedir(dirname, exitfirst):
- break
- dirs[:] = []
- if self.report.ran == 0:
- print("no test dir found testing here:", here)
- # if no test was found during the visit, consider
- # the local directory as a test directory even if
- # it doesn't have a traditional test directory name
- self.testonedir(here)
-
- def testonedir(self, testdir, exitfirst=False):
- """finds each testfile in the `testdir` and runs it
-
- return true when all tests has been executed, false if exitfirst and
- some test has failed.
- """
- for filename in abspath_listdir(testdir):
- if this_is_a_testfile(filename):
- if self.options.exitfirst and not self.options.restart:
- # overwrite restart file
- try:
- restartfile = open(FILE_RESTART, "w")
- restartfile.close()
- except Exception:
- print("Error while overwriting succeeded test file :",
- osp.join(os.getcwd(), FILE_RESTART),
- file=sys.__stderr__)
- raise
- # run test and collect information
- prog = self.testfile(filename, batchmode=True)
- if exitfirst and (prog is None or not prog.result.wasSuccessful()):
- return False
- self.firstwrite = True
- # clean local modules
- remove_local_modules_from_sys(testdir)
- return True
-
- def testfile(self, filename, batchmode=False):
- """runs every test in `filename`
-
- :param filename: an absolute path pointing to a unittest file
- """
- here = os.getcwd()
- dirname = osp.dirname(filename)
- if dirname:
- os.chdir(dirname)
- # overwrite restart file if it has not been done already
- if self.options.exitfirst and not self.options.restart and self.firstwrite:
- try:
- restartfile = open(FILE_RESTART, "w")
- restartfile.close()
- except Exception:
- print("Error while overwriting succeeded test file :",
- osp.join(os.getcwd(), FILE_RESTART), file=sys.__stderr__)
- raise
- modname = osp.basename(filename)[:-3]
- print((' %s ' % osp.basename(filename)).center(70, '='),
- file=sys.__stderr__)
- try:
- tstart, cstart = time(), clock()
- try:
- testprog = SkipAwareTestProgram(modname, batchmode=batchmode, cvg=self.cvg,
- options=self.options, outstream=sys.stderr)
- except KeyboardInterrupt:
- raise
- except SystemExit as exc:
- self.errcode = exc.code
- raise
- except testlib.SkipTest:
- print("Module skipped:", filename)
- self.report.skip_module(filename)
- return None
- except Exception:
- self.report.failed_to_test_module(filename)
- print('unhandled exception occurred while testing', modname,
- file=sys.stderr)
- import traceback
- traceback.print_exc(file=sys.stderr)
- return None
-
- tend, cend = time(), clock()
- ttime, ctime = (tend - tstart), (cend - cstart)
- self.report.feed(filename, testprog.result, ttime, ctime)
- return testprog
- finally:
- if dirname:
- os.chdir(here)
-
-
-
-class DjangoTester(PyTester):
-
- def load_django_settings(self, dirname):
- """try to find project's setting and load it"""
- curdir = osp.abspath(dirname)
- previousdir = curdir
- while not osp.isfile(osp.join(curdir, 'settings.py')) and \
- osp.isfile(osp.join(curdir, '__init__.py')):
- newdir = osp.normpath(osp.join(curdir, os.pardir))
- if newdir == curdir:
- raise AssertionError('could not find settings.py')
- previousdir = curdir
- curdir = newdir
- # late django initialization
- settings = load_module_from_modpath(modpath_from_file(osp.join(curdir, 'settings.py')))
- from django.core.management import setup_environ
- setup_environ(settings)
- settings.DEBUG = False
- self.settings = settings
- # add settings dir to pythonpath since it's the project's root
- if curdir not in sys.path:
- sys.path.insert(1, curdir)
-
- def before_testfile(self):
- # Those imports must be done **after** setup_environ was called
- from django.test.utils import setup_test_environment
- from django.test.utils import create_test_db
- setup_test_environment()
- create_test_db(verbosity=0)
- self.dbname = self.settings.TEST_DATABASE_NAME
-
- def after_testfile(self):
- # Those imports must be done **after** setup_environ was called
- from django.test.utils import teardown_test_environment
- from django.test.utils import destroy_test_db
- teardown_test_environment()
- print('destroying', self.dbname)
- destroy_test_db(self.dbname, verbosity=0)
-
- def testall(self, exitfirst=False):
- """walks through current working directory, finds something
- which can be considered as a testdir and runs every test there
- """
- for dirname, dirs, files in os.walk(os.getcwd()):
- for skipped in ('CVS', '.svn', '.hg'):
- if skipped in dirs:
- dirs.remove(skipped)
- if 'tests.py' in files:
- if not self.testonedir(dirname, exitfirst):
- break
- dirs[:] = []
- else:
- basename = osp.basename(dirname)
- if basename in ('test', 'tests'):
- print("going into", dirname)
- # we found a testdir, let's explore it !
- if not self.testonedir(dirname, exitfirst):
- break
- dirs[:] = []
-
- def testonedir(self, testdir, exitfirst=False):
- """finds each testfile in the `testdir` and runs it
-
- return true when all tests has been executed, false if exitfirst and
- some test has failed.
- """
- # special django behaviour : if tests are splitted in several files,
- # remove the main tests.py file and tests each test file separately
- testfiles = [fpath for fpath in abspath_listdir(testdir)
- if this_is_a_testfile(fpath)]
- if len(testfiles) > 1:
- try:
- testfiles.remove(osp.join(testdir, 'tests.py'))
- except ValueError:
- pass
- for filename in testfiles:
- # run test and collect information
- prog = self.testfile(filename, batchmode=True)
- if exitfirst and (prog is None or not prog.result.wasSuccessful()):
- return False
- # clean local modules
- remove_local_modules_from_sys(testdir)
- return True
-
- def testfile(self, filename, batchmode=False):
- """runs every test in `filename`
-
- :param filename: an absolute path pointing to a unittest file
- """
- here = os.getcwd()
- dirname = osp.dirname(filename)
- if dirname:
- os.chdir(dirname)
- self.load_django_settings(dirname)
- modname = osp.basename(filename)[:-3]
- print((' %s ' % osp.basename(filename)).center(70, '='),
- file=sys.stderr)
- try:
- try:
- tstart, cstart = time(), clock()
- self.before_testfile()
- testprog = SkipAwareTestProgram(modname, batchmode=batchmode, cvg=self.cvg)
- tend, cend = time(), clock()
- ttime, ctime = (tend - tstart), (cend - cstart)
- self.report.feed(filename, testprog.result, ttime, ctime)
- return testprog
- except SystemExit:
- raise
- except Exception as exc:
- import traceback
- traceback.print_exc()
- self.report.failed_to_test_module(filename)
- print('unhandled exception occurred while testing', modname)
- print('error: %s' % exc)
- return None
- finally:
- self.after_testfile()
- if dirname:
- os.chdir(here)
-
-
-def make_parser():
- """creates the OptionParser instance
- """
- from optparse import OptionParser
- parser = OptionParser(usage=PYTEST_DOC)
-
- parser.newargs = []
- def rebuild_cmdline(option, opt, value, parser):
- """carry the option to unittest_main"""
- parser.newargs.append(opt)
-
- def rebuild_and_store(option, opt, value, parser):
- """carry the option to unittest_main and store
- the value on current parser
- """
- parser.newargs.append(opt)
- setattr(parser.values, option.dest, True)
-
- def capture_and_rebuild(option, opt, value, parser):
- warnings.simplefilter('ignore', DeprecationWarning)
- rebuild_cmdline(option, opt, value, parser)
-
- # pytest options
- parser.add_option('-t', dest='testdir', default=None,
- help="directory where the tests will be found")
- parser.add_option('-d', dest='dbc', default=False,
- action="store_true", help="enable design-by-contract")
- # unittest_main options provided and passed through pytest
- parser.add_option('-v', '--verbose', callback=rebuild_cmdline,
- action="callback", help="Verbose output")
- parser.add_option('-i', '--pdb', callback=rebuild_and_store,
- dest="pdb", action="callback",
- help="Enable test failure inspection")
- parser.add_option('-x', '--exitfirst', callback=rebuild_and_store,
- dest="exitfirst", default=False,
- action="callback", help="Exit on first failure "
- "(only make sense when pytest run one test file)")
- parser.add_option('-R', '--restart', callback=rebuild_and_store,
- dest="restart", default=False,
- action="callback",
- help="Restart tests from where it failed (implies exitfirst) "
- "(only make sense if tests previously ran with exitfirst only)")
- parser.add_option('--color', callback=rebuild_cmdline,
- action="callback",
- help="colorize tracebacks")
- parser.add_option('-s', '--skip',
- # XXX: I wish I could use the callback action but it
- # doesn't seem to be able to get the value
- # associated to the option
- action="store", dest="skipped", default=None,
- help="test names matching this name will be skipped "
- "to skip several patterns, use commas")
- parser.add_option('-q', '--quiet', callback=rebuild_cmdline,
- action="callback", help="Minimal output")
- parser.add_option('-P', '--profile', default=None, dest='profile',
- help="Profile execution and store data in the given file")
- parser.add_option('-m', '--match', default=None, dest='tags_pattern',
- help="only execute test whose tag match the current pattern")
-
- if DJANGO_FOUND:
- parser.add_option('-J', '--django', dest='django', default=False,
- action="store_true",
- help='use pytest for django test cases')
- return parser
-
-
-def parseargs(parser):
- """Parse the command line and return (options processed), (options to pass to
- unittest_main()), (explicitfile or None).
- """
- # parse the command line
- options, args = parser.parse_args()
- filenames = [arg for arg in args if arg.endswith('.py')]
- if filenames:
- if len(filenames) > 1:
- parser.error("only one filename is acceptable")
- explicitfile = filenames[0]
- args.remove(explicitfile)
- else:
- explicitfile = None
- # someone wants DBC
- testlib.ENABLE_DBC = options.dbc
- newargs = parser.newargs
- if options.skipped:
- newargs.extend(['--skip', options.skipped])
- # restart implies exitfirst
- if options.restart:
- options.exitfirst = True
- # append additional args to the new sys.argv and let unittest_main
- # do the rest
- newargs += args
- return options, explicitfile
-
-
-
-def run():
- parser = make_parser()
- rootdir, testercls = project_root(parser)
- options, explicitfile = parseargs(parser)
- # mock a new command line
- sys.argv[1:] = parser.newargs
- cvg = None
- if not '' in sys.path:
- sys.path.insert(0, '')
- if DJANGO_FOUND and options.django:
- tester = DjangoTester(cvg, options)
- else:
- tester = testercls(cvg, options)
- if explicitfile:
- cmd, args = tester.testfile, (explicitfile,)
- elif options.testdir:
- cmd, args = tester.testonedir, (options.testdir, options.exitfirst)
- else:
- cmd, args = tester.testall, (options.exitfirst,)
- try:
- try:
- if options.profile:
- import hotshot
- prof = hotshot.Profile(options.profile)
- prof.runcall(cmd, *args)
- prof.close()
- print('profile data saved in', options.profile)
- else:
- cmd(*args)
- except SystemExit:
- raise
- except:
- import traceback
- traceback.print_exc()
- finally:
- tester.show_report()
- sys.exit(tester.errcode)
-
-class SkipAwareTestProgram(unittest.TestProgram):
- # XXX: don't try to stay close to unittest.py, use optparse
- USAGE = """\
-Usage: %(progName)s [options] [test] [...]
-
-Options:
- -h, --help Show this message
- -v, --verbose Verbose output
- -i, --pdb Enable test failure inspection
- -x, --exitfirst Exit on first failure
- -s, --skip skip test matching this pattern (no regexp for now)
- -q, --quiet Minimal output
- --color colorize tracebacks
-
- -m, --match Run only test whose tag match this pattern
-
- -P, --profile FILE: Run the tests using cProfile and saving results
- in FILE
-
-Examples:
- %(progName)s - run default set of tests
- %(progName)s MyTestSuite - run suite 'MyTestSuite'
- %(progName)s MyTestCase.testSomething - run MyTestCase.testSomething
- %(progName)s MyTestCase - run all 'test*' test methods
- in MyTestCase
-"""
- def __init__(self, module='__main__', defaultTest=None, batchmode=False,
- cvg=None, options=None, outstream=sys.stderr):
- self.batchmode = batchmode
- self.cvg = cvg
- self.options = options
- self.outstream = outstream
- super(SkipAwareTestProgram, self).__init__(
- module=module, defaultTest=defaultTest,
- testLoader=NonStrictTestLoader())
-
- def parseArgs(self, argv):
- self.pdbmode = False
- self.exitfirst = False
- self.skipped_patterns = []
- self.test_pattern = None
- self.tags_pattern = None
- self.colorize = False
- self.profile_name = None
- import getopt
- try:
- options, args = getopt.getopt(argv[1:], 'hHvixrqcp:s:m:P:',
- ['help', 'verbose', 'quiet', 'pdb',
- 'exitfirst', 'restart',
- 'skip=', 'color', 'match=', 'profile='])
- for opt, value in options:
- if opt in ('-h', '-H', '--help'):
- self.usageExit()
- if opt in ('-i', '--pdb'):
- self.pdbmode = True
- if opt in ('-x', '--exitfirst'):
- self.exitfirst = True
- if opt in ('-r', '--restart'):
- self.restart = True
- self.exitfirst = True
- if opt in ('-q', '--quiet'):
- self.verbosity = 0
- if opt in ('-v', '--verbose'):
- self.verbosity = 2
- if opt in ('-s', '--skip'):
- self.skipped_patterns = [pat.strip() for pat in
- value.split(', ')]
- if opt == '--color':
- self.colorize = True
- if opt in ('-m', '--match'):
- #self.tags_pattern = value
- self.options["tag_pattern"] = value
- if opt in ('-P', '--profile'):
- self.profile_name = value
- self.testLoader.skipped_patterns = self.skipped_patterns
- if len(args) == 0 and self.defaultTest is None:
- suitefunc = getattr(self.module, 'suite', None)
- if isinstance(suitefunc, (types.FunctionType,
- types.MethodType)):
- self.test = self.module.suite()
- else:
- self.test = self.testLoader.loadTestsFromModule(self.module)
- return
- if len(args) > 0:
- self.test_pattern = args[0]
- self.testNames = args
- else:
- self.testNames = (self.defaultTest, )
- self.createTests()
- except getopt.error as msg:
- self.usageExit(msg)
-
- def runTests(self):
- if self.profile_name:
- import cProfile
- cProfile.runctx('self._runTests()', globals(), locals(), self.profile_name )
- else:
- return self._runTests()
-
- def _runTests(self):
- self.testRunner = SkipAwareTextTestRunner(verbosity=self.verbosity,
- stream=self.outstream,
- exitfirst=self.exitfirst,
- pdbmode=self.pdbmode,
- cvg=self.cvg,
- test_pattern=self.test_pattern,
- skipped_patterns=self.skipped_patterns,
- colorize=self.colorize,
- batchmode=self.batchmode,
- options=self.options)
-
- def removeSucceededTests(obj, succTests):
- """ Recursive function that removes succTests from
- a TestSuite or TestCase
- """
- if isinstance(obj, unittest.TestSuite):
- removeSucceededTests(obj._tests, succTests)
- if isinstance(obj, list):
- for el in obj[:]:
- if isinstance(el, unittest.TestSuite):
- removeSucceededTests(el, succTests)
- elif isinstance(el, unittest.TestCase):
- descr = '.'.join((el.__class__.__module__,
- el.__class__.__name__,
- el._testMethodName))
- if descr in succTests:
- obj.remove(el)
- # take care, self.options may be None
- if getattr(self.options, 'restart', False):
- # retrieve succeeded tests from FILE_RESTART
- try:
- restartfile = open(FILE_RESTART, 'r')
- try:
- succeededtests = list(elem.rstrip('\n\r') for elem in
- restartfile.readlines())
- removeSucceededTests(self.test, succeededtests)
- finally:
- restartfile.close()
- except Exception as ex:
- raise Exception("Error while reading succeeded tests into %s: %s"
- % (osp.join(os.getcwd(), FILE_RESTART), ex))
-
- result = self.testRunner.run(self.test)
- # help garbage collection: we want TestSuite, which hold refs to every
- # executed TestCase, to be gc'ed
- del self.test
- if getattr(result, "debuggers", None) and \
- getattr(self, "pdbmode", None):
- start_interactive_mode(result)
- if not getattr(self, "batchmode", None):
- sys.exit(not result.wasSuccessful())
- self.result = result
-
-
-class SkipAwareTextTestRunner(unittest.TextTestRunner):
-
- def __init__(self, stream=sys.stderr, verbosity=1,
- exitfirst=False, pdbmode=False, cvg=None, test_pattern=None,
- skipped_patterns=(), colorize=False, batchmode=False,
- options=None):
- super(SkipAwareTextTestRunner, self).__init__(stream=stream,
- verbosity=verbosity)
- self.exitfirst = exitfirst
- self.pdbmode = pdbmode
- self.cvg = cvg
- self.test_pattern = test_pattern
- self.skipped_patterns = skipped_patterns
- self.colorize = colorize
- self.batchmode = batchmode
- self.options = options
-
- def _this_is_skipped(self, testedname):
- return any([(pat in testedname) for pat in self.skipped_patterns])
-
- def _runcondition(self, test, skipgenerator=True):
- if isinstance(test, testlib.InnerTest):
- testname = test.name
- else:
- if isinstance(test, testlib.TestCase):
- meth = test._get_test_method()
- testname = '%s.%s' % (test.__name__, meth.__name__)
- elif isinstance(test, types.FunctionType):
- func = test
- testname = func.__name__
- elif isinstance(test, types.MethodType):
- cls = test.__self__.__class__
- testname = '%s.%s' % (cls.__name__, test.__name__)
- else:
- return True # Not sure when this happens
- if isgeneratorfunction(test) and skipgenerator:
- return self.does_match_tags(test) # Let inner tests decide at run time
- if self._this_is_skipped(testname):
- return False # this was explicitly skipped
- if self.test_pattern is not None:
- try:
- classpattern, testpattern = self.test_pattern.split('.')
- klass, name = testname.split('.')
- if classpattern not in klass or testpattern not in name:
- return False
- except ValueError:
- if self.test_pattern not in testname:
- return False
-
- return self.does_match_tags(test)
-
- def does_match_tags(self, test):
- if self.options is not None:
- tags_pattern = getattr(self.options, 'tags_pattern', None)
- if tags_pattern is not None:
- tags = getattr(test, 'tags', testlib.Tags())
- if tags.inherit and isinstance(test, types.MethodType):
- tags = tags | getattr(test.im_class, 'tags', testlib.Tags())
- return tags.match(tags_pattern)
- return True # no pattern
-
- def _makeResult(self):
- return testlib.SkipAwareTestResult(self.stream, self.descriptions,
- self.verbosity, self.exitfirst,
- self.pdbmode, self.cvg, self.colorize)
-
- def run(self, test):
- "Run the given test case or test suite."
- result = self._makeResult()
- startTime = time()
- test(result, runcondition=self._runcondition, options=self.options)
- stopTime = time()
- timeTaken = stopTime - startTime
- result.printErrors()
- if not self.batchmode:
- self.stream.writeln(result.separator2)
- run = result.testsRun
- self.stream.writeln("Ran %d test%s in %.3fs" %
- (run, run != 1 and "s" or "", timeTaken))
- self.stream.writeln()
- if not result.wasSuccessful():
- if self.colorize:
- self.stream.write(textutils.colorize_ansi("FAILED", color='red'))
- else:
- self.stream.write("FAILED")
- else:
- if self.colorize:
- self.stream.write(textutils.colorize_ansi("OK", color='green'))
- else:
- self.stream.write("OK")
- failed, errored, skipped = map(len, (result.failures,
- result.errors,
- result.skipped))
-
- det_results = []
- for name, value in (("failures", result.failures),
- ("errors",result.errors),
- ("skipped", result.skipped)):
- if value:
- det_results.append("%s=%i" % (name, len(value)))
- if det_results:
- self.stream.write(" (")
- self.stream.write(', '.join(det_results))
- self.stream.write(")")
- self.stream.writeln("")
- return result
-
-class NonStrictTestLoader(unittest.TestLoader):
- """
- Overrides default testloader to be able to omit classname when
- specifying tests to run on command line.
-
- For example, if the file test_foo.py contains ::
-
- class FooTC(TestCase):
- def test_foo1(self): # ...
- def test_foo2(self): # ...
- def test_bar1(self): # ...
-
- class BarTC(TestCase):
- def test_bar2(self): # ...
-
- 'python test_foo.py' will run the 3 tests in FooTC
- 'python test_foo.py FooTC' will run the 3 tests in FooTC
- 'python test_foo.py test_foo' will run test_foo1 and test_foo2
- 'python test_foo.py test_foo1' will run test_foo1
- 'python test_foo.py test_bar' will run FooTC.test_bar1 and BarTC.test_bar2
- """
-
- def __init__(self):
- self.skipped_patterns = ()
-
- # some magic here to accept empty list by extending
- # and to provide callable capability
- def loadTestsFromNames(self, names, module=None):
- suites = []
- for name in names:
- suites.extend(self.loadTestsFromName(name, module))
- return self.suiteClass(suites)
-
- def _collect_tests(self, module):
- tests = {}
- for obj in vars(module).values():
- if isclass(obj) and issubclass(obj, unittest.TestCase):
- classname = obj.__name__
- if classname[0] == '_' or self._this_is_skipped(classname):
- continue
- methodnames = []
- # obj is a TestCase class
- for attrname in dir(obj):
- if attrname.startswith(self.testMethodPrefix):
- attr = getattr(obj, attrname)
- if callable(attr):
- methodnames.append(attrname)
- # keep track of class (obj) for convenience
- tests[classname] = (obj, methodnames)
- return tests
-
- def loadTestsFromSuite(self, module, suitename):
- try:
- suite = getattr(module, suitename)()
- except AttributeError:
- return []
- assert hasattr(suite, '_tests'), \
- "%s.%s is not a valid TestSuite" % (module.__name__, suitename)
- # python2.3 does not implement __iter__ on suites, we need to return
- # _tests explicitly
- return suite._tests
-
- def loadTestsFromName(self, name, module=None):
- parts = name.split('.')
- if module is None or len(parts) > 2:
- # let the base class do its job here
- return [super(NonStrictTestLoader, self).loadTestsFromName(name)]
- tests = self._collect_tests(module)
- collected = []
- if len(parts) == 1:
- pattern = parts[0]
- if callable(getattr(module, pattern, None)
- ) and pattern not in tests:
- # consider it as a suite
- return self.loadTestsFromSuite(module, pattern)
- if pattern in tests:
- # case python unittest_foo.py MyTestTC
- klass, methodnames = tests[pattern]
- for methodname in methodnames:
- collected = [klass(methodname)
- for methodname in methodnames]
- else:
- # case python unittest_foo.py something
- for klass, methodnames in tests.values():
- # skip methodname if matched by skipped_patterns
- for skip_pattern in self.skipped_patterns:
- methodnames = [methodname
- for methodname in methodnames
- if skip_pattern not in methodname]
- collected += [klass(methodname)
- for methodname in methodnames
- if pattern in methodname]
- elif len(parts) == 2:
- # case "MyClass.test_1"
- classname, pattern = parts
- klass, methodnames = tests.get(classname, (None, []))
- for methodname in methodnames:
- collected = [klass(methodname) for methodname in methodnames
- if pattern in methodname]
- return collected
-
- def _this_is_skipped(self, testedname):
- return any([(pat in testedname) for pat in self.skipped_patterns])
-
- def getTestCaseNames(self, testCaseClass):
- """Return a sorted sequence of method names found within testCaseClass
- """
- is_skipped = self._this_is_skipped
- classname = testCaseClass.__name__
- if classname[0] == '_' or is_skipped(classname):
- return []
- testnames = super(NonStrictTestLoader, self).getTestCaseNames(
- testCaseClass)
- return [testname for testname in testnames if not is_skipped(testname)]
-
-
-# The 2 functions below are modified versions of the TestSuite.run method
-# that is provided with unittest2 for python 2.6, in unittest2/suite.py
-# It is used to monkeypatch the original implementation to support
-# extra runcondition and options arguments (see in testlib.py)
-
-def _ts_run(self, result, runcondition=None, options=None):
- self._wrapped_run(result, runcondition=runcondition, options=options)
- self._tearDownPreviousClass(None, result)
- self._handleModuleTearDown(result)
- return result
-
-def _ts_wrapped_run(self, result, debug=False, runcondition=None, options=None):
- for test in self:
- if result.shouldStop:
- break
- if unittest_suite._isnotsuite(test):
- self._tearDownPreviousClass(test, result)
- self._handleModuleFixture(test, result)
- self._handleClassSetUp(test, result)
- result._previousTestClass = test.__class__
- if (getattr(test.__class__, '_classSetupFailed', False) or
- getattr(result, '_moduleSetUpFailed', False)):
- continue
-
- # --- modifications to deal with _wrapped_run ---
- # original code is:
- #
- # if not debug:
- # test(result)
- # else:
- # test.debug()
- if hasattr(test, '_wrapped_run'):
- try:
- test._wrapped_run(result, debug, runcondition=runcondition, options=options)
- except TypeError:
- test._wrapped_run(result, debug)
- elif not debug:
- try:
- test(result, runcondition, options)
- except TypeError:
- test(result)
- else:
- test.debug()
- # --- end of modifications to deal with _wrapped_run ---
- return result
-
-if sys.version_info >= (2, 7):
- # The function below implements a modified version of the
- # TestSuite.run method that is provided with python 2.7, in
- # unittest/suite.py
- def _ts_run(self, result, debug=False, runcondition=None, options=None):
- topLevel = False
- if getattr(result, '_testRunEntered', False) is False:
- result._testRunEntered = topLevel = True
-
- self._wrapped_run(result, debug, runcondition, options)
-
- if topLevel:
- self._tearDownPreviousClass(None, result)
- self._handleModuleTearDown(result)
- result._testRunEntered = False
- return result
-
-
-def enable_dbc(*args):
- """
- Without arguments, return True if contracts can be enabled and should be
- enabled (see option -d), return False otherwise.
-
- With arguments, return False if contracts can't or shouldn't be enabled,
- otherwise weave ContractAspect with items passed as arguments.
- """
- if not ENABLE_DBC:
- return False
- try:
- from logilab.aspects.weaver import weaver
- from logilab.aspects.lib.contracts import ContractAspect
- except ImportError:
- sys.stderr.write(
- 'Warning: logilab.aspects is not available. Contracts disabled.')
- return False
- for arg in args:
- weaver.weave_module(arg, ContractAspect)
- return True
-
-
-# monkeypatch unittest and doctest (ouch !)
-unittest._TextTestResult = testlib.SkipAwareTestResult
-unittest.TextTestRunner = SkipAwareTextTestRunner
-unittest.TestLoader = NonStrictTestLoader
-unittest.TestProgram = SkipAwareTestProgram
-
-if sys.version_info >= (2, 4):
- doctest.DocTestCase.__bases__ = (testlib.TestCase,)
- # XXX check python2.6 compatibility
- #doctest.DocTestCase._cleanups = []
- #doctest.DocTestCase._out = []
-else:
- unittest.FunctionTestCase.__bases__ = (testlib.TestCase,)
-unittest.TestSuite.run = _ts_run
-unittest.TestSuite._wrapped_run = _ts_wrapped_run
diff --git a/chromium/third_party/logilab/logilab/common/registry.py b/chromium/third_party/logilab/logilab/common/registry.py
deleted file mode 100644
index a52b2eb0b75..00000000000
--- a/chromium/third_party/logilab/logilab/common/registry.py
+++ /dev/null
@@ -1,1119 +0,0 @@
-# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of Logilab-common.
-#
-# Logilab-common is free software: you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as published by the
-# Free Software Foundation, either version 2.1 of the License, or (at your
-# option) any later version.
-#
-# Logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with Logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""This module provides bases for predicates dispatching (the pattern in use
-here is similar to what's refered as multi-dispatch or predicate-dispatch in the
-literature, though a bit different since the idea is to select across different
-implementation 'e.g. classes), not to dispatch a message to a function or
-method. It contains the following classes:
-
-* :class:`RegistryStore`, the top level object which loads implementation
- objects and stores them into registries. You'll usually use it to access
- registries and their contained objects;
-
-* :class:`Registry`, the base class which contains objects semantically grouped
- (for instance, sharing a same API, hence the 'implementation' name). You'll
- use it to select the proper implementation according to a context. Notice you
- may use registries on their own without using the store.
-
-.. Note::
-
- implementation objects are usually designed to be accessed through the
- registry and not by direct instantiation, besides to use it as base classe.
-
-The selection procedure is delegated to a selector, which is responsible for
-scoring the object according to some context. At the end of the selection, if an
-implementation has been found, an instance of this class is returned. A selector
-is built from one or more predicates combined together using AND, OR, NOT
-operators (actually `&`, `|` and `~`). You'll thus find some base classes to
-build predicates:
-
-* :class:`Predicate`, the abstract base predicate class
-
-* :class:`AndPredicate`, :class:`OrPredicate`, :class:`NotPredicate`, which you
- shouldn't have to use directly. You'll use `&`, `|` and '~' operators between
- predicates directly
-
-* :func:`objectify_predicate`
-
-You'll eventually find one concrete predicate: :class:`yes`
-
-.. autoclass:: RegistryStore
-.. autoclass:: Registry
-
-Predicates
-----------
-.. autoclass:: Predicate
-.. autofunc:: objectify_predicate
-.. autoclass:: yes
-
-Debugging
----------
-.. autoclass:: traced_selection
-
-Exceptions
-----------
-.. autoclass:: RegistryException
-.. autoclass:: RegistryNotFound
-.. autoclass:: ObjectNotFound
-.. autoclass:: NoSelectableObject
-"""
-
-from __future__ import print_function
-
-__docformat__ = "restructuredtext en"
-
-import sys
-import types
-import weakref
-import traceback as tb
-from os import listdir, stat
-from os.path import join, isdir, exists
-from logging import getLogger
-from warnings import warn
-
-from six import string_types, add_metaclass
-
-from logilab.common.modutils import modpath_from_file
-from logilab.common.logging_ext import set_log_methods
-from logilab.common.decorators import classproperty
-
-
-class RegistryException(Exception):
- """Base class for registry exception."""
-
-class RegistryNotFound(RegistryException):
- """Raised when an unknown registry is requested.
-
- This is usually a programming/typo error.
- """
-
-class ObjectNotFound(RegistryException):
- """Raised when an unregistered object is requested.
-
- This may be a programming/typo or a misconfiguration error.
- """
-
-class NoSelectableObject(RegistryException):
- """Raised when no object is selectable for a given context."""
- def __init__(self, args, kwargs, objects):
- self.args = args
- self.kwargs = kwargs
- self.objects = objects
-
- def __str__(self):
- return ('args: %s, kwargs: %s\ncandidates: %s'
- % (self.args, self.kwargs.keys(), self.objects))
-
-
-def _modname_from_path(path, extrapath=None):
- modpath = modpath_from_file(path, extrapath)
- # omit '__init__' from package's name to avoid loading that module
- # once for each name when it is imported by some other object
- # module. This supposes import in modules are done as::
- #
- # from package import something
- #
- # not::
- #
- # from package.__init__ import something
- #
- # which seems quite correct.
- if modpath[-1] == '__init__':
- modpath.pop()
- return '.'.join(modpath)
-
-
-def _toload_info(path, extrapath, _toload=None):
- """Return a dictionary of <modname>: <modpath> and an ordered list of
- (file, module name) to load
- """
- if _toload is None:
- assert isinstance(path, list)
- _toload = {}, []
- for fileordir in path:
- if isdir(fileordir) and exists(join(fileordir, '__init__.py')):
- subfiles = [join(fileordir, fname) for fname in listdir(fileordir)]
- _toload_info(subfiles, extrapath, _toload)
- elif fileordir[-3:] == '.py':
- modname = _modname_from_path(fileordir, extrapath)
- _toload[0][modname] = fileordir
- _toload[1].append((fileordir, modname))
- return _toload
-
-
-class RegistrableObject(object):
- """This is the base class for registrable objects which are selected
- according to a context.
-
- :attr:`__registry__`
- name of the registry for this object (string like 'views',
- 'templates'...). You may want to define `__registries__` directly if your
- object should be registered in several registries.
-
- :attr:`__regid__`
- object's identifier in the registry (string like 'main',
- 'primary', 'folder_box')
-
- :attr:`__select__`
- class'selector
-
- Moreover, the `__abstract__` attribute may be set to True to indicate that a
- class is abstract and should not be registered.
-
- You don't have to inherit from this class to put it in a registry (having
- `__regid__` and `__select__` is enough), though this is needed for classes
- that should be automatically registered.
- """
-
- __registry__ = None
- __regid__ = None
- __select__ = None
- __abstract__ = True # see doc snipppets below (in Registry class)
-
- @classproperty
- def __registries__(cls):
- if cls.__registry__ is None:
- return ()
- return (cls.__registry__,)
-
-
-class RegistrableInstance(RegistrableObject):
- """Inherit this class if you want instances of the classes to be
- automatically registered.
- """
-
- def __new__(cls, *args, **kwargs):
- """Add a __module__ attribute telling the module where the instance was
- created, for automatic registration.
- """
- obj = super(RegistrableInstance, cls).__new__(cls)
- # XXX subclass must no override __new__
- filepath = tb.extract_stack(limit=2)[0][0]
- obj.__module__ = _modname_from_path(filepath)
- return obj
-
-
-class Registry(dict):
- """The registry store a set of implementations associated to identifier:
-
- * to each identifier are associated a list of implementations
-
- * to select an implementation of a given identifier, you should use one of the
- :meth:`select` or :meth:`select_or_none` method
-
- * to select a list of implementations for a context, you should use the
- :meth:`possible_objects` method
-
- * dictionary like access to an identifier will return the bare list of
- implementations for this identifier.
-
- To be usable in a registry, the only requirement is to have a `__select__`
- attribute.
-
- At the end of the registration process, the :meth:`__registered__`
- method is called on each registered object which have them, given the
- registry in which it's registered as argument.
-
- Registration methods:
-
- .. automethod: register
- .. automethod: unregister
-
- Selection methods:
-
- .. automethod: select
- .. automethod: select_or_none
- .. automethod: possible_objects
- .. automethod: object_by_id
- """
- def __init__(self, debugmode):
- super(Registry, self).__init__()
- self.debugmode = debugmode
-
- def __getitem__(self, name):
- """return the registry (list of implementation objects) associated to
- this name
- """
- try:
- return super(Registry, self).__getitem__(name)
- except KeyError:
- exc = ObjectNotFound(name)
- exc.__traceback__ = sys.exc_info()[-1]
- raise exc
-
- @classmethod
- def objid(cls, obj):
- """returns a unique identifier for an object stored in the registry"""
- return '%s.%s' % (obj.__module__, cls.objname(obj))
-
- @classmethod
- def objname(cls, obj):
- """returns a readable name for an object stored in the registry"""
- return getattr(obj, '__name__', id(obj))
-
- def initialization_completed(self):
- """call method __registered__() on registered objects when the callback
- is defined"""
- for objects in self.values():
- for objectcls in objects:
- registered = getattr(objectcls, '__registered__', None)
- if registered:
- registered(self)
- if self.debugmode:
- wrap_predicates(_lltrace)
-
- def register(self, obj, oid=None, clear=False):
- """base method to add an object in the registry"""
- assert not '__abstract__' in obj.__dict__, obj
- assert obj.__select__, obj
- oid = oid or obj.__regid__
- assert oid, ('no explicit name supplied to register object %s, '
- 'which has no __regid__ set' % obj)
- if clear:
- objects = self[oid] = []
- else:
- objects = self.setdefault(oid, [])
- assert not obj in objects, 'object %s is already registered' % obj
- objects.append(obj)
-
- def register_and_replace(self, obj, replaced):
- """remove <replaced> and register <obj>"""
- # XXXFIXME this is a duplication of unregister()
- # remove register_and_replace in favor of unregister + register
- # or simplify by calling unregister then register here
- if not isinstance(replaced, string_types):
- replaced = self.objid(replaced)
- # prevent from misspelling
- assert obj is not replaced, 'replacing an object by itself: %s' % obj
- registered_objs = self.get(obj.__regid__, ())
- for index, registered in enumerate(registered_objs):
- if self.objid(registered) == replaced:
- del registered_objs[index]
- break
- else:
- self.warning('trying to replace %s that is not registered with %s',
- replaced, obj)
- self.register(obj)
-
- def unregister(self, obj):
- """remove object <obj> from this registry"""
- objid = self.objid(obj)
- oid = obj.__regid__
- for registered in self.get(oid, ()):
- # use self.objid() to compare objects because vreg will probably
- # have its own version of the object, loaded through execfile
- if self.objid(registered) == objid:
- self[oid].remove(registered)
- break
- else:
- self.warning('can\'t remove %s, no id %s in the registry',
- objid, oid)
-
- def all_objects(self):
- """return a list containing all objects in this registry.
- """
- result = []
- for objs in self.values():
- result += objs
- return result
-
- # dynamic selection methods ################################################
-
- def object_by_id(self, oid, *args, **kwargs):
- """return object with the `oid` identifier. Only one object is expected
- to be found.
-
- raise :exc:`ObjectNotFound` if there are no object with id `oid` in this
- registry
-
- raise :exc:`AssertionError` if there is more than one object there
- """
- objects = self[oid]
- assert len(objects) == 1, objects
- return objects[0](*args, **kwargs)
-
- def select(self, __oid, *args, **kwargs):
- """return the most specific object among those with the given oid
- according to the given context.
-
- raise :exc:`ObjectNotFound` if there are no object with id `oid` in this
- registry
-
- raise :exc:`NoSelectableObject` if no object can be selected
- """
- obj = self._select_best(self[__oid], *args, **kwargs)
- if obj is None:
- raise NoSelectableObject(args, kwargs, self[__oid] )
- return obj
-
- def select_or_none(self, __oid, *args, **kwargs):
- """return the most specific object among those with the given oid
- according to the given context, or None if no object applies.
- """
- try:
- return self._select_best(self[__oid], *args, **kwargs)
- except ObjectNotFound:
- return None
-
- def possible_objects(self, *args, **kwargs):
- """return an iterator on possible objects in this registry for the given
- context
- """
- for objects in self.values():
- obj = self._select_best(objects, *args, **kwargs)
- if obj is None:
- continue
- yield obj
-
- def _select_best(self, objects, *args, **kwargs):
- """return an instance of the most specific object according
- to parameters
-
- return None if not object apply (don't raise `NoSelectableObject` since
- it's costly when searching objects using `possible_objects`
- (e.g. searching for hooks).
- """
- score, winners = 0, None
- for obj in objects:
- objectscore = obj.__select__(obj, *args, **kwargs)
- if objectscore > score:
- score, winners = objectscore, [obj]
- elif objectscore > 0 and objectscore == score:
- winners.append(obj)
- if winners is None:
- return None
- if len(winners) > 1:
- # log in production environement / test, error while debugging
- msg = 'select ambiguity: %s\n(args: %s, kwargs: %s)'
- if self.debugmode:
- # raise bare exception in debug mode
- raise Exception(msg % (winners, args, kwargs.keys()))
- self.error(msg, winners, args, kwargs.keys())
- # return the result of calling the object
- return self.selected(winners[0], args, kwargs)
-
- def selected(self, winner, args, kwargs):
- """override here if for instance you don't want "instanciation"
- """
- return winner(*args, **kwargs)
-
- # these are overridden by set_log_methods below
- # only defining here to prevent pylint from complaining
- info = warning = error = critical = exception = debug = lambda msg, *a, **kw: None
-
-
-def obj_registries(cls, registryname=None):
- """return a tuple of registry names (see __registries__)"""
- if registryname:
- return (registryname,)
- return cls.__registries__
-
-
-class RegistryStore(dict):
- """This class is responsible for loading objects and storing them
- in their registry which is created on the fly as needed.
-
- It handles dynamic registration of objects and provides a
- convenient api to access them. To be recognized as an object that
- should be stored into one of the store's registry
- (:class:`Registry`), an object must provide the following
- attributes, used control how they interact with the registry:
-
- :attr:`__registries__`
- list of registry names (string like 'views', 'templates'...) into which
- the object should be registered
-
- :attr:`__regid__`
- object identifier in the registry (string like 'main',
- 'primary', 'folder_box')
-
- :attr:`__select__`
- the object predicate selectors
-
- Moreover, the :attr:`__abstract__` attribute may be set to `True`
- to indicate that an object is abstract and should not be registered
- (such inherited attributes not considered).
-
- .. Note::
-
- When using the store to load objects dynamically, you *always* have
- to use **super()** to get the methods and attributes of the
- superclasses, and not use the class identifier. If not, you'll get into
- trouble at reload time.
-
- For example, instead of writing::
-
- class Thing(Parent):
- __regid__ = 'athing'
- __select__ = yes()
-
- def f(self, arg1):
- Parent.f(self, arg1)
-
- You must write::
-
- class Thing(Parent):
- __regid__ = 'athing'
- __select__ = yes()
-
- def f(self, arg1):
- super(Thing, self).f(arg1)
-
- Controlling object registration
- -------------------------------
-
- Dynamic loading is triggered by calling the
- :meth:`register_objects` method, given a list of directories to
- inspect for python modules.
-
- .. automethod: register_objects
-
- For each module, by default, all compatible objects are registered
- automatically. However if some objects come as replacement of
- other objects, or have to be included only if some condition is
- met, you'll have to define a `registration_callback(vreg)`
- function in the module and explicitly register **all objects** in
- this module, using the api defined below.
-
-
- .. automethod:: RegistryStore.register_all
- .. automethod:: RegistryStore.register_and_replace
- .. automethod:: RegistryStore.register
- .. automethod:: RegistryStore.unregister
-
- .. Note::
- Once the function `registration_callback(vreg)` is implemented in a
- module, all the objects from this module have to be explicitly
- registered as it disables the automatic object registration.
-
-
- Examples:
-
- .. sourcecode:: python
-
- def registration_callback(store):
- # register everything in the module except BabarClass
- store.register_all(globals().values(), __name__, (BabarClass,))
-
- # conditionally register BabarClass
- if 'babar_relation' in store.schema:
- store.register(BabarClass)
-
- In this example, we register all application object classes defined in the module
- except `BabarClass`. This class is then registered only if the 'babar_relation'
- relation type is defined in the instance schema.
-
- .. sourcecode:: python
-
- def registration_callback(store):
- store.register(Elephant)
- # replace Babar by Celeste
- store.register_and_replace(Celeste, Babar)
-
- In this example, we explicitly register classes one by one:
-
- * the `Elephant` class
- * the `Celeste` to replace `Babar`
-
- If at some point we register a new appobject class in this module, it won't be
- registered at all without modification to the `registration_callback`
- implementation. The first example will register it though, thanks to the call
- to the `register_all` method.
-
- Controlling registry instantiation
- ----------------------------------
-
- The `REGISTRY_FACTORY` class dictionary allows to specify which class should
- be instantiated for a given registry name. The class associated to `None`
- key will be the class used when there is no specific class for a name.
- """
-
- def __init__(self, debugmode=False):
- super(RegistryStore, self).__init__()
- self.debugmode = debugmode
-
- def reset(self):
- """clear all registries managed by this store"""
- # don't use self.clear, we want to keep existing subdictionaries
- for subdict in self.values():
- subdict.clear()
- self._lastmodifs = {}
-
- def __getitem__(self, name):
- """return the registry (dictionary of class objects) associated to
- this name
- """
- try:
- return super(RegistryStore, self).__getitem__(name)
- except KeyError:
- exc = RegistryNotFound(name)
- exc.__traceback__ = sys.exc_info()[-1]
- raise exc
-
- # methods for explicit (un)registration ###################################
-
- # default class, when no specific class set
- REGISTRY_FACTORY = {None: Registry}
-
- def registry_class(self, regid):
- """return existing registry named regid or use factory to create one and
- return it"""
- try:
- return self.REGISTRY_FACTORY[regid]
- except KeyError:
- return self.REGISTRY_FACTORY[None]
-
- def setdefault(self, regid):
- try:
- return self[regid]
- except RegistryNotFound:
- self[regid] = self.registry_class(regid)(self.debugmode)
- return self[regid]
-
- def register_all(self, objects, modname, butclasses=()):
- """register registrable objects into `objects`.
-
- Registrable objects are properly configured subclasses of
- :class:`RegistrableObject`. Objects which are not defined in the module
- `modname` or which are in `butclasses` won't be registered.
-
- Typical usage is:
-
- .. sourcecode:: python
-
- store.register_all(globals().values(), __name__, (ClassIWantToRegisterExplicitly,))
-
- So you get partially automatic registration, keeping manual registration
- for some object (to use
- :meth:`~logilab.common.registry.RegistryStore.register_and_replace` for
- instance).
- """
- assert isinstance(modname, string_types), \
- 'modname expected to be a module name (ie string), got %r' % modname
- for obj in objects:
- if self.is_registrable(obj) and obj.__module__ == modname and not obj in butclasses:
- if isinstance(obj, type):
- self._load_ancestors_then_object(modname, obj, butclasses)
- else:
- self.register(obj)
-
- def register(self, obj, registryname=None, oid=None, clear=False):
- """register `obj` implementation into `registryname` or
- `obj.__registries__` if not specified, with identifier `oid` or
- `obj.__regid__` if not specified.
-
- If `clear` is true, all objects with the same identifier will be
- previously unregistered.
- """
- assert not obj.__dict__.get('__abstract__'), obj
- for registryname in obj_registries(obj, registryname):
- registry = self.setdefault(registryname)
- registry.register(obj, oid=oid, clear=clear)
- self.debug("register %s in %s['%s']",
- registry.objname(obj), registryname, oid or obj.__regid__)
- self._loadedmods.setdefault(obj.__module__, {})[registry.objid(obj)] = obj
-
- def unregister(self, obj, registryname=None):
- """unregister `obj` object from the registry `registryname` or
- `obj.__registries__` if not specified.
- """
- for registryname in obj_registries(obj, registryname):
- registry = self[registryname]
- registry.unregister(obj)
- self.debug("unregister %s from %s['%s']",
- registry.objname(obj), registryname, obj.__regid__)
-
- def register_and_replace(self, obj, replaced, registryname=None):
- """register `obj` object into `registryname` or
- `obj.__registries__` if not specified. If found, the `replaced` object
- will be unregistered first (else a warning will be issued as it is
- generally unexpected).
- """
- for registryname in obj_registries(obj, registryname):
- registry = self[registryname]
- registry.register_and_replace(obj, replaced)
- self.debug("register %s in %s['%s'] instead of %s",
- registry.objname(obj), registryname, obj.__regid__,
- registry.objname(replaced))
-
- # initialization methods ###################################################
-
- def init_registration(self, path, extrapath=None):
- """reset registry and walk down path to return list of (path, name)
- file modules to be loaded"""
- # XXX make this private by renaming it to _init_registration ?
- self.reset()
- # compute list of all modules that have to be loaded
- self._toloadmods, filemods = _toload_info(path, extrapath)
- # XXX is _loadedmods still necessary ? It seems like it's useful
- # to avoid loading same module twice, especially with the
- # _load_ancestors_then_object logic but this needs to be checked
- self._loadedmods = {}
- return filemods
-
- def register_objects(self, path, extrapath=None):
- """register all objects found walking down <path>"""
- # load views from each directory in the instance's path
- # XXX inline init_registration ?
- filemods = self.init_registration(path, extrapath)
- for filepath, modname in filemods:
- self.load_file(filepath, modname)
- self.initialization_completed()
-
- def initialization_completed(self):
- """call initialization_completed() on all known registries"""
- for reg in self.values():
- reg.initialization_completed()
-
- def _mdate(self, filepath):
- """ return the modification date of a file path """
- try:
- return stat(filepath)[-2]
- except OSError:
- # this typically happens on emacs backup files (.#foo.py)
- self.warning('Unable to load %s. It is likely to be a backup file',
- filepath)
- return None
-
- def is_reload_needed(self, path):
- """return True if something module changed and the registry should be
- reloaded
- """
- lastmodifs = self._lastmodifs
- for fileordir in path:
- if isdir(fileordir) and exists(join(fileordir, '__init__.py')):
- if self.is_reload_needed([join(fileordir, fname)
- for fname in listdir(fileordir)]):
- return True
- elif fileordir[-3:] == '.py':
- mdate = self._mdate(fileordir)
- if mdate is None:
- continue # backup file, see _mdate implementation
- elif "flymake" in fileordir:
- # flymake + pylint in use, don't consider these they will corrupt the registry
- continue
- if fileordir not in lastmodifs or lastmodifs[fileordir] < mdate:
- self.info('File %s changed since last visit', fileordir)
- return True
- return False
-
- def load_file(self, filepath, modname):
- """ load registrable objects (if any) from a python file """
- from logilab.common.modutils import load_module_from_name
- if modname in self._loadedmods:
- return
- self._loadedmods[modname] = {}
- mdate = self._mdate(filepath)
- if mdate is None:
- return # backup file, see _mdate implementation
- elif "flymake" in filepath:
- # flymake + pylint in use, don't consider these they will corrupt the registry
- return
- # set update time before module loading, else we get some reloading
- # weirdness in case of syntax error or other error while importing the
- # module
- self._lastmodifs[filepath] = mdate
- # load the module
- module = load_module_from_name(modname)
- self.load_module(module)
-
- def load_module(self, module):
- """Automatically handle module objects registration.
-
- Instances are registered as soon as they are hashable and have the
- following attributes:
-
- * __regid__ (a string)
- * __select__ (a callable)
- * __registries__ (a tuple/list of string)
-
- For classes this is a bit more complicated :
-
- - first ensure parent classes are already registered
-
- - class with __abstract__ == True in their local dictionary are skipped
-
- - object class needs to have registries and identifier properly set to a
- non empty string to be registered.
- """
- self.info('loading %s from %s', module.__name__, module.__file__)
- if hasattr(module, 'registration_callback'):
- module.registration_callback(self)
- else:
- self.register_all(vars(module).values(), module.__name__)
-
- def _load_ancestors_then_object(self, modname, objectcls, butclasses=()):
- """handle class registration according to rules defined in
- :meth:`load_module`
- """
- # backward compat, we used to allow whatever else than classes
- if not isinstance(objectcls, type):
- if self.is_registrable(objectcls) and objectcls.__module__ == modname:
- self.register(objectcls)
- return
- # imported classes
- objmodname = objectcls.__module__
- if objmodname != modname:
- # The module of the object is not the same as the currently
- # worked on module, or this is actually an instance, which
- # has no module at all
- if objmodname in self._toloadmods:
- # if this is still scheduled for loading, let's proceed immediately,
- # but using the object module
- self.load_file(self._toloadmods[objmodname], objmodname)
- return
- # ensure object hasn't been already processed
- clsid = '%s.%s' % (modname, objectcls.__name__)
- if clsid in self._loadedmods[modname]:
- return
- self._loadedmods[modname][clsid] = objectcls
- # ensure ancestors are registered
- for parent in objectcls.__bases__:
- self._load_ancestors_then_object(modname, parent, butclasses)
- # ensure object is registrable
- if objectcls in butclasses or not self.is_registrable(objectcls):
- return
- # backward compat
- reg = self.setdefault(obj_registries(objectcls)[0])
- if reg.objname(objectcls)[0] == '_':
- warn("[lgc 0.59] object whose name start with '_' won't be "
- "skipped anymore at some point, use __abstract__ = True "
- "instead (%s)" % objectcls, DeprecationWarning)
- return
- # register, finally
- self.register(objectcls)
-
- @classmethod
- def is_registrable(cls, obj):
- """ensure `obj` should be registered
-
- as arbitrary stuff may be registered, do a lot of check and warn about
- weird cases (think to dumb proxy objects)
- """
- if isinstance(obj, type):
- if not issubclass(obj, RegistrableObject):
- # ducktyping backward compat
- if not (getattr(obj, '__registries__', None)
- and getattr(obj, '__regid__', None)
- and getattr(obj, '__select__', None)):
- return False
- elif issubclass(obj, RegistrableInstance):
- return False
- elif not isinstance(obj, RegistrableInstance):
- return False
- if not obj.__regid__:
- return False # no regid
- registries = obj.__registries__
- if not registries:
- return False # no registries
- selector = obj.__select__
- if not selector:
- return False # no selector
- if obj.__dict__.get('__abstract__', False):
- return False
- # then detect potential problems that should be warned
- if not isinstance(registries, (tuple, list)):
- cls.warning('%s has __registries__ which is not a list or tuple', obj)
- return False
- if not callable(selector):
- cls.warning('%s has not callable __select__', obj)
- return False
- return True
-
- # these are overridden by set_log_methods below
- # only defining here to prevent pylint from complaining
- info = warning = error = critical = exception = debug = lambda msg, *a, **kw: None
-
-
-# init logging
-set_log_methods(RegistryStore, getLogger('registry.store'))
-set_log_methods(Registry, getLogger('registry'))
-
-
-# helpers for debugging selectors
-TRACED_OIDS = None
-
-def _trace_selector(cls, selector, args, ret):
- vobj = args[0]
- if TRACED_OIDS == 'all' or vobj.__regid__ in TRACED_OIDS:
- print('%s -> %s for %s(%s)' % (cls, ret, vobj, vobj.__regid__))
-
-def _lltrace(selector):
- """use this decorator on your predicates so they become traceable with
- :class:`traced_selection`
- """
- def traced(cls, *args, **kwargs):
- ret = selector(cls, *args, **kwargs)
- if TRACED_OIDS is not None:
- _trace_selector(cls, selector, args, ret)
- return ret
- traced.__name__ = selector.__name__
- traced.__doc__ = selector.__doc__
- return traced
-
-class traced_selection(object): # pylint: disable=C0103
- """
- Typical usage is :
-
- .. sourcecode:: python
-
- >>> from logilab.common.registry import traced_selection
- >>> with traced_selection():
- ... # some code in which you want to debug selectors
- ... # for all objects
-
- This will yield lines like this in the logs::
-
- selector one_line_rset returned 0 for <class 'elephant.Babar'>
-
- You can also give to :class:`traced_selection` the identifiers of objects on
- which you want to debug selection ('oid1' and 'oid2' in the example above).
-
- .. sourcecode:: python
-
- >>> with traced_selection( ('regid1', 'regid2') ):
- ... # some code in which you want to debug selectors
- ... # for objects with __regid__ 'regid1' and 'regid2'
-
- A potentially useful point to set up such a tracing function is
- the `logilab.common.registry.Registry.select` method body.
- """
-
- def __init__(self, traced='all'):
- self.traced = traced
-
- def __enter__(self):
- global TRACED_OIDS
- TRACED_OIDS = self.traced
-
- def __exit__(self, exctype, exc, traceback):
- global TRACED_OIDS
- TRACED_OIDS = None
- return traceback is None
-
-# selector base classes and operations ########################################
-
-def objectify_predicate(selector_func):
- """Most of the time, a simple score function is enough to build a selector.
- The :func:`objectify_predicate` decorator turn it into a proper selector
- class::
-
- @objectify_predicate
- def one(cls, req, rset=None, **kwargs):
- return 1
-
- class MyView(View):
- __select__ = View.__select__ & one()
-
- """
- return type(selector_func.__name__, (Predicate,),
- {'__doc__': selector_func.__doc__,
- '__call__': lambda self, *a, **kw: selector_func(*a, **kw)})
-
-
-_PREDICATES = {}
-
-def wrap_predicates(decorator):
- for predicate in _PREDICATES.values():
- if not '_decorators' in predicate.__dict__:
- predicate._decorators = set()
- if decorator in predicate._decorators:
- continue
- predicate._decorators.add(decorator)
- predicate.__call__ = decorator(predicate.__call__)
-
-class PredicateMetaClass(type):
- def __new__(mcs, *args, **kwargs):
- # use __new__ so subclasses doesn't have to call Predicate.__init__
- inst = type.__new__(mcs, *args, **kwargs)
- proxy = weakref.proxy(inst, lambda p: _PREDICATES.pop(id(p)))
- _PREDICATES[id(proxy)] = proxy
- return inst
-
-
-@add_metaclass(PredicateMetaClass)
-class Predicate(object):
- """base class for selector classes providing implementation
- for operators ``&``, ``|`` and ``~``
-
- This class is only here to give access to binary operators, the selector
- logic itself should be implemented in the :meth:`__call__` method. Notice it
- should usually accept any arbitrary arguments (the context), though that may
- vary depending on your usage of the registry.
-
- a selector is called to help choosing the correct object for a
- particular context by returning a score (`int`) telling how well
- the implementation given as first argument fit to the given context.
-
- 0 score means that the class doesn't apply.
- """
-
- @property
- def func_name(self):
- # backward compatibility
- return self.__class__.__name__
-
- def search_selector(self, selector):
- """search for the given selector, selector instance or tuple of
- selectors in the selectors tree. Return None if not found.
- """
- if self is selector:
- return self
- if (isinstance(selector, type) or isinstance(selector, tuple)) and \
- isinstance(self, selector):
- return self
- return None
-
- def __str__(self):
- return self.__class__.__name__
-
- def __and__(self, other):
- return AndPredicate(self, other)
- def __rand__(self, other):
- return AndPredicate(other, self)
- def __iand__(self, other):
- return AndPredicate(self, other)
- def __or__(self, other):
- return OrPredicate(self, other)
- def __ror__(self, other):
- return OrPredicate(other, self)
- def __ior__(self, other):
- return OrPredicate(self, other)
-
- def __invert__(self):
- return NotPredicate(self)
-
- # XXX (function | function) or (function & function) not managed yet
-
- def __call__(self, cls, *args, **kwargs):
- return NotImplementedError("selector %s must implement its logic "
- "in its __call__ method" % self.__class__)
-
- def __repr__(self):
- return u'<Predicate %s at %x>' % (self.__class__.__name__, id(self))
-
-
-class MultiPredicate(Predicate):
- """base class for compound selector classes"""
-
- def __init__(self, *selectors):
- self.selectors = self.merge_selectors(selectors)
-
- def __str__(self):
- return '%s(%s)' % (self.__class__.__name__,
- ','.join(str(s) for s in self.selectors))
-
- @classmethod
- def merge_selectors(cls, selectors):
- """deal with selector instanciation when necessary and merge
- multi-selectors if possible:
-
- AndPredicate(AndPredicate(sel1, sel2), AndPredicate(sel3, sel4))
- ==> AndPredicate(sel1, sel2, sel3, sel4)
- """
- merged_selectors = []
- for selector in selectors:
- # XXX do we really want magic-transformations below?
- # if so, wanna warn about them?
- if isinstance(selector, types.FunctionType):
- selector = objectify_predicate(selector)()
- if isinstance(selector, type) and issubclass(selector, Predicate):
- selector = selector()
- assert isinstance(selector, Predicate), selector
- if isinstance(selector, cls):
- merged_selectors += selector.selectors
- else:
- merged_selectors.append(selector)
- return merged_selectors
-
- def search_selector(self, selector):
- """search for the given selector or selector instance (or tuple of
- selectors) in the selectors tree. Return None if not found
- """
- for childselector in self.selectors:
- if childselector is selector:
- return childselector
- found = childselector.search_selector(selector)
- if found is not None:
- return found
- # if not found in children, maybe we are looking for self?
- return super(MultiPredicate, self).search_selector(selector)
-
-
-class AndPredicate(MultiPredicate):
- """and-chained selectors"""
- def __call__(self, cls, *args, **kwargs):
- score = 0
- for selector in self.selectors:
- partscore = selector(cls, *args, **kwargs)
- if not partscore:
- return 0
- score += partscore
- return score
-
-
-class OrPredicate(MultiPredicate):
- """or-chained selectors"""
- def __call__(self, cls, *args, **kwargs):
- for selector in self.selectors:
- partscore = selector(cls, *args, **kwargs)
- if partscore:
- return partscore
- return 0
-
-class NotPredicate(Predicate):
- """negation selector"""
- def __init__(self, selector):
- self.selector = selector
-
- def __call__(self, cls, *args, **kwargs):
- score = self.selector(cls, *args, **kwargs)
- return int(not score)
-
- def __str__(self):
- return 'NOT(%s)' % self.selector
-
-
-class yes(Predicate): # pylint: disable=C0103
- """Return the score given as parameter, with a default score of 0.5 so any
- other selector take precedence.
-
- Usually used for objects which can be selected whatever the context, or
- also sometimes to add arbitrary points to a score.
-
- Take care, `yes(0)` could be named 'no'...
- """
- def __init__(self, score=0.5):
- self.score = score
-
- def __call__(self, *args, **kwargs):
- return self.score
-
-
-# deprecated stuff #############################################################
-
-from logilab.common.deprecation import deprecated
-
-@deprecated('[lgc 0.59] use Registry.objid class method instead')
-def classid(cls):
- return '%s.%s' % (cls.__module__, cls.__name__)
-
-@deprecated('[lgc 0.59] use obj_registries function instead')
-def class_registries(cls, registryname):
- return obj_registries(cls, registryname)
-
diff --git a/chromium/third_party/logilab/logilab/common/shellutils.py b/chromium/third_party/logilab/logilab/common/shellutils.py
deleted file mode 100644
index 4e689560bb1..00000000000
--- a/chromium/third_party/logilab/logilab/common/shellutils.py
+++ /dev/null
@@ -1,462 +0,0 @@
-# copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""shell/term utilities, useful to write some python scripts instead of shell
-scripts.
-"""
-
-from __future__ import print_function
-
-__docformat__ = "restructuredtext en"
-
-import os
-import glob
-import shutil
-import stat
-import sys
-import tempfile
-import time
-import fnmatch
-import errno
-import string
-import random
-import subprocess
-from os.path import exists, isdir, islink, basename, join
-
-from six import string_types
-from six.moves import range, input as raw_input
-
-from logilab.common import STD_BLACKLIST, _handle_blacklist
-from logilab.common.compat import str_to_bytes
-from logilab.common.deprecation import deprecated
-
-try:
- from logilab.common.proc import ProcInfo, NoSuchProcess
-except ImportError:
- # windows platform
- class NoSuchProcess(Exception): pass
-
- def ProcInfo(pid):
- raise NoSuchProcess()
-
-
-class tempdir(object):
-
- def __enter__(self):
- self.path = tempfile.mkdtemp()
- return self.path
-
- def __exit__(self, exctype, value, traceback):
- # rmtree in all cases
- shutil.rmtree(self.path)
- return traceback is None
-
-
-class pushd(object):
- def __init__(self, directory):
- self.directory = directory
-
- def __enter__(self):
- self.cwd = os.getcwd()
- os.chdir(self.directory)
- return self.directory
-
- def __exit__(self, exctype, value, traceback):
- os.chdir(self.cwd)
-
-
-def chown(path, login=None, group=None):
- """Same as `os.chown` function but accepting user login or group name as
- argument. If login or group is omitted, it's left unchanged.
-
- Note: you must own the file to chown it (or be root). Otherwise OSError is raised.
- """
- if login is None:
- uid = -1
- else:
- try:
- uid = int(login)
- except ValueError:
- import pwd # Platforms: Unix
- uid = pwd.getpwnam(login).pw_uid
- if group is None:
- gid = -1
- else:
- try:
- gid = int(group)
- except ValueError:
- import grp
- gid = grp.getgrnam(group).gr_gid
- os.chown(path, uid, gid)
-
-def mv(source, destination, _action=shutil.move):
- """A shell-like mv, supporting wildcards.
- """
- sources = glob.glob(source)
- if len(sources) > 1:
- assert isdir(destination)
- for filename in sources:
- _action(filename, join(destination, basename(filename)))
- else:
- try:
- source = sources[0]
- except IndexError:
- raise OSError('No file matching %s' % source)
- if isdir(destination) and exists(destination):
- destination = join(destination, basename(source))
- try:
- _action(source, destination)
- except OSError as ex:
- raise OSError('Unable to move %r to %r (%s)' % (
- source, destination, ex))
-
-def rm(*files):
- """A shell-like rm, supporting wildcards.
- """
- for wfile in files:
- for filename in glob.glob(wfile):
- if islink(filename):
- os.remove(filename)
- elif isdir(filename):
- shutil.rmtree(filename)
- else:
- os.remove(filename)
-
-def cp(source, destination):
- """A shell-like cp, supporting wildcards.
- """
- mv(source, destination, _action=shutil.copy)
-
-def find(directory, exts, exclude=False, blacklist=STD_BLACKLIST):
- """Recursively find files ending with the given extensions from the directory.
-
- :type directory: str
- :param directory:
- directory where the search should start
-
- :type exts: basestring or list or tuple
- :param exts:
- extensions or lists or extensions to search
-
- :type exclude: boolean
- :param exts:
- if this argument is True, returning files NOT ending with the given
- extensions
-
- :type blacklist: list or tuple
- :param blacklist:
- optional list of files or directory to ignore, default to the value of
- `logilab.common.STD_BLACKLIST`
-
- :rtype: list
- :return:
- the list of all matching files
- """
- if isinstance(exts, string_types):
- exts = (exts,)
- if exclude:
- def match(filename, exts):
- for ext in exts:
- if filename.endswith(ext):
- return False
- return True
- else:
- def match(filename, exts):
- for ext in exts:
- if filename.endswith(ext):
- return True
- return False
- files = []
- for dirpath, dirnames, filenames in os.walk(directory):
- _handle_blacklist(blacklist, dirnames, filenames)
- # don't append files if the directory is blacklisted
- dirname = basename(dirpath)
- if dirname in blacklist:
- continue
- files.extend([join(dirpath, f) for f in filenames if match(f, exts)])
- return files
-
-
-def globfind(directory, pattern, blacklist=STD_BLACKLIST):
- """Recursively finds files matching glob `pattern` under `directory`.
-
- This is an alternative to `logilab.common.shellutils.find`.
-
- :type directory: str
- :param directory:
- directory where the search should start
-
- :type pattern: basestring
- :param pattern:
- the glob pattern (e.g *.py, foo*.py, etc.)
-
- :type blacklist: list or tuple
- :param blacklist:
- optional list of files or directory to ignore, default to the value of
- `logilab.common.STD_BLACKLIST`
-
- :rtype: iterator
- :return:
- iterator over the list of all matching files
- """
- for curdir, dirnames, filenames in os.walk(directory):
- _handle_blacklist(blacklist, dirnames, filenames)
- for fname in fnmatch.filter(filenames, pattern):
- yield join(curdir, fname)
-
-def unzip(archive, destdir):
- import zipfile
- if not exists(destdir):
- os.mkdir(destdir)
- zfobj = zipfile.ZipFile(archive)
- for name in zfobj.namelist():
- if name.endswith('/'):
- os.mkdir(join(destdir, name))
- else:
- outfile = open(join(destdir, name), 'wb')
- outfile.write(zfobj.read(name))
- outfile.close()
-
-
-class Execute:
- """This is a deadlock safe version of popen2 (no stdin), that returns
- an object with errorlevel, out and err.
- """
-
- def __init__(self, command):
- cmd = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- self.out, self.err = cmd.communicate()
- self.status = os.WEXITSTATUS(cmd.returncode)
-
-Execute = deprecated('Use subprocess.Popen instead')(Execute)
-
-
-def acquire_lock(lock_file, max_try=10, delay=10, max_delay=3600):
- """Acquire a lock represented by a file on the file system
-
- If the process written in lock file doesn't exist anymore, we remove the
- lock file immediately
- If age of the lock_file is greater than max_delay, then we raise a UserWarning
- """
- count = abs(max_try)
- while count:
- try:
- fd = os.open(lock_file, os.O_EXCL | os.O_RDWR | os.O_CREAT)
- os.write(fd, str_to_bytes(str(os.getpid())) )
- os.close(fd)
- return True
- except OSError as e:
- if e.errno == errno.EEXIST:
- try:
- fd = open(lock_file, "r")
- pid = int(fd.readline())
- pi = ProcInfo(pid)
- age = (time.time() - os.stat(lock_file)[stat.ST_MTIME])
- if age / max_delay > 1 :
- raise UserWarning("Command '%s' (pid %s) has locked the "
- "file '%s' for %s minutes"
- % (pi.name(), pid, lock_file, age/60))
- except UserWarning:
- raise
- except NoSuchProcess:
- os.remove(lock_file)
- except Exception:
- # The try block is not essential. can be skipped.
- # Note: ProcInfo object is only available for linux
- # process information are not accessible...
- # or lock_file is no more present...
- pass
- else:
- raise
- count -= 1
- time.sleep(delay)
- else:
- raise Exception('Unable to acquire %s' % lock_file)
-
-def release_lock(lock_file):
- """Release a lock represented by a file on the file system."""
- os.remove(lock_file)
-
-
-class ProgressBar(object):
- """A simple text progression bar."""
-
- def __init__(self, nbops, size=20, stream=sys.stdout, title=''):
- if title:
- self._fstr = '\r%s [%%-%ss]' % (title, int(size))
- else:
- self._fstr = '\r[%%-%ss]' % int(size)
- self._stream = stream
- self._total = nbops
- self._size = size
- self._current = 0
- self._progress = 0
- self._current_text = None
- self._last_text_write_size = 0
-
- def _get_text(self):
- return self._current_text
-
- def _set_text(self, text=None):
- if text != self._current_text:
- self._current_text = text
- self.refresh()
-
- def _del_text(self):
- self.text = None
-
- text = property(_get_text, _set_text, _del_text)
-
- def update(self, offset=1, exact=False):
- """Move FORWARD to new cursor position (cursor will never go backward).
-
- :offset: fraction of ``size``
-
- :exact:
-
- - False: offset relative to current cursor position if True
- - True: offset as an asbsolute position
-
- """
- if exact:
- self._current = offset
- else:
- self._current += offset
-
- progress = int((float(self._current)/float(self._total))*self._size)
- if progress > self._progress:
- self._progress = progress
- self.refresh()
-
- def refresh(self):
- """Refresh the progression bar display."""
- self._stream.write(self._fstr % ('=' * min(self._progress, self._size)) )
- if self._last_text_write_size or self._current_text:
- template = ' %%-%is' % (self._last_text_write_size)
- text = self._current_text
- if text is None:
- text = ''
- self._stream.write(template % text)
- self._last_text_write_size = len(text.rstrip())
- self._stream.flush()
-
- def finish(self):
- self._stream.write('\n')
- self._stream.flush()
-
-
-class DummyProgressBar(object):
- __slot__ = ('text',)
-
- def refresh(self):
- pass
- def update(self):
- pass
- def finish(self):
- pass
-
-
-_MARKER = object()
-class progress(object):
-
- def __init__(self, nbops=_MARKER, size=_MARKER, stream=_MARKER, title=_MARKER, enabled=True):
- self.nbops = nbops
- self.size = size
- self.stream = stream
- self.title = title
- self.enabled = enabled
-
- def __enter__(self):
- if self.enabled:
- kwargs = {}
- for attr in ('nbops', 'size', 'stream', 'title'):
- value = getattr(self, attr)
- if value is not _MARKER:
- kwargs[attr] = value
- self.pb = ProgressBar(**kwargs)
- else:
- self.pb = DummyProgressBar()
- return self.pb
-
- def __exit__(self, exc_type, exc_val, exc_tb):
- self.pb.finish()
-
-class RawInput(object):
-
- def __init__(self, input=None, printer=None):
- self._input = input or raw_input
- self._print = printer
-
- def ask(self, question, options, default):
- assert default in options
- choices = []
- for option in options:
- if option == default:
- label = option[0].upper()
- else:
- label = option[0].lower()
- if len(option) > 1:
- label += '(%s)' % option[1:].lower()
- choices.append((option, label))
- prompt = "%s [%s]: " % (question,
- '/'.join([opt[1] for opt in choices]))
- tries = 3
- while tries > 0:
- answer = self._input(prompt).strip().lower()
- if not answer:
- return default
- possible = [option for option, label in choices
- if option.lower().startswith(answer)]
- if len(possible) == 1:
- return possible[0]
- elif len(possible) == 0:
- msg = '%s is not an option.' % answer
- else:
- msg = ('%s is an ambiguous answer, do you mean %s ?' % (
- answer, ' or '.join(possible)))
- if self._print:
- self._print(msg)
- else:
- print(msg)
- tries -= 1
- raise Exception('unable to get a sensible answer')
-
- def confirm(self, question, default_is_yes=True):
- default = default_is_yes and 'y' or 'n'
- answer = self.ask(question, ('y', 'n'), default)
- return answer == 'y'
-
-ASK = RawInput()
-
-
-def getlogin():
- """avoid using os.getlogin() because of strange tty / stdin problems
- (man 3 getlogin)
- Another solution would be to use $LOGNAME, $USER or $USERNAME
- """
- if sys.platform != 'win32':
- import pwd # Platforms: Unix
- return pwd.getpwuid(os.getuid())[0]
- else:
- return os.environ['USERNAME']
-
-def generate_password(length=8, vocab=string.ascii_letters + string.digits):
- """dumb password generation function"""
- pwd = ''
- for i in range(length):
- pwd += random.choice(vocab)
- return pwd
diff --git a/chromium/third_party/logilab/logilab/common/sphinx_ext.py b/chromium/third_party/logilab/logilab/common/sphinx_ext.py
deleted file mode 100644
index a24608ce8b4..00000000000
--- a/chromium/third_party/logilab/logilab/common/sphinx_ext.py
+++ /dev/null
@@ -1,87 +0,0 @@
-# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-from logilab.common.decorators import monkeypatch
-
-from sphinx.ext import autodoc
-
-class DocstringOnlyModuleDocumenter(autodoc.ModuleDocumenter):
- objtype = 'docstring'
- def format_signature(self):
- pass
- def add_directive_header(self, sig):
- pass
- def document_members(self, all_members=False):
- pass
-
- def resolve_name(self, modname, parents, path, base):
- if modname is not None:
- return modname, parents + [base]
- return (path or '') + base, []
-
-
-#autodoc.add_documenter(DocstringOnlyModuleDocumenter)
-
-def setup(app):
- app.add_autodocumenter(DocstringOnlyModuleDocumenter)
-
-
-
-from sphinx.ext.autodoc import (ViewList, Options, AutodocReporter, nodes,
- assemble_option_dict, nested_parse_with_titles)
-
-@monkeypatch(autodoc.AutoDirective)
-def run(self):
- self.filename_set = set() # a set of dependent filenames
- self.reporter = self.state.document.reporter
- self.env = self.state.document.settings.env
- self.warnings = []
- self.result = ViewList()
-
- # find out what documenter to call
- objtype = self.name[4:]
- doc_class = self._registry[objtype]
- # process the options with the selected documenter's option_spec
- self.genopt = Options(assemble_option_dict(
- self.options.items(), doc_class.option_spec))
- # generate the output
- documenter = doc_class(self, self.arguments[0])
- documenter.generate(more_content=self.content)
- if not self.result:
- return self.warnings
-
- # record all filenames as dependencies -- this will at least
- # partially make automatic invalidation possible
- for fn in self.filename_set:
- self.env.note_dependency(fn)
-
- # use a custom reporter that correctly assigns lines to source
- # filename/description and lineno
- old_reporter = self.state.memo.reporter
- self.state.memo.reporter = AutodocReporter(self.result,
- self.state.memo.reporter)
- if self.name in ('automodule', 'autodocstring'):
- node = nodes.section()
- # necessary so that the child nodes get the right source/line set
- node.document = self.state.document
- nested_parse_with_titles(self.state, self.result, node)
- else:
- node = nodes.paragraph()
- node.document = self.state.document
- self.state.nested_parse(self.result, 0, node)
- self.state.memo.reporter = old_reporter
- return self.warnings + node.children
diff --git a/chromium/third_party/logilab/logilab/common/sphinxutils.py b/chromium/third_party/logilab/logilab/common/sphinxutils.py
deleted file mode 100644
index ab6e8a187a7..00000000000
--- a/chromium/third_party/logilab/logilab/common/sphinxutils.py
+++ /dev/null
@@ -1,122 +0,0 @@
-# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""Sphinx utils
-
-ModuleGenerator: Generate a file that lists all the modules of a list of
-packages in order to pull all the docstring.
-This should not be used in a makefile to systematically generate sphinx
-documentation!
-
-Typical usage:
-
->>> from logilab.common.sphinxutils import ModuleGenerator
->>> mgen = ModuleGenerator('logilab common', '/home/adim/src/logilab/common')
->>> mgen.generate('api_logilab_common.rst', exclude_dirs=('test',))
-"""
-
-import os, sys
-import os.path as osp
-import inspect
-
-from logilab.common import STD_BLACKLIST
-from logilab.common.shellutils import globfind
-from logilab.common.modutils import load_module_from_file, modpath_from_file
-
-def module_members(module):
- members = []
- for name, value in inspect.getmembers(module):
- if getattr(value, '__module__', None) == module.__name__:
- members.append( (name, value) )
- return sorted(members)
-
-
-def class_members(klass):
- return sorted([name for name in vars(klass)
- if name not in ('__doc__', '__module__',
- '__dict__', '__weakref__')])
-
-class ModuleGenerator:
- file_header = """.. -*- coding: utf-8 -*-\n\n%s\n"""
- module_def = """
-:mod:`%s`
-=======%s
-
-.. automodule:: %s
- :members: %s
-"""
- class_def = """
-
-.. autoclass:: %s
- :members: %s
-
-"""
-
- def __init__(self, project_title, code_dir):
- self.title = project_title
- self.code_dir = osp.abspath(code_dir)
-
- def generate(self, dest_file, exclude_dirs=STD_BLACKLIST):
- """make the module file"""
- self.fn = open(dest_file, 'w')
- num = len(self.title) + 6
- title = "=" * num + "\n %s API\n" % self.title + "=" * num
- self.fn.write(self.file_header % title)
- self.gen_modules(exclude_dirs=exclude_dirs)
- self.fn.close()
-
- def gen_modules(self, exclude_dirs):
- """generate all modules"""
- for module in self.find_modules(exclude_dirs):
- modname = module.__name__
- classes = []
- modmembers = []
- for objname, obj in module_members(module):
- if inspect.isclass(obj):
- classmembers = class_members(obj)
- classes.append( (objname, classmembers) )
- else:
- modmembers.append(objname)
- self.fn.write(self.module_def % (modname, '=' * len(modname),
- modname,
- ', '.join(modmembers)))
- for klass, members in classes:
- self.fn.write(self.class_def % (klass, ', '.join(members)))
-
- def find_modules(self, exclude_dirs):
- basepath = osp.dirname(self.code_dir)
- basedir = osp.basename(basepath) + osp.sep
- if basedir not in sys.path:
- sys.path.insert(1, basedir)
- for filepath in globfind(self.code_dir, '*.py', exclude_dirs):
- if osp.basename(filepath) in ('setup.py', '__pkginfo__.py'):
- continue
- try:
- module = load_module_from_file(filepath)
- except: # module might be broken or magic
- dotted_path = modpath_from_file(filepath)
- module = type('.'.join(dotted_path), (), {}) # mock it
- yield module
-
-
-if __name__ == '__main__':
- # example :
- title, code_dir, outfile = sys.argv[1:]
- generator = ModuleGenerator(title, code_dir)
- # XXX modnames = ['logilab']
- generator.generate(outfile, ('test', 'tests', 'examples',
- 'data', 'doc', '.hg', 'migration'))
diff --git a/chromium/third_party/logilab/logilab/common/table.py b/chromium/third_party/logilab/logilab/common/table.py
deleted file mode 100644
index 2f3df69401d..00000000000
--- a/chromium/third_party/logilab/logilab/common/table.py
+++ /dev/null
@@ -1,929 +0,0 @@
-# copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""Table management module."""
-
-from __future__ import print_function
-
-__docformat__ = "restructuredtext en"
-
-from six.moves import range
-
-class Table(object):
- """Table defines a data table with column and row names.
- inv:
- len(self.data) <= len(self.row_names)
- forall(self.data, lambda x: len(x) <= len(self.col_names))
- """
-
- def __init__(self, default_value=0, col_names=None, row_names=None):
- self.col_names = []
- self.row_names = []
- self.data = []
- self.default_value = default_value
- if col_names:
- self.create_columns(col_names)
- if row_names:
- self.create_rows(row_names)
-
- def _next_row_name(self):
- return 'row%s' % (len(self.row_names)+1)
-
- def __iter__(self):
- return iter(self.data)
-
- def __eq__(self, other):
- if other is None:
- return False
- else:
- return list(self) == list(other)
-
- __hash__ = object.__hash__
-
- def __ne__(self, other):
- return not self == other
-
- def __len__(self):
- return len(self.row_names)
-
- ## Rows / Columns creation #################################################
- def create_rows(self, row_names):
- """Appends row_names to the list of existing rows
- """
- self.row_names.extend(row_names)
- for row_name in row_names:
- self.data.append([self.default_value]*len(self.col_names))
-
- def create_columns(self, col_names):
- """Appends col_names to the list of existing columns
- """
- for col_name in col_names:
- self.create_column(col_name)
-
- def create_row(self, row_name=None):
- """Creates a rowname to the row_names list
- """
- row_name = row_name or self._next_row_name()
- self.row_names.append(row_name)
- self.data.append([self.default_value]*len(self.col_names))
-
-
- def create_column(self, col_name):
- """Creates a colname to the col_names list
- """
- self.col_names.append(col_name)
- for row in self.data:
- row.append(self.default_value)
-
- ## Sort by column ##########################################################
- def sort_by_column_id(self, col_id, method = 'asc'):
- """Sorts the table (in-place) according to data stored in col_id
- """
- try:
- col_index = self.col_names.index(col_id)
- self.sort_by_column_index(col_index, method)
- except ValueError:
- raise KeyError("Col (%s) not found in table" % (col_id))
-
-
- def sort_by_column_index(self, col_index, method = 'asc'):
- """Sorts the table 'in-place' according to data stored in col_index
-
- method should be in ('asc', 'desc')
- """
- sort_list = sorted([(row[col_index], row, row_name)
- for row, row_name in zip(self.data, self.row_names)])
- # Sorting sort_list will sort according to col_index
- # If we want reverse sort, then reverse list
- if method.lower() == 'desc':
- sort_list.reverse()
-
- # Rebuild data / row names
- self.data = []
- self.row_names = []
- for val, row, row_name in sort_list:
- self.data.append(row)
- self.row_names.append(row_name)
-
- def groupby(self, colname, *others):
- """builds indexes of data
- :returns: nested dictionaries pointing to actual rows
- """
- groups = {}
- colnames = (colname,) + others
- col_indexes = [self.col_names.index(col_id) for col_id in colnames]
- for row in self.data:
- ptr = groups
- for col_index in col_indexes[:-1]:
- ptr = ptr.setdefault(row[col_index], {})
- ptr = ptr.setdefault(row[col_indexes[-1]],
- Table(default_value=self.default_value,
- col_names=self.col_names))
- ptr.append_row(tuple(row))
- return groups
-
- def select(self, colname, value):
- grouped = self.groupby(colname)
- try:
- return grouped[value]
- except KeyError:
- return []
-
- def remove(self, colname, value):
- col_index = self.col_names.index(colname)
- for row in self.data[:]:
- if row[col_index] == value:
- self.data.remove(row)
-
-
- ## The 'setter' part #######################################################
- def set_cell(self, row_index, col_index, data):
- """sets value of cell 'row_indew', 'col_index' to data
- """
- self.data[row_index][col_index] = data
-
-
- def set_cell_by_ids(self, row_id, col_id, data):
- """sets value of cell mapped by row_id and col_id to data
- Raises a KeyError if row_id or col_id are not found in the table
- """
- try:
- row_index = self.row_names.index(row_id)
- except ValueError:
- raise KeyError("Row (%s) not found in table" % (row_id))
- else:
- try:
- col_index = self.col_names.index(col_id)
- self.data[row_index][col_index] = data
- except ValueError:
- raise KeyError("Column (%s) not found in table" % (col_id))
-
-
- def set_row(self, row_index, row_data):
- """sets the 'row_index' row
- pre:
- type(row_data) == types.ListType
- len(row_data) == len(self.col_names)
- """
- self.data[row_index] = row_data
-
-
- def set_row_by_id(self, row_id, row_data):
- """sets the 'row_id' column
- pre:
- type(row_data) == types.ListType
- len(row_data) == len(self.row_names)
- Raises a KeyError if row_id is not found
- """
- try:
- row_index = self.row_names.index(row_id)
- self.set_row(row_index, row_data)
- except ValueError:
- raise KeyError('Row (%s) not found in table' % (row_id))
-
-
- def append_row(self, row_data, row_name=None):
- """Appends a row to the table
- pre:
- type(row_data) == types.ListType
- len(row_data) == len(self.col_names)
- """
- row_name = row_name or self._next_row_name()
- self.row_names.append(row_name)
- self.data.append(row_data)
- return len(self.data) - 1
-
- def insert_row(self, index, row_data, row_name=None):
- """Appends row_data before 'index' in the table. To make 'insert'
- behave like 'list.insert', inserting in an out of range index will
- insert row_data to the end of the list
- pre:
- type(row_data) == types.ListType
- len(row_data) == len(self.col_names)
- """
- row_name = row_name or self._next_row_name()
- self.row_names.insert(index, row_name)
- self.data.insert(index, row_data)
-
-
- def delete_row(self, index):
- """Deletes the 'index' row in the table, and returns it.
- Raises an IndexError if index is out of range
- """
- self.row_names.pop(index)
- return self.data.pop(index)
-
-
- def delete_row_by_id(self, row_id):
- """Deletes the 'row_id' row in the table.
- Raises a KeyError if row_id was not found.
- """
- try:
- row_index = self.row_names.index(row_id)
- self.delete_row(row_index)
- except ValueError:
- raise KeyError('Row (%s) not found in table' % (row_id))
-
-
- def set_column(self, col_index, col_data):
- """sets the 'col_index' column
- pre:
- type(col_data) == types.ListType
- len(col_data) == len(self.row_names)
- """
-
- for row_index, cell_data in enumerate(col_data):
- self.data[row_index][col_index] = cell_data
-
-
- def set_column_by_id(self, col_id, col_data):
- """sets the 'col_id' column
- pre:
- type(col_data) == types.ListType
- len(col_data) == len(self.col_names)
- Raises a KeyError if col_id is not found
- """
- try:
- col_index = self.col_names.index(col_id)
- self.set_column(col_index, col_data)
- except ValueError:
- raise KeyError('Column (%s) not found in table' % (col_id))
-
-
- def append_column(self, col_data, col_name):
- """Appends the 'col_index' column
- pre:
- type(col_data) == types.ListType
- len(col_data) == len(self.row_names)
- """
- self.col_names.append(col_name)
- for row_index, cell_data in enumerate(col_data):
- self.data[row_index].append(cell_data)
-
-
- def insert_column(self, index, col_data, col_name):
- """Appends col_data before 'index' in the table. To make 'insert'
- behave like 'list.insert', inserting in an out of range index will
- insert col_data to the end of the list
- pre:
- type(col_data) == types.ListType
- len(col_data) == len(self.row_names)
- """
- self.col_names.insert(index, col_name)
- for row_index, cell_data in enumerate(col_data):
- self.data[row_index].insert(index, cell_data)
-
-
- def delete_column(self, index):
- """Deletes the 'index' column in the table, and returns it.
- Raises an IndexError if index is out of range
- """
- self.col_names.pop(index)
- return [row.pop(index) for row in self.data]
-
-
- def delete_column_by_id(self, col_id):
- """Deletes the 'col_id' col in the table.
- Raises a KeyError if col_id was not found.
- """
- try:
- col_index = self.col_names.index(col_id)
- self.delete_column(col_index)
- except ValueError:
- raise KeyError('Column (%s) not found in table' % (col_id))
-
-
- ## The 'getter' part #######################################################
-
- def get_shape(self):
- """Returns a tuple which represents the table's shape
- """
- return len(self.row_names), len(self.col_names)
- shape = property(get_shape)
-
- def __getitem__(self, indices):
- """provided for convenience"""
- rows, multirows = None, False
- cols, multicols = None, False
- if isinstance(indices, tuple):
- rows = indices[0]
- if len(indices) > 1:
- cols = indices[1]
- else:
- rows = indices
- # define row slice
- if isinstance(rows, str):
- try:
- rows = self.row_names.index(rows)
- except ValueError:
- raise KeyError("Row (%s) not found in table" % (rows))
- if isinstance(rows, int):
- rows = slice(rows, rows+1)
- multirows = False
- else:
- rows = slice(None)
- multirows = True
- # define col slice
- if isinstance(cols, str):
- try:
- cols = self.col_names.index(cols)
- except ValueError:
- raise KeyError("Column (%s) not found in table" % (cols))
- if isinstance(cols, int):
- cols = slice(cols, cols+1)
- multicols = False
- else:
- cols = slice(None)
- multicols = True
- # get sub-table
- tab = Table()
- tab.default_value = self.default_value
- tab.create_rows(self.row_names[rows])
- tab.create_columns(self.col_names[cols])
- for idx, row in enumerate(self.data[rows]):
- tab.set_row(idx, row[cols])
- if multirows :
- if multicols:
- return tab
- else:
- return [item[0] for item in tab.data]
- else:
- if multicols:
- return tab.data[0]
- else:
- return tab.data[0][0]
-
- def get_cell_by_ids(self, row_id, col_id):
- """Returns the element at [row_id][col_id]
- """
- try:
- row_index = self.row_names.index(row_id)
- except ValueError:
- raise KeyError("Row (%s) not found in table" % (row_id))
- else:
- try:
- col_index = self.col_names.index(col_id)
- except ValueError:
- raise KeyError("Column (%s) not found in table" % (col_id))
- return self.data[row_index][col_index]
-
- def get_row_by_id(self, row_id):
- """Returns the 'row_id' row
- """
- try:
- row_index = self.row_names.index(row_id)
- except ValueError:
- raise KeyError("Row (%s) not found in table" % (row_id))
- return self.data[row_index]
-
- def get_column_by_id(self, col_id, distinct=False):
- """Returns the 'col_id' col
- """
- try:
- col_index = self.col_names.index(col_id)
- except ValueError:
- raise KeyError("Column (%s) not found in table" % (col_id))
- return self.get_column(col_index, distinct)
-
- def get_columns(self):
- """Returns all the columns in the table
- """
- return [self[:, index] for index in range(len(self.col_names))]
-
- def get_column(self, col_index, distinct=False):
- """get a column by index"""
- col = [row[col_index] for row in self.data]
- if distinct:
- col = list(set(col))
- return col
-
- def apply_stylesheet(self, stylesheet):
- """Applies the stylesheet to this table
- """
- for instruction in stylesheet.instructions:
- eval(instruction)
-
-
- def transpose(self):
- """Keeps the self object intact, and returns the transposed (rotated)
- table.
- """
- transposed = Table()
- transposed.create_rows(self.col_names)
- transposed.create_columns(self.row_names)
- for col_index, column in enumerate(self.get_columns()):
- transposed.set_row(col_index, column)
- return transposed
-
-
- def pprint(self):
- """returns a string representing the table in a pretty
- printed 'text' format.
- """
- # The maximum row name (to know the start_index of the first col)
- max_row_name = 0
- for row_name in self.row_names:
- if len(row_name) > max_row_name:
- max_row_name = len(row_name)
- col_start = max_row_name + 5
-
- lines = []
- # Build the 'first' line <=> the col_names one
- # The first cell <=> an empty one
- col_names_line = [' '*col_start]
- for col_name in self.col_names:
- col_names_line.append(col_name + ' '*5)
- lines.append('|' + '|'.join(col_names_line) + '|')
- max_line_length = len(lines[0])
-
- # Build the table
- for row_index, row in enumerate(self.data):
- line = []
- # First, build the row_name's cell
- row_name = self.row_names[row_index]
- line.append(row_name + ' '*(col_start-len(row_name)))
-
- # Then, build all the table's cell for this line.
- for col_index, cell in enumerate(row):
- col_name_length = len(self.col_names[col_index]) + 5
- data = str(cell)
- line.append(data + ' '*(col_name_length - len(data)))
- lines.append('|' + '|'.join(line) + '|')
- if len(lines[-1]) > max_line_length:
- max_line_length = len(lines[-1])
-
- # Wrap the table with '-' to make a frame
- lines.insert(0, '-'*max_line_length)
- lines.append('-'*max_line_length)
- return '\n'.join(lines)
-
-
- def __repr__(self):
- return repr(self.data)
-
- def as_text(self):
- data = []
- # We must convert cells into strings before joining them
- for row in self.data:
- data.append([str(cell) for cell in row])
- lines = ['\t'.join(row) for row in data]
- return '\n'.join(lines)
-
-
-
-class TableStyle:
- """Defines a table's style
- """
-
- def __init__(self, table):
-
- self._table = table
- self.size = dict([(col_name, '1*') for col_name in table.col_names])
- # __row_column__ is a special key to define the first column which
- # actually has no name (<=> left most column <=> row names column)
- self.size['__row_column__'] = '1*'
- self.alignment = dict([(col_name, 'right')
- for col_name in table.col_names])
- self.alignment['__row_column__'] = 'right'
-
- # We shouldn't have to create an entry for
- # the 1st col (the row_column one)
- self.units = dict([(col_name, '') for col_name in table.col_names])
- self.units['__row_column__'] = ''
-
- # XXX FIXME : params order should be reversed for all set() methods
- def set_size(self, value, col_id):
- """sets the size of the specified col_id to value
- """
- self.size[col_id] = value
-
- def set_size_by_index(self, value, col_index):
- """Allows to set the size according to the column index rather than
- using the column's id.
- BE CAREFUL : the '0' column is the '__row_column__' one !
- """
- if col_index == 0:
- col_id = '__row_column__'
- else:
- col_id = self._table.col_names[col_index-1]
-
- self.size[col_id] = value
-
-
- def set_alignment(self, value, col_id):
- """sets the alignment of the specified col_id to value
- """
- self.alignment[col_id] = value
-
-
- def set_alignment_by_index(self, value, col_index):
- """Allows to set the alignment according to the column index rather than
- using the column's id.
- BE CAREFUL : the '0' column is the '__row_column__' one !
- """
- if col_index == 0:
- col_id = '__row_column__'
- else:
- col_id = self._table.col_names[col_index-1]
-
- self.alignment[col_id] = value
-
-
- def set_unit(self, value, col_id):
- """sets the unit of the specified col_id to value
- """
- self.units[col_id] = value
-
-
- def set_unit_by_index(self, value, col_index):
- """Allows to set the unit according to the column index rather than
- using the column's id.
- BE CAREFUL : the '0' column is the '__row_column__' one !
- (Note that in the 'unit' case, you shouldn't have to set a unit
- for the 1st column (the __row__column__ one))
- """
- if col_index == 0:
- col_id = '__row_column__'
- else:
- col_id = self._table.col_names[col_index-1]
-
- self.units[col_id] = value
-
-
- def get_size(self, col_id):
- """Returns the size of the specified col_id
- """
- return self.size[col_id]
-
-
- def get_size_by_index(self, col_index):
- """Allows to get the size according to the column index rather than
- using the column's id.
- BE CAREFUL : the '0' column is the '__row_column__' one !
- """
- if col_index == 0:
- col_id = '__row_column__'
- else:
- col_id = self._table.col_names[col_index-1]
-
- return self.size[col_id]
-
-
- def get_alignment(self, col_id):
- """Returns the alignment of the specified col_id
- """
- return self.alignment[col_id]
-
-
- def get_alignment_by_index(self, col_index):
- """Allors to get the alignment according to the column index rather than
- using the column's id.
- BE CAREFUL : the '0' column is the '__row_column__' one !
- """
- if col_index == 0:
- col_id = '__row_column__'
- else:
- col_id = self._table.col_names[col_index-1]
-
- return self.alignment[col_id]
-
-
- def get_unit(self, col_id):
- """Returns the unit of the specified col_id
- """
- return self.units[col_id]
-
-
- def get_unit_by_index(self, col_index):
- """Allors to get the unit according to the column index rather than
- using the column's id.
- BE CAREFUL : the '0' column is the '__row_column__' one !
- """
- if col_index == 0:
- col_id = '__row_column__'
- else:
- col_id = self._table.col_names[col_index-1]
-
- return self.units[col_id]
-
-
-import re
-CELL_PROG = re.compile("([0-9]+)_([0-9]+)")
-
-class TableStyleSheet:
- """A simple Table stylesheet
- Rules are expressions where cells are defined by the row_index
- and col_index separated by an underscore ('_').
- For example, suppose you want to say that the (2,5) cell must be
- the sum of its two preceding cells in the row, you would create
- the following rule :
- 2_5 = 2_3 + 2_4
- You can also use all the math.* operations you want. For example:
- 2_5 = sqrt(2_3**2 + 2_4**2)
- """
-
- def __init__(self, rules = None):
- rules = rules or []
- self.rules = []
- self.instructions = []
- for rule in rules:
- self.add_rule(rule)
-
-
- def add_rule(self, rule):
- """Adds a rule to the stylesheet rules
- """
- try:
- source_code = ['from math import *']
- source_code.append(CELL_PROG.sub(r'self.data[\1][\2]', rule))
- self.instructions.append(compile('\n'.join(source_code),
- 'table.py', 'exec'))
- self.rules.append(rule)
- except SyntaxError:
- print("Bad Stylesheet Rule : %s [skipped]" % rule)
-
-
- def add_rowsum_rule(self, dest_cell, row_index, start_col, end_col):
- """Creates and adds a rule to sum over the row at row_index from
- start_col to end_col.
- dest_cell is a tuple of two elements (x,y) of the destination cell
- No check is done for indexes ranges.
- pre:
- start_col >= 0
- end_col > start_col
- """
- cell_list = ['%d_%d'%(row_index, index) for index in range(start_col,
- end_col + 1)]
- rule = '%d_%d=' % dest_cell + '+'.join(cell_list)
- self.add_rule(rule)
-
-
- def add_rowavg_rule(self, dest_cell, row_index, start_col, end_col):
- """Creates and adds a rule to make the row average (from start_col
- to end_col)
- dest_cell is a tuple of two elements (x,y) of the destination cell
- No check is done for indexes ranges.
- pre:
- start_col >= 0
- end_col > start_col
- """
- cell_list = ['%d_%d'%(row_index, index) for index in range(start_col,
- end_col + 1)]
- num = (end_col - start_col + 1)
- rule = '%d_%d=' % dest_cell + '('+'+'.join(cell_list)+')/%f'%num
- self.add_rule(rule)
-
-
- def add_colsum_rule(self, dest_cell, col_index, start_row, end_row):
- """Creates and adds a rule to sum over the col at col_index from
- start_row to end_row.
- dest_cell is a tuple of two elements (x,y) of the destination cell
- No check is done for indexes ranges.
- pre:
- start_row >= 0
- end_row > start_row
- """
- cell_list = ['%d_%d'%(index, col_index) for index in range(start_row,
- end_row + 1)]
- rule = '%d_%d=' % dest_cell + '+'.join(cell_list)
- self.add_rule(rule)
-
-
- def add_colavg_rule(self, dest_cell, col_index, start_row, end_row):
- """Creates and adds a rule to make the col average (from start_row
- to end_row)
- dest_cell is a tuple of two elements (x,y) of the destination cell
- No check is done for indexes ranges.
- pre:
- start_row >= 0
- end_row > start_row
- """
- cell_list = ['%d_%d'%(index, col_index) for index in range(start_row,
- end_row + 1)]
- num = (end_row - start_row + 1)
- rule = '%d_%d=' % dest_cell + '('+'+'.join(cell_list)+')/%f'%num
- self.add_rule(rule)
-
-
-
-class TableCellRenderer:
- """Defines a simple text renderer
- """
-
- def __init__(self, **properties):
- """keywords should be properties with an associated boolean as value.
- For example :
- renderer = TableCellRenderer(units = True, alignment = False)
- An unspecified property will have a 'False' value by default.
- Possible properties are :
- alignment, unit
- """
- self.properties = properties
-
-
- def render_cell(self, cell_coord, table, table_style):
- """Renders the cell at 'cell_coord' in the table, using table_style
- """
- row_index, col_index = cell_coord
- cell_value = table.data[row_index][col_index]
- final_content = self._make_cell_content(cell_value,
- table_style, col_index +1)
- return self._render_cell_content(final_content,
- table_style, col_index + 1)
-
-
- def render_row_cell(self, row_name, table, table_style):
- """Renders the cell for 'row_id' row
- """
- cell_value = row_name
- return self._render_cell_content(cell_value, table_style, 0)
-
-
- def render_col_cell(self, col_name, table, table_style):
- """Renders the cell for 'col_id' row
- """
- cell_value = col_name
- col_index = table.col_names.index(col_name)
- return self._render_cell_content(cell_value, table_style, col_index +1)
-
-
-
- def _render_cell_content(self, content, table_style, col_index):
- """Makes the appropriate rendering for this cell content.
- Rendering properties will be searched using the
- *table_style.get_xxx_by_index(col_index)' methods
-
- **This method should be overridden in the derived renderer classes.**
- """
- return content
-
-
- def _make_cell_content(self, cell_content, table_style, col_index):
- """Makes the cell content (adds decoration data, like units for
- example)
- """
- final_content = cell_content
- if 'skip_zero' in self.properties:
- replacement_char = self.properties['skip_zero']
- else:
- replacement_char = 0
- if replacement_char and final_content == 0:
- return replacement_char
-
- try:
- units_on = self.properties['units']
- if units_on:
- final_content = self._add_unit(
- cell_content, table_style, col_index)
- except KeyError:
- pass
-
- return final_content
-
-
- def _add_unit(self, cell_content, table_style, col_index):
- """Adds unit to the cell_content if needed
- """
- unit = table_style.get_unit_by_index(col_index)
- return str(cell_content) + " " + unit
-
-
-
-class DocbookRenderer(TableCellRenderer):
- """Defines how to render a cell for a docboook table
- """
-
- def define_col_header(self, col_index, table_style):
- """Computes the colspec element according to the style
- """
- size = table_style.get_size_by_index(col_index)
- return '<colspec colname="c%d" colwidth="%s"/>\n' % \
- (col_index, size)
-
-
- def _render_cell_content(self, cell_content, table_style, col_index):
- """Makes the appropriate rendering for this cell content.
- Rendering properties will be searched using the
- table_style.get_xxx_by_index(col_index)' methods.
- """
- try:
- align_on = self.properties['alignment']
- alignment = table_style.get_alignment_by_index(col_index)
- if align_on:
- return "<entry align='%s'>%s</entry>\n" % \
- (alignment, cell_content)
- except KeyError:
- # KeyError <=> Default alignment
- return "<entry>%s</entry>\n" % cell_content
-
-
-class TableWriter:
- """A class to write tables
- """
-
- def __init__(self, stream, table, style, **properties):
- self._stream = stream
- self.style = style or TableStyle(table)
- self._table = table
- self.properties = properties
- self.renderer = None
-
-
- def set_style(self, style):
- """sets the table's associated style
- """
- self.style = style
-
-
- def set_renderer(self, renderer):
- """sets the way to render cell
- """
- self.renderer = renderer
-
-
- def update_properties(self, **properties):
- """Updates writer's properties (for cell rendering)
- """
- self.properties.update(properties)
-
-
- def write_table(self, title = ""):
- """Writes the table
- """
- raise NotImplementedError("write_table must be implemented !")
-
-
-
-class DocbookTableWriter(TableWriter):
- """Defines an implementation of TableWriter to write a table in Docbook
- """
-
- def _write_headers(self):
- """Writes col headers
- """
- # Define col_headers (colstpec elements)
- for col_index in range(len(self._table.col_names)+1):
- self._stream.write(self.renderer.define_col_header(col_index,
- self.style))
-
- self._stream.write("<thead>\n<row>\n")
- # XXX FIXME : write an empty entry <=> the first (__row_column) column
- self._stream.write('<entry></entry>\n')
- for col_name in self._table.col_names:
- self._stream.write(self.renderer.render_col_cell(
- col_name, self._table,
- self.style))
-
- self._stream.write("</row>\n</thead>\n")
-
-
- def _write_body(self):
- """Writes the table body
- """
- self._stream.write('<tbody>\n')
-
- for row_index, row in enumerate(self._table.data):
- self._stream.write('<row>\n')
- row_name = self._table.row_names[row_index]
- # Write the first entry (row_name)
- self._stream.write(self.renderer.render_row_cell(row_name,
- self._table,
- self.style))
-
- for col_index, cell in enumerate(row):
- self._stream.write(self.renderer.render_cell(
- (row_index, col_index),
- self._table, self.style))
-
- self._stream.write('</row>\n')
-
- self._stream.write('</tbody>\n')
-
-
- def write_table(self, title = ""):
- """Writes the table
- """
- self._stream.write('<table>\n<title>%s></title>\n'%(title))
- self._stream.write(
- '<tgroup cols="%d" align="left" colsep="1" rowsep="1">\n'%
- (len(self._table.col_names)+1))
- self._write_headers()
- self._write_body()
-
- self._stream.write('</tgroup>\n</table>\n')
-
-
diff --git a/chromium/third_party/logilab/logilab/common/tasksqueue.py b/chromium/third_party/logilab/logilab/common/tasksqueue.py
deleted file mode 100644
index ed74cf5ab5d..00000000000
--- a/chromium/third_party/logilab/logilab/common/tasksqueue.py
+++ /dev/null
@@ -1,101 +0,0 @@
-# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""Prioritized tasks queue"""
-
-__docformat__ = "restructuredtext en"
-
-from bisect import insort_left
-
-from six.moves import queue
-
-LOW = 0
-MEDIUM = 10
-HIGH = 100
-
-PRIORITY = {
- 'LOW': LOW,
- 'MEDIUM': MEDIUM,
- 'HIGH': HIGH,
- }
-REVERSE_PRIORITY = dict((values, key) for key, values in PRIORITY.items())
-
-
-
-class PrioritizedTasksQueue(queue.Queue):
-
- def _init(self, maxsize):
- """Initialize the queue representation"""
- self.maxsize = maxsize
- # ordered list of task, from the lowest to the highest priority
- self.queue = []
-
- def _put(self, item):
- """Put a new item in the queue"""
- for i, task in enumerate(self.queue):
- # equivalent task
- if task == item:
- # if new task has a higher priority, remove the one already
- # queued so the new priority will be considered
- if task < item:
- item.merge(task)
- del self.queue[i]
- break
- # else keep it so current order is kept
- task.merge(item)
- return
- insort_left(self.queue, item)
-
- def _get(self):
- """Get an item from the queue"""
- return self.queue.pop()
-
- def __iter__(self):
- return iter(self.queue)
-
- def remove(self, tid):
- """remove a specific task from the queue"""
- # XXX acquire lock
- for i, task in enumerate(self):
- if task.id == tid:
- self.queue.pop(i)
- return
- raise ValueError('not task of id %s in queue' % tid)
-
-class Task(object):
- def __init__(self, tid, priority=LOW):
- # task id
- self.id = tid
- # task priority
- self.priority = priority
-
- def __repr__(self):
- return '<Task %s @%#x>' % (self.id, id(self))
-
- def __cmp__(self, other):
- return cmp(self.priority, other.priority)
-
- def __lt__(self, other):
- return self.priority < other.priority
-
- def __eq__(self, other):
- return self.id == other.id
-
- __hash__ = object.__hash__
-
- def merge(self, other):
- pass
diff --git a/chromium/third_party/logilab/logilab/common/testlib.py b/chromium/third_party/logilab/logilab/common/testlib.py
deleted file mode 100644
index 31efe567bcc..00000000000
--- a/chromium/third_party/logilab/logilab/common/testlib.py
+++ /dev/null
@@ -1,1392 +0,0 @@
-# -*- coding: utf-8 -*-
-# copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""Run tests.
-
-This will find all modules whose name match a given prefix in the test
-directory, and run them. Various command line options provide
-additional facilities.
-
-Command line options:
-
- -v verbose -- run tests in verbose mode with output to stdout
- -q quiet -- don't print anything except if a test fails
- -t testdir -- directory where the tests will be found
- -x exclude -- add a test to exclude
- -p profile -- profiled execution
- -d dbc -- enable design-by-contract
- -m match -- only run test matching the tag pattern which follow
-
-If no non-option arguments are present, prefixes used are 'test',
-'regrtest', 'smoketest' and 'unittest'.
-
-"""
-
-from __future__ import print_function
-
-__docformat__ = "restructuredtext en"
-# modified copy of some functions from test/regrtest.py from PyXml
-# disable camel case warning
-# pylint: disable=C0103
-
-import sys
-import os, os.path as osp
-import re
-import traceback
-import inspect
-import difflib
-import tempfile
-import math
-import warnings
-from shutil import rmtree
-from operator import itemgetter
-from itertools import dropwhile
-from inspect import isgeneratorfunction
-
-from six import string_types
-from six.moves import builtins, range, configparser, input
-
-from logilab.common.deprecation import deprecated
-
-import unittest as unittest_legacy
-if not getattr(unittest_legacy, "__package__", None):
- try:
- import unittest2 as unittest
- from unittest2 import SkipTest
- except ImportError:
- raise ImportError("You have to install python-unittest2 to use %s" % __name__)
-else:
- import unittest
- from unittest import SkipTest
-
-from functools import wraps
-
-from logilab.common.debugger import Debugger, colorize_source
-from logilab.common.decorators import cached, classproperty
-from logilab.common import textutils
-
-
-__all__ = ['main', 'unittest_main', 'find_tests', 'run_test', 'spawn']
-
-DEFAULT_PREFIXES = ('test', 'regrtest', 'smoketest', 'unittest',
- 'func', 'validation')
-
-is_generator = deprecated('[lgc 0.63] use inspect.isgeneratorfunction')(isgeneratorfunction)
-
-# used by unittest to count the number of relevant levels in the traceback
-__unittest = 1
-
-
-def with_tempdir(callable):
- """A decorator ensuring no temporary file left when the function return
- Work only for temporary file create with the tempfile module"""
- if isgeneratorfunction(callable):
- def proxy(*args, **kwargs):
- old_tmpdir = tempfile.gettempdir()
- new_tmpdir = tempfile.mkdtemp(prefix="temp-lgc-")
- tempfile.tempdir = new_tmpdir
- try:
- for x in callable(*args, **kwargs):
- yield x
- finally:
- try:
- rmtree(new_tmpdir, ignore_errors=True)
- finally:
- tempfile.tempdir = old_tmpdir
- return proxy
-
- @wraps(callable)
- def proxy(*args, **kargs):
-
- old_tmpdir = tempfile.gettempdir()
- new_tmpdir = tempfile.mkdtemp(prefix="temp-lgc-")
- tempfile.tempdir = new_tmpdir
- try:
- return callable(*args, **kargs)
- finally:
- try:
- rmtree(new_tmpdir, ignore_errors=True)
- finally:
- tempfile.tempdir = old_tmpdir
- return proxy
-
-def in_tempdir(callable):
- """A decorator moving the enclosed function inside the tempfile.tempfdir
- """
- @wraps(callable)
- def proxy(*args, **kargs):
-
- old_cwd = os.getcwd()
- os.chdir(tempfile.tempdir)
- try:
- return callable(*args, **kargs)
- finally:
- os.chdir(old_cwd)
- return proxy
-
-def within_tempdir(callable):
- """A decorator run the enclosed function inside a tmpdir removed after execution
- """
- proxy = with_tempdir(in_tempdir(callable))
- proxy.__name__ = callable.__name__
- return proxy
-
-def find_tests(testdir,
- prefixes=DEFAULT_PREFIXES, suffix=".py",
- excludes=(),
- remove_suffix=True):
- """
- Return a list of all applicable test modules.
- """
- tests = []
- for name in os.listdir(testdir):
- if not suffix or name.endswith(suffix):
- for prefix in prefixes:
- if name.startswith(prefix):
- if remove_suffix and name.endswith(suffix):
- name = name[:-len(suffix)]
- if name not in excludes:
- tests.append(name)
- tests.sort()
- return tests
-
-
-## PostMortem Debug facilities #####
-def start_interactive_mode(result):
- """starts an interactive shell so that the user can inspect errors
- """
- debuggers = result.debuggers
- descrs = result.error_descrs + result.fail_descrs
- if len(debuggers) == 1:
- # don't ask for test name if there's only one failure
- debuggers[0].start()
- else:
- while True:
- testindex = 0
- print("Choose a test to debug:")
- # order debuggers in the same way than errors were printed
- print("\n".join(['\t%s : %s' % (i, descr) for i, (_, descr)
- in enumerate(descrs)]))
- print("Type 'exit' (or ^D) to quit")
- print()
- try:
- todebug = input('Enter a test name: ')
- if todebug.strip().lower() == 'exit':
- print()
- break
- else:
- try:
- testindex = int(todebug)
- debugger = debuggers[descrs[testindex][0]]
- except (ValueError, IndexError):
- print("ERROR: invalid test number %r" % (todebug, ))
- else:
- debugger.start()
- except (EOFError, KeyboardInterrupt):
- print()
- break
-
-
-# test utils ##################################################################
-
-class SkipAwareTestResult(unittest._TextTestResult):
-
- def __init__(self, stream, descriptions, verbosity,
- exitfirst=False, pdbmode=False, cvg=None, colorize=False):
- super(SkipAwareTestResult, self).__init__(stream,
- descriptions, verbosity)
- self.skipped = []
- self.debuggers = []
- self.fail_descrs = []
- self.error_descrs = []
- self.exitfirst = exitfirst
- self.pdbmode = pdbmode
- self.cvg = cvg
- self.colorize = colorize
- self.pdbclass = Debugger
- self.verbose = verbosity > 1
-
- def descrs_for(self, flavour):
- return getattr(self, '%s_descrs' % flavour.lower())
-
- def _create_pdb(self, test_descr, flavour):
- self.descrs_for(flavour).append( (len(self.debuggers), test_descr) )
- if self.pdbmode:
- self.debuggers.append(self.pdbclass(sys.exc_info()[2]))
-
- def _iter_valid_frames(self, frames):
- """only consider non-testlib frames when formatting traceback"""
- lgc_testlib = osp.abspath(__file__)
- std_testlib = osp.abspath(unittest.__file__)
- invalid = lambda fi: osp.abspath(fi[1]) in (lgc_testlib, std_testlib)
- for frameinfo in dropwhile(invalid, frames):
- yield frameinfo
-
- def _exc_info_to_string(self, err, test):
- """Converts a sys.exc_info()-style tuple of values into a string.
-
- This method is overridden here because we want to colorize
- lines if --color is passed, and display local variables if
- --verbose is passed
- """
- exctype, exc, tb = err
- output = ['Traceback (most recent call last)']
- frames = inspect.getinnerframes(tb)
- colorize = self.colorize
- frames = enumerate(self._iter_valid_frames(frames))
- for index, (frame, filename, lineno, funcname, ctx, ctxindex) in frames:
- filename = osp.abspath(filename)
- if ctx is None: # pyc files or C extensions for instance
- source = '<no source available>'
- else:
- source = ''.join(ctx)
- if colorize:
- filename = textutils.colorize_ansi(filename, 'magenta')
- source = colorize_source(source)
- output.append(' File "%s", line %s, in %s' % (filename, lineno, funcname))
- output.append(' %s' % source.strip())
- if self.verbose:
- output.append('%r == %r' % (dir(frame), test.__module__))
- output.append('')
- output.append(' ' + ' local variables '.center(66, '-'))
- for varname, value in sorted(frame.f_locals.items()):
- output.append(' %s: %r' % (varname, value))
- if varname == 'self': # special handy processing for self
- for varname, value in sorted(vars(value).items()):
- output.append(' self.%s: %r' % (varname, value))
- output.append(' ' + '-' * 66)
- output.append('')
- output.append(''.join(traceback.format_exception_only(exctype, exc)))
- return '\n'.join(output)
-
- def addError(self, test, err):
- """err -> (exc_type, exc, tcbk)"""
- exc_type, exc, _ = err
- if isinstance(exc, SkipTest):
- assert exc_type == SkipTest
- self.addSkip(test, exc)
- else:
- if self.exitfirst:
- self.shouldStop = True
- descr = self.getDescription(test)
- super(SkipAwareTestResult, self).addError(test, err)
- self._create_pdb(descr, 'error')
-
- def addFailure(self, test, err):
- if self.exitfirst:
- self.shouldStop = True
- descr = self.getDescription(test)
- super(SkipAwareTestResult, self).addFailure(test, err)
- self._create_pdb(descr, 'fail')
-
- def addSkip(self, test, reason):
- self.skipped.append((test, reason))
- if self.showAll:
- self.stream.writeln("SKIPPED")
- elif self.dots:
- self.stream.write('S')
-
- def printErrors(self):
- super(SkipAwareTestResult, self).printErrors()
- self.printSkippedList()
-
- def printSkippedList(self):
- # format (test, err) compatible with unittest2
- for test, err in self.skipped:
- descr = self.getDescription(test)
- self.stream.writeln(self.separator1)
- self.stream.writeln("%s: %s" % ('SKIPPED', descr))
- self.stream.writeln("\t%s" % err)
-
- def printErrorList(self, flavour, errors):
- for (_, descr), (test, err) in zip(self.descrs_for(flavour), errors):
- self.stream.writeln(self.separator1)
- self.stream.writeln("%s: %s" % (flavour, descr))
- self.stream.writeln(self.separator2)
- self.stream.writeln(err)
- self.stream.writeln('no stdout'.center(len(self.separator2)))
- self.stream.writeln('no stderr'.center(len(self.separator2)))
-
-# Add deprecation warnings about new api used by module level fixtures in unittest2
-# http://www.voidspace.org.uk/python/articles/unittest2.shtml#setupmodule-and-teardownmodule
-class _DebugResult(object): # simplify import statement among unittest flavors..
- "Used by the TestSuite to hold previous class when running in debug."
- _previousTestClass = None
- _moduleSetUpFailed = False
- shouldStop = False
-
-from logilab.common.decorators import monkeypatch
-@monkeypatch(unittest.TestSuite)
-def _handleModuleTearDown(self, result):
- previousModule = self._get_previous_module(result)
- if previousModule is None:
- return
- if result._moduleSetUpFailed:
- return
- try:
- module = sys.modules[previousModule]
- except KeyError:
- return
- # add testlib specific deprecation warning and switch to new api
- if hasattr(module, 'teardown_module'):
- warnings.warn('Please rename teardown_module() to tearDownModule() instead.',
- DeprecationWarning)
- setattr(module, 'tearDownModule', module.teardown_module)
- # end of monkey-patching
- tearDownModule = getattr(module, 'tearDownModule', None)
- if tearDownModule is not None:
- try:
- tearDownModule()
- except Exception as e:
- if isinstance(result, _DebugResult):
- raise
- errorName = 'tearDownModule (%s)' % previousModule
- self._addClassOrModuleLevelException(result, e, errorName)
-
-@monkeypatch(unittest.TestSuite)
-def _handleModuleFixture(self, test, result):
- previousModule = self._get_previous_module(result)
- currentModule = test.__class__.__module__
- if currentModule == previousModule:
- return
- self._handleModuleTearDown(result)
- result._moduleSetUpFailed = False
- try:
- module = sys.modules[currentModule]
- except KeyError:
- return
- # add testlib specific deprecation warning and switch to new api
- if hasattr(module, 'setup_module'):
- warnings.warn('Please rename setup_module() to setUpModule() instead.',
- DeprecationWarning)
- setattr(module, 'setUpModule', module.setup_module)
- # end of monkey-patching
- setUpModule = getattr(module, 'setUpModule', None)
- if setUpModule is not None:
- try:
- setUpModule()
- except Exception as e:
- if isinstance(result, _DebugResult):
- raise
- result._moduleSetUpFailed = True
- errorName = 'setUpModule (%s)' % currentModule
- self._addClassOrModuleLevelException(result, e, errorName)
-
-# backward compatibility: TestSuite might be imported from lgc.testlib
-TestSuite = unittest.TestSuite
-
-class keywords(dict):
- """Keyword args (**kwargs) support for generative tests."""
-
-class starargs(tuple):
- """Variable arguments (*args) for generative tests."""
- def __new__(cls, *args):
- return tuple.__new__(cls, args)
-
-unittest_main = unittest.main
-
-
-class InnerTestSkipped(SkipTest):
- """raised when a test is skipped"""
- pass
-
-def parse_generative_args(params):
- args = []
- varargs = ()
- kwargs = {}
- flags = 0 # 2 <=> starargs, 4 <=> kwargs
- for param in params:
- if isinstance(param, starargs):
- varargs = param
- if flags:
- raise TypeError('found starargs after keywords !')
- flags |= 2
- args += list(varargs)
- elif isinstance(param, keywords):
- kwargs = param
- if flags & 4:
- raise TypeError('got multiple keywords parameters')
- flags |= 4
- elif flags & 2 or flags & 4:
- raise TypeError('found parameters after kwargs or args')
- else:
- args.append(param)
-
- return args, kwargs
-
-
-class InnerTest(tuple):
- def __new__(cls, name, *data):
- instance = tuple.__new__(cls, data)
- instance.name = name
- return instance
-
-class Tags(set):
- """A set of tag able validate an expression"""
-
- def __init__(self, *tags, **kwargs):
- self.inherit = kwargs.pop('inherit', True)
- if kwargs:
- raise TypeError("%s are an invalid keyword argument for this function" % kwargs.keys())
-
- if len(tags) == 1 and not isinstance(tags[0], string_types):
- tags = tags[0]
- super(Tags, self).__init__(tags, **kwargs)
-
- def __getitem__(self, key):
- return key in self
-
- def match(self, exp):
- return eval(exp, {}, self)
-
-
-# duplicate definition from unittest2 of the _deprecate decorator
-def _deprecate(original_func):
- def deprecated_func(*args, **kwargs):
- warnings.warn(
- ('Please use %s instead.' % original_func.__name__),
- DeprecationWarning, 2)
- return original_func(*args, **kwargs)
- return deprecated_func
-
-class TestCase(unittest.TestCase):
- """A unittest.TestCase extension with some additional methods."""
- maxDiff = None
- pdbclass = Debugger
- tags = Tags()
-
- def __init__(self, methodName='runTest'):
- super(TestCase, self).__init__(methodName)
- self.__exc_info = sys.exc_info
- self.__testMethodName = self._testMethodName
- self._current_test_descr = None
- self._options_ = None
-
- @classproperty
- @cached
- def datadir(cls): # pylint: disable=E0213
- """helper attribute holding the standard test's data directory
-
- NOTE: this is a logilab's standard
- """
- mod = __import__(cls.__module__)
- return osp.join(osp.dirname(osp.abspath(mod.__file__)), 'data')
- # cache it (use a class method to cache on class since TestCase is
- # instantiated for each test run)
-
- @classmethod
- def datapath(cls, *fname):
- """joins the object's datadir and `fname`"""
- return osp.join(cls.datadir, *fname)
-
- def set_description(self, descr):
- """sets the current test's description.
- This can be useful for generative tests because it allows to specify
- a description per yield
- """
- self._current_test_descr = descr
-
- # override default's unittest.py feature
- def shortDescription(self):
- """override default unittest shortDescription to handle correctly
- generative tests
- """
- if self._current_test_descr is not None:
- return self._current_test_descr
- return super(TestCase, self).shortDescription()
-
- def quiet_run(self, result, func, *args, **kwargs):
- try:
- func(*args, **kwargs)
- except (KeyboardInterrupt, SystemExit):
- raise
- except unittest.SkipTest as e:
- if hasattr(result, 'addSkip'):
- result.addSkip(self, str(e))
- else:
- warnings.warn("TestResult has no addSkip method, skips not reported",
- RuntimeWarning, 2)
- result.addSuccess(self)
- return False
- except:
- result.addError(self, self.__exc_info())
- return False
- return True
-
- def _get_test_method(self):
- """return the test method"""
- return getattr(self, self._testMethodName)
-
- def optval(self, option, default=None):
- """return the option value or default if the option is not define"""
- return getattr(self._options_, option, default)
-
- def __call__(self, result=None, runcondition=None, options=None):
- """rewrite TestCase.__call__ to support generative tests
- This is mostly a copy/paste from unittest.py (i.e same
- variable names, same logic, except for the generative tests part)
- """
- from logilab.common.pytest import FILE_RESTART
- if result is None:
- result = self.defaultTestResult()
- result.pdbclass = self.pdbclass
- self._options_ = options
- # if result.cvg:
- # result.cvg.start()
- testMethod = self._get_test_method()
- if (getattr(self.__class__, "__unittest_skip__", False) or
- getattr(testMethod, "__unittest_skip__", False)):
- # If the class or method was skipped.
- try:
- skip_why = (getattr(self.__class__, '__unittest_skip_why__', '')
- or getattr(testMethod, '__unittest_skip_why__', ''))
- self._addSkip(result, skip_why)
- finally:
- result.stopTest(self)
- return
- if runcondition and not runcondition(testMethod):
- return # test is skipped
- result.startTest(self)
- try:
- if not self.quiet_run(result, self.setUp):
- return
- generative = isgeneratorfunction(testMethod)
- # generative tests
- if generative:
- self._proceed_generative(result, testMethod,
- runcondition)
- else:
- status = self._proceed(result, testMethod)
- success = (status == 0)
- if not self.quiet_run(result, self.tearDown):
- return
- if not generative and success:
- if hasattr(options, "exitfirst") and options.exitfirst:
- # add this test to restart file
- try:
- restartfile = open(FILE_RESTART, 'a')
- try:
- descr = '.'.join((self.__class__.__module__,
- self.__class__.__name__,
- self._testMethodName))
- restartfile.write(descr+os.linesep)
- finally:
- restartfile.close()
- except Exception:
- print("Error while saving succeeded test into",
- osp.join(os.getcwd(), FILE_RESTART),
- file=sys.__stderr__)
- raise
- result.addSuccess(self)
- finally:
- # if result.cvg:
- # result.cvg.stop()
- result.stopTest(self)
-
- def _proceed_generative(self, result, testfunc, runcondition=None):
- # cancel startTest()'s increment
- result.testsRun -= 1
- success = True
- try:
- for params in testfunc():
- if runcondition and not runcondition(testfunc,
- skipgenerator=False):
- if not (isinstance(params, InnerTest)
- and runcondition(params)):
- continue
- if not isinstance(params, (tuple, list)):
- params = (params, )
- func = params[0]
- args, kwargs = parse_generative_args(params[1:])
- # increment test counter manually
- result.testsRun += 1
- status = self._proceed(result, func, args, kwargs)
- if status == 0:
- result.addSuccess(self)
- success = True
- else:
- success = False
- # XXX Don't stop anymore if an error occured
- #if status == 2:
- # result.shouldStop = True
- if result.shouldStop: # either on error or on exitfirst + error
- break
- except:
- # if an error occurs between two yield
- result.addError(self, self.__exc_info())
- success = False
- return success
-
- def _proceed(self, result, testfunc, args=(), kwargs=None):
- """proceed the actual test
- returns 0 on success, 1 on failure, 2 on error
-
- Note: addSuccess can't be called here because we have to wait
- for tearDown to be successfully executed to declare the test as
- successful
- """
- kwargs = kwargs or {}
- try:
- testfunc(*args, **kwargs)
- except self.failureException:
- result.addFailure(self, self.__exc_info())
- return 1
- except KeyboardInterrupt:
- raise
- except InnerTestSkipped as e:
- result.addSkip(self, e)
- return 1
- except SkipTest as e:
- result.addSkip(self, e)
- return 0
- except:
- result.addError(self, self.__exc_info())
- return 2
- return 0
-
- def defaultTestResult(self):
- """return a new instance of the defaultTestResult"""
- return SkipAwareTestResult()
-
- skip = _deprecate(unittest.TestCase.skipTest)
- assertEquals = _deprecate(unittest.TestCase.assertEqual)
- assertNotEquals = _deprecate(unittest.TestCase.assertNotEqual)
- assertAlmostEquals = _deprecate(unittest.TestCase.assertAlmostEqual)
- assertNotAlmostEquals = _deprecate(unittest.TestCase.assertNotAlmostEqual)
-
- def innerSkip(self, msg=None):
- """mark a generative test as skipped for the <msg> reason"""
- msg = msg or 'test was skipped'
- raise InnerTestSkipped(msg)
-
- @deprecated('Please use assertDictEqual instead.')
- def assertDictEquals(self, dict1, dict2, msg=None, context=None):
- """compares two dicts
-
- If the two dict differ, the first difference is shown in the error
- message
- :param dict1: a Python Dictionary
- :param dict2: a Python Dictionary
- :param msg: custom message (String) in case of failure
- """
- dict1 = dict(dict1)
- msgs = []
- for key, value in dict2.items():
- try:
- if dict1[key] != value:
- msgs.append('%r != %r for key %r' % (dict1[key], value,
- key))
- del dict1[key]
- except KeyError:
- msgs.append('missing %r key' % key)
- if dict1:
- msgs.append('dict2 is lacking %r' % dict1)
- if msg:
- self.failureException(msg)
- elif msgs:
- if context is not None:
- base = '%s\n' % context
- else:
- base = ''
- self.fail(base + '\n'.join(msgs))
-
- @deprecated('Please use assertCountEqual instead.')
- def assertUnorderedIterableEquals(self, got, expected, msg=None):
- """compares two iterable and shows difference between both
-
- :param got: the unordered Iterable that we found
- :param expected: the expected unordered Iterable
- :param msg: custom message (String) in case of failure
- """
- got, expected = list(got), list(expected)
- self.assertSetEqual(set(got), set(expected), msg)
- if len(got) != len(expected):
- if msg is None:
- msg = ['Iterable have the same elements but not the same number',
- '\t<element>\t<expected>i\t<got>']
- got_count = {}
- expected_count = {}
- for element in got:
- got_count[element] = got_count.get(element, 0) + 1
- for element in expected:
- expected_count[element] = expected_count.get(element, 0) + 1
- # we know that got_count.key() == expected_count.key()
- # because of assertSetEqual
- for element, count in got_count.iteritems():
- other_count = expected_count[element]
- if other_count != count:
- msg.append('\t%s\t%s\t%s' % (element, other_count, count))
-
- self.fail(msg)
-
- assertUnorderedIterableEqual = assertUnorderedIterableEquals
- assertUnordIterEquals = assertUnordIterEqual = assertUnorderedIterableEqual
-
- @deprecated('Please use assertSetEqual instead.')
- def assertSetEquals(self,got,expected, msg=None):
- """compares two sets and shows difference between both
-
- Don't use it for iterables other than sets.
-
- :param got: the Set that we found
- :param expected: the second Set to be compared to the first one
- :param msg: custom message (String) in case of failure
- """
-
- if not(isinstance(got, set) and isinstance(expected, set)):
- warnings.warn("the assertSetEquals function if now intended for set only."\
- "use assertUnorderedIterableEquals instead.",
- DeprecationWarning, 2)
- return self.assertUnorderedIterableEquals(got, expected, msg)
-
- items={}
- items['missing'] = expected - got
- items['unexpected'] = got - expected
- if any(items.itervalues()):
- if msg is None:
- msg = '\n'.join('%s:\n\t%s' % (key, "\n\t".join(str(value) for value in values))
- for key, values in items.iteritems() if values)
- self.fail(msg)
-
- @deprecated('Please use assertListEqual instead.')
- def assertListEquals(self, list_1, list_2, msg=None):
- """compares two lists
-
- If the two list differ, the first difference is shown in the error
- message
-
- :param list_1: a Python List
- :param list_2: a second Python List
- :param msg: custom message (String) in case of failure
- """
- _l1 = list_1[:]
- for i, value in enumerate(list_2):
- try:
- if _l1[0] != value:
- from pprint import pprint
- pprint(list_1)
- pprint(list_2)
- self.fail('%r != %r for index %d' % (_l1[0], value, i))
- del _l1[0]
- except IndexError:
- if msg is None:
- msg = 'list_1 has only %d elements, not %s '\
- '(at least %r missing)'% (i, len(list_2), value)
- self.fail(msg)
- if _l1:
- if msg is None:
- msg = 'list_2 is lacking %r' % _l1
- self.fail(msg)
-
- @deprecated('Non-standard. Please use assertMultiLineEqual instead.')
- def assertLinesEquals(self, string1, string2, msg=None, striplines=False):
- """compare two strings and assert that the text lines of the strings
- are equal.
-
- :param string1: a String
- :param string2: a String
- :param msg: custom message (String) in case of failure
- :param striplines: Boolean to trigger line stripping before comparing
- """
- lines1 = string1.splitlines()
- lines2 = string2.splitlines()
- if striplines:
- lines1 = [l.strip() for l in lines1]
- lines2 = [l.strip() for l in lines2]
- self.assertListEqual(lines1, lines2, msg)
- assertLineEqual = assertLinesEquals
-
- @deprecated('Non-standard: please copy test method to your TestCase class')
- def assertXMLWellFormed(self, stream, msg=None, context=2):
- """asserts the XML stream is well-formed (no DTD conformance check)
-
- :param context: number of context lines in standard message
- (show all data if negative).
- Only available with element tree
- """
- try:
- from xml.etree.ElementTree import parse
- self._assertETXMLWellFormed(stream, parse, msg)
- except ImportError:
- from xml.sax import make_parser, SAXParseException
- parser = make_parser()
- try:
- parser.parse(stream)
- except SAXParseException as ex:
- if msg is None:
- stream.seek(0)
- for _ in range(ex.getLineNumber()):
- line = stream.readline()
- pointer = ('' * (ex.getLineNumber() - 1)) + '^'
- msg = 'XML stream not well formed: %s\n%s%s' % (ex, line, pointer)
- self.fail(msg)
-
- @deprecated('Non-standard: please copy test method to your TestCase class')
- def assertXMLStringWellFormed(self, xml_string, msg=None, context=2):
- """asserts the XML string is well-formed (no DTD conformance check)
-
- :param context: number of context lines in standard message
- (show all data if negative).
- Only available with element tree
- """
- try:
- from xml.etree.ElementTree import fromstring
- except ImportError:
- from elementtree.ElementTree import fromstring
- self._assertETXMLWellFormed(xml_string, fromstring, msg)
-
- def _assertETXMLWellFormed(self, data, parse, msg=None, context=2):
- """internal function used by /assertXML(String)?WellFormed/ functions
-
- :param data: xml_data
- :param parse: appropriate parser function for this data
- :param msg: error message
- :param context: number of context lines in standard message
- (show all data if negative).
- Only available with element tree
- """
- from xml.parsers.expat import ExpatError
- try:
- from xml.etree.ElementTree import ParseError
- except ImportError:
- # compatibility for <python2.7
- ParseError = ExpatError
- try:
- parse(data)
- except (ExpatError, ParseError) as ex:
- if msg is None:
- if hasattr(data, 'readlines'): #file like object
- data.seek(0)
- lines = data.readlines()
- else:
- lines = data.splitlines(True)
- nb_lines = len(lines)
- context_lines = []
-
- # catch when ParseError doesn't set valid lineno
- if ex.lineno is not None:
- if context < 0:
- start = 1
- end = nb_lines
- else:
- start = max(ex.lineno-context, 1)
- end = min(ex.lineno+context, nb_lines)
- line_number_length = len('%i' % end)
- line_pattern = " %%%ii: %%s" % line_number_length
-
- for line_no in range(start, ex.lineno):
- context_lines.append(line_pattern % (line_no, lines[line_no-1]))
- context_lines.append(line_pattern % (ex.lineno, lines[ex.lineno-1]))
- context_lines.append('%s^\n' % (' ' * (1 + line_number_length + 2 +ex.offset)))
- for line_no in range(ex.lineno+1, end+1):
- context_lines.append(line_pattern % (line_no, lines[line_no-1]))
-
- rich_context = ''.join(context_lines)
- msg = 'XML stream not well formed: %s\n%s' % (ex, rich_context)
- self.fail(msg)
-
- @deprecated('Non-standard: please copy test method to your TestCase class')
- def assertXMLEqualsTuple(self, element, tup):
- """compare an ElementTree Element to a tuple formatted as follow:
- (tagname, [attrib[, children[, text[, tail]]]])"""
- # check tag
- self.assertTextEquals(element.tag, tup[0])
- # check attrib
- if len(element.attrib) or len(tup)>1:
- if len(tup)<=1:
- self.fail( "tuple %s has no attributes (%s expected)"%(tup,
- dict(element.attrib)))
- self.assertDictEqual(element.attrib, tup[1])
- # check children
- if len(element) or len(tup)>2:
- if len(tup)<=2:
- self.fail( "tuple %s has no children (%i expected)"%(tup,
- len(element)))
- if len(element) != len(tup[2]):
- self.fail( "tuple %s has %i children%s (%i expected)"%(tup,
- len(tup[2]),
- ('', 's')[len(tup[2])>1], len(element)))
- for index in range(len(tup[2])):
- self.assertXMLEqualsTuple(element[index], tup[2][index])
- #check text
- if element.text or len(tup)>3:
- if len(tup)<=3:
- self.fail( "tuple %s has no text value (%r expected)"%(tup,
- element.text))
- self.assertTextEquals(element.text, tup[3])
- #check tail
- if element.tail or len(tup)>4:
- if len(tup)<=4:
- self.fail( "tuple %s has no tail value (%r expected)"%(tup,
- element.tail))
- self.assertTextEquals(element.tail, tup[4])
-
- def _difftext(self, lines1, lines2, junk=None, msg_prefix='Texts differ'):
- junk = junk or (' ', '\t')
- # result is a generator
- result = difflib.ndiff(lines1, lines2, charjunk=lambda x: x in junk)
- read = []
- for line in result:
- read.append(line)
- # lines that don't start with a ' ' are diff ones
- if not line.startswith(' '):
- self.fail('\n'.join(['%s\n'%msg_prefix]+read + list(result)))
-
- @deprecated('Non-standard. Please use assertMultiLineEqual instead.')
- def assertTextEquals(self, text1, text2, junk=None,
- msg_prefix='Text differ', striplines=False):
- """compare two multiline strings (using difflib and splitlines())
-
- :param text1: a Python BaseString
- :param text2: a second Python Basestring
- :param junk: List of Caracters
- :param msg_prefix: String (message prefix)
- :param striplines: Boolean to trigger line stripping before comparing
- """
- msg = []
- if not isinstance(text1, string_types):
- msg.append('text1 is not a string (%s)'%(type(text1)))
- if not isinstance(text2, string_types):
- msg.append('text2 is not a string (%s)'%(type(text2)))
- if msg:
- self.fail('\n'.join(msg))
- lines1 = text1.strip().splitlines(True)
- lines2 = text2.strip().splitlines(True)
- if striplines:
- lines1 = [line.strip() for line in lines1]
- lines2 = [line.strip() for line in lines2]
- self._difftext(lines1, lines2, junk, msg_prefix)
- assertTextEqual = assertTextEquals
-
- @deprecated('Non-standard: please copy test method to your TestCase class')
- def assertStreamEquals(self, stream1, stream2, junk=None,
- msg_prefix='Stream differ'):
- """compare two streams (using difflib and readlines())"""
- # if stream2 is stream2, readlines() on stream1 will also read lines
- # in stream2, so they'll appear different, although they're not
- if stream1 is stream2:
- return
- # make sure we compare from the beginning of the stream
- stream1.seek(0)
- stream2.seek(0)
- # compare
- self._difftext(stream1.readlines(), stream2.readlines(), junk,
- msg_prefix)
-
- assertStreamEqual = assertStreamEquals
-
- @deprecated('Non-standard: please copy test method to your TestCase class')
- def assertFileEquals(self, fname1, fname2, junk=(' ', '\t')):
- """compares two files using difflib"""
- self.assertStreamEqual(open(fname1), open(fname2), junk,
- msg_prefix='Files differs\n-:%s\n+:%s\n'%(fname1, fname2))
-
- assertFileEqual = assertFileEquals
-
- @deprecated('Non-standard: please copy test method to your TestCase class')
- def assertDirEquals(self, path_a, path_b):
- """compares two files using difflib"""
- assert osp.exists(path_a), "%s doesn't exists" % path_a
- assert osp.exists(path_b), "%s doesn't exists" % path_b
-
- all_a = [ (ipath[len(path_a):].lstrip('/'), idirs, ifiles)
- for ipath, idirs, ifiles in os.walk(path_a)]
- all_a.sort(key=itemgetter(0))
-
- all_b = [ (ipath[len(path_b):].lstrip('/'), idirs, ifiles)
- for ipath, idirs, ifiles in os.walk(path_b)]
- all_b.sort(key=itemgetter(0))
-
- iter_a, iter_b = iter(all_a), iter(all_b)
- partial_iter = True
- ipath_a, idirs_a, ifiles_a = data_a = None, None, None
- while True:
- try:
- ipath_a, idirs_a, ifiles_a = datas_a = next(iter_a)
- partial_iter = False
- ipath_b, idirs_b, ifiles_b = datas_b = next(iter_b)
- partial_iter = True
-
-
- self.assertTrue(ipath_a == ipath_b,
- "unexpected %s in %s while looking %s from %s" %
- (ipath_a, path_a, ipath_b, path_b))
-
-
- errors = {}
- sdirs_a = set(idirs_a)
- sdirs_b = set(idirs_b)
- errors["unexpected directories"] = sdirs_a - sdirs_b
- errors["missing directories"] = sdirs_b - sdirs_a
-
- sfiles_a = set(ifiles_a)
- sfiles_b = set(ifiles_b)
- errors["unexpected files"] = sfiles_a - sfiles_b
- errors["missing files"] = sfiles_b - sfiles_a
-
-
- msgs = [ "%s: %s"% (name, items)
- for name, items in errors.items() if items]
-
- if msgs:
- msgs.insert(0, "%s and %s differ :" % (
- osp.join(path_a, ipath_a),
- osp.join(path_b, ipath_b),
- ))
- self.fail("\n".join(msgs))
-
- for files in (ifiles_a, ifiles_b):
- files.sort()
-
- for index, path in enumerate(ifiles_a):
- self.assertFileEquals(osp.join(path_a, ipath_a, path),
- osp.join(path_b, ipath_b, ifiles_b[index]))
-
- except StopIteration:
- break
-
- assertDirEqual = assertDirEquals
-
- def assertIsInstance(self, obj, klass, msg=None, strict=False):
- """check if an object is an instance of a class
-
- :param obj: the Python Object to be checked
- :param klass: the target class
- :param msg: a String for a custom message
- :param strict: if True, check that the class of <obj> is <klass>;
- else check with 'isinstance'
- """
- if strict:
- warnings.warn('[API] Non-standard. Strict parameter has vanished',
- DeprecationWarning, stacklevel=2)
- if msg is None:
- if strict:
- msg = '%r is not of class %s but of %s'
- else:
- msg = '%r is not an instance of %s but of %s'
- msg = msg % (obj, klass, type(obj))
- if strict:
- self.assertTrue(obj.__class__ is klass, msg)
- else:
- self.assertTrue(isinstance(obj, klass), msg)
-
- @deprecated('Please use assertIsNone instead.')
- def assertNone(self, obj, msg=None):
- """assert obj is None
-
- :param obj: Python Object to be tested
- """
- if msg is None:
- msg = "reference to %r when None expected"%(obj,)
- self.assertTrue( obj is None, msg )
-
- @deprecated('Please use assertIsNotNone instead.')
- def assertNotNone(self, obj, msg=None):
- """assert obj is not None"""
- if msg is None:
- msg = "unexpected reference to None"
- self.assertTrue( obj is not None, msg )
-
- @deprecated('Non-standard. Please use assertAlmostEqual instead.')
- def assertFloatAlmostEquals(self, obj, other, prec=1e-5,
- relative=False, msg=None):
- """compares if two floats have a distance smaller than expected
- precision.
-
- :param obj: a Float
- :param other: another Float to be comparted to <obj>
- :param prec: a Float describing the precision
- :param relative: boolean switching to relative/absolute precision
- :param msg: a String for a custom message
- """
- if msg is None:
- msg = "%r != %r" % (obj, other)
- if relative:
- prec = prec*math.fabs(obj)
- self.assertTrue(math.fabs(obj - other) < prec, msg)
-
- def failUnlessRaises(self, excClass, callableObj=None, *args, **kwargs):
- """override default failUnlessRaises method to return the raised
- exception instance.
-
- Fail unless an exception of class excClass is thrown
- by callableObj when invoked with arguments args and keyword
- arguments kwargs. If a different type of exception is
- thrown, it will not be caught, and the test case will be
- deemed to have suffered an error, exactly as for an
- unexpected exception.
-
- CAUTION! There are subtle differences between Logilab and unittest2
- - exc is not returned in standard version
- - context capabilities in standard version
- - try/except/else construction (minor)
-
- :param excClass: the Exception to be raised
- :param callableObj: a callable Object which should raise <excClass>
- :param args: a List of arguments for <callableObj>
- :param kwargs: a List of keyword arguments for <callableObj>
- """
- # XXX cube vcslib : test_branches_from_app
- if callableObj is None:
- _assert = super(TestCase, self).assertRaises
- return _assert(excClass, callableObj, *args, **kwargs)
- try:
- callableObj(*args, **kwargs)
- except excClass as exc:
- class ProxyException:
- def __init__(self, obj):
- self._obj = obj
- def __getattr__(self, attr):
- warn_msg = ("This exception was retrieved with the old testlib way "
- "`exc = self.assertRaises(Exc, callable)`, please use "
- "the context manager instead'")
- warnings.warn(warn_msg, DeprecationWarning, 2)
- return self._obj.__getattribute__(attr)
- return ProxyException(exc)
- else:
- if hasattr(excClass, '__name__'):
- excName = excClass.__name__
- else:
- excName = str(excClass)
- raise self.failureException("%s not raised" % excName)
-
- assertRaises = failUnlessRaises
-
- if sys.version_info >= (3,2):
- assertItemsEqual = unittest.TestCase.assertCountEqual
- else:
- assertCountEqual = unittest.TestCase.assertItemsEqual
- if sys.version_info < (2,7):
- def assertIsNotNone(self, value, *args, **kwargs):
- self.assertNotEqual(None, value, *args, **kwargs)
-
-TestCase.assertItemsEqual = deprecated('assertItemsEqual is deprecated, use assertCountEqual')(
- TestCase.assertItemsEqual)
-
-import doctest
-
-class SkippedSuite(unittest.TestSuite):
- def test(self):
- """just there to trigger test execution"""
- self.skipped_test('doctest module has no DocTestSuite class')
-
-
-class DocTestFinder(doctest.DocTestFinder):
-
- def __init__(self, *args, **kwargs):
- self.skipped = kwargs.pop('skipped', ())
- doctest.DocTestFinder.__init__(self, *args, **kwargs)
-
- def _get_test(self, obj, name, module, globs, source_lines):
- """override default _get_test method to be able to skip tests
- according to skipped attribute's value
- """
- if getattr(obj, '__name__', '') in self.skipped:
- return None
- return doctest.DocTestFinder._get_test(self, obj, name, module,
- globs, source_lines)
-
-
-class DocTest(TestCase):
- """trigger module doctest
- I don't know how to make unittest.main consider the DocTestSuite instance
- without this hack
- """
- skipped = ()
- def __call__(self, result=None, runcondition=None, options=None):\
- # pylint: disable=W0613
- try:
- finder = DocTestFinder(skipped=self.skipped)
- suite = doctest.DocTestSuite(self.module, test_finder=finder)
- # XXX iirk
- doctest.DocTestCase._TestCase__exc_info = sys.exc_info
- except AttributeError:
- suite = SkippedSuite()
- # doctest may gork the builtins dictionnary
- # This happen to the "_" entry used by gettext
- old_builtins = builtins.__dict__.copy()
- try:
- return suite.run(result)
- finally:
- builtins.__dict__.clear()
- builtins.__dict__.update(old_builtins)
- run = __call__
-
- def test(self):
- """just there to trigger test execution"""
-
-MAILBOX = None
-
-class MockSMTP:
- """fake smtplib.SMTP"""
-
- def __init__(self, host, port):
- self.host = host
- self.port = port
- global MAILBOX
- self.reveived = MAILBOX = []
-
- def set_debuglevel(self, debuglevel):
- """ignore debug level"""
-
- def sendmail(self, fromaddr, toaddres, body):
- """push sent mail in the mailbox"""
- self.reveived.append((fromaddr, toaddres, body))
-
- def quit(self):
- """ignore quit"""
-
-
-class MockConfigParser(configparser.ConfigParser):
- """fake ConfigParser.ConfigParser"""
-
- def __init__(self, options):
- configparser.ConfigParser.__init__(self)
- for section, pairs in options.iteritems():
- self.add_section(section)
- for key, value in pairs.iteritems():
- self.set(section, key, value)
- def write(self, _):
- raise NotImplementedError()
-
-
-class MockConnection:
- """fake DB-API 2.0 connexion AND cursor (i.e. cursor() return self)"""
-
- def __init__(self, results):
- self.received = []
- self.states = []
- self.results = results
-
- def cursor(self):
- """Mock cursor method"""
- return self
- def execute(self, query, args=None):
- """Mock execute method"""
- self.received.append( (query, args) )
- def fetchone(self):
- """Mock fetchone method"""
- return self.results[0]
- def fetchall(self):
- """Mock fetchall method"""
- return self.results
- def commit(self):
- """Mock commiy method"""
- self.states.append( ('commit', len(self.received)) )
- def rollback(self):
- """Mock rollback method"""
- self.states.append( ('rollback', len(self.received)) )
- def close(self):
- """Mock close method"""
- pass
-
-
-def mock_object(**params):
- """creates an object using params to set attributes
- >>> option = mock_object(verbose=False, index=range(5))
- >>> option.verbose
- False
- >>> option.index
- [0, 1, 2, 3, 4]
- """
- return type('Mock', (), params)()
-
-
-def create_files(paths, chroot):
- """Creates directories and files found in <path>.
-
- :param paths: list of relative paths to files or directories
- :param chroot: the root directory in which paths will be created
-
- >>> from os.path import isdir, isfile
- >>> isdir('/tmp/a')
- False
- >>> create_files(['a/b/foo.py', 'a/b/c/', 'a/b/c/d/e.py'], '/tmp')
- >>> isdir('/tmp/a')
- True
- >>> isdir('/tmp/a/b/c')
- True
- >>> isfile('/tmp/a/b/c/d/e.py')
- True
- >>> isfile('/tmp/a/b/foo.py')
- True
- """
- dirs, files = set(), set()
- for path in paths:
- path = osp.join(chroot, path)
- filename = osp.basename(path)
- # path is a directory path
- if filename == '':
- dirs.add(path)
- # path is a filename path
- else:
- dirs.add(osp.dirname(path))
- files.add(path)
- for dirpath in dirs:
- if not osp.isdir(dirpath):
- os.makedirs(dirpath)
- for filepath in files:
- open(filepath, 'w').close()
-
-
-class AttrObject: # XXX cf mock_object
- def __init__(self, **kwargs):
- self.__dict__.update(kwargs)
-
-def tag(*args, **kwargs):
- """descriptor adding tag to a function"""
- def desc(func):
- assert not hasattr(func, 'tags')
- func.tags = Tags(*args, **kwargs)
- return func
- return desc
-
-def require_version(version):
- """ Compare version of python interpreter to the given one. Skip the test
- if older.
- """
- def check_require_version(f):
- version_elements = version.split('.')
- try:
- compare = tuple([int(v) for v in version_elements])
- except ValueError:
- raise ValueError('%s is not a correct version : should be X.Y[.Z].' % version)
- current = sys.version_info[:3]
- if current < compare:
- def new_f(self, *args, **kwargs):
- self.skipTest('Need at least %s version of python. Current version is %s.' % (version, '.'.join([str(element) for element in current])))
- new_f.__name__ = f.__name__
- return new_f
- else:
- return f
- return check_require_version
-
-def require_module(module):
- """ Check if the given module is loaded. Skip the test if not.
- """
- def check_require_module(f):
- try:
- __import__(module)
- return f
- except ImportError:
- def new_f(self, *args, **kwargs):
- self.skipTest('%s can not be imported.' % module)
- new_f.__name__ = f.__name__
- return new_f
- return check_require_module
-
diff --git a/chromium/third_party/logilab/logilab/common/textutils.py b/chromium/third_party/logilab/logilab/common/textutils.py
deleted file mode 100644
index 9046f975b7c..00000000000
--- a/chromium/third_party/logilab/logilab/common/textutils.py
+++ /dev/null
@@ -1,537 +0,0 @@
-# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""Some text manipulation utility functions.
-
-
-:group text formatting: normalize_text, normalize_paragraph, pretty_match,\
-unquote, colorize_ansi
-:group text manipulation: searchall, splitstrip
-:sort: text formatting, text manipulation
-
-:type ANSI_STYLES: dict(str)
-:var ANSI_STYLES: dictionary mapping style identifier to ANSI terminal code
-
-:type ANSI_COLORS: dict(str)
-:var ANSI_COLORS: dictionary mapping color identifier to ANSI terminal code
-
-:type ANSI_PREFIX: str
-:var ANSI_PREFIX:
- ANSI terminal code notifying the start of an ANSI escape sequence
-
-:type ANSI_END: str
-:var ANSI_END:
- ANSI terminal code notifying the end of an ANSI escape sequence
-
-:type ANSI_RESET: str
-:var ANSI_RESET:
- ANSI terminal code resetting format defined by a previous ANSI escape sequence
-"""
-__docformat__ = "restructuredtext en"
-
-import sys
-import re
-import os.path as osp
-from warnings import warn
-from unicodedata import normalize as _uninormalize
-try:
- from os import linesep
-except ImportError:
- linesep = '\n' # gae
-
-from logilab.common.deprecation import deprecated
-
-MANUAL_UNICODE_MAP = {
- u'\xa1': u'!', # INVERTED EXCLAMATION MARK
- u'\u0142': u'l', # LATIN SMALL LETTER L WITH STROKE
- u'\u2044': u'/', # FRACTION SLASH
- u'\xc6': u'AE', # LATIN CAPITAL LETTER AE
- u'\xa9': u'(c)', # COPYRIGHT SIGN
- u'\xab': u'"', # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
- u'\xe6': u'ae', # LATIN SMALL LETTER AE
- u'\xae': u'(r)', # REGISTERED SIGN
- u'\u0153': u'oe', # LATIN SMALL LIGATURE OE
- u'\u0152': u'OE', # LATIN CAPITAL LIGATURE OE
- u'\xd8': u'O', # LATIN CAPITAL LETTER O WITH STROKE
- u'\xf8': u'o', # LATIN SMALL LETTER O WITH STROKE
- u'\xbb': u'"', # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
- u'\xdf': u'ss', # LATIN SMALL LETTER SHARP S
- }
-
-def unormalize(ustring, ignorenonascii=None, substitute=None):
- """replace diacritical characters with their corresponding ascii characters
-
- Convert the unicode string to its long normalized form (unicode character
- will be transform into several characters) and keep the first one only.
- The normal form KD (NFKD) will apply the compatibility decomposition, i.e.
- replace all compatibility characters with their equivalents.
-
- :type substitute: str
- :param substitute: replacement character to use if decomposition fails
-
- :see: Another project about ASCII transliterations of Unicode text
- http://pypi.python.org/pypi/Unidecode
- """
- # backward compatibility, ignorenonascii was a boolean
- if ignorenonascii is not None:
- warn("ignorenonascii is deprecated, use substitute named parameter instead",
- DeprecationWarning, stacklevel=2)
- if ignorenonascii:
- substitute = ''
- res = []
- for letter in ustring[:]:
- try:
- replacement = MANUAL_UNICODE_MAP[letter]
- except KeyError:
- replacement = _uninormalize('NFKD', letter)[0]
- if ord(replacement) >= 2 ** 7:
- if substitute is None:
- raise ValueError("can't deal with non-ascii based characters")
- replacement = substitute
- res.append(replacement)
- return u''.join(res)
-
-def unquote(string):
- """remove optional quotes (simple or double) from the string
-
- :type string: str or unicode
- :param string: an optionally quoted string
-
- :rtype: str or unicode
- :return: the unquoted string (or the input string if it wasn't quoted)
- """
- if not string:
- return string
- if string[0] in '"\'':
- string = string[1:]
- if string[-1] in '"\'':
- string = string[:-1]
- return string
-
-
-_BLANKLINES_RGX = re.compile('\r?\n\r?\n')
-_NORM_SPACES_RGX = re.compile('\s+')
-
-def normalize_text(text, line_len=80, indent='', rest=False):
- """normalize a text to display it with a maximum line size and
- optionally arbitrary indentation. Line jumps are normalized but blank
- lines are kept. The indentation string may be used to insert a
- comment (#) or a quoting (>) mark for instance.
-
- :type text: str or unicode
- :param text: the input text to normalize
-
- :type line_len: int
- :param line_len: expected maximum line's length, default to 80
-
- :type indent: str or unicode
- :param indent: optional string to use as indentation
-
- :rtype: str or unicode
- :return:
- the input text normalized to fit on lines with a maximized size
- inferior to `line_len`, and optionally prefixed by an
- indentation string
- """
- if rest:
- normp = normalize_rest_paragraph
- else:
- normp = normalize_paragraph
- result = []
- for text in _BLANKLINES_RGX.split(text):
- result.append(normp(text, line_len, indent))
- return ('%s%s%s' % (linesep, indent, linesep)).join(result)
-
-
-def normalize_paragraph(text, line_len=80, indent=''):
- """normalize a text to display it with a maximum line size and
- optionally arbitrary indentation. Line jumps are normalized. The
- indentation string may be used top insert a comment mark for
- instance.
-
- :type text: str or unicode
- :param text: the input text to normalize
-
- :type line_len: int
- :param line_len: expected maximum line's length, default to 80
-
- :type indent: str or unicode
- :param indent: optional string to use as indentation
-
- :rtype: str or unicode
- :return:
- the input text normalized to fit on lines with a maximized size
- inferior to `line_len`, and optionally prefixed by an
- indentation string
- """
- text = _NORM_SPACES_RGX.sub(' ', text)
- line_len = line_len - len(indent)
- lines = []
- while text:
- aline, text = splittext(text.strip(), line_len)
- lines.append(indent + aline)
- return linesep.join(lines)
-
-def normalize_rest_paragraph(text, line_len=80, indent=''):
- """normalize a ReST text to display it with a maximum line size and
- optionally arbitrary indentation. Line jumps are normalized. The
- indentation string may be used top insert a comment mark for
- instance.
-
- :type text: str or unicode
- :param text: the input text to normalize
-
- :type line_len: int
- :param line_len: expected maximum line's length, default to 80
-
- :type indent: str or unicode
- :param indent: optional string to use as indentation
-
- :rtype: str or unicode
- :return:
- the input text normalized to fit on lines with a maximized size
- inferior to `line_len`, and optionally prefixed by an
- indentation string
- """
- toreport = ''
- lines = []
- line_len = line_len - len(indent)
- for line in text.splitlines():
- line = toreport + _NORM_SPACES_RGX.sub(' ', line.strip())
- toreport = ''
- while len(line) > line_len:
- # too long line, need split
- line, toreport = splittext(line, line_len)
- lines.append(indent + line)
- if toreport:
- line = toreport + ' '
- toreport = ''
- else:
- line = ''
- if line:
- lines.append(indent + line.strip())
- return linesep.join(lines)
-
-
-def splittext(text, line_len):
- """split the given text on space according to the given max line size
-
- return a 2-uple:
- * a line <= line_len if possible
- * the rest of the text which has to be reported on another line
- """
- if len(text) <= line_len:
- return text, ''
- pos = min(len(text)-1, line_len)
- while pos > 0 and text[pos] != ' ':
- pos -= 1
- if pos == 0:
- pos = min(len(text), line_len)
- while len(text) > pos and text[pos] != ' ':
- pos += 1
- return text[:pos], text[pos+1:].strip()
-
-
-def splitstrip(string, sep=','):
- """return a list of stripped string by splitting the string given as
- argument on `sep` (',' by default). Empty string are discarded.
-
- >>> splitstrip('a, b, c , 4,,')
- ['a', 'b', 'c', '4']
- >>> splitstrip('a')
- ['a']
- >>>
-
- :type string: str or unicode
- :param string: a csv line
-
- :type sep: str or unicode
- :param sep: field separator, default to the comma (',')
-
- :rtype: str or unicode
- :return: the unquoted string (or the input string if it wasn't quoted)
- """
- return [word.strip() for word in string.split(sep) if word.strip()]
-
-get_csv = deprecated('get_csv is deprecated, use splitstrip')(splitstrip)
-
-
-def split_url_or_path(url_or_path):
- """return the latest component of a string containing either an url of the
- form <scheme>://<path> or a local file system path
- """
- if '://' in url_or_path:
- return url_or_path.rstrip('/').rsplit('/', 1)
- return osp.split(url_or_path.rstrip(osp.sep))
-
-
-def text_to_dict(text):
- """parse multilines text containing simple 'key=value' lines and return a
- dict of {'key': 'value'}. When the same key is encountered multiple time,
- value is turned into a list containing all values.
-
- >>> d = text_to_dict('''multiple=1
- ... multiple= 2
- ... single =3
- ... ''')
- >>> d['single']
- '3'
- >>> d['multiple']
- ['1', '2']
-
- """
- res = {}
- if not text:
- return res
- for line in text.splitlines():
- line = line.strip()
- if line and not line.startswith('#'):
- key, value = [w.strip() for w in line.split('=', 1)]
- if key in res:
- try:
- res[key].append(value)
- except AttributeError:
- res[key] = [res[key], value]
- else:
- res[key] = value
- return res
-
-
-_BLANK_URE = r'(\s|,)+'
-_BLANK_RE = re.compile(_BLANK_URE)
-__VALUE_URE = r'-?(([0-9]+\.[0-9]*)|((0x?)?[0-9]+))'
-__UNITS_URE = r'[a-zA-Z]+'
-_VALUE_RE = re.compile(r'(?P<value>%s)(?P<unit>%s)?'%(__VALUE_URE, __UNITS_URE))
-_VALIDATION_RE = re.compile(r'^((%s)(%s))*(%s)?$' % (__VALUE_URE, __UNITS_URE,
- __VALUE_URE))
-
-BYTE_UNITS = {
- "b": 1,
- "kb": 1024,
- "mb": 1024 ** 2,
- "gb": 1024 ** 3,
- "tb": 1024 ** 4,
-}
-
-TIME_UNITS = {
- "ms": 0.0001,
- "s": 1,
- "min": 60,
- "h": 60 * 60,
- "d": 60 * 60 *24,
-}
-
-def apply_units(string, units, inter=None, final=float, blank_reg=_BLANK_RE,
- value_reg=_VALUE_RE):
- """Parse the string applying the units defined in units
- (e.g.: "1.5m",{'m',60} -> 80).
-
- :type string: str or unicode
- :param string: the string to parse
-
- :type units: dict (or any object with __getitem__ using basestring key)
- :param units: a dict mapping a unit string repr to its value
-
- :type inter: type
- :param inter: used to parse every intermediate value (need __sum__)
-
- :type blank_reg: regexp
- :param blank_reg: should match every blank char to ignore.
-
- :type value_reg: regexp with "value" and optional "unit" group
- :param value_reg: match a value and it's unit into the
- """
- if inter is None:
- inter = final
- fstring = _BLANK_RE.sub('', string)
- if not (fstring and _VALIDATION_RE.match(fstring)):
- raise ValueError("Invalid unit string: %r." % string)
- values = []
- for match in value_reg.finditer(fstring):
- dic = match.groupdict()
- lit, unit = dic["value"], dic.get("unit")
- value = inter(lit)
- if unit is not None:
- try:
- value *= units[unit.lower()]
- except KeyError:
- raise KeyError('invalid unit %s. valid units are %s' %
- (unit, units.keys()))
- values.append(value)
- return final(sum(values))
-
-
-_LINE_RGX = re.compile('\r\n|\r+|\n')
-
-def pretty_match(match, string, underline_char='^'):
- """return a string with the match location underlined:
-
- >>> import re
- >>> print(pretty_match(re.search('mange', 'il mange du bacon'), 'il mange du bacon'))
- il mange du bacon
- ^^^^^
- >>>
-
- :type match: _sre.SRE_match
- :param match: object returned by re.match, re.search or re.finditer
-
- :type string: str or unicode
- :param string:
- the string on which the regular expression has been applied to
- obtain the `match` object
-
- :type underline_char: str or unicode
- :param underline_char:
- character to use to underline the matched section, default to the
- carret '^'
-
- :rtype: str or unicode
- :return:
- the original string with an inserted line to underline the match
- location
- """
- start = match.start()
- end = match.end()
- string = _LINE_RGX.sub(linesep, string)
- start_line_pos = string.rfind(linesep, 0, start)
- if start_line_pos == -1:
- start_line_pos = 0
- result = []
- else:
- result = [string[:start_line_pos]]
- start_line_pos += len(linesep)
- offset = start - start_line_pos
- underline = ' ' * offset + underline_char * (end - start)
- end_line_pos = string.find(linesep, end)
- if end_line_pos == -1:
- string = string[start_line_pos:]
- result.append(string)
- result.append(underline)
- else:
- end = string[end_line_pos + len(linesep):]
- string = string[start_line_pos:end_line_pos]
- result.append(string)
- result.append(underline)
- result.append(end)
- return linesep.join(result).rstrip()
-
-
-# Ansi colorization ###########################################################
-
-ANSI_PREFIX = '\033['
-ANSI_END = 'm'
-ANSI_RESET = '\033[0m'
-ANSI_STYLES = {
- 'reset': "0",
- 'bold': "1",
- 'italic': "3",
- 'underline': "4",
- 'blink': "5",
- 'inverse': "7",
- 'strike': "9",
-}
-ANSI_COLORS = {
- 'reset': "0",
- 'black': "30",
- 'red': "31",
- 'green': "32",
- 'yellow': "33",
- 'blue': "34",
- 'magenta': "35",
- 'cyan': "36",
- 'white': "37",
-}
-
-def _get_ansi_code(color=None, style=None):
- """return ansi escape code corresponding to color and style
-
- :type color: str or None
- :param color:
- the color name (see `ANSI_COLORS` for available values)
- or the color number when 256 colors are available
-
- :type style: str or None
- :param style:
- style string (see `ANSI_COLORS` for available values). To get
- several style effects at the same time, use a coma as separator.
-
- :raise KeyError: if an unexistent color or style identifier is given
-
- :rtype: str
- :return: the built escape code
- """
- ansi_code = []
- if style:
- style_attrs = splitstrip(style)
- for effect in style_attrs:
- ansi_code.append(ANSI_STYLES[effect])
- if color:
- if color.isdigit():
- ansi_code.extend(['38', '5'])
- ansi_code.append(color)
- else:
- ansi_code.append(ANSI_COLORS[color])
- if ansi_code:
- return ANSI_PREFIX + ';'.join(ansi_code) + ANSI_END
- return ''
-
-def colorize_ansi(msg, color=None, style=None):
- """colorize message by wrapping it with ansi escape codes
-
- :type msg: str or unicode
- :param msg: the message string to colorize
-
- :type color: str or None
- :param color:
- the color identifier (see `ANSI_COLORS` for available values)
-
- :type style: str or None
- :param style:
- style string (see `ANSI_COLORS` for available values). To get
- several style effects at the same time, use a coma as separator.
-
- :raise KeyError: if an unexistent color or style identifier is given
-
- :rtype: str or unicode
- :return: the ansi escaped string
- """
- # If both color and style are not defined, then leave the text as is
- if color is None and style is None:
- return msg
- escape_code = _get_ansi_code(color, style)
- # If invalid (or unknown) color, don't wrap msg with ansi codes
- if escape_code:
- return '%s%s%s' % (escape_code, msg, ANSI_RESET)
- return msg
-
-DIFF_STYLE = {'separator': 'cyan', 'remove': 'red', 'add': 'green'}
-
-def diff_colorize_ansi(lines, out=sys.stdout, style=DIFF_STYLE):
- for line in lines:
- if line[:4] in ('--- ', '+++ '):
- out.write(colorize_ansi(line, style['separator']))
- elif line[0] == '-':
- out.write(colorize_ansi(line, style['remove']))
- elif line[0] == '+':
- out.write(colorize_ansi(line, style['add']))
- elif line[:4] == '--- ':
- out.write(colorize_ansi(line, style['separator']))
- elif line[:4] == '+++ ':
- out.write(colorize_ansi(line, style['separator']))
- else:
- out.write(line)
-
diff --git a/chromium/third_party/logilab/logilab/common/tree.py b/chromium/third_party/logilab/logilab/common/tree.py
deleted file mode 100644
index 885eb0faa41..00000000000
--- a/chromium/third_party/logilab/logilab/common/tree.py
+++ /dev/null
@@ -1,369 +0,0 @@
-# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""Base class to represent a tree structure.
-
-
-
-
-"""
-__docformat__ = "restructuredtext en"
-
-import sys
-
-from logilab.common import flatten
-from logilab.common.visitor import VisitedMixIn, FilteredIterator, no_filter
-
-## Exceptions #################################################################
-
-class NodeNotFound(Exception):
- """raised when a node has not been found"""
-
-EX_SIBLING_NOT_FOUND = "No such sibling as '%s'"
-EX_CHILD_NOT_FOUND = "No such child as '%s'"
-EX_NODE_NOT_FOUND = "No such node as '%s'"
-
-
-# Base node ###################################################################
-
-class Node(object):
- """a basic tree node, characterized by an id"""
-
- def __init__(self, nid=None) :
- self.id = nid
- # navigation
- self.parent = None
- self.children = []
-
- def __iter__(self):
- return iter(self.children)
-
- def __str__(self, indent=0):
- s = ['%s%s %s' % (' '*indent, self.__class__.__name__, self.id)]
- indent += 2
- for child in self.children:
- try:
- s.append(child.__str__(indent))
- except TypeError:
- s.append(child.__str__())
- return '\n'.join(s)
-
- def is_leaf(self):
- return not self.children
-
- def append(self, child):
- """add a node to children"""
- self.children.append(child)
- child.parent = self
-
- def remove(self, child):
- """remove a child node"""
- self.children.remove(child)
- child.parent = None
-
- def insert(self, index, child):
- """insert a child node"""
- self.children.insert(index, child)
- child.parent = self
-
- def replace(self, old_child, new_child):
- """replace a child node with another"""
- i = self.children.index(old_child)
- self.children.pop(i)
- self.children.insert(i, new_child)
- new_child.parent = self
-
- def get_sibling(self, nid):
- """return the sibling node that has given id"""
- try:
- return self.parent.get_child_by_id(nid)
- except NodeNotFound :
- raise NodeNotFound(EX_SIBLING_NOT_FOUND % nid)
-
- def next_sibling(self):
- """
- return the next sibling for this node if any
- """
- parent = self.parent
- if parent is None:
- # root node has no sibling
- return None
- index = parent.children.index(self)
- try:
- return parent.children[index+1]
- except IndexError:
- return None
-
- def previous_sibling(self):
- """
- return the previous sibling for this node if any
- """
- parent = self.parent
- if parent is None:
- # root node has no sibling
- return None
- index = parent.children.index(self)
- if index > 0:
- return parent.children[index-1]
- return None
-
- def get_node_by_id(self, nid):
- """
- return node in whole hierarchy that has given id
- """
- root = self.root()
- try:
- return root.get_child_by_id(nid, 1)
- except NodeNotFound :
- raise NodeNotFound(EX_NODE_NOT_FOUND % nid)
-
- def get_child_by_id(self, nid, recurse=None):
- """
- return child of given id
- """
- if self.id == nid:
- return self
- for c in self.children :
- if recurse:
- try:
- return c.get_child_by_id(nid, 1)
- except NodeNotFound :
- continue
- if c.id == nid :
- return c
- raise NodeNotFound(EX_CHILD_NOT_FOUND % nid)
-
- def get_child_by_path(self, path):
- """
- return child of given path (path is a list of ids)
- """
- if len(path) > 0 and path[0] == self.id:
- if len(path) == 1 :
- return self
- else :
- for c in self.children :
- try:
- return c.get_child_by_path(path[1:])
- except NodeNotFound :
- pass
- raise NodeNotFound(EX_CHILD_NOT_FOUND % path)
-
- def depth(self):
- """
- return depth of this node in the tree
- """
- if self.parent is not None:
- return 1 + self.parent.depth()
- else :
- return 0
-
- def depth_down(self):
- """
- return depth of the tree from this node
- """
- if self.children:
- return 1 + max([c.depth_down() for c in self.children])
- return 1
-
- def width(self):
- """
- return the width of the tree from this node
- """
- return len(self.leaves())
-
- def root(self):
- """
- return the root node of the tree
- """
- if self.parent is not None:
- return self.parent.root()
- return self
-
- def leaves(self):
- """
- return a list with all the leaves nodes descendant from this node
- """
- leaves = []
- if self.children:
- for child in self.children:
- leaves += child.leaves()
- return leaves
- else:
- return [self]
-
- def flatten(self, _list=None):
- """
- return a list with all the nodes descendant from this node
- """
- if _list is None:
- _list = []
- _list.append(self)
- for c in self.children:
- c.flatten(_list)
- return _list
-
- def lineage(self):
- """
- return list of parents up to root node
- """
- lst = [self]
- if self.parent is not None:
- lst.extend(self.parent.lineage())
- return lst
-
-class VNode(Node, VisitedMixIn):
- """a visitable node
- """
- pass
-
-
-class BinaryNode(VNode):
- """a binary node (i.e. only two children
- """
- def __init__(self, lhs=None, rhs=None) :
- VNode.__init__(self)
- if lhs is not None or rhs is not None:
- assert lhs and rhs
- self.append(lhs)
- self.append(rhs)
-
- def remove(self, child):
- """remove the child and replace this node with the other child
- """
- self.children.remove(child)
- self.parent.replace(self, self.children[0])
-
- def get_parts(self):
- """
- return the left hand side and the right hand side of this node
- """
- return self.children[0], self.children[1]
-
-
-
-if sys.version_info[0:2] >= (2, 2):
- list_class = list
-else:
- from UserList import UserList
- list_class = UserList
-
-class ListNode(VNode, list_class):
- """Used to manipulate Nodes as Lists
- """
- def __init__(self):
- list_class.__init__(self)
- VNode.__init__(self)
- self.children = self
-
- def __str__(self, indent=0):
- return '%s%s %s' % (indent*' ', self.__class__.__name__,
- ', '.join([str(v) for v in self]))
-
- def append(self, child):
- """add a node to children"""
- list_class.append(self, child)
- child.parent = self
-
- def insert(self, index, child):
- """add a node to children"""
- list_class.insert(self, index, child)
- child.parent = self
-
- def remove(self, child):
- """add a node to children"""
- list_class.remove(self, child)
- child.parent = None
-
- def pop(self, index):
- """add a node to children"""
- child = list_class.pop(self, index)
- child.parent = None
-
- def __iter__(self):
- return list_class.__iter__(self)
-
-# construct list from tree ####################################################
-
-def post_order_list(node, filter_func=no_filter):
- """
- create a list with tree nodes for which the <filter> function returned true
- in a post order fashion
- """
- l, stack = [], []
- poped, index = 0, 0
- while node:
- if filter_func(node):
- if node.children and not poped:
- stack.append((node, index))
- index = 0
- node = node.children[0]
- else:
- l.append(node)
- index += 1
- try:
- node = stack[-1][0].children[index]
- except IndexError:
- node = None
- else:
- node = None
- poped = 0
- if node is None and stack:
- node, index = stack.pop()
- poped = 1
- return l
-
-def pre_order_list(node, filter_func=no_filter):
- """
- create a list with tree nodes for which the <filter> function returned true
- in a pre order fashion
- """
- l, stack = [], []
- poped, index = 0, 0
- while node:
- if filter_func(node):
- if not poped:
- l.append(node)
- if node.children and not poped:
- stack.append((node, index))
- index = 0
- node = node.children[0]
- else:
- index += 1
- try:
- node = stack[-1][0].children[index]
- except IndexError:
- node = None
- else:
- node = None
- poped = 0
- if node is None and len(stack) > 1:
- node, index = stack.pop()
- poped = 1
- return l
-
-class PostfixedDepthFirstIterator(FilteredIterator):
- """a postfixed depth first iterator, designed to be used with visitors
- """
- def __init__(self, node, filter_func=None):
- FilteredIterator.__init__(self, node, post_order_list, filter_func)
-
-class PrefixedDepthFirstIterator(FilteredIterator):
- """a prefixed depth first iterator, designed to be used with visitors
- """
- def __init__(self, node, filter_func=None):
- FilteredIterator.__init__(self, node, pre_order_list, filter_func)
-
diff --git a/chromium/third_party/logilab/logilab/common/umessage.py b/chromium/third_party/logilab/logilab/common/umessage.py
deleted file mode 100644
index a5e479952a7..00000000000
--- a/chromium/third_party/logilab/logilab/common/umessage.py
+++ /dev/null
@@ -1,194 +0,0 @@
-# copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""Unicode email support (extends email from stdlib)"""
-
-__docformat__ = "restructuredtext en"
-
-import email
-from encodings import search_function
-import sys
-if sys.version_info >= (2, 5):
- from email.utils import parseaddr, parsedate
- from email.header import decode_header
-else:
- from email.Utils import parseaddr, parsedate
- from email.Header import decode_header
-
-from datetime import datetime
-
-try:
- from mx.DateTime import DateTime
-except ImportError:
- DateTime = datetime
-
-import logilab.common as lgc
-
-
-def decode_QP(string):
- parts = []
- for decoded, charset in decode_header(string):
- if not charset :
- charset = 'iso-8859-15'
- parts.append(decoded.decode(charset, 'replace'))
-
- if sys.version_info < (3, 3):
- # decoding was non-RFC compliant wrt to whitespace handling
- # see http://bugs.python.org/issue1079
- return u' '.join(parts)
- return u''.join(parts)
-
-def message_from_file(fd):
- try:
- return UMessage(email.message_from_file(fd))
- except email.Errors.MessageParseError:
- return ''
-
-def message_from_string(string):
- try:
- return UMessage(email.message_from_string(string))
- except email.Errors.MessageParseError:
- return ''
-
-class UMessage:
- """Encapsulates an email.Message instance and returns only unicode objects.
- """
-
- def __init__(self, message):
- self.message = message
-
- # email.Message interface #################################################
-
- def get(self, header, default=None):
- value = self.message.get(header, default)
- if value:
- return decode_QP(value)
- return value
-
- def __getitem__(self, header):
- return self.get(header)
-
- def get_all(self, header, default=()):
- return [decode_QP(val) for val in self.message.get_all(header, default)
- if val is not None]
-
- def is_multipart(self):
- return self.message.is_multipart()
-
- def get_boundary(self):
- return self.message.get_boundary()
-
- def walk(self):
- for part in self.message.walk():
- yield UMessage(part)
-
- if sys.version_info < (3, 0):
-
- def get_payload(self, index=None, decode=False):
- message = self.message
- if index is None:
- payload = message.get_payload(index, decode)
- if isinstance(payload, list):
- return [UMessage(msg) for msg in payload]
- if message.get_content_maintype() != 'text':
- return payload
-
- charset = message.get_content_charset() or 'iso-8859-1'
- if search_function(charset) is None:
- charset = 'iso-8859-1'
- return unicode(payload or '', charset, "replace")
- else:
- payload = UMessage(message.get_payload(index, decode))
- return payload
-
- def get_content_maintype(self):
- return unicode(self.message.get_content_maintype())
-
- def get_content_type(self):
- return unicode(self.message.get_content_type())
-
- def get_filename(self, failobj=None):
- value = self.message.get_filename(failobj)
- if value is failobj:
- return value
- try:
- return unicode(value)
- except UnicodeDecodeError:
- return u'error decoding filename'
-
- else:
-
- def get_payload(self, index=None, decode=False):
- message = self.message
- if index is None:
- payload = message.get_payload(index, decode)
- if isinstance(payload, list):
- return [UMessage(msg) for msg in payload]
- return payload
- else:
- payload = UMessage(message.get_payload(index, decode))
- return payload
-
- def get_content_maintype(self):
- return self.message.get_content_maintype()
-
- def get_content_type(self):
- return self.message.get_content_type()
-
- def get_filename(self, failobj=None):
- return self.message.get_filename(failobj)
-
- # other convenience methods ###############################################
-
- def headers(self):
- """return an unicode string containing all the message's headers"""
- values = []
- for header in self.message.keys():
- values.append(u'%s: %s' % (header, self.get(header)))
- return '\n'.join(values)
-
- def multi_addrs(self, header):
- """return a list of 2-uple (name, address) for the given address (which
- is expected to be an header containing address such as from, to, cc...)
- """
- persons = []
- for person in self.get_all(header, ()):
- name, mail = parseaddr(person)
- persons.append((name, mail))
- return persons
-
- def date(self, alternative_source=False, return_str=False):
- """return a datetime object for the email's date or None if no date is
- set or if it can't be parsed
- """
- value = self.get('date')
- if value is None and alternative_source:
- unix_from = self.message.get_unixfrom()
- if unix_from is not None:
- try:
- value = unix_from.split(" ", 2)[2]
- except IndexError:
- pass
- if value is not None:
- datetuple = parsedate(value)
- if datetuple:
- if lgc.USE_MX_DATETIME:
- return DateTime(*datetuple[:6])
- return datetime(*datetuple[:6])
- elif not return_str:
- return None
- return value
diff --git a/chromium/third_party/logilab/logilab/common/ureports/__init__.py b/chromium/third_party/logilab/logilab/common/ureports/__init__.py
deleted file mode 100644
index d76ebe52edf..00000000000
--- a/chromium/third_party/logilab/logilab/common/ureports/__init__.py
+++ /dev/null
@@ -1,172 +0,0 @@
-# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""Universal report objects and some formatting drivers.
-
-A way to create simple reports using python objects, primarily designed to be
-formatted as text and html.
-"""
-__docformat__ = "restructuredtext en"
-
-import sys
-
-from logilab.common.compat import StringIO
-from logilab.common.textutils import linesep
-
-
-def get_nodes(node, klass):
- """return an iterator on all children node of the given klass"""
- for child in node.children:
- if isinstance(child, klass):
- yield child
- # recurse (FIXME: recursion controled by an option)
- for grandchild in get_nodes(child, klass):
- yield grandchild
-
-def layout_title(layout):
- """try to return the layout's title as string, return None if not found
- """
- for child in layout.children:
- if isinstance(child, Title):
- return u' '.join([node.data for node in get_nodes(child, Text)])
-
-def build_summary(layout, level=1):
- """make a summary for the report, including X level"""
- assert level > 0
- level -= 1
- summary = List(klass=u'summary')
- for child in layout.children:
- if not isinstance(child, Section):
- continue
- label = layout_title(child)
- if not label and not child.id:
- continue
- if not child.id:
- child.id = label.replace(' ', '-')
- node = Link(u'#'+child.id, label=label or child.id)
- # FIXME: Three following lines produce not very compliant
- # docbook: there are some useless <para><para>. They might be
- # replaced by the three commented lines but this then produces
- # a bug in html display...
- if level and [n for n in child.children if isinstance(n, Section)]:
- node = Paragraph([node, build_summary(child, level)])
- summary.append(node)
-# summary.append(node)
-# if level and [n for n in child.children if isinstance(n, Section)]:
-# summary.append(build_summary(child, level))
- return summary
-
-
-class BaseWriter(object):
- """base class for ureport writers"""
-
- def format(self, layout, stream=None, encoding=None):
- """format and write the given layout into the stream object
-
- unicode policy: unicode strings may be found in the layout;
- try to call stream.write with it, but give it back encoded using
- the given encoding if it fails
- """
- if stream is None:
- stream = sys.stdout
- if not encoding:
- encoding = getattr(stream, 'encoding', 'UTF-8')
- self.encoding = encoding or 'UTF-8'
- self.__compute_funcs = []
- self.out = stream
- self.begin_format(layout)
- layout.accept(self)
- self.end_format(layout)
-
- def format_children(self, layout):
- """recurse on the layout children and call their accept method
- (see the Visitor pattern)
- """
- for child in getattr(layout, 'children', ()):
- child.accept(self)
-
- def writeln(self, string=u''):
- """write a line in the output buffer"""
- self.write(string + linesep)
-
- def write(self, string):
- """write a string in the output buffer"""
- try:
- self.out.write(string)
- except UnicodeEncodeError:
- self.out.write(string.encode(self.encoding))
-
- def begin_format(self, layout):
- """begin to format a layout"""
- self.section = 0
-
- def end_format(self, layout):
- """finished to format a layout"""
-
- def get_table_content(self, table):
- """trick to get table content without actually writing it
-
- return an aligned list of lists containing table cells values as string
- """
- result = [[]]
- cols = table.cols
- for cell in self.compute_content(table):
- if cols == 0:
- result.append([])
- cols = table.cols
- cols -= 1
- result[-1].append(cell)
- # fill missing cells
- while len(result[-1]) < cols:
- result[-1].append(u'')
- return result
-
- def compute_content(self, layout):
- """trick to compute the formatting of children layout before actually
- writing it
-
- return an iterator on strings (one for each child element)
- """
- # use cells !
- def write(data):
- try:
- stream.write(data)
- except UnicodeEncodeError:
- stream.write(data.encode(self.encoding))
- def writeln(data=u''):
- try:
- stream.write(data+linesep)
- except UnicodeEncodeError:
- stream.write(data.encode(self.encoding)+linesep)
- self.write = write
- self.writeln = writeln
- self.__compute_funcs.append((write, writeln))
- for child in layout.children:
- stream = StringIO()
- child.accept(self)
- yield stream.getvalue()
- self.__compute_funcs.pop()
- try:
- self.write, self.writeln = self.__compute_funcs[-1]
- except IndexError:
- del self.write
- del self.writeln
-
-
-from logilab.common.ureports.nodes import *
-from logilab.common.ureports.text_writer import TextWriter
-from logilab.common.ureports.html_writer import HTMLWriter
diff --git a/chromium/third_party/logilab/logilab/common/ureports/docbook_writer.py b/chromium/third_party/logilab/logilab/common/ureports/docbook_writer.py
deleted file mode 100644
index 857068c8f06..00000000000
--- a/chromium/third_party/logilab/logilab/common/ureports/docbook_writer.py
+++ /dev/null
@@ -1,140 +0,0 @@
-# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""HTML formatting drivers for ureports"""
-__docformat__ = "restructuredtext en"
-
-from six.moves import range
-
-from logilab.common.ureports import HTMLWriter
-
-class DocbookWriter(HTMLWriter):
- """format layouts as HTML"""
-
- def begin_format(self, layout):
- """begin to format a layout"""
- super(HTMLWriter, self).begin_format(layout)
- if self.snippet is None:
- self.writeln('<?xml version="1.0" encoding="ISO-8859-1"?>')
- self.writeln("""
-<book xmlns:xi='http://www.w3.org/2001/XInclude'
- lang='fr'>
-""")
-
- def end_format(self, layout):
- """finished to format a layout"""
- if self.snippet is None:
- self.writeln('</book>')
-
- def visit_section(self, layout):
- """display a section (using <chapter> (level 0) or <section>)"""
- if self.section == 0:
- tag = "chapter"
- else:
- tag = "section"
- self.section += 1
- self.writeln(self._indent('<%s%s>' % (tag, self.handle_attrs(layout))))
- self.format_children(layout)
- self.writeln(self._indent('</%s>'% tag))
- self.section -= 1
-
- def visit_title(self, layout):
- """display a title using <title>"""
- self.write(self._indent(' <title%s>' % self.handle_attrs(layout)))
- self.format_children(layout)
- self.writeln('</title>')
-
- def visit_table(self, layout):
- """display a table as html"""
- self.writeln(self._indent(' <table%s><title>%s</title>' \
- % (self.handle_attrs(layout), layout.title)))
- self.writeln(self._indent(' <tgroup cols="%s">'% layout.cols))
- for i in range(layout.cols):
- self.writeln(self._indent(' <colspec colname="c%s" colwidth="1*"/>' % i))
-
- table_content = self.get_table_content(layout)
- # write headers
- if layout.cheaders:
- self.writeln(self._indent(' <thead>'))
- self._write_row(table_content[0])
- self.writeln(self._indent(' </thead>'))
- table_content = table_content[1:]
- elif layout.rcheaders:
- self.writeln(self._indent(' <thead>'))
- self._write_row(table_content[-1])
- self.writeln(self._indent(' </thead>'))
- table_content = table_content[:-1]
- # write body
- self.writeln(self._indent(' <tbody>'))
- for i in range(len(table_content)):
- row = table_content[i]
- self.writeln(self._indent(' <row>'))
- for j in range(len(row)):
- cell = row[j] or '&#160;'
- self.writeln(self._indent(' <entry>%s</entry>' % cell))
- self.writeln(self._indent(' </row>'))
- self.writeln(self._indent(' </tbody>'))
- self.writeln(self._indent(' </tgroup>'))
- self.writeln(self._indent(' </table>'))
-
- def _write_row(self, row):
- """write content of row (using <row> <entry>)"""
- self.writeln(' <row>')
- for j in range(len(row)):
- cell = row[j] or '&#160;'
- self.writeln(' <entry>%s</entry>' % cell)
- self.writeln(self._indent(' </row>'))
-
- def visit_list(self, layout):
- """display a list (using <itemizedlist>)"""
- self.writeln(self._indent(' <itemizedlist%s>' % self.handle_attrs(layout)))
- for row in list(self.compute_content(layout)):
- self.writeln(' <listitem><para>%s</para></listitem>' % row)
- self.writeln(self._indent(' </itemizedlist>'))
-
- def visit_paragraph(self, layout):
- """display links (using <para>)"""
- self.write(self._indent(' <para>'))
- self.format_children(layout)
- self.writeln('</para>')
-
- def visit_span(self, layout):
- """display links (using <p>)"""
- #TODO: translate in docbook
- self.write('<literal %s>' % self.handle_attrs(layout))
- self.format_children(layout)
- self.write('</literal>')
-
- def visit_link(self, layout):
- """display links (using <ulink>)"""
- self.write('<ulink url="%s"%s>%s</ulink>' % (layout.url,
- self.handle_attrs(layout),
- layout.label))
-
- def visit_verbatimtext(self, layout):
- """display verbatim text (using <programlisting>)"""
- self.writeln(self._indent(' <programlisting>'))
- self.write(layout.data.replace('&', '&amp;').replace('<', '&lt;'))
- self.writeln(self._indent(' </programlisting>'))
-
- def visit_text(self, layout):
- """add some text"""
- self.write(layout.data.replace('&', '&amp;').replace('<', '&lt;'))
-
- def _indent(self, string):
- """correctly indent string according to section"""
- return ' ' * 2*(self.section) + string
diff --git a/chromium/third_party/logilab/logilab/common/ureports/html_writer.py b/chromium/third_party/logilab/logilab/common/ureports/html_writer.py
deleted file mode 100644
index eba34ea4702..00000000000
--- a/chromium/third_party/logilab/logilab/common/ureports/html_writer.py
+++ /dev/null
@@ -1,133 +0,0 @@
-# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""HTML formatting drivers for ureports"""
-__docformat__ = "restructuredtext en"
-
-from cgi import escape
-
-from six.moves import range
-
-from logilab.common.ureports import BaseWriter
-
-
-class HTMLWriter(BaseWriter):
- """format layouts as HTML"""
-
- def __init__(self, snippet=None):
- super(HTMLWriter, self).__init__()
- self.snippet = snippet
-
- def handle_attrs(self, layout):
- """get an attribute string from layout member attributes"""
- attrs = u''
- klass = getattr(layout, 'klass', None)
- if klass:
- attrs += u' class="%s"' % klass
- nid = getattr(layout, 'id', None)
- if nid:
- attrs += u' id="%s"' % nid
- return attrs
-
- def begin_format(self, layout):
- """begin to format a layout"""
- super(HTMLWriter, self).begin_format(layout)
- if self.snippet is None:
- self.writeln(u'<html>')
- self.writeln(u'<body>')
-
- def end_format(self, layout):
- """finished to format a layout"""
- if self.snippet is None:
- self.writeln(u'</body>')
- self.writeln(u'</html>')
-
-
- def visit_section(self, layout):
- """display a section as html, using div + h[section level]"""
- self.section += 1
- self.writeln(u'<div%s>' % self.handle_attrs(layout))
- self.format_children(layout)
- self.writeln(u'</div>')
- self.section -= 1
-
- def visit_title(self, layout):
- """display a title using <hX>"""
- self.write(u'<h%s%s>' % (self.section, self.handle_attrs(layout)))
- self.format_children(layout)
- self.writeln(u'</h%s>' % self.section)
-
- def visit_table(self, layout):
- """display a table as html"""
- self.writeln(u'<table%s>' % self.handle_attrs(layout))
- table_content = self.get_table_content(layout)
- for i in range(len(table_content)):
- row = table_content[i]
- if i == 0 and layout.rheaders:
- self.writeln(u'<tr class="header">')
- elif i+1 == len(table_content) and layout.rrheaders:
- self.writeln(u'<tr class="header">')
- else:
- self.writeln(u'<tr class="%s">' % (i%2 and 'even' or 'odd'))
- for j in range(len(row)):
- cell = row[j] or u'&#160;'
- if (layout.rheaders and i == 0) or \
- (layout.cheaders and j == 0) or \
- (layout.rrheaders and i+1 == len(table_content)) or \
- (layout.rcheaders and j+1 == len(row)):
- self.writeln(u'<th>%s</th>' % cell)
- else:
- self.writeln(u'<td>%s</td>' % cell)
- self.writeln(u'</tr>')
- self.writeln(u'</table>')
-
- def visit_list(self, layout):
- """display a list as html"""
- self.writeln(u'<ul%s>' % self.handle_attrs(layout))
- for row in list(self.compute_content(layout)):
- self.writeln(u'<li>%s</li>' % row)
- self.writeln(u'</ul>')
-
- def visit_paragraph(self, layout):
- """display links (using <p>)"""
- self.write(u'<p>')
- self.format_children(layout)
- self.write(u'</p>')
-
- def visit_span(self, layout):
- """display links (using <p>)"""
- self.write(u'<span%s>' % self.handle_attrs(layout))
- self.format_children(layout)
- self.write(u'</span>')
-
- def visit_link(self, layout):
- """display links (using <a>)"""
- self.write(u' <a href="%s"%s>%s</a>' % (layout.url,
- self.handle_attrs(layout),
- layout.label))
- def visit_verbatimtext(self, layout):
- """display verbatim text (using <pre>)"""
- self.write(u'<pre>')
- self.write(layout.data.replace(u'&', u'&amp;').replace(u'<', u'&lt;'))
- self.write(u'</pre>')
-
- def visit_text(self, layout):
- """add some text"""
- data = layout.data
- if layout.escaped:
- data = data.replace(u'&', u'&amp;').replace(u'<', u'&lt;')
- self.write(data)
diff --git a/chromium/third_party/logilab/logilab/common/ureports/nodes.py b/chromium/third_party/logilab/logilab/common/ureports/nodes.py
deleted file mode 100644
index a9585b30d21..00000000000
--- a/chromium/third_party/logilab/logilab/common/ureports/nodes.py
+++ /dev/null
@@ -1,203 +0,0 @@
-# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""Micro reports objects.
-
-A micro report is a tree of layout and content objects.
-"""
-__docformat__ = "restructuredtext en"
-
-from logilab.common.tree import VNode
-
-from six import string_types
-
-class BaseComponent(VNode):
- """base report component
-
- attributes
- * id : the component's optional id
- * klass : the component's optional klass
- """
- def __init__(self, id=None, klass=None):
- VNode.__init__(self, id)
- self.klass = klass
-
-class BaseLayout(BaseComponent):
- """base container node
-
- attributes
- * BaseComponent attributes
- * children : components in this table (i.e. the table's cells)
- """
- def __init__(self, children=(), **kwargs):
- super(BaseLayout, self).__init__(**kwargs)
- for child in children:
- if isinstance(child, BaseComponent):
- self.append(child)
- else:
- self.add_text(child)
-
- def append(self, child):
- """overridden to detect problems easily"""
- assert child not in self.parents()
- VNode.append(self, child)
-
- def parents(self):
- """return the ancestor nodes"""
- assert self.parent is not self
- if self.parent is None:
- return []
- return [self.parent] + self.parent.parents()
-
- def add_text(self, text):
- """shortcut to add text data"""
- self.children.append(Text(text))
-
-
-# non container nodes #########################################################
-
-class Text(BaseComponent):
- """a text portion
-
- attributes :
- * BaseComponent attributes
- * data : the text value as an encoded or unicode string
- """
- def __init__(self, data, escaped=True, **kwargs):
- super(Text, self).__init__(**kwargs)
- #if isinstance(data, unicode):
- # data = data.encode('ascii')
- assert isinstance(data, string_types), data.__class__
- self.escaped = escaped
- self.data = data
-
-class VerbatimText(Text):
- """a verbatim text, display the raw data
-
- attributes :
- * BaseComponent attributes
- * data : the text value as an encoded or unicode string
- """
-
-class Link(BaseComponent):
- """a labelled link
-
- attributes :
- * BaseComponent attributes
- * url : the link's target (REQUIRED)
- * label : the link's label as a string (use the url by default)
- """
- def __init__(self, url, label=None, **kwargs):
- super(Link, self).__init__(**kwargs)
- assert url
- self.url = url
- self.label = label or url
-
-
-class Image(BaseComponent):
- """an embedded or a single image
-
- attributes :
- * BaseComponent attributes
- * filename : the image's filename (REQUIRED)
- * stream : the stream object containing the image data (REQUIRED)
- * title : the image's optional title
- """
- def __init__(self, filename, stream, title=None, **kwargs):
- super(Image, self).__init__(**kwargs)
- assert filename
- assert stream
- self.filename = filename
- self.stream = stream
- self.title = title
-
-
-# container nodes #############################################################
-
-class Section(BaseLayout):
- """a section
-
- attributes :
- * BaseLayout attributes
-
- a title may also be given to the constructor, it'll be added
- as a first element
- a description may also be given to the constructor, it'll be added
- as a first paragraph
- """
- def __init__(self, title=None, description=None, **kwargs):
- super(Section, self).__init__(**kwargs)
- if description:
- self.insert(0, Paragraph([Text(description)]))
- if title:
- self.insert(0, Title(children=(title,)))
-
-class Title(BaseLayout):
- """a title
-
- attributes :
- * BaseLayout attributes
-
- A title must not contains a section nor a paragraph!
- """
-
-class Span(BaseLayout):
- """a title
-
- attributes :
- * BaseLayout attributes
-
- A span should only contains Text and Link nodes (in-line elements)
- """
-
-class Paragraph(BaseLayout):
- """a simple text paragraph
-
- attributes :
- * BaseLayout attributes
-
- A paragraph must not contains a section !
- """
-
-class Table(BaseLayout):
- """some tabular data
-
- attributes :
- * BaseLayout attributes
- * cols : the number of columns of the table (REQUIRED)
- * rheaders : the first row's elements are table's header
- * cheaders : the first col's elements are table's header
- * title : the table's optional title
- """
- def __init__(self, cols, title=None,
- rheaders=0, cheaders=0, rrheaders=0, rcheaders=0,
- **kwargs):
- super(Table, self).__init__(**kwargs)
- assert isinstance(cols, int)
- self.cols = cols
- self.title = title
- self.rheaders = rheaders
- self.cheaders = cheaders
- self.rrheaders = rrheaders
- self.rcheaders = rcheaders
-
-class List(BaseLayout):
- """some list data
-
- attributes :
- * BaseLayout attributes
- """
diff --git a/chromium/third_party/logilab/logilab/common/ureports/text_writer.py b/chromium/third_party/logilab/logilab/common/ureports/text_writer.py
deleted file mode 100644
index c87613c9145..00000000000
--- a/chromium/third_party/logilab/logilab/common/ureports/text_writer.py
+++ /dev/null
@@ -1,145 +0,0 @@
-# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""Text formatting drivers for ureports"""
-
-from __future__ import print_function
-
-__docformat__ = "restructuredtext en"
-
-from six.moves import range
-
-from logilab.common.textutils import linesep
-from logilab.common.ureports import BaseWriter
-
-
-TITLE_UNDERLINES = [u'', u'=', u'-', u'`', u'.', u'~', u'^']
-BULLETS = [u'*', u'-']
-
-class TextWriter(BaseWriter):
- """format layouts as text
- (ReStructured inspiration but not totally handled yet)
- """
- def begin_format(self, layout):
- super(TextWriter, self).begin_format(layout)
- self.list_level = 0
- self.pending_urls = []
-
- def visit_section(self, layout):
- """display a section as text
- """
- self.section += 1
- self.writeln()
- self.format_children(layout)
- if self.pending_urls:
- self.writeln()
- for label, url in self.pending_urls:
- self.writeln(u'.. _`%s`: %s' % (label, url))
- self.pending_urls = []
- self.section -= 1
- self.writeln()
-
- def visit_title(self, layout):
- title = u''.join(list(self.compute_content(layout)))
- self.writeln(title)
- try:
- self.writeln(TITLE_UNDERLINES[self.section] * len(title))
- except IndexError:
- print("FIXME TITLE TOO DEEP. TURNING TITLE INTO TEXT")
-
- def visit_paragraph(self, layout):
- """enter a paragraph"""
- self.format_children(layout)
- self.writeln()
-
- def visit_span(self, layout):
- """enter a span"""
- self.format_children(layout)
-
- def visit_table(self, layout):
- """display a table as text"""
- table_content = self.get_table_content(layout)
- # get columns width
- cols_width = [0]*len(table_content[0])
- for row in table_content:
- for index in range(len(row)):
- col = row[index]
- cols_width[index] = max(cols_width[index], len(col))
- if layout.klass == 'field':
- self.field_table(layout, table_content, cols_width)
- else:
- self.default_table(layout, table_content, cols_width)
- self.writeln()
-
- def default_table(self, layout, table_content, cols_width):
- """format a table"""
- cols_width = [size+1 for size in cols_width]
- format_strings = u' '.join([u'%%-%ss'] * len(cols_width))
- format_strings = format_strings % tuple(cols_width)
- format_strings = format_strings.split(' ')
- table_linesep = u'\n+' + u'+'.join([u'-'*w for w in cols_width]) + u'+\n'
- headsep = u'\n+' + u'+'.join([u'='*w for w in cols_width]) + u'+\n'
- # FIXME: layout.cheaders
- self.write(table_linesep)
- for i in range(len(table_content)):
- self.write(u'|')
- line = table_content[i]
- for j in range(len(line)):
- self.write(format_strings[j] % line[j])
- self.write(u'|')
- if i == 0 and layout.rheaders:
- self.write(headsep)
- else:
- self.write(table_linesep)
-
- def field_table(self, layout, table_content, cols_width):
- """special case for field table"""
- assert layout.cols == 2
- format_string = u'%s%%-%ss: %%s' % (linesep, cols_width[0])
- for field, value in table_content:
- self.write(format_string % (field, value))
-
-
- def visit_list(self, layout):
- """display a list layout as text"""
- bullet = BULLETS[self.list_level % len(BULLETS)]
- indent = ' ' * self.list_level
- self.list_level += 1
- for child in layout.children:
- self.write(u'%s%s%s ' % (linesep, indent, bullet))
- child.accept(self)
- self.list_level -= 1
-
- def visit_link(self, layout):
- """add a hyperlink"""
- if layout.label != layout.url:
- self.write(u'`%s`_' % layout.label)
- self.pending_urls.append( (layout.label, layout.url) )
- else:
- self.write(layout.url)
-
- def visit_verbatimtext(self, layout):
- """display a verbatim layout as text (so difficult ;)
- """
- self.writeln(u'::\n')
- for line in layout.data.splitlines():
- self.writeln(u' ' + line)
- self.writeln()
-
- def visit_text(self, layout):
- """add some text"""
- self.write(u'%s' % layout.data)
diff --git a/chromium/third_party/logilab/logilab/common/urllib2ext.py b/chromium/third_party/logilab/logilab/common/urllib2ext.py
deleted file mode 100644
index 339aec06886..00000000000
--- a/chromium/third_party/logilab/logilab/common/urllib2ext.py
+++ /dev/null
@@ -1,89 +0,0 @@
-from __future__ import print_function
-
-import logging
-import urllib2
-
-import kerberos as krb
-
-class GssapiAuthError(Exception):
- """raised on error during authentication process"""
-
-import re
-RGX = re.compile('(?:.*,)*\s*Negotiate\s*([^,]*),?', re.I)
-
-def get_negociate_value(headers):
- for authreq in headers.getheaders('www-authenticate'):
- match = RGX.search(authreq)
- if match:
- return match.group(1)
-
-class HTTPGssapiAuthHandler(urllib2.BaseHandler):
- """Negotiate HTTP authentication using context from GSSAPI"""
-
- handler_order = 400 # before Digest Auth
-
- def __init__(self):
- self._reset()
-
- def _reset(self):
- self._retried = 0
- self._context = None
-
- def clean_context(self):
- if self._context is not None:
- krb.authGSSClientClean(self._context)
-
- def http_error_401(self, req, fp, code, msg, headers):
- try:
- if self._retried > 5:
- raise urllib2.HTTPError(req.get_full_url(), 401,
- "negotiate auth failed", headers, None)
- self._retried += 1
- logging.debug('gssapi handler, try %s' % self._retried)
- negotiate = get_negociate_value(headers)
- if negotiate is None:
- logging.debug('no negociate found in a www-authenticate header')
- return None
- logging.debug('HTTPGssapiAuthHandler: negotiate 1 is %r' % negotiate)
- result, self._context = krb.authGSSClientInit("HTTP@%s" % req.get_host())
- if result < 1:
- raise GssapiAuthError("HTTPGssapiAuthHandler: init failed with %d" % result)
- result = krb.authGSSClientStep(self._context, negotiate)
- if result < 0:
- raise GssapiAuthError("HTTPGssapiAuthHandler: step 1 failed with %d" % result)
- client_response = krb.authGSSClientResponse(self._context)
- logging.debug('HTTPGssapiAuthHandler: client response is %s...' % client_response[:10])
- req.add_unredirected_header('Authorization', "Negotiate %s" % client_response)
- server_response = self.parent.open(req)
- negotiate = get_negociate_value(server_response.info())
- if negotiate is None:
- logging.warning('HTTPGssapiAuthHandler: failed to authenticate server')
- else:
- logging.debug('HTTPGssapiAuthHandler negotiate 2: %s' % negotiate)
- result = krb.authGSSClientStep(self._context, negotiate)
- if result < 1:
- raise GssapiAuthError("HTTPGssapiAuthHandler: step 2 failed with %d" % result)
- return server_response
- except GssapiAuthError as exc:
- logging.error(repr(exc))
- finally:
- self.clean_context()
- self._reset()
-
-if __name__ == '__main__':
- import sys
- # debug
- import httplib
- httplib.HTTPConnection.debuglevel = 1
- httplib.HTTPSConnection.debuglevel = 1
- # debug
- import logging
- logging.basicConfig(level=logging.DEBUG)
- # handle cookies
- import cookielib
- cj = cookielib.CookieJar()
- ch = urllib2.HTTPCookieProcessor(cj)
- # test with url sys.argv[1]
- h = HTTPGssapiAuthHandler()
- response = urllib2.build_opener(h, ch).open(sys.argv[1])
- print('\nresponse: %s\n--------------\n' % response.code, response.info())
diff --git a/chromium/third_party/logilab/logilab/common/vcgutils.py b/chromium/third_party/logilab/logilab/common/vcgutils.py
deleted file mode 100644
index 9cd2acda0cd..00000000000
--- a/chromium/third_party/logilab/logilab/common/vcgutils.py
+++ /dev/null
@@ -1,216 +0,0 @@
-# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""Functions to generate files readable with Georg Sander's vcg
-(Visualization of Compiler Graphs).
-
-You can download vcg at http://rw4.cs.uni-sb.de/~sander/html/gshome.html
-Note that vcg exists as a debian package.
-
-See vcg's documentation for explanation about the different values that
-maybe used for the functions parameters.
-
-
-
-
-"""
-__docformat__ = "restructuredtext en"
-
-import string
-
-ATTRS_VAL = {
- 'algos': ('dfs', 'tree', 'minbackward',
- 'left_to_right', 'right_to_left',
- 'top_to_bottom', 'bottom_to_top',
- 'maxdepth', 'maxdepthslow', 'mindepth', 'mindepthslow',
- 'mindegree', 'minindegree', 'minoutdegree',
- 'maxdegree', 'maxindegree', 'maxoutdegree'),
- 'booleans': ('yes', 'no'),
- 'colors': ('black', 'white', 'blue', 'red', 'green', 'yellow',
- 'magenta', 'lightgrey',
- 'cyan', 'darkgrey', 'darkblue', 'darkred', 'darkgreen',
- 'darkyellow', 'darkmagenta', 'darkcyan', 'gold',
- 'lightblue', 'lightred', 'lightgreen', 'lightyellow',
- 'lightmagenta', 'lightcyan', 'lilac', 'turquoise',
- 'aquamarine', 'khaki', 'purple', 'yellowgreen', 'pink',
- 'orange', 'orchid'),
- 'shapes': ('box', 'ellipse', 'rhomb', 'triangle'),
- 'textmodes': ('center', 'left_justify', 'right_justify'),
- 'arrowstyles': ('solid', 'line', 'none'),
- 'linestyles': ('continuous', 'dashed', 'dotted', 'invisible'),
- }
-
-# meaning of possible values:
-# O -> string
-# 1 -> int
-# list -> value in list
-GRAPH_ATTRS = {
- 'title': 0,
- 'label': 0,
- 'color': ATTRS_VAL['colors'],
- 'textcolor': ATTRS_VAL['colors'],
- 'bordercolor': ATTRS_VAL['colors'],
- 'width': 1,
- 'height': 1,
- 'borderwidth': 1,
- 'textmode': ATTRS_VAL['textmodes'],
- 'shape': ATTRS_VAL['shapes'],
- 'shrink': 1,
- 'stretch': 1,
- 'orientation': ATTRS_VAL['algos'],
- 'vertical_order': 1,
- 'horizontal_order': 1,
- 'xspace': 1,
- 'yspace': 1,
- 'layoutalgorithm': ATTRS_VAL['algos'],
- 'late_edge_labels': ATTRS_VAL['booleans'],
- 'display_edge_labels': ATTRS_VAL['booleans'],
- 'dirty_edge_labels': ATTRS_VAL['booleans'],
- 'finetuning': ATTRS_VAL['booleans'],
- 'manhattan_edges': ATTRS_VAL['booleans'],
- 'smanhattan_edges': ATTRS_VAL['booleans'],
- 'port_sharing': ATTRS_VAL['booleans'],
- 'edges': ATTRS_VAL['booleans'],
- 'nodes': ATTRS_VAL['booleans'],
- 'splines': ATTRS_VAL['booleans'],
- }
-NODE_ATTRS = {
- 'title': 0,
- 'label': 0,
- 'color': ATTRS_VAL['colors'],
- 'textcolor': ATTRS_VAL['colors'],
- 'bordercolor': ATTRS_VAL['colors'],
- 'width': 1,
- 'height': 1,
- 'borderwidth': 1,
- 'textmode': ATTRS_VAL['textmodes'],
- 'shape': ATTRS_VAL['shapes'],
- 'shrink': 1,
- 'stretch': 1,
- 'vertical_order': 1,
- 'horizontal_order': 1,
- }
-EDGE_ATTRS = {
- 'sourcename': 0,
- 'targetname': 0,
- 'label': 0,
- 'linestyle': ATTRS_VAL['linestyles'],
- 'class': 1,
- 'thickness': 0,
- 'color': ATTRS_VAL['colors'],
- 'textcolor': ATTRS_VAL['colors'],
- 'arrowcolor': ATTRS_VAL['colors'],
- 'backarrowcolor': ATTRS_VAL['colors'],
- 'arrowsize': 1,
- 'backarrowsize': 1,
- 'arrowstyle': ATTRS_VAL['arrowstyles'],
- 'backarrowstyle': ATTRS_VAL['arrowstyles'],
- 'textmode': ATTRS_VAL['textmodes'],
- 'priority': 1,
- 'anchor': 1,
- 'horizontal_order': 1,
- }
-
-
-# Misc utilities ###############################################################
-
-def latin_to_vcg(st):
- """Convert latin characters using vcg escape sequence.
- """
- for char in st:
- if char not in string.ascii_letters:
- try:
- num = ord(char)
- if num >= 192:
- st = st.replace(char, r'\fi%d'%ord(char))
- except:
- pass
- return st
-
-
-class VCGPrinter:
- """A vcg graph writer.
- """
-
- def __init__(self, output_stream):
- self._stream = output_stream
- self._indent = ''
-
- def open_graph(self, **args):
- """open a vcg graph
- """
- self._stream.write('%sgraph:{\n'%self._indent)
- self._inc_indent()
- self._write_attributes(GRAPH_ATTRS, **args)
-
- def close_graph(self):
- """close a vcg graph
- """
- self._dec_indent()
- self._stream.write('%s}\n'%self._indent)
-
-
- def node(self, title, **args):
- """draw a node
- """
- self._stream.write('%snode: {title:"%s"' % (self._indent, title))
- self._write_attributes(NODE_ATTRS, **args)
- self._stream.write('}\n')
-
-
- def edge(self, from_node, to_node, edge_type='', **args):
- """draw an edge from a node to another.
- """
- self._stream.write(
- '%s%sedge: {sourcename:"%s" targetname:"%s"' % (
- self._indent, edge_type, from_node, to_node))
- self._write_attributes(EDGE_ATTRS, **args)
- self._stream.write('}\n')
-
-
- # private ##################################################################
-
- def _write_attributes(self, attributes_dict, **args):
- """write graph, node or edge attributes
- """
- for key, value in args.items():
- try:
- _type = attributes_dict[key]
- except KeyError:
- raise Exception('''no such attribute %s
-possible attributes are %s''' % (key, attributes_dict.keys()))
-
- if not _type:
- self._stream.write('%s%s:"%s"\n' % (self._indent, key, value))
- elif _type == 1:
- self._stream.write('%s%s:%s\n' % (self._indent, key,
- int(value)))
- elif value in _type:
- self._stream.write('%s%s:%s\n' % (self._indent, key, value))
- else:
- raise Exception('''value %s isn\'t correct for attribute %s
-correct values are %s''' % (value, key, _type))
-
- def _inc_indent(self):
- """increment indentation
- """
- self._indent = ' %s' % self._indent
-
- def _dec_indent(self):
- """decrement indentation
- """
- self._indent = self._indent[:-2]
diff --git a/chromium/third_party/logilab/logilab/common/visitor.py b/chromium/third_party/logilab/logilab/common/visitor.py
deleted file mode 100644
index ed2b70f9612..00000000000
--- a/chromium/third_party/logilab/logilab/common/visitor.py
+++ /dev/null
@@ -1,109 +0,0 @@
-# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""A generic visitor abstract implementation.
-
-
-
-
-"""
-__docformat__ = "restructuredtext en"
-
-def no_filter(_):
- return 1
-
-# Iterators ###################################################################
-class FilteredIterator(object):
-
- def __init__(self, node, list_func, filter_func=None):
- self._next = [(node, 0)]
- if filter_func is None:
- filter_func = no_filter
- self._list = list_func(node, filter_func)
-
- def __next__(self):
- try:
- return self._list.pop(0)
- except :
- return None
-
- next = __next__
-
-# Base Visitor ################################################################
-class Visitor(object):
-
- def __init__(self, iterator_class, filter_func=None):
- self._iter_class = iterator_class
- self.filter = filter_func
-
- def visit(self, node, *args, **kargs):
- """
- launch the visit on a given node
-
- call 'open_visit' before the beginning of the visit, with extra args
- given
- when all nodes have been visited, call the 'close_visit' method
- """
- self.open_visit(node, *args, **kargs)
- return self.close_visit(self._visit(node))
-
- def _visit(self, node):
- iterator = self._get_iterator(node)
- n = next(iterator)
- while n:
- result = n.accept(self)
- n = next(iterator)
- return result
-
- def _get_iterator(self, node):
- return self._iter_class(node, self.filter)
-
- def open_visit(self, *args, **kargs):
- """
- method called at the beginning of the visit
- """
- pass
-
- def close_visit(self, result):
- """
- method called at the end of the visit
- """
- return result
-
-# standard visited mixin ######################################################
-class VisitedMixIn(object):
- """
- Visited interface allow node visitors to use the node
- """
- def get_visit_name(self):
- """
- return the visit name for the mixed class. When calling 'accept', the
- method <'visit_' + name returned by this method> will be called on the
- visitor
- """
- try:
- return self.TYPE.replace('-', '_')
- except:
- return self.__class__.__name__.lower()
-
- def accept(self, visitor, *args, **kwargs):
- func = getattr(visitor, 'visit_%s' % self.get_visit_name())
- return func(self, *args, **kwargs)
-
- def leave(self, visitor, *args, **kwargs):
- func = getattr(visitor, 'leave_%s' % self.get_visit_name())
- return func(self, *args, **kwargs)
diff --git a/chromium/third_party/logilab/logilab/common/xmlrpcutils.py b/chromium/third_party/logilab/logilab/common/xmlrpcutils.py
deleted file mode 100644
index 1d30d829b0b..00000000000
--- a/chromium/third_party/logilab/logilab/common/xmlrpcutils.py
+++ /dev/null
@@ -1,131 +0,0 @@
-# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""XML-RPC utilities."""
-__docformat__ = "restructuredtext en"
-
-import xmlrpclib
-from base64 import encodestring
-#from cStringIO import StringIO
-
-ProtocolError = xmlrpclib.ProtocolError
-
-## class BasicAuthTransport(xmlrpclib.Transport):
-## def __init__(self, username=None, password=None):
-## self.username = username
-## self.password = password
-## self.verbose = None
-## self.has_ssl = httplib.__dict__.has_key("HTTPConnection")
-
-## def request(self, host, handler, request_body, verbose=None):
-## # issue XML-RPC request
-## if self.has_ssl:
-## if host.startswith("https:"): h = httplib.HTTPSConnection(host)
-## else: h = httplib.HTTPConnection(host)
-## else: h = httplib.HTTP(host)
-
-## h.putrequest("POST", handler)
-
-## # required by HTTP/1.1
-## if not self.has_ssl: # HTTPConnection already does 1.1
-## h.putheader("Host", host)
-## h.putheader("Connection", "close")
-
-## if request_body: h.send(request_body)
-## if self.has_ssl:
-## response = h.getresponse()
-## if response.status != 200:
-## raise xmlrpclib.ProtocolError(host + handler,
-## response.status,
-## response.reason,
-## response.msg)
-## file = response.fp
-## else:
-## errcode, errmsg, headers = h.getreply()
-## if errcode != 200:
-## raise xmlrpclib.ProtocolError(host + handler, errcode,
-## errmsg, headers)
-
-## file = h.getfile()
-
-## return self.parse_response(file)
-
-
-
-class AuthMixin:
- """basic http authentication mixin for xmlrpc transports"""
-
- def __init__(self, username, password, encoding):
- self.verbose = 0
- self.username = username
- self.password = password
- self.encoding = encoding
-
- def request(self, host, handler, request_body, verbose=0):
- """issue XML-RPC request"""
- h = self.make_connection(host)
- h.putrequest("POST", handler)
- # required by XML-RPC
- h.putheader("User-Agent", self.user_agent)
- h.putheader("Content-Type", "text/xml")
- h.putheader("Content-Length", str(len(request_body)))
- h.putheader("Host", host)
- h.putheader("Connection", "close")
- # basic auth
- if self.username is not None and self.password is not None:
- h.putheader("AUTHORIZATION", "Basic %s" % encodestring(
- "%s:%s" % (self.username, self.password)).replace("\012", ""))
- h.endheaders()
- # send body
- if request_body:
- h.send(request_body)
- # get and check reply
- errcode, errmsg, headers = h.getreply()
- if errcode != 200:
- raise ProtocolError(host + handler, errcode, errmsg, headers)
- file = h.getfile()
-## # FIXME: encoding ??? iirc, this fix a bug in xmlrpclib but...
-## data = h.getfile().read()
-## if self.encoding != 'UTF-8':
-## data = data.replace("version='1.0'",
-## "version='1.0' encoding='%s'" % self.encoding)
-## result = StringIO()
-## result.write(data)
-## result.seek(0)
-## return self.parse_response(result)
- return self.parse_response(file)
-
-class BasicAuthTransport(AuthMixin, xmlrpclib.Transport):
- """basic http authentication transport"""
-
-class BasicAuthSafeTransport(AuthMixin, xmlrpclib.SafeTransport):
- """basic https authentication transport"""
-
-
-def connect(url, user=None, passwd=None, encoding='ISO-8859-1'):
- """return an xml rpc server on <url>, using user / password if specified
- """
- if user or passwd:
- assert user and passwd is not None
- if url.startswith('https://'):
- transport = BasicAuthSafeTransport(user, passwd, encoding)
- else:
- transport = BasicAuthTransport(user, passwd, encoding)
- else:
- transport = None
- server = xmlrpclib.ServerProxy(url, transport, encoding=encoding)
- return server
diff --git a/chromium/third_party/logilab/logilab/common/xmlutils.py b/chromium/third_party/logilab/logilab/common/xmlutils.py
deleted file mode 100644
index d383b9d5ef6..00000000000
--- a/chromium/third_party/logilab/logilab/common/xmlutils.py
+++ /dev/null
@@ -1,61 +0,0 @@
-# -*- coding: utf-8 -*-
-# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# This file is part of logilab-common.
-#
-# logilab-common is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation, either version 2.1 of the License, or (at your option) any
-# later version.
-#
-# logilab-common 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
-"""XML utilities.
-
-This module contains useful functions for parsing and using XML data. For the
-moment, there is only one function that can parse the data inside a processing
-instruction and return a Python dictionary.
-
-
-
-
-"""
-__docformat__ = "restructuredtext en"
-
-import re
-
-RE_DOUBLE_QUOTE = re.compile('([\w\-\.]+)="([^"]+)"')
-RE_SIMPLE_QUOTE = re.compile("([\w\-\.]+)='([^']+)'")
-
-def parse_pi_data(pi_data):
- """
- Utility function that parses the data contained in an XML
- processing instruction and returns a dictionary of keywords and their
- associated values (most of the time, the processing instructions contain
- data like ``keyword="value"``, if a keyword is not associated to a value,
- for example ``keyword``, it will be associated to ``None``).
-
- :param pi_data: data contained in an XML processing instruction.
- :type pi_data: unicode
-
- :returns: Dictionary of the keywords (Unicode strings) associated to
- their values (Unicode strings) as they were defined in the
- data.
- :rtype: dict
- """
- results = {}
- for elt in pi_data.split():
- if RE_DOUBLE_QUOTE.match(elt):
- kwd, val = RE_DOUBLE_QUOTE.match(elt).groups()
- elif RE_SIMPLE_QUOTE.match(elt):
- kwd, val = RE_SIMPLE_QUOTE.match(elt).groups()
- else:
- kwd, val = elt, None
- results[kwd] = val
- return results
diff --git a/chromium/third_party/pylint/README.chromium b/chromium/third_party/pylint/README.chromium
deleted file mode 100644
index 88e1f1a5842..00000000000
--- a/chromium/third_party/pylint/README.chromium
+++ /dev/null
@@ -1,55 +0,0 @@
-URL: http://www.pylint.org/
-Name: pylint
-Version: 1.4.1
-License: GPL v2
-License File: pylint/LICENSE.txt
-Security Critical: No
-
-Description:
-This directory contains the pylint module.
-
-Local Modifications:
-- applied upstream fix https://bitbucket.org/logilab/pylint/commits/5df347467ee0
-- applied fix to work around bad interaction between sys.path manipulation in
- pylint itself and multiprocessing's implementation on Windows (DIFF1)
-
-
-Diffs:
-DIFF1
-diff --git a/third_party/pylint/lint.py b/third_party/pylint/lint.py
-index e10ae56..082d8b3 100644
---- a/third_party/pylint/lint.py
-+++ b/third_party/pylint/lint.py
-@@ -671,7 +671,8 @@ class PyLinter(configuration.OptionsManagerMixIn,
- files_or_modules = (files_or_modules,)
-
- if self.config.jobs == 1:
-- self._do_check(files_or_modules)
-+ with fix_import_path(files_or_modules):
-+ self._do_check(files_or_modules)
- else:
- # Hack that permits running pylint, on Windows, with -m switch
- # and with --jobs, as in 'python -2 -m pylint .. --jobs'.
-@@ -1252,8 +1253,8 @@ group are mutually exclusive.'),
-
- # insert current working directory to the python path to have a correct
- # behaviour
-- with fix_import_path(args):
-- if self.linter.config.profile:
-+ if self.linter.config.profile:
-+ with fix_import_path(args):
- print('** profiled run', file=sys.stderr)
- import cProfile, pstats
- cProfile.runctx('linter.check(%r)' % args, globals(), locals(),
-@@ -1262,9 +1263,9 @@ group are mutually exclusive.'),
- data.strip_dirs()
- data.sort_stats('time', 'calls')
- data.print_stats(30)
-- else:
-- linter.check(args)
-- linter.generate_reports()
-+ else:
-+ linter.check(args)
-+ linter.generate_reports()
- if exit:
- sys.exit(self.linter.msg_status)
diff --git a/chromium/third_party/pylint/pylint/LICENSE.txt b/chromium/third_party/pylint/pylint/LICENSE.txt
deleted file mode 100644
index b7b5f53df14..00000000000
--- a/chromium/third_party/pylint/pylint/LICENSE.txt
+++ /dev/null
@@ -1,340 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- 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 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 St, Fifth Floor, Boston, MA 02110-1301 USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) year name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
-Public License instead of this License.
diff --git a/chromium/third_party/pylint/pylint/__init__.py b/chromium/third_party/pylint/pylint/__init__.py
deleted file mode 100644
index 82e557dce77..00000000000
--- a/chromium/third_party/pylint/pylint/__init__.py
+++ /dev/null
@@ -1,46 +0,0 @@
-# Copyright (c) 2003-2012 LOGILAB S.A. (Paris, FRANCE).
-# http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# 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 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.
-import sys
-
-from .__pkginfo__ import version as __version__
-
-def run_pylint():
- """run pylint"""
- from pylint.lint import Run
- Run(sys.argv[1:])
-
-def run_pylint_gui():
- """run pylint-gui"""
- try:
- from pylint.gui import Run
- Run(sys.argv[1:])
- except ImportError:
- sys.exit('tkinter is not available')
-
-def run_epylint():
- """run pylint"""
- from pylint.epylint import Run
- Run()
-
-def run_pyreverse():
- """run pyreverse"""
- from pylint.pyreverse.main import Run
- Run(sys.argv[1:])
-
-def run_symilar():
- """run symilar"""
- from pylint.checkers.similar import Run
- Run(sys.argv[1:])
diff --git a/chromium/third_party/pylint/pylint/__main__.py b/chromium/third_party/pylint/pylint/__main__.py
deleted file mode 100755
index 7716361def3..00000000000
--- a/chromium/third_party/pylint/pylint/__main__.py
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env python
-import pylint
-pylint.run_pylint()
diff --git a/chromium/third_party/pylint/pylint/__pkginfo__.py b/chromium/third_party/pylint/pylint/__pkginfo__.py
deleted file mode 100644
index 6ed331aac00..00000000000
--- a/chromium/third_party/pylint/pylint/__pkginfo__.py
+++ /dev/null
@@ -1,70 +0,0 @@
-# pylint: disable=W0622,C0103
-# Copyright (c) 2003-2014 LOGILAB S.A. (Paris, FRANCE).
-# http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# 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 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.
-"""pylint packaging information"""
-from __future__ import absolute_import
-
-modname = distname = 'pylint'
-
-numversion = (1, 4, 1)
-version = '.'.join([str(num) for num in numversion])
-
-install_requires = ['logilab-common >= 0.53.0', 'astroid >= 1.3.3', 'six']
-
-license = 'GPL'
-description = "python code static checker"
-web = 'http://www.pylint.org'
-mailinglist = "mailto://code-quality@python.org"
-author = 'Logilab'
-author_email = 'python-projects@lists.logilab.org'
-
-classifiers = ['Development Status :: 4 - Beta',
- 'Environment :: Console',
- 'Intended Audience :: Developers',
- 'License :: OSI Approved :: GNU General Public License (GPL)',
- 'Operating System :: OS Independent',
- 'Programming Language :: Python',
- 'Programming Language :: Python :: 2',
- 'Programming Language :: Python :: 3',
- 'Topic :: Software Development :: Debuggers',
- 'Topic :: Software Development :: Quality Assurance',
- 'Topic :: Software Development :: Testing'
- ]
-
-
-long_desc = """\
- Pylint is a Python source code analyzer which looks for programming
- errors, helps enforcing a coding standard and sniffs for some code
- smells (as defined in Martin Fowler's Refactoring book)
- .
- Pylint can be seen as another PyChecker since nearly all tests you
- can do with PyChecker can also be done with Pylint. However, Pylint
- offers some more features, like checking length of lines of code,
- checking if variable names are well-formed according to your coding
- standard, or checking if declared interfaces are truly implemented,
- and much more.
- .
- Additionally, it is possible to write plugins to add your own checks.
- .
- Pylint is shipped with "pylint-gui", "pyreverse" (UML diagram generator)
- and "symilar" (an independent similarities checker)."""
-
-from os.path import join
-scripts = [join('bin', filename)
- for filename in ('pylint', 'pylint-gui', "symilar", "epylint",
- "pyreverse")]
-
-include_dirs = ['test']
diff --git a/chromium/third_party/pylint/pylint/checkers/__init__.py b/chromium/third_party/pylint/pylint/checkers/__init__.py
deleted file mode 100644
index 51adb4d0433..00000000000
--- a/chromium/third_party/pylint/pylint/checkers/__init__.py
+++ /dev/null
@@ -1,124 +0,0 @@
-# Copyright (c) 2003-2013 LOGILAB S.A. (Paris, FRANCE).
-# http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# 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 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.
-"""utilities methods and classes for checkers
-
-Base id of standard checkers (used in msg and report ids):
-01: base
-02: classes
-03: format
-04: import
-05: misc
-06: variables
-07: exceptions
-08: similar
-09: design_analysis
-10: newstyle
-11: typecheck
-12: logging
-13: string_format
-14: string_constant
-15: stdlib
-16: python3
-17-50: not yet used: reserved for future internal checkers.
-51-99: perhaps used: reserved for external checkers
-
-The raw_metrics checker has no number associated since it doesn't emit any
-messages nor reports. XXX not true, emit a 07 report !
-
-"""
-
-import sys
-import tokenize
-import warnings
-
-from logilab.common.configuration import OptionsProviderMixIn
-
-from pylint.reporters import diff_string
-from pylint.utils import register_plugins
-from pylint.interfaces import UNDEFINED
-
-
-def table_lines_from_stats(stats, old_stats, columns):
- """get values listed in <columns> from <stats> and <old_stats>,
- and return a formated list of values, designed to be given to a
- ureport.Table object
- """
- lines = []
- for m_type in columns:
- new = stats[m_type]
- format = str # pylint: disable=redefined-builtin
- if isinstance(new, float):
- format = lambda num: '%.3f' % num
- old = old_stats.get(m_type)
- if old is not None:
- diff_str = diff_string(old, new)
- old = format(old)
- else:
- old, diff_str = 'NC', 'NC'
- lines += (m_type.replace('_', ' '), format(new), old, diff_str)
- return lines
-
-
-class BaseChecker(OptionsProviderMixIn):
- """base class for checkers"""
- # checker name (you may reuse an existing one)
- name = None
- # options level (0 will be displaying in --help, 1 in --long-help)
- level = 1
- # ordered list of options to control the ckecker behaviour
- options = ()
- # messages issued by this checker
- msgs = {}
- # reports issued by this checker
- reports = ()
- # mark this checker as enabled or not.
- enabled = True
-
- def __init__(self, linter=None):
- """checker instances should have the linter as argument
-
- linter is an object implementing ILinter
- """
- self.name = self.name.lower()
- OptionsProviderMixIn.__init__(self)
- self.linter = linter
-
- def add_message(self, msg_id, line=None, node=None, args=None, confidence=UNDEFINED):
- """add a message of a given type"""
- self.linter.add_message(msg_id, line, node, args, confidence)
-
- # dummy methods implementing the IChecker interface
-
- def open(self):
- """called before visiting project (i.e set of modules)"""
-
- def close(self):
- """called after visiting project (i.e set of modules)"""
-
-
-class BaseTokenChecker(BaseChecker):
- """Base class for checkers that want to have access to the token stream."""
-
- def process_tokens(self, tokens):
- """Should be overridden by subclasses."""
- raise NotImplementedError()
-
-
-def initialize(linter):
- """initialize linter with checkers in this package """
- register_plugins(linter, __path__[0])
-
-__all__ = ('BaseChecker', 'initialize')
diff --git a/chromium/third_party/pylint/pylint/checkers/base.py b/chromium/third_party/pylint/pylint/checkers/base.py
deleted file mode 100644
index 750d661f669..00000000000
--- a/chromium/third_party/pylint/pylint/checkers/base.py
+++ /dev/null
@@ -1,1248 +0,0 @@
-# Copyright (c) 2003-2013 LOGILAB S.A. (Paris, FRANCE).
-# http://www.logilab.fr/ -- mailto:contact@logilab.fr
-# Copyright (c) 2009-2010 Arista Networks, 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 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.
-"""basic checker for Python code"""
-
-import collections
-import itertools
-import sys
-import re
-
-import six
-from six.moves import zip # pylint: disable=redefined-builtin
-
-from logilab.common.ureports import Table
-
-import astroid
-import astroid.bases
-from astroid import are_exclusive, InferenceError
-
-from pylint.interfaces import IAstroidChecker, INFERENCE, INFERENCE_FAILURE, HIGH
-from pylint.utils import EmptyReport
-from pylint.reporters import diff_string
-from pylint.checkers import BaseChecker
-from pylint.checkers.utils import (
- check_messages,
- clobber_in_except,
- is_builtin_object,
- is_inside_except,
- overrides_a_method,
- safe_infer,
- get_argument_from_call,
- has_known_bases,
- NoSuchArgumentError,
- is_import_error,
- unimplemented_abstract_methods,
- )
-
-
-# regex for class/function/variable/constant name
-CLASS_NAME_RGX = re.compile('[A-Z_][a-zA-Z0-9]+$')
-MOD_NAME_RGX = re.compile('(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$')
-CONST_NAME_RGX = re.compile('(([A-Z_][A-Z0-9_]*)|(__.*__))$')
-COMP_VAR_RGX = re.compile('[A-Za-z_][A-Za-z0-9_]*$')
-DEFAULT_NAME_RGX = re.compile('[a-z_][a-z0-9_]{2,30}$')
-CLASS_ATTRIBUTE_RGX = re.compile(r'([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$')
-# do not require a doc string on system methods
-NO_REQUIRED_DOC_RGX = re.compile('__.*__')
-REVERSED_METHODS = (('__getitem__', '__len__'),
- ('__reversed__', ))
-
-PY33 = sys.version_info >= (3, 3)
-PY3K = sys.version_info >= (3, 0)
-BAD_FUNCTIONS = ['map', 'filter']
-if sys.version_info < (3, 0):
- BAD_FUNCTIONS.append('input')
-
-# Name categories that are always consistent with all naming conventions.
-EXEMPT_NAME_CATEGORIES = set(('exempt', 'ignore'))
-
-# A mapping from builtin-qname -> symbol, to be used when generating messages
-# about dangerous default values as arguments
-DEFAULT_ARGUMENT_SYMBOLS = dict(
- zip(['.'.join([astroid.bases.BUILTINS, x]) for x in ('set', 'dict', 'list')],
- ['set()', '{}', '[]'])
-)
-
-del re
-
-def _redefines_import(node):
- """ Detect that the given node (AssName) is inside an
- exception handler and redefines an import from the tryexcept body.
- Returns True if the node redefines an import, False otherwise.
- """
- current = node
- while current and not isinstance(current.parent, astroid.ExceptHandler):
- current = current.parent
- if not current or not is_import_error(current.parent):
- return False
- try_block = current.parent.parent
- for import_node in try_block.nodes_of_class((astroid.From, astroid.Import)):
- for name, alias in import_node.names:
- if alias:
- if alias == node.name:
- return True
- elif name == node.name:
- return True
- return False
-
-def in_loop(node):
- """return True if the node is inside a kind of for loop"""
- parent = node.parent
- while parent is not None:
- if isinstance(parent, (astroid.For, astroid.ListComp, astroid.SetComp,
- astroid.DictComp, astroid.GenExpr)):
- return True
- parent = parent.parent
- return False
-
-def in_nested_list(nested_list, obj):
- """return true if the object is an element of <nested_list> or of a nested
- list
- """
- for elmt in nested_list:
- if isinstance(elmt, (list, tuple)):
- if in_nested_list(elmt, obj):
- return True
- elif elmt == obj:
- return True
- return False
-
-def _loop_exits_early(loop):
- """Returns true if a loop has a break statement in its body."""
- loop_nodes = (astroid.For, astroid.While)
- # Loop over body explicitly to avoid matching break statements
- # in orelse.
- for child in loop.body:
- if isinstance(child, loop_nodes):
- # break statement may be in orelse of child loop.
- # pylint: disable=superfluous-parens
- for orelse in (child.orelse or ()):
- for _ in orelse.nodes_of_class(astroid.Break, skip_klass=loop_nodes):
- return True
- continue
- for _ in child.nodes_of_class(astroid.Break, skip_klass=loop_nodes):
- return True
- return False
-
-def _is_multi_naming_match(match, node_type, confidence):
- return (match is not None and
- match.lastgroup is not None and
- match.lastgroup not in EXEMPT_NAME_CATEGORIES
- and (node_type != 'method' or confidence != INFERENCE_FAILURE))
-
-
-if sys.version_info < (3, 0):
- PROPERTY_CLASSES = set(('__builtin__.property', 'abc.abstractproperty'))
-else:
- PROPERTY_CLASSES = set(('builtins.property', 'abc.abstractproperty'))
-
-
-def _determine_function_name_type(node):
- """Determine the name type whose regex the a function's name should match.
-
- :param node: A function node.
- :returns: One of ('function', 'method', 'attr')
- """
- if not node.is_method():
- return 'function'
- if node.decorators:
- decorators = node.decorators.nodes
- else:
- decorators = []
- for decorator in decorators:
- # If the function is a property (decorated with @property
- # or @abc.abstractproperty), the name type is 'attr'.
- if (isinstance(decorator, astroid.Name) or
- (isinstance(decorator, astroid.Getattr) and
- decorator.attrname == 'abstractproperty')):
- infered = safe_infer(decorator)
- if infered and infered.qname() in PROPERTY_CLASSES:
- return 'attr'
- # If the function is decorated using the prop_method.{setter,getter}
- # form, treat it like an attribute as well.
- elif (isinstance(decorator, astroid.Getattr) and
- decorator.attrname in ('setter', 'deleter')):
- return 'attr'
- return 'method'
-
-
-
-def _has_abstract_methods(node):
- """
- Determine if the given `node` has abstract methods.
-
- The methods should be made abstract by decorating them
- with `abc` decorators.
- """
- return len(unimplemented_abstract_methods(node)) > 0
-
-
-def report_by_type_stats(sect, stats, old_stats):
- """make a report of
-
- * percentage of different types documented
- * percentage of different types with a bad name
- """
- # percentage of different types documented and/or with a bad name
- nice_stats = {}
- for node_type in ('module', 'class', 'method', 'function'):
- try:
- total = stats[node_type]
- except KeyError:
- raise EmptyReport()
- nice_stats[node_type] = {}
- if total != 0:
- try:
- documented = total - stats['undocumented_'+node_type]
- percent = (documented * 100.) / total
- nice_stats[node_type]['percent_documented'] = '%.2f' % percent
- except KeyError:
- nice_stats[node_type]['percent_documented'] = 'NC'
- try:
- percent = (stats['badname_'+node_type] * 100.) / total
- nice_stats[node_type]['percent_badname'] = '%.2f' % percent
- except KeyError:
- nice_stats[node_type]['percent_badname'] = 'NC'
- lines = ('type', 'number', 'old number', 'difference',
- '%documented', '%badname')
- for node_type in ('module', 'class', 'method', 'function'):
- new = stats[node_type]
- old = old_stats.get(node_type, None)
- if old is not None:
- diff_str = diff_string(old, new)
- else:
- old, diff_str = 'NC', 'NC'
- lines += (node_type, str(new), str(old), diff_str,
- nice_stats[node_type].get('percent_documented', '0'),
- nice_stats[node_type].get('percent_badname', '0'))
- sect.append(Table(children=lines, cols=6, rheaders=1))
-
-def redefined_by_decorator(node):
- """return True if the object is a method redefined via decorator.
-
- For example:
- @property
- def x(self): return self._x
- @x.setter
- def x(self, value): self._x = value
- """
- if node.decorators:
- for decorator in node.decorators.nodes:
- if (isinstance(decorator, astroid.Getattr) and
- getattr(decorator.expr, 'name', None) == node.name):
- return True
- return False
-
-class _BasicChecker(BaseChecker):
- __implements__ = IAstroidChecker
- name = 'basic'
-
-class BasicErrorChecker(_BasicChecker):
- msgs = {
- 'E0100': ('__init__ method is a generator',
- 'init-is-generator',
- 'Used when the special class method __init__ is turned into a '
- 'generator by a yield in its body.'),
- 'E0101': ('Explicit return in __init__',
- 'return-in-init',
- 'Used when the special class method __init__ has an explicit '
- 'return value.'),
- 'E0102': ('%s already defined line %s',
- 'function-redefined',
- 'Used when a function / class / method is redefined.'),
- 'E0103': ('%r not properly in loop',
- 'not-in-loop',
- 'Used when break or continue keywords are used outside a loop.'),
- 'E0104': ('Return outside function',
- 'return-outside-function',
- 'Used when a "return" statement is found outside a function or '
- 'method.'),
- 'E0105': ('Yield outside function',
- 'yield-outside-function',
- 'Used when a "yield" statement is found outside a function or '
- 'method.'),
- 'E0106': ('Return with argument inside generator',
- 'return-arg-in-generator',
- 'Used when a "return" statement with an argument is found '
- 'outside in a generator function or method (e.g. with some '
- '"yield" statements).',
- {'maxversion': (3, 3)}),
- 'E0107': ("Use of the non-existent %s operator",
- 'nonexistent-operator',
- "Used when you attempt to use the C-style pre-increment or"
- "pre-decrement operator -- and ++, which doesn't exist in Python."),
- 'E0108': ('Duplicate argument name %s in function definition',
- 'duplicate-argument-name',
- 'Duplicate argument names in function definitions are syntax'
- ' errors.'),
- 'E0110': ('Abstract class %r with abstract methods instantiated',
- 'abstract-class-instantiated',
- 'Used when an abstract class with `abc.ABCMeta` as metaclass '
- 'has abstract methods and is instantiated.'),
- 'W0120': ('Else clause on loop without a break statement',
- 'useless-else-on-loop',
- 'Loops should only have an else clause if they can exit early '
- 'with a break statement, otherwise the statements under else '
- 'should be on the same scope as the loop itself.'),
- }
-
- @check_messages('function-redefined')
- def visit_class(self, node):
- self._check_redefinition('class', node)
-
- @check_messages('init-is-generator', 'return-in-init',
- 'function-redefined', 'return-arg-in-generator',
- 'duplicate-argument-name')
- def visit_function(self, node):
- if not redefined_by_decorator(node):
- self._check_redefinition(node.is_method() and 'method' or 'function', node)
- # checks for max returns, branch, return in __init__
- returns = node.nodes_of_class(astroid.Return,
- skip_klass=(astroid.Function, astroid.Class))
- if node.is_method() and node.name == '__init__':
- if node.is_generator():
- self.add_message('init-is-generator', node=node)
- else:
- values = [r.value for r in returns]
- # Are we returning anything but None from constructors
- if [v for v in values
- if not (v is None or
- (isinstance(v, astroid.Const) and v.value is None) or
- (isinstance(v, astroid.Name) and v.name == 'None')
- )]:
- self.add_message('return-in-init', node=node)
- elif node.is_generator():
- # make sure we don't mix non-None returns and yields
- if not PY33:
- for retnode in returns:
- if isinstance(retnode.value, astroid.Const) and \
- retnode.value.value is not None:
- self.add_message('return-arg-in-generator', node=node,
- line=retnode.fromlineno)
- # Check for duplicate names
- args = set()
- for name in node.argnames():
- if name in args:
- self.add_message('duplicate-argument-name', node=node, args=(name,))
- else:
- args.add(name)
-
-
- @check_messages('return-outside-function')
- def visit_return(self, node):
- if not isinstance(node.frame(), astroid.Function):
- self.add_message('return-outside-function', node=node)
-
- @check_messages('yield-outside-function')
- def visit_yield(self, node):
- if not isinstance(node.frame(), (astroid.Function, astroid.Lambda)):
- self.add_message('yield-outside-function', node=node)
-
- @check_messages('not-in-loop')
- def visit_continue(self, node):
- self._check_in_loop(node, 'continue')
-
- @check_messages('not-in-loop')
- def visit_break(self, node):
- self._check_in_loop(node, 'break')
-
- @check_messages('useless-else-on-loop')
- def visit_for(self, node):
- self._check_else_on_loop(node)
-
- @check_messages('useless-else-on-loop')
- def visit_while(self, node):
- self._check_else_on_loop(node)
-
- @check_messages('nonexistent-operator')
- def visit_unaryop(self, node):
- """check use of the non-existent ++ and -- operator operator"""
- if ((node.op in '+-') and
- isinstance(node.operand, astroid.UnaryOp) and
- (node.operand.op == node.op)):
- self.add_message('nonexistent-operator', node=node, args=node.op*2)
-
- @check_messages('abstract-class-instantiated')
- def visit_callfunc(self, node):
- """ Check instantiating abstract class with
- abc.ABCMeta as metaclass.
- """
- try:
- infered = next(node.func.infer())
- except astroid.InferenceError:
- return
- if not isinstance(infered, astroid.Class):
- return
- # __init__ was called
- metaclass = infered.metaclass()
- abstract_methods = _has_abstract_methods(infered)
- if metaclass is None:
- # Python 3.4 has `abc.ABC`, which won't be detected
- # by ClassNode.metaclass()
- for ancestor in infered.ancestors():
- if ancestor.qname() == 'abc.ABC' and abstract_methods:
- self.add_message('abstract-class-instantiated',
- args=(infered.name, ),
- node=node)
- break
- return
- if metaclass.qname() == 'abc.ABCMeta' and abstract_methods:
- self.add_message('abstract-class-instantiated',
- args=(infered.name, ),
- node=node)
-
- def _check_else_on_loop(self, node):
- """Check that any loop with an else clause has a break statement."""
- if node.orelse and not _loop_exits_early(node):
- self.add_message('useless-else-on-loop', node=node,
- # This is not optimal, but the line previous
- # to the first statement in the else clause
- # will usually be the one that contains the else:.
- line=node.orelse[0].lineno - 1)
-
- def _check_in_loop(self, node, node_name):
- """check that a node is inside a for or while loop"""
- _node = node.parent
- while _node:
- if isinstance(_node, (astroid.For, astroid.While)):
- break
- _node = _node.parent
- else:
- self.add_message('not-in-loop', node=node, args=node_name)
-
- def _check_redefinition(self, redeftype, node):
- """check for redefinition of a function / method / class name"""
- defined_self = node.parent.frame()[node.name]
- if defined_self is not node and not are_exclusive(node, defined_self):
- self.add_message('function-redefined', node=node,
- args=(redeftype, defined_self.fromlineno))
-
-
-
-class BasicChecker(_BasicChecker):
- """checks for :
- * doc strings
- * number of arguments, local variables, branches, returns and statements in
-functions, methods
- * required module attributes
- * dangerous default values as arguments
- * redefinition of function / method / class
- * uses of the global statement
- """
-
- __implements__ = IAstroidChecker
-
- name = 'basic'
- msgs = {
- 'W0101': ('Unreachable code',
- 'unreachable',
- 'Used when there is some code behind a "return" or "raise" '
- 'statement, which will never be accessed.'),
- 'W0102': ('Dangerous default value %s as argument',
- 'dangerous-default-value',
- 'Used when a mutable value as list or dictionary is detected in '
- 'a default value for an argument.'),
- 'W0104': ('Statement seems to have no effect',
- 'pointless-statement',
- 'Used when a statement doesn\'t have (or at least seems to) '
- 'any effect.'),
- 'W0105': ('String statement has no effect',
- 'pointless-string-statement',
- 'Used when a string is used as a statement (which of course '
- 'has no effect). This is a particular case of W0104 with its '
- 'own message so you can easily disable it if you\'re using '
- 'those strings as documentation, instead of comments.'),
- 'W0106': ('Expression "%s" is assigned to nothing',
- 'expression-not-assigned',
- 'Used when an expression that is not a function call is assigned '
- 'to nothing. Probably something else was intended.'),
- 'W0108': ('Lambda may not be necessary',
- 'unnecessary-lambda',
- 'Used when the body of a lambda expression is a function call '
- 'on the same argument list as the lambda itself; such lambda '
- 'expressions are in all but a few cases replaceable with the '
- 'function being called in the body of the lambda.'),
- 'W0109': ("Duplicate key %r in dictionary",
- 'duplicate-key',
- 'Used when a dictionary expression binds the same key multiple '
- 'times.'),
- 'W0122': ('Use of exec',
- 'exec-used',
- 'Used when you use the "exec" statement (function for Python '
- '3), to discourage its usage. That doesn\'t '
- 'mean you can not use it !'),
- 'W0123': ('Use of eval',
- 'eval-used',
- 'Used when you use the "eval" function, to discourage its '
- 'usage. Consider using `ast.literal_eval` for safely evaluating '
- 'strings containing Python expressions '
- 'from untrusted sources. '),
- 'W0141': ('Used builtin function %r',
- 'bad-builtin',
- 'Used when a black listed builtin function is used (see the '
- 'bad-function option). Usual black listed functions are the ones '
- 'like map, or filter , where Python offers now some cleaner '
- 'alternative like list comprehension.'),
- 'W0142': ('Used * or ** magic',
- 'star-args',
- 'Used when a function or method is called using `*args` or '
- '`**kwargs` to dispatch arguments. This doesn\'t improve '
- 'readability and should be used with care.'),
- 'W0150': ("%s statement in finally block may swallow exception",
- 'lost-exception',
- 'Used when a break or a return statement is found inside the '
- 'finally clause of a try...finally block: the exceptions raised '
- 'in the try clause will be silently swallowed instead of being '
- 're-raised.'),
- 'W0199': ('Assert called on a 2-uple. Did you mean \'assert x,y\'?',
- 'assert-on-tuple',
- 'A call of assert on a tuple will always evaluate to true if '
- 'the tuple is not empty, and will always evaluate to false if '
- 'it is.'),
- 'C0121': ('Missing required attribute "%s"', # W0103
- 'missing-module-attribute',
- 'Used when an attribute required for modules is missing.'),
-
- 'E0109': ('Missing argument to reversed()',
- 'missing-reversed-argument',
- 'Used when reversed() builtin didn\'t receive an argument.'),
- 'E0111': ('The first reversed() argument is not a sequence',
- 'bad-reversed-sequence',
- 'Used when the first argument to reversed() builtin '
- 'isn\'t a sequence (does not implement __reversed__, '
- 'nor __getitem__ and __len__'),
-
- }
-
- options = (('required-attributes',
- {'default' : (), 'type' : 'csv',
- 'metavar' : '<attributes>',
- 'help' : 'Required attributes for module, separated by a '
- 'comma'}
- ),
- ('bad-functions',
- {'default' : BAD_FUNCTIONS,
- 'type' :'csv', 'metavar' : '<builtin function names>',
- 'help' : 'List of builtins function names that should not be '
- 'used, separated by a comma'}
- ),
- )
- reports = (('RP0101', 'Statistics by type', report_by_type_stats),)
-
- def __init__(self, linter):
- _BasicChecker.__init__(self, linter)
- self.stats = None
- self._tryfinallys = None
-
- def open(self):
- """initialize visit variables and statistics
- """
- self._tryfinallys = []
- self.stats = self.linter.add_stats(module=0, function=0,
- method=0, class_=0)
-
- @check_messages('missing-module-attribute')
- def visit_module(self, node):
- """check module name, docstring and required arguments
- """
- self.stats['module'] += 1
- for attr in self.config.required_attributes:
- if attr not in node:
- self.add_message('missing-module-attribute', node=node, args=attr)
-
- def visit_class(self, node): # pylint: disable=unused-argument
- """check module name, docstring and redefinition
- increment branch counter
- """
- self.stats['class'] += 1
-
- @check_messages('pointless-statement', 'pointless-string-statement',
- 'expression-not-assigned')
- def visit_discard(self, node):
- """check for various kind of statements without effect"""
- expr = node.value
- if isinstance(expr, astroid.Const) and isinstance(expr.value,
- six.string_types):
- # treat string statement in a separated message
- # Handle PEP-257 attribute docstrings.
- # An attribute docstring is defined as being a string right after
- # an assignment at the module level, class level or __init__ level.
- scope = expr.scope()
- if isinstance(scope, (astroid.Class, astroid.Module, astroid.Function)):
- if isinstance(scope, astroid.Function) and scope.name != '__init__':
- pass
- else:
- sibling = expr.previous_sibling()
- if (sibling is not None and sibling.scope() is scope and
- isinstance(sibling, astroid.Assign)):
- return
- self.add_message('pointless-string-statement', node=node)
- return
- # ignore if this is :
- # * a direct function call
- # * the unique child of a try/except body
- # * a yield (which are wrapped by a discard node in _ast XXX)
- # warn W0106 if we have any underlying function call (we can't predict
- # side effects), else pointless-statement
- if (isinstance(expr, (astroid.Yield, astroid.CallFunc)) or
- (isinstance(node.parent, astroid.TryExcept) and
- node.parent.body == [node])):
- return
- if any(expr.nodes_of_class(astroid.CallFunc)):
- self.add_message('expression-not-assigned', node=node,
- args=expr.as_string())
- else:
- self.add_message('pointless-statement', node=node)
-
- @check_messages('unnecessary-lambda')
- def visit_lambda(self, node):
- """check whether or not the lambda is suspicious
- """
- # if the body of the lambda is a call expression with the same
- # argument list as the lambda itself, then the lambda is
- # possibly unnecessary and at least suspicious.
- if node.args.defaults:
- # If the arguments of the lambda include defaults, then a
- # judgment cannot be made because there is no way to check
- # that the defaults defined by the lambda are the same as
- # the defaults defined by the function called in the body
- # of the lambda.
- return
- call = node.body
- if not isinstance(call, astroid.CallFunc):
- # The body of the lambda must be a function call expression
- # for the lambda to be unnecessary.
- return
- # XXX are lambda still different with astroid >= 0.18 ?
- # *args and **kwargs need to be treated specially, since they
- # are structured differently between the lambda and the function
- # call (in the lambda they appear in the args.args list and are
- # indicated as * and ** by two bits in the lambda's flags, but
- # in the function call they are omitted from the args list and
- # are indicated by separate attributes on the function call node).
- ordinary_args = list(node.args.args)
- if node.args.kwarg:
- if (not call.kwargs
- or not isinstance(call.kwargs, astroid.Name)
- or node.args.kwarg != call.kwargs.name):
- return
- elif call.kwargs:
- return
- if node.args.vararg:
- if (not call.starargs
- or not isinstance(call.starargs, astroid.Name)
- or node.args.vararg != call.starargs.name):
- return
- elif call.starargs:
- return
- # The "ordinary" arguments must be in a correspondence such that:
- # ordinary_args[i].name == call.args[i].name.
- if len(ordinary_args) != len(call.args):
- return
- for i in range(len(ordinary_args)):
- if not isinstance(call.args[i], astroid.Name):
- return
- if node.args.args[i].name != call.args[i].name:
- return
- if (isinstance(node.body.func, astroid.Getattr) and
- isinstance(node.body.func.expr, astroid.CallFunc)):
- # Chained call, the intermediate call might
- # return something else (but we don't check that, yet).
- return
- self.add_message('unnecessary-lambda', line=node.fromlineno, node=node)
-
- @check_messages('dangerous-default-value')
- def visit_function(self, node):
- """check function name, docstring, arguments, redefinition,
- variable names, max locals
- """
- self.stats[node.is_method() and 'method' or 'function'] += 1
- self._check_dangerous_default(node)
-
- def _check_dangerous_default(self, node):
- # check for dangerous default values as arguments
- is_iterable = lambda n: isinstance(n, (astroid.List,
- astroid.Set,
- astroid.Dict))
- for default in node.args.defaults:
- try:
- value = next(default.infer())
- except astroid.InferenceError:
- continue
-
- if (isinstance(value, astroid.Instance) and
- value.qname() in DEFAULT_ARGUMENT_SYMBOLS):
-
- if value is default:
- msg = DEFAULT_ARGUMENT_SYMBOLS[value.qname()]
- elif type(value) is astroid.Instance or is_iterable(value):
- # We are here in the following situation(s):
- # * a dict/set/list/tuple call which wasn't inferred
- # to a syntax node ({}, () etc.). This can happen
- # when the arguments are invalid or unknown to
- # the inference.
- # * a variable from somewhere else, which turns out to be a list
- # or a dict.
- if is_iterable(default):
- msg = value.pytype()
- elif isinstance(default, astroid.CallFunc):
- msg = '%s() (%s)' % (value.name, value.qname())
- else:
- msg = '%s (%s)' % (default.as_string(), value.qname())
- else:
- # this argument is a name
- msg = '%s (%s)' % (default.as_string(),
- DEFAULT_ARGUMENT_SYMBOLS[value.qname()])
- self.add_message('dangerous-default-value',
- node=node,
- args=(msg, ))
-
- @check_messages('unreachable', 'lost-exception')
- def visit_return(self, node):
- """1 - check is the node has a right sibling (if so, that's some
- unreachable code)
- 2 - check is the node is inside the finally clause of a try...finally
- block
- """
- self._check_unreachable(node)
- # Is it inside final body of a try...finally bloc ?
- self._check_not_in_finally(node, 'return', (astroid.Function,))
-
- @check_messages('unreachable')
- def visit_continue(self, node):
- """check is the node has a right sibling (if so, that's some unreachable
- code)
- """
- self._check_unreachable(node)
-
- @check_messages('unreachable', 'lost-exception')
- def visit_break(self, node):
- """1 - check is the node has a right sibling (if so, that's some
- unreachable code)
- 2 - check is the node is inside the finally clause of a try...finally
- block
- """
- # 1 - Is it right sibling ?
- self._check_unreachable(node)
- # 2 - Is it inside final body of a try...finally bloc ?
- self._check_not_in_finally(node, 'break', (astroid.For, astroid.While,))
-
- @check_messages('unreachable')
- def visit_raise(self, node):
- """check if the node has a right sibling (if so, that's some unreachable
- code)
- """
- self._check_unreachable(node)
-
- @check_messages('exec-used')
- def visit_exec(self, node):
- """just print a warning on exec statements"""
- self.add_message('exec-used', node=node)
-
- @check_messages('bad-builtin', 'star-args', 'eval-used',
- 'exec-used', 'missing-reversed-argument',
- 'bad-reversed-sequence')
- def visit_callfunc(self, node):
- """visit a CallFunc node -> check if this is not a blacklisted builtin
- call and check for * or ** use
- """
- if isinstance(node.func, astroid.Name):
- name = node.func.name
- # ignore the name if it's not a builtin (i.e. not defined in the
- # locals nor globals scope)
- if not (name in node.frame() or
- name in node.root()):
- if name == 'exec':
- self.add_message('exec-used', node=node)
- elif name == 'reversed':
- self._check_reversed(node)
- elif name == 'eval':
- self.add_message('eval-used', node=node)
- if name in self.config.bad_functions:
- self.add_message('bad-builtin', node=node, args=name)
- if node.starargs or node.kwargs:
- scope = node.scope()
- if isinstance(scope, astroid.Function):
- toprocess = [(n, vn) for (n, vn) in ((node.starargs, scope.args.vararg),
- (node.kwargs, scope.args.kwarg)) if n]
- if toprocess:
- for cfnode, fargname in toprocess[:]:
- if getattr(cfnode, 'name', None) == fargname:
- toprocess.remove((cfnode, fargname))
- if not toprocess:
- return # star-args can be skipped
- self.add_message('star-args', node=node.func)
-
- @check_messages('assert-on-tuple')
- def visit_assert(self, node):
- """check the use of an assert statement on a tuple."""
- if node.fail is None and isinstance(node.test, astroid.Tuple) and \
- len(node.test.elts) == 2:
- self.add_message('assert-on-tuple', node=node)
-
- @check_messages('duplicate-key')
- def visit_dict(self, node):
- """check duplicate key in dictionary"""
- keys = set()
- for k, _ in node.items:
- if isinstance(k, astroid.Const):
- key = k.value
- if key in keys:
- self.add_message('duplicate-key', node=node, args=key)
- keys.add(key)
-
- def visit_tryfinally(self, node):
- """update try...finally flag"""
- self._tryfinallys.append(node)
-
- def leave_tryfinally(self, node): # pylint: disable=unused-argument
- """update try...finally flag"""
- self._tryfinallys.pop()
-
- def _check_unreachable(self, node):
- """check unreachable code"""
- unreach_stmt = node.next_sibling()
- if unreach_stmt is not None:
- self.add_message('unreachable', node=unreach_stmt)
-
- def _check_not_in_finally(self, node, node_name, breaker_classes=()):
- """check that a node is not inside a finally clause of a
- try...finally statement.
- If we found before a try...finally bloc a parent which its type is
- in breaker_classes, we skip the whole check."""
- # if self._tryfinallys is empty, we're not a in try...finally bloc
- if not self._tryfinallys:
- return
- # the node could be a grand-grand...-children of the try...finally
- _parent = node.parent
- _node = node
- while _parent and not isinstance(_parent, breaker_classes):
- if hasattr(_parent, 'finalbody') and _node in _parent.finalbody:
- self.add_message('lost-exception', node=node, args=node_name)
- return
- _node = _parent
- _parent = _node.parent
-
- def _check_reversed(self, node):
- """ check that the argument to `reversed` is a sequence """
- try:
- argument = safe_infer(get_argument_from_call(node, position=0))
- except NoSuchArgumentError:
- self.add_message('missing-reversed-argument', node=node)
- else:
- if argument is astroid.YES:
- return
- if argument is None:
- # Nothing was infered.
- # Try to see if we have iter().
- if isinstance(node.args[0], astroid.CallFunc):
- try:
- func = next(node.args[0].func.infer())
- except InferenceError:
- return
- if (getattr(func, 'name', None) == 'iter' and
- is_builtin_object(func)):
- self.add_message('bad-reversed-sequence', node=node)
- return
-
- if isinstance(argument, astroid.Instance):
- if (argument._proxied.name == 'dict' and
- is_builtin_object(argument._proxied)):
- self.add_message('bad-reversed-sequence', node=node)
- return
- elif any(ancestor.name == 'dict' and is_builtin_object(ancestor)
- for ancestor in argument._proxied.ancestors()):
- # mappings aren't accepted by reversed()
- self.add_message('bad-reversed-sequence', node=node)
- return
-
- for methods in REVERSED_METHODS:
- for meth in methods:
- try:
- argument.getattr(meth)
- except astroid.NotFoundError:
- break
- else:
- break
- else:
- # Check if it is a .deque. It doesn't seem that
- # we can retrieve special methods
- # from C implemented constructs.
- if argument._proxied.qname().endswith(".deque"):
- return
- self.add_message('bad-reversed-sequence', node=node)
- elif not isinstance(argument, (astroid.List, astroid.Tuple)):
- # everything else is not a proper sequence for reversed()
- self.add_message('bad-reversed-sequence', node=node)
-
-_NAME_TYPES = {
- 'module': (MOD_NAME_RGX, 'module'),
- 'const': (CONST_NAME_RGX, 'constant'),
- 'class': (CLASS_NAME_RGX, 'class'),
- 'function': (DEFAULT_NAME_RGX, 'function'),
- 'method': (DEFAULT_NAME_RGX, 'method'),
- 'attr': (DEFAULT_NAME_RGX, 'attribute'),
- 'argument': (DEFAULT_NAME_RGX, 'argument'),
- 'variable': (DEFAULT_NAME_RGX, 'variable'),
- 'class_attribute': (CLASS_ATTRIBUTE_RGX, 'class attribute'),
- 'inlinevar': (COMP_VAR_RGX, 'inline iteration'),
-}
-
-def _create_naming_options():
- name_options = []
- for name_type, (rgx, human_readable_name) in six.iteritems(_NAME_TYPES):
- name_type = name_type.replace('_', '-')
- name_options.append((
- '%s-rgx' % (name_type,),
- {'default': rgx, 'type': 'regexp', 'metavar': '<regexp>',
- 'help': 'Regular expression matching correct %s names' % (human_readable_name,)}))
- name_options.append((
- '%s-name-hint' % (name_type,),
- {'default': rgx.pattern, 'type': 'string', 'metavar': '<string>',
- 'help': 'Naming hint for %s names' % (human_readable_name,)}))
- return tuple(name_options)
-
-class NameChecker(_BasicChecker):
- msgs = {
- 'C0102': ('Black listed name "%s"',
- 'blacklisted-name',
- 'Used when the name is listed in the black list (unauthorized '
- 'names).'),
- 'C0103': ('Invalid %s name "%s"%s',
- 'invalid-name',
- 'Used when the name doesn\'t match the regular expression '
- 'associated to its type (constant, variable, class...).'),
- }
-
- options = (('good-names',
- {'default' : ('i', 'j', 'k', 'ex', 'Run', '_'),
- 'type' :'csv', 'metavar' : '<names>',
- 'help' : 'Good variable names which should always be accepted,'
- ' separated by a comma'}
- ),
- ('bad-names',
- {'default' : ('foo', 'bar', 'baz', 'toto', 'tutu', 'tata'),
- 'type' :'csv', 'metavar' : '<names>',
- 'help' : 'Bad variable names which should always be refused, '
- 'separated by a comma'}
- ),
- ('name-group',
- {'default' : (),
- 'type' :'csv', 'metavar' : '<name1:name2>',
- 'help' : ('Colon-delimited sets of names that determine each'
- ' other\'s naming style when the name regexes'
- ' allow several styles.')}
- ),
- ('include-naming-hint',
- {'default': False, 'type' : 'yn', 'metavar' : '<y_or_n>',
- 'help': 'Include a hint for the correct naming format with invalid-name'}
- ),
- ) + _create_naming_options()
-
-
- def __init__(self, linter):
- _BasicChecker.__init__(self, linter)
- self._name_category = {}
- self._name_group = {}
- self._bad_names = {}
-
- def open(self):
- self.stats = self.linter.add_stats(badname_module=0,
- badname_class=0, badname_function=0,
- badname_method=0, badname_attr=0,
- badname_const=0,
- badname_variable=0,
- badname_inlinevar=0,
- badname_argument=0,
- badname_class_attribute=0)
- for group in self.config.name_group:
- for name_type in group.split(':'):
- self._name_group[name_type] = 'group_%s' % (group,)
-
- @check_messages('blacklisted-name', 'invalid-name')
- def visit_module(self, node):
- self._check_name('module', node.name.split('.')[-1], node)
- self._bad_names = {}
-
- def leave_module(self, node): # pylint: disable=unused-argument
- for all_groups in six.itervalues(self._bad_names):
- if len(all_groups) < 2:
- continue
- groups = collections.defaultdict(list)
- min_warnings = sys.maxsize
- for group in six.itervalues(all_groups):
- groups[len(group)].append(group)
- min_warnings = min(len(group), min_warnings)
- if len(groups[min_warnings]) > 1:
- by_line = sorted(groups[min_warnings],
- key=lambda group: min(warning[0].lineno for warning in group))
- warnings = itertools.chain(*by_line[1:])
- else:
- warnings = groups[min_warnings][0]
- for args in warnings:
- self._raise_name_warning(*args)
-
- @check_messages('blacklisted-name', 'invalid-name')
- def visit_class(self, node):
- self._check_name('class', node.name, node)
- for attr, anodes in six.iteritems(node.instance_attrs):
- if not list(node.instance_attr_ancestors(attr)):
- self._check_name('attr', attr, anodes[0])
-
- @check_messages('blacklisted-name', 'invalid-name')
- def visit_function(self, node):
- # Do not emit any warnings if the method is just an implementation
- # of a base class method.
- confidence = HIGH
- if node.is_method():
- if overrides_a_method(node.parent.frame(), node.name):
- return
- confidence = (INFERENCE if has_known_bases(node.parent.frame())
- else INFERENCE_FAILURE)
-
- self._check_name(_determine_function_name_type(node),
- node.name, node, confidence)
- # Check argument names
- args = node.args.args
- if args is not None:
- self._recursive_check_names(args, node)
-
- @check_messages('blacklisted-name', 'invalid-name')
- def visit_global(self, node):
- for name in node.names:
- self._check_name('const', name, node)
-
- @check_messages('blacklisted-name', 'invalid-name')
- def visit_assname(self, node):
- """check module level assigned names"""
- frame = node.frame()
- ass_type = node.ass_type()
- if isinstance(ass_type, astroid.Comprehension):
- self._check_name('inlinevar', node.name, node)
- elif isinstance(frame, astroid.Module):
- if isinstance(ass_type, astroid.Assign) and not in_loop(ass_type):
- if isinstance(safe_infer(ass_type.value), astroid.Class):
- self._check_name('class', node.name, node)
- else:
- if not _redefines_import(node):
- # Don't emit if the name redefines an import
- # in an ImportError except handler.
- self._check_name('const', node.name, node)
- elif isinstance(ass_type, astroid.ExceptHandler):
- self._check_name('variable', node.name, node)
- elif isinstance(frame, astroid.Function):
- # global introduced variable aren't in the function locals
- if node.name in frame and node.name not in frame.argnames():
- if not _redefines_import(node):
- self._check_name('variable', node.name, node)
- elif isinstance(frame, astroid.Class):
- if not list(frame.local_attr_ancestors(node.name)):
- self._check_name('class_attribute', node.name, node)
-
- def _recursive_check_names(self, args, node):
- """check names in a possibly recursive list <arg>"""
- for arg in args:
- if isinstance(arg, astroid.AssName):
- self._check_name('argument', arg.name, node)
- else:
- self._recursive_check_names(arg.elts, node)
-
- def _find_name_group(self, node_type):
- return self._name_group.get(node_type, node_type)
-
- def _raise_name_warning(self, node, node_type, name, confidence):
- type_label = _NAME_TYPES[node_type][1]
- hint = ''
- if self.config.include_naming_hint:
- hint = ' (hint: %s)' % (getattr(self.config, node_type + '_name_hint'))
- self.add_message('invalid-name', node=node, args=(type_label, name, hint),
- confidence=confidence)
- self.stats['badname_' + node_type] += 1
-
- def _check_name(self, node_type, name, node, confidence=HIGH):
- """check for a name using the type's regexp"""
- if is_inside_except(node):
- clobbering, _ = clobber_in_except(node)
- if clobbering:
- return
- if name in self.config.good_names:
- return
- if name in self.config.bad_names:
- self.stats['badname_' + node_type] += 1
- self.add_message('blacklisted-name', node=node, args=name)
- return
- regexp = getattr(self.config, node_type + '_rgx')
- match = regexp.match(name)
-
- if _is_multi_naming_match(match, node_type, confidence):
- name_group = self._find_name_group(node_type)
- bad_name_group = self._bad_names.setdefault(name_group, {})
- warnings = bad_name_group.setdefault(match.lastgroup, [])
- warnings.append((node, node_type, name, confidence))
-
- if match is None:
- self._raise_name_warning(node, node_type, name, confidence)
-
-
-class DocStringChecker(_BasicChecker):
- msgs = {
- 'C0111': ('Missing %s docstring', # W0131
- 'missing-docstring',
- 'Used when a module, function, class or method has no docstring.'
- 'Some special methods like __init__ doesn\'t necessary require a '
- 'docstring.'),
- 'C0112': ('Empty %s docstring', # W0132
- 'empty-docstring',
- 'Used when a module, function, class or method has an empty '
- 'docstring (it would be too easy ;).'),
- }
- options = (('no-docstring-rgx',
- {'default' : NO_REQUIRED_DOC_RGX,
- 'type' : 'regexp', 'metavar' : '<regexp>',
- 'help' : 'Regular expression which should only match '
- 'function or class names that do not require a '
- 'docstring.'}
- ),
- ('docstring-min-length',
- {'default' : -1,
- 'type' : 'int', 'metavar' : '<int>',
- 'help': ('Minimum line length for functions/classes that'
- ' require docstrings, shorter ones are exempt.')}
- ),
- )
-
-
- def open(self):
- self.stats = self.linter.add_stats(undocumented_module=0,
- undocumented_function=0,
- undocumented_method=0,
- undocumented_class=0)
- @check_messages('missing-docstring', 'empty-docstring')
- def visit_module(self, node):
- self._check_docstring('module', node)
-
- @check_messages('missing-docstring', 'empty-docstring')
- def visit_class(self, node):
- if self.config.no_docstring_rgx.match(node.name) is None:
- self._check_docstring('class', node)
-
- @check_messages('missing-docstring', 'empty-docstring')
- def visit_function(self, node):
- if self.config.no_docstring_rgx.match(node.name) is None:
- ftype = node.is_method() and 'method' or 'function'
- if isinstance(node.parent.frame(), astroid.Class):
- overridden = False
- confidence = (INFERENCE if has_known_bases(node.parent.frame())
- else INFERENCE_FAILURE)
- # check if node is from a method overridden by its ancestor
- for ancestor in node.parent.frame().ancestors():
- if node.name in ancestor and \
- isinstance(ancestor[node.name], astroid.Function):
- overridden = True
- break
- self._check_docstring(ftype, node,
- report_missing=not overridden,
- confidence=confidence)
- else:
- self._check_docstring(ftype, node)
-
- def _check_docstring(self, node_type, node, report_missing=True,
- confidence=HIGH):
- """check the node has a non empty docstring"""
- docstring = node.doc
- if docstring is None:
- if not report_missing:
- return
- if node.body:
- lines = node.body[-1].lineno - node.body[0].lineno + 1
- else:
- lines = 0
- max_lines = self.config.docstring_min_length
-
- if node_type != 'module' and max_lines > -1 and lines < max_lines:
- return
- self.stats['undocumented_'+node_type] += 1
- if (node.body and isinstance(node.body[0], astroid.Discard) and
- isinstance(node.body[0].value, astroid.CallFunc)):
- # Most likely a string with a format call. Let's see.
- func = safe_infer(node.body[0].value.func)
- if (isinstance(func, astroid.BoundMethod)
- and isinstance(func.bound, astroid.Instance)):
- # Strings in Python 3, others in Python 2.
- if PY3K and func.bound.name == 'str':
- return
- elif func.bound.name in ('str', 'unicode', 'bytes'):
- return
- self.add_message('missing-docstring', node=node, args=(node_type,),
- confidence=confidence)
- elif not docstring.strip():
- self.stats['undocumented_'+node_type] += 1
- self.add_message('empty-docstring', node=node, args=(node_type,),
- confidence=confidence)
-
-
-class PassChecker(_BasicChecker):
- """check if the pass statement is really necessary"""
- msgs = {'W0107': ('Unnecessary pass statement',
- 'unnecessary-pass',
- 'Used when a "pass" statement that can be avoided is '
- 'encountered.'),
- }
- @check_messages('unnecessary-pass')
- def visit_pass(self, node):
- if len(node.parent.child_sequence(node)) > 1:
- self.add_message('unnecessary-pass', node=node)
-
-
-class LambdaForComprehensionChecker(_BasicChecker):
- """check for using a lambda where a comprehension would do.
-
- See <http://www.artima.com/weblogs/viewpost.jsp?thread=98196>
- where GvR says comprehensions would be clearer.
- """
-
- msgs = {'W0110': ('map/filter on lambda could be replaced by comprehension',
- 'deprecated-lambda',
- 'Used when a lambda is the first argument to "map" or '
- '"filter". It could be clearer as a list '
- 'comprehension or generator expression.',
- {'maxversion': (3, 0)}),
- }
-
- @check_messages('deprecated-lambda')
- def visit_callfunc(self, node):
- """visit a CallFunc node, check if map or filter are called with a
- lambda
- """
- if not node.args:
- return
- if not isinstance(node.args[0], astroid.Lambda):
- return
- infered = safe_infer(node.func)
- if (is_builtin_object(infered)
- and infered.name in ['map', 'filter']):
- self.add_message('deprecated-lambda', node=node)
-
-
-def register(linter):
- """required method to auto register this checker"""
- linter.register_checker(BasicErrorChecker(linter))
- linter.register_checker(BasicChecker(linter))
- linter.register_checker(NameChecker(linter))
- linter.register_checker(DocStringChecker(linter))
- linter.register_checker(PassChecker(linter))
- linter.register_checker(LambdaForComprehensionChecker(linter))
diff --git a/chromium/third_party/pylint/pylint/checkers/classes.py b/chromium/third_party/pylint/pylint/checkers/classes.py
deleted file mode 100644
index 1a10c3576d7..00000000000
--- a/chromium/third_party/pylint/pylint/checkers/classes.py
+++ /dev/null
@@ -1,981 +0,0 @@
-# Copyright (c) 2003-2014 LOGILAB S.A. (Paris, FRANCE).
-# http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# 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 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.
-"""classes checker for Python code
-"""
-from __future__ import generators
-
-import sys
-from collections import defaultdict
-
-import astroid
-from astroid import YES, Instance, are_exclusive, AssAttr, Class
-from astroid.bases import Generator, BUILTINS
-from astroid.inference import InferenceContext
-
-from pylint.interfaces import IAstroidChecker
-from pylint.checkers import BaseChecker
-from pylint.checkers.utils import (
- PYMETHODS, overrides_a_method, check_messages, is_attr_private,
- is_attr_protected, node_frame_class, safe_infer, is_builtin_object,
- decorated_with_property, unimplemented_abstract_methods)
-import six
-
-if sys.version_info >= (3, 0):
- NEXT_METHOD = '__next__'
-else:
- NEXT_METHOD = 'next'
-ITER_METHODS = ('__iter__', '__getitem__')
-
-def _called_in_methods(func, klass, methods):
- """ Check if the func was called in any of the given methods,
- belonging to the *klass*. Returns True if so, False otherwise.
- """
- if not isinstance(func, astroid.Function):
- return False
- for method in methods:
- try:
- infered = klass.getattr(method)
- except astroid.NotFoundError:
- continue
- for infer_method in infered:
- for callfunc in infer_method.nodes_of_class(astroid.CallFunc):
- try:
- bound = next(callfunc.func.infer())
- except (astroid.InferenceError, StopIteration):
- continue
- if not isinstance(bound, astroid.BoundMethod):
- continue
- func_obj = bound._proxied
- if isinstance(func_obj, astroid.UnboundMethod):
- func_obj = func_obj._proxied
- if func_obj.name == func.name:
- return True
- return False
-
-def class_is_abstract(node):
- """return true if the given class node should be considered as an abstract
- class
- """
- for method in node.methods():
- if method.parent.frame() is node:
- if method.is_abstract(pass_is_abstract=False):
- return True
- return False
-
-def _is_attribute_property(name, klass):
- """ Check if the given attribute *name* is a property
- in the given *klass*.
-
- It will look for `property` calls or for functions
- with the given name, decorated by `property` or `property`
- subclasses.
- Returns ``True`` if the name is a property in the given klass,
- ``False`` otherwise.
- """
-
- try:
- attributes = klass.getattr(name)
- except astroid.NotFoundError:
- return False
- property_name = "{0}.property".format(BUILTINS)
- for attr in attributes:
- try:
- infered = next(attr.infer())
- except astroid.InferenceError:
- continue
- if (isinstance(infered, astroid.Function) and
- decorated_with_property(infered)):
- return True
- if infered.pytype() == property_name:
- return True
- return False
-
-
-MSGS = {
- 'F0202': ('Unable to check methods signature (%s / %s)',
- 'method-check-failed',
- 'Used when Pylint has been unable to check methods signature \
- compatibility for an unexpected reason. Please report this kind \
- if you don\'t make sense of it.'),
-
- 'E0202': ('An attribute defined in %s line %s hides this method',
- 'method-hidden',
- 'Used when a class defines a method which is hidden by an '
- 'instance attribute from an ancestor class or set by some '
- 'client code.'),
- 'E0203': ('Access to member %r before its definition line %s',
- 'access-member-before-definition',
- 'Used when an instance member is accessed before it\'s actually\
- assigned.'),
- 'W0201': ('Attribute %r defined outside __init__',
- 'attribute-defined-outside-init',
- 'Used when an instance attribute is defined outside the __init__\
- method.'),
-
- 'W0212': ('Access to a protected member %s of a client class', # E0214
- 'protected-access',
- 'Used when a protected member (i.e. class member with a name \
- beginning with an underscore) is access outside the class or a \
- descendant of the class where it\'s defined.'),
-
- 'E0211': ('Method has no argument',
- 'no-method-argument',
- 'Used when a method which should have the bound instance as \
- first argument has no argument defined.'),
- 'E0213': ('Method should have "self" as first argument',
- 'no-self-argument',
- 'Used when a method has an attribute different the "self" as\
- first argument. This is considered as an error since this is\
- a so common convention that you shouldn\'t break it!'),
- 'C0202': ('Class method %s should have %s as first argument', # E0212
- 'bad-classmethod-argument',
- 'Used when a class method has a first argument named differently '
- 'than the value specified in valid-classmethod-first-arg option '
- '(default to "cls"), recommended to easily differentiate them '
- 'from regular instance methods.'),
- 'C0203': ('Metaclass method %s should have %s as first argument', # E0214
- 'bad-mcs-method-argument',
- 'Used when a metaclass method has a first agument named '
- 'differently than the value specified in valid-classmethod-first'
- '-arg option (default to "cls"), recommended to easily '
- 'differentiate them from regular instance methods.'),
- 'C0204': ('Metaclass class method %s should have %s as first argument',
- 'bad-mcs-classmethod-argument',
- 'Used when a metaclass class method has a first argument named '
- 'differently than the value specified in valid-metaclass-'
- 'classmethod-first-arg option (default to "mcs"), recommended to '
- 'easily differentiate them from regular instance methods.'),
-
- 'W0211': ('Static method with %r as first argument',
- 'bad-staticmethod-argument',
- 'Used when a static method has "self" or a value specified in '
- 'valid-classmethod-first-arg option or '
- 'valid-metaclass-classmethod-first-arg option as first argument.'
- ),
- 'R0201': ('Method could be a function',
- 'no-self-use',
- 'Used when a method doesn\'t use its bound instance, and so could\
- be written as a function.'
- ),
-
- 'E0221': ('Interface resolved to %s is not a class',
- 'interface-is-not-class',
- 'Used when a class claims to implement an interface which is not \
- a class.'),
- 'E0222': ('Missing method %r from %s interface',
- 'missing-interface-method',
- 'Used when a method declared in an interface is missing from a \
- class implementing this interface'),
- 'W0221': ('Arguments number differs from %s %r method',
- 'arguments-differ',
- 'Used when a method has a different number of arguments than in \
- the implemented interface or in an overridden method.'),
- 'W0222': ('Signature differs from %s %r method',
- 'signature-differs',
- 'Used when a method signature is different than in the \
- implemented interface or in an overridden method.'),
- 'W0223': ('Method %r is abstract in class %r but is not overridden',
- 'abstract-method',
- 'Used when an abstract method (i.e. raise NotImplementedError) is \
- not overridden in concrete class.'
- ),
- 'F0220': ('failed to resolve interfaces implemented by %s (%s)', # W0224
- 'unresolved-interface',
- 'Used when a Pylint as failed to find interfaces implemented by \
- a class'),
-
-
- 'W0231': ('__init__ method from base class %r is not called',
- 'super-init-not-called',
- 'Used when an ancestor class method has an __init__ method \
- which is not called by a derived class.'),
- 'W0232': ('Class has no __init__ method',
- 'no-init',
- 'Used when a class has no __init__ method, neither its parent \
- classes.'),
- 'W0233': ('__init__ method from a non direct base class %r is called',
- 'non-parent-init-called',
- 'Used when an __init__ method is called on a class which is not \
- in the direct ancestors for the analysed class.'),
- 'W0234': ('__iter__ returns non-iterator',
- 'non-iterator-returned',
- 'Used when an __iter__ method returns something which is not an \
- iterable (i.e. has no `%s` method)' % NEXT_METHOD),
- 'E0235': ('__exit__ must accept 3 arguments: type, value, traceback',
- 'bad-context-manager',
- 'Used when the __exit__ special method, belonging to a \
- context manager, does not accept 3 arguments \
- (type, value, traceback).'),
- 'E0236': ('Invalid object %r in __slots__, must contain '
- 'only non empty strings',
- 'invalid-slots-object',
- 'Used when an invalid (non-string) object occurs in __slots__.'),
- 'E0237': ('Assigning to attribute %r not defined in class slots',
- 'assigning-non-slot',
- 'Used when assigning to an attribute not defined '
- 'in the class slots.'),
- 'E0238': ('Invalid __slots__ object',
- 'invalid-slots',
- 'Used when an invalid __slots__ is found in class. '
- 'Only a string, an iterable or a sequence is permitted.'),
- 'E0239': ('Inheriting %r, which is not a class.',
- 'inherit-non-class',
- 'Used when a class inherits from something which is not a '
- 'class.'),
-
-
- }
-
-
-class ClassChecker(BaseChecker):
- """checks for :
- * methods without self as first argument
- * overridden methods signature
- * access only to existent members via self
- * attributes not defined in the __init__ method
- * supported interfaces implementation
- * unreachable code
- """
-
- __implements__ = (IAstroidChecker,)
-
- # configuration section name
- name = 'classes'
- # messages
- msgs = MSGS
- priority = -2
- # configuration options
- options = (('ignore-iface-methods',
- {'default' : (#zope interface
- 'isImplementedBy', 'deferred', 'extends', 'names',
- 'namesAndDescriptions', 'queryDescriptionFor', 'getBases',
- 'getDescriptionFor', 'getDoc', 'getName', 'getTaggedValue',
- 'getTaggedValueTags', 'isEqualOrExtendedBy', 'setTaggedValue',
- 'isImplementedByInstancesOf',
- # twisted
- 'adaptWith',
- # logilab.common interface
- 'is_implemented_by'),
- 'type' : 'csv',
- 'metavar' : '<method names>',
- 'help' : 'List of interface methods to ignore, \
-separated by a comma. This is used for instance to not check methods defines \
-in Zope\'s Interface base class.'}
- ),
- ('defining-attr-methods',
- {'default' : ('__init__', '__new__', 'setUp'),
- 'type' : 'csv',
- 'metavar' : '<method names>',
- 'help' : 'List of method names used to declare (i.e. assign) \
-instance attributes.'}
- ),
- ('valid-classmethod-first-arg',
- {'default' : ('cls',),
- 'type' : 'csv',
- 'metavar' : '<argument names>',
- 'help' : 'List of valid names for the first argument in \
-a class method.'}
- ),
- ('valid-metaclass-classmethod-first-arg',
- {'default' : ('mcs',),
- 'type' : 'csv',
- 'metavar' : '<argument names>',
- 'help' : 'List of valid names for the first argument in \
-a metaclass class method.'}
- ),
- ('exclude-protected',
- {
- 'default': (
- # namedtuple public API.
- '_asdict', '_fields', '_replace', '_source', '_make'),
- 'type': 'csv',
- 'metavar': '<protected access exclusions>',
- 'help': ('List of member names, which should be excluded '
- 'from the protected access warning.')}
- ))
-
- def __init__(self, linter=None):
- BaseChecker.__init__(self, linter)
- self._accessed = []
- self._first_attrs = []
- self._meth_could_be_func = None
-
- def visit_class(self, node):
- """init visit variable _accessed and check interfaces
- """
- self._accessed.append(defaultdict(list))
- self._check_bases_classes(node)
- self._check_interfaces(node)
- # if not an interface, exception, metaclass
- if node.type == 'class':
- try:
- node.local_attr('__init__')
- except astroid.NotFoundError:
- self.add_message('no-init', args=node, node=node)
- self._check_slots(node)
- self._check_proper_bases(node)
-
- @check_messages('inherit-non-class')
- def _check_proper_bases(self, node):
- """
- Detect that a class inherits something which is not
- a class or a type.
- """
- for base in node.bases:
- ancestor = safe_infer(base)
- if ancestor in (YES, None):
- continue
- if (isinstance(ancestor, astroid.Instance) and
- ancestor.is_subtype_of('%s.type' % (BUILTINS,))):
- continue
- if not isinstance(ancestor, astroid.Class):
- self.add_message('inherit-non-class',
- args=base.as_string(), node=node)
-
- @check_messages('access-member-before-definition',
- 'attribute-defined-outside-init')
- def leave_class(self, cnode):
- """close a class node:
- check that instance attributes are defined in __init__ and check
- access to existent members
- """
- # check access to existent members on non metaclass classes
- accessed = self._accessed.pop()
- if cnode.type != 'metaclass':
- self._check_accessed_members(cnode, accessed)
- # checks attributes are defined in an allowed method such as __init__
- if not self.linter.is_message_enabled('attribute-defined-outside-init'):
- return
- defining_methods = self.config.defining_attr_methods
- current_module = cnode.root()
- for attr, nodes in six.iteritems(cnode.instance_attrs):
- # skip nodes which are not in the current module and it may screw up
- # the output, while it's not worth it
- nodes = [n for n in nodes if not
- isinstance(n.statement(), (astroid.Delete, astroid.AugAssign))
- and n.root() is current_module]
- if not nodes:
- continue # error detected by typechecking
- # check if any method attr is defined in is a defining method
- if any(node.frame().name in defining_methods
- for node in nodes):
- continue
-
- # check attribute is defined in a parent's __init__
- for parent in cnode.instance_attr_ancestors(attr):
- attr_defined = False
- # check if any parent method attr is defined in is a defining method
- for node in parent.instance_attrs[attr]:
- if node.frame().name in defining_methods:
- attr_defined = True
- if attr_defined:
- # we're done :)
- break
- else:
- # check attribute is defined as a class attribute
- try:
- cnode.local_attr(attr)
- except astroid.NotFoundError:
- for node in nodes:
- if node.frame().name not in defining_methods:
- # If the attribute was set by a callfunc in any
- # of the defining methods, then don't emit
- # the warning.
- if _called_in_methods(node.frame(), cnode,
- defining_methods):
- continue
- self.add_message('attribute-defined-outside-init',
- args=attr, node=node)
-
- def visit_function(self, node):
- """check method arguments, overriding"""
- # ignore actual functions
- if not node.is_method():
- return
- klass = node.parent.frame()
- self._meth_could_be_func = True
- # check first argument is self if this is actually a method
- self._check_first_arg_for_type(node, klass.type == 'metaclass')
- if node.name == '__init__':
- self._check_init(node)
- return
- # check signature if the method overloads inherited method
- for overridden in klass.local_attr_ancestors(node.name):
- # get astroid for the searched method
- try:
- meth_node = overridden[node.name]
- except KeyError:
- # we have found the method but it's not in the local
- # dictionary.
- # This may happen with astroid build from living objects
- continue
- if not isinstance(meth_node, astroid.Function):
- continue
- self._check_signature(node, meth_node, 'overridden')
- break
- if node.decorators:
- for decorator in node.decorators.nodes:
- if isinstance(decorator, astroid.Getattr) and \
- decorator.attrname in ('getter', 'setter', 'deleter'):
- # attribute affectation will call this method, not hiding it
- return
- if isinstance(decorator, astroid.Name) and decorator.name == 'property':
- # attribute affectation will either call a setter or raise
- # an attribute error, anyway not hiding the function
- return
- # check if the method is hidden by an attribute
- try:
- overridden = klass.instance_attr(node.name)[0] # XXX
- overridden_frame = overridden.frame()
- if (isinstance(overridden_frame, astroid.Function)
- and overridden_frame.type == 'method'):
- overridden_frame = overridden_frame.parent.frame()
- if (isinstance(overridden_frame, Class)
- and klass.is_subtype_of(overridden_frame.qname())):
- args = (overridden.root().name, overridden.fromlineno)
- self.add_message('method-hidden', args=args, node=node)
- except astroid.NotFoundError:
- pass
-
- # check non-iterators in __iter__
- if node.name == '__iter__':
- self._check_iter(node)
- elif node.name == '__exit__':
- self._check_exit(node)
-
- def _check_slots(self, node):
- if '__slots__' not in node.locals:
- return
- for slots in node.igetattr('__slots__'):
- # check if __slots__ is a valid type
- for meth in ITER_METHODS:
- try:
- slots.getattr(meth)
- break
- except astroid.NotFoundError:
- continue
- else:
- self.add_message('invalid-slots', node=node)
- continue
-
- if isinstance(slots, astroid.Const):
- # a string, ignore the following checks
- continue
- if not hasattr(slots, 'itered'):
- # we can't obtain the values, maybe a .deque?
- continue
-
- if isinstance(slots, astroid.Dict):
- values = [item[0] for item in slots.items]
- else:
- values = slots.itered()
- if values is YES:
- return
-
- for elt in values:
- try:
- self._check_slots_elt(elt)
- except astroid.InferenceError:
- continue
-
- def _check_slots_elt(self, elt):
- for infered in elt.infer():
- if infered is YES:
- continue
- if (not isinstance(infered, astroid.Const) or
- not isinstance(infered.value, six.string_types)):
- self.add_message('invalid-slots-object',
- args=infered.as_string(),
- node=elt)
- continue
- if not infered.value:
- self.add_message('invalid-slots-object',
- args=infered.as_string(),
- node=elt)
-
- def _check_iter(self, node):
- try:
- infered = node.infer_call_result(node)
- except astroid.InferenceError:
- return
-
- for infered_node in infered:
- if (infered_node is YES
- or isinstance(infered_node, Generator)):
- continue
- if isinstance(infered_node, astroid.Instance):
- try:
- infered_node.local_attr(NEXT_METHOD)
- except astroid.NotFoundError:
- self.add_message('non-iterator-returned',
- node=node)
- break
-
- def _check_exit(self, node):
- positional = sum(1 for arg in node.args.args if arg.name != 'self')
- if positional < 3 and not node.args.vararg:
- self.add_message('bad-context-manager',
- node=node)
- elif positional > 3:
- self.add_message('bad-context-manager',
- node=node)
-
- def leave_function(self, node):
- """on method node, check if this method couldn't be a function
-
- ignore class, static and abstract methods, initializer,
- methods overridden from a parent class and any
- kind of method defined in an interface for this warning
- """
- if node.is_method():
- if node.args.args is not None:
- self._first_attrs.pop()
- if not self.linter.is_message_enabled('no-self-use'):
- return
- class_node = node.parent.frame()
- if (self._meth_could_be_func and node.type == 'method'
- and not node.name in PYMETHODS
- and not (node.is_abstract() or
- overrides_a_method(class_node, node.name))
- and class_node.type != 'interface'):
- self.add_message('no-self-use', node=node)
-
- def visit_getattr(self, node):
- """check if the getattr is an access to a class member
- if so, register it. Also check for access to protected
- class member from outside its class (but ignore __special__
- methods)
- """
- attrname = node.attrname
- # Check self
- if self.is_first_attr(node):
- self._accessed[-1][attrname].append(node)
- return
- if not self.linter.is_message_enabled('protected-access'):
- return
-
- self._check_protected_attribute_access(node)
-
- def visit_assattr(self, node):
- if isinstance(node.ass_type(), astroid.AugAssign) and self.is_first_attr(node):
- self._accessed[-1][node.attrname].append(node)
- self._check_in_slots(node)
-
- def _check_in_slots(self, node):
- """ Check that the given assattr node
- is defined in the class slots.
- """
- infered = safe_infer(node.expr)
- if infered and isinstance(infered, Instance):
- klass = infered._proxied
- if '__slots__' not in klass.locals or not klass.newstyle:
- return
-
- slots = klass.slots()
- if slots is None:
- return
- # If any ancestor doesn't use slots, the slots
- # defined for this class are superfluous.
- if any('__slots__' not in ancestor.locals and
- ancestor.name != 'object'
- for ancestor in klass.ancestors()):
- return
-
- if not any(slot.value == node.attrname for slot in slots):
- # If we have a '__dict__' in slots, then
- # assigning any name is valid.
- if not any(slot.value == '__dict__' for slot in slots):
- if _is_attribute_property(node.attrname, klass):
- # Properties circumvent the slots mechanism,
- # so we should not emit a warning for them.
- return
- self.add_message('assigning-non-slot',
- args=(node.attrname, ), node=node)
-
- @check_messages('protected-access')
- def visit_assign(self, assign_node):
- node = assign_node.targets[0]
- if not isinstance(node, AssAttr):
- return
-
- if self.is_first_attr(node):
- return
-
- self._check_protected_attribute_access(node)
-
- def _check_protected_attribute_access(self, node):
- '''Given an attribute access node (set or get), check if attribute
- access is legitimate. Call _check_first_attr with node before calling
- this method. Valid cases are:
- * self._attr in a method or cls._attr in a classmethod. Checked by
- _check_first_attr.
- * Klass._attr inside "Klass" class.
- * Klass2._attr inside "Klass" class when Klass2 is a base class of
- Klass.
- '''
- attrname = node.attrname
-
- if (is_attr_protected(attrname) and
- attrname not in self.config.exclude_protected):
-
- klass = node_frame_class(node)
-
- # XXX infer to be more safe and less dirty ??
- # in classes, check we are not getting a parent method
- # through the class object or through super
- callee = node.expr.as_string()
-
- # We are not in a class, no remaining valid case
- if klass is None:
- self.add_message('protected-access', node=node, args=attrname)
- return
-
- # If the expression begins with a call to super, that's ok.
- if isinstance(node.expr, astroid.CallFunc) and \
- isinstance(node.expr.func, astroid.Name) and \
- node.expr.func.name == 'super':
- return
-
- # We are in a class, one remaining valid cases, Klass._attr inside
- # Klass
- if not (callee == klass.name or callee in klass.basenames):
- # Detect property assignments in the body of the class.
- # This is acceptable:
- #
- # class A:
- # b = property(lambda: self._b)
-
- stmt = node.parent.statement()
- try:
- if (isinstance(stmt, astroid.Assign) and
- (stmt in klass.body or klass.parent_of(stmt)) and
- isinstance(stmt.value, astroid.CallFunc) and
- isinstance(stmt.value.func, astroid.Name) and
- stmt.value.func.name == 'property' and
- is_builtin_object(next(stmt.value.func.infer(), None))):
- return
- except astroid.InferenceError:
- pass
- self.add_message('protected-access', node=node, args=attrname)
-
- def visit_name(self, node):
- """check if the name handle an access to a class member
- if so, register it
- """
- if self._first_attrs and (node.name == self._first_attrs[-1] or
- not self._first_attrs[-1]):
- self._meth_could_be_func = False
-
- def _check_accessed_members(self, node, accessed):
- """check that accessed members are defined"""
- # XXX refactor, probably much simpler now that E0201 is in type checker
- for attr, nodes in six.iteritems(accessed):
- # deactivate "except doesn't do anything", that's expected
- # pylint: disable=W0704
- try:
- # is it a class attribute ?
- node.local_attr(attr)
- # yes, stop here
- continue
- except astroid.NotFoundError:
- pass
- # is it an instance attribute of a parent class ?
- try:
- next(node.instance_attr_ancestors(attr))
- # yes, stop here
- continue
- except StopIteration:
- pass
- # is it an instance attribute ?
- try:
- defstmts = node.instance_attr(attr)
- except astroid.NotFoundError:
- pass
- else:
- # filter out augment assignment nodes
- defstmts = [stmt for stmt in defstmts if stmt not in nodes]
- if not defstmts:
- # only augment assignment for this node, no-member should be
- # triggered by the typecheck checker
- continue
- # filter defstmts to only pick the first one when there are
- # several assignments in the same scope
- scope = defstmts[0].scope()
- defstmts = [stmt for i, stmt in enumerate(defstmts)
- if i == 0 or stmt.scope() is not scope]
- # if there are still more than one, don't attempt to be smarter
- # than we can be
- if len(defstmts) == 1:
- defstmt = defstmts[0]
- # check that if the node is accessed in the same method as
- # it's defined, it's accessed after the initial assignment
- frame = defstmt.frame()
- lno = defstmt.fromlineno
- for _node in nodes:
- if _node.frame() is frame and _node.fromlineno < lno \
- and not are_exclusive(_node.statement(), defstmt,
- ('AttributeError', 'Exception', 'BaseException')):
- self.add_message('access-member-before-definition',
- node=_node, args=(attr, lno))
-
- def _check_first_arg_for_type(self, node, metaclass=0):
- """check the name of first argument, expect:
-
- * 'self' for a regular method
- * 'cls' for a class method or a metaclass regular method (actually
- valid-classmethod-first-arg value)
- * 'mcs' for a metaclass class method (actually
- valid-metaclass-classmethod-first-arg)
- * not one of the above for a static method
- """
- # don't care about functions with unknown argument (builtins)
- if node.args.args is None:
- return
- first_arg = node.args.args and node.argnames()[0]
- self._first_attrs.append(first_arg)
- first = self._first_attrs[-1]
- # static method
- if node.type == 'staticmethod':
- if (first_arg == 'self' or
- first_arg in self.config.valid_classmethod_first_arg or
- first_arg in self.config.valid_metaclass_classmethod_first_arg):
- self.add_message('bad-staticmethod-argument', args=first, node=node)
- return
- self._first_attrs[-1] = None
- # class / regular method with no args
- elif not node.args.args:
- self.add_message('no-method-argument', node=node)
- # metaclass
- elif metaclass:
- # metaclass __new__ or classmethod
- if node.type == 'classmethod':
- self._check_first_arg_config(
- first,
- self.config.valid_metaclass_classmethod_first_arg, node,
- 'bad-mcs-classmethod-argument', node.name)
- # metaclass regular method
- else:
- self._check_first_arg_config(
- first,
- self.config.valid_classmethod_first_arg, node,
- 'bad-mcs-method-argument',
- node.name)
- # regular class
- else:
- # class method
- if node.type == 'classmethod':
- self._check_first_arg_config(
- first,
- self.config.valid_classmethod_first_arg, node,
- 'bad-classmethod-argument',
- node.name)
- # regular method without self as argument
- elif first != 'self':
- self.add_message('no-self-argument', node=node)
-
- def _check_first_arg_config(self, first, config, node, message,
- method_name):
- if first not in config:
- if len(config) == 1:
- valid = repr(config[0])
- else:
- valid = ', '.join(repr(v) for v in config[:-1])
- valid = '%s or %r' % (valid, config[-1])
- self.add_message(message, args=(method_name, valid), node=node)
-
- def _check_bases_classes(self, node):
- """check that the given class node implements abstract methods from
- base classes
- """
- def is_abstract(method):
- return method.is_abstract(pass_is_abstract=False)
-
- # check if this class abstract
- if class_is_abstract(node):
- return
-
- methods = sorted(
- unimplemented_abstract_methods(node, is_abstract).items(),
- key=lambda item: item[0],
- )
- for name, method in methods:
- owner = method.parent.frame()
- if owner is node:
- continue
- # owner is not this class, it must be a parent class
- # check that the ancestor's method is not abstract
- if name in node.locals:
- # it is redefined as an attribute or with a descriptor
- continue
- self.add_message('abstract-method', node=node,
- args=(name, owner.name))
-
- def _check_interfaces(self, node):
- """check that the given class node really implements declared
- interfaces
- """
- e0221_hack = [False]
- def iface_handler(obj):
- """filter interface objects, it should be classes"""
- if not isinstance(obj, astroid.Class):
- e0221_hack[0] = True
- self.add_message('interface-is-not-class', node=node,
- args=(obj.as_string(),))
- return False
- return True
- ignore_iface_methods = self.config.ignore_iface_methods
- try:
- for iface in node.interfaces(handler_func=iface_handler):
- for imethod in iface.methods():
- name = imethod.name
- if name.startswith('_') or name in ignore_iface_methods:
- # don't check method beginning with an underscore,
- # usually belonging to the interface implementation
- continue
- # get class method astroid
- try:
- method = node_method(node, name)
- except astroid.NotFoundError:
- self.add_message('missing-interface-method',
- args=(name, iface.name),
- node=node)
- continue
- # ignore inherited methods
- if method.parent.frame() is not node:
- continue
- # check signature
- self._check_signature(method, imethod,
- '%s interface' % iface.name)
- except astroid.InferenceError:
- if e0221_hack[0]:
- return
- implements = Instance(node).getattr('__implements__')[0]
- assignment = implements.parent
- assert isinstance(assignment, astroid.Assign)
- # assignment.expr can be a Name or a Tuple or whatever.
- # Use as_string() for the message
- # FIXME: in case of multiple interfaces, find which one could not
- # be resolved
- self.add_message('unresolved-interface', node=implements,
- args=(node.name, assignment.value.as_string()))
-
- def _check_init(self, node):
- """check that the __init__ method call super or ancestors'__init__
- method
- """
- if (not self.linter.is_message_enabled('super-init-not-called') and
- not self.linter.is_message_enabled('non-parent-init-called')):
- return
- klass_node = node.parent.frame()
- to_call = _ancestors_to_call(klass_node)
- not_called_yet = dict(to_call)
- for stmt in node.nodes_of_class(astroid.CallFunc):
- expr = stmt.func
- if not isinstance(expr, astroid.Getattr) \
- or expr.attrname != '__init__':
- continue
- # skip the test if using super
- if isinstance(expr.expr, astroid.CallFunc) and \
- isinstance(expr.expr.func, astroid.Name) and \
- expr.expr.func.name == 'super':
- return
- try:
- klass = next(expr.expr.infer())
- if klass is YES:
- continue
- # The infered klass can be super(), which was
- # assigned to a variable and the `__init__` was called later.
- #
- # base = super()
- # base.__init__(...)
-
- if (isinstance(klass, astroid.Instance) and
- isinstance(klass._proxied, astroid.Class) and
- is_builtin_object(klass._proxied) and
- klass._proxied.name == 'super'):
- return
- try:
- del not_called_yet[klass]
- except KeyError:
- if klass not in to_call:
- self.add_message('non-parent-init-called',
- node=expr, args=klass.name)
- except astroid.InferenceError:
- continue
- for klass, method in six.iteritems(not_called_yet):
- if klass.name == 'object' or method.parent.name == 'object':
- continue
- self.add_message('super-init-not-called', args=klass.name, node=node)
-
- def _check_signature(self, method1, refmethod, class_type):
- """check that the signature of the two given methods match
-
- class_type is in 'class', 'interface'
- """
- if not (isinstance(method1, astroid.Function)
- and isinstance(refmethod, astroid.Function)):
- self.add_message('method-check-failed',
- args=(method1, refmethod), node=method1)
- return
- # don't care about functions with unknown argument (builtins)
- if method1.args.args is None or refmethod.args.args is None:
- return
- # if we use *args, **kwargs, skip the below checks
- if method1.args.vararg or method1.args.kwarg:
- return
- if is_attr_private(method1.name):
- return
- if len(method1.args.args) != len(refmethod.args.args):
- self.add_message('arguments-differ',
- args=(class_type, method1.name),
- node=method1)
- elif len(method1.args.defaults) < len(refmethod.args.defaults):
- self.add_message('signature-differs',
- args=(class_type, method1.name),
- node=method1)
-
- def is_first_attr(self, node):
- """Check that attribute lookup name use first attribute variable name
- (self for method, cls for classmethod and mcs for metaclass).
- """
- return self._first_attrs and isinstance(node.expr, astroid.Name) and \
- node.expr.name == self._first_attrs[-1]
-
-def _ancestors_to_call(klass_node, method='__init__'):
- """return a dictionary where keys are the list of base classes providing
- the queried method, and so that should/may be called from the method node
- """
- to_call = {}
- for base_node in klass_node.ancestors(recurs=False):
- try:
- to_call[base_node] = next(base_node.igetattr(method))
- except astroid.InferenceError:
- continue
- return to_call
-
-
-def node_method(node, method_name):
- """get astroid for <method_name> on the given class node, ensuring it
- is a Function node
- """
- for n in node.local_attr(method_name):
- if isinstance(n, astroid.Function):
- return n
- raise astroid.NotFoundError(method_name)
-
-def register(linter):
- """required method to auto register this checker """
- linter.register_checker(ClassChecker(linter))
diff --git a/chromium/third_party/pylint/pylint/checkers/design_analysis.py b/chromium/third_party/pylint/pylint/checkers/design_analysis.py
deleted file mode 100644
index 0a7a307cfb2..00000000000
--- a/chromium/third_party/pylint/pylint/checkers/design_analysis.py
+++ /dev/null
@@ -1,363 +0,0 @@
-# Copyright (c) 2003-2013 LOGILAB S.A. (Paris, FRANCE).
-# http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# 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 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.
-"""check for signs of poor design"""
-
-import re
-from collections import defaultdict
-
-from astroid import Function, If, InferenceError
-
-from pylint.interfaces import IAstroidChecker
-from pylint.checkers import BaseChecker
-from pylint.checkers.utils import check_messages
-
-# regexp for ignored argument name
-IGNORED_ARGUMENT_NAMES = re.compile('_.*')
-
-
-def class_is_abstract(klass):
- """return true if the given class node should be considered as an abstract
- class
- """
- for attr in klass.values():
- if isinstance(attr, Function):
- if attr.is_abstract(pass_is_abstract=False):
- return True
- return False
-
-
-MSGS = {
- 'R0901': ('Too many ancestors (%s/%s)',
- 'too-many-ancestors',
- 'Used when class has too many parent classes, try to reduce \
- this to get a simpler (and so easier to use) class.'),
- 'R0902': ('Too many instance attributes (%s/%s)',
- 'too-many-instance-attributes',
- 'Used when class has too many instance attributes, try to reduce \
- this to get a simpler (and so easier to use) class.'),
- 'R0903': ('Too few public methods (%s/%s)',
- 'too-few-public-methods',
- 'Used when class has too few public methods, so be sure it\'s \
- really worth it.'),
- 'R0904': ('Too many public methods (%s/%s)',
- 'too-many-public-methods',
- 'Used when class has too many public methods, try to reduce \
- this to get a simpler (and so easier to use) class.'),
-
- 'R0911': ('Too many return statements (%s/%s)',
- 'too-many-return-statements',
- 'Used when a function or method has too many return statement, \
- making it hard to follow.'),
- 'R0912': ('Too many branches (%s/%s)',
- 'too-many-branches',
- 'Used when a function or method has too many branches, \
- making it hard to follow.'),
- 'R0913': ('Too many arguments (%s/%s)',
- 'too-many-arguments',
- 'Used when a function or method takes too many arguments.'),
- 'R0914': ('Too many local variables (%s/%s)',
- 'too-many-locals',
- 'Used when a function or method has too many local variables.'),
- 'R0915': ('Too many statements (%s/%s)',
- 'too-many-statements',
- 'Used when a function or method has too many statements. You \
- should then split it in smaller functions / methods.'),
-
- 'R0921': ('Abstract class not referenced',
- 'abstract-class-not-used',
- 'Used when an abstract class is not used as ancestor anywhere.'),
- 'R0922': ('Abstract class is only referenced %s times',
- 'abstract-class-little-used',
- 'Used when an abstract class is used less than X times as \
- ancestor.'),
- 'R0923': ('Interface not implemented',
- 'interface-not-implemented',
- 'Used when an interface class is not implemented anywhere.'),
- }
-
-
-class MisdesignChecker(BaseChecker):
- """checks for sign of poor/misdesign:
- * number of methods, attributes, local variables...
- * size, complexity of functions, methods
- """
-
- __implements__ = (IAstroidChecker,)
-
- # configuration section name
- name = 'design'
- # messages
- msgs = MSGS
- priority = -2
- # configuration options
- options = (('max-args',
- {'default' : 5, 'type' : 'int', 'metavar' : '<int>',
- 'help': 'Maximum number of arguments for function / method'}
- ),
- ('ignored-argument-names',
- {'default' : IGNORED_ARGUMENT_NAMES,
- 'type' :'regexp', 'metavar' : '<regexp>',
- 'help' : 'Argument names that match this expression will be '
- 'ignored. Default to name with leading underscore'}
- ),
- ('max-locals',
- {'default' : 15, 'type' : 'int', 'metavar' : '<int>',
- 'help': 'Maximum number of locals for function / method body'}
- ),
- ('max-returns',
- {'default' : 6, 'type' : 'int', 'metavar' : '<int>',
- 'help': 'Maximum number of return / yield for function / '
- 'method body'}
- ),
- ('max-branches',
- {'default' : 12, 'type' : 'int', 'metavar' : '<int>',
- 'help': 'Maximum number of branch for function / method body'}
- ),
- ('max-statements',
- {'default' : 50, 'type' : 'int', 'metavar' : '<int>',
- 'help': 'Maximum number of statements in function / method '
- 'body'}
- ),
- ('max-parents',
- {'default' : 7,
- 'type' : 'int',
- 'metavar' : '<num>',
- 'help' : 'Maximum number of parents for a class (see R0901).'}
- ),
- ('max-attributes',
- {'default' : 7,
- 'type' : 'int',
- 'metavar' : '<num>',
- 'help' : 'Maximum number of attributes for a class \
-(see R0902).'}
- ),
- ('min-public-methods',
- {'default' : 2,
- 'type' : 'int',
- 'metavar' : '<num>',
- 'help' : 'Minimum number of public methods for a class \
-(see R0903).'}
- ),
- ('max-public-methods',
- {'default' : 20,
- 'type' : 'int',
- 'metavar' : '<num>',
- 'help' : 'Maximum number of public methods for a class \
-(see R0904).'}
- ),
- )
-
- def __init__(self, linter=None):
- BaseChecker.__init__(self, linter)
- self.stats = None
- self._returns = None
- self._branches = None
- self._used_abstracts = None
- self._used_ifaces = None
- self._abstracts = None
- self._ifaces = None
- self._stmts = 0
-
- def open(self):
- """initialize visit variables"""
- self.stats = self.linter.add_stats()
- self._returns = []
- self._branches = defaultdict(int)
- self._used_abstracts = {}
- self._used_ifaces = {}
- self._abstracts = []
- self._ifaces = []
-
- # Check 'R0921', 'R0922', 'R0923'
- def close(self):
- """check that abstract/interface classes are used"""
- for abstract in self._abstracts:
- if not abstract in self._used_abstracts:
- self.add_message('abstract-class-not-used', node=abstract)
- elif self._used_abstracts[abstract] < 2:
- self.add_message('abstract-class-little-used', node=abstract,
- args=self._used_abstracts[abstract])
- for iface in self._ifaces:
- if not iface in self._used_ifaces:
- self.add_message('interface-not-implemented', node=iface)
-
- @check_messages('too-many-ancestors', 'too-many-instance-attributes',
- 'too-few-public-methods', 'too-many-public-methods',
- 'abstract-class-not-used', 'abstract-class-little-used',
- 'interface-not-implemented')
- def visit_class(self, node):
- """check size of inheritance hierarchy and number of instance attributes
- """
- # Is the total inheritance hierarchy is 7 or less?
- nb_parents = len(list(node.ancestors()))
- if nb_parents > self.config.max_parents:
- self.add_message('too-many-ancestors', node=node,
- args=(nb_parents, self.config.max_parents))
- # Does the class contain less than 20 attributes for
- # non-GUI classes (40 for GUI)?
- # FIXME detect gui classes
- if len(node.instance_attrs) > self.config.max_attributes:
- self.add_message('too-many-instance-attributes', node=node,
- args=(len(node.instance_attrs),
- self.config.max_attributes))
- # update abstract / interface classes structures
- if class_is_abstract(node):
- self._abstracts.append(node)
- elif node.type == 'interface' and node.name != 'Interface':
- self._ifaces.append(node)
- for parent in node.ancestors(False):
- if parent.name == 'Interface':
- continue
- self._used_ifaces[parent] = 1
- try:
- for iface in node.interfaces():
- self._used_ifaces[iface] = 1
- except InferenceError:
- # XXX log ?
- pass
- for parent in node.ancestors():
- try:
- self._used_abstracts[parent] += 1
- except KeyError:
- self._used_abstracts[parent] = 1
-
- @check_messages('too-many-ancestors', 'too-many-instance-attributes',
- 'too-few-public-methods', 'too-many-public-methods',
- 'abstract-class-not-used', 'abstract-class-little-used',
- 'interface-not-implemented')
- def leave_class(self, node):
- """check number of public methods"""
- nb_public_methods = 0
- for method in node.mymethods():
- if not method.name.startswith('_'):
- nb_public_methods += 1
- # Does the class contain less than 20 public methods ?
- if nb_public_methods > self.config.max_public_methods:
- self.add_message('too-many-public-methods', node=node,
- args=(nb_public_methods,
- self.config.max_public_methods))
- # stop here for exception, metaclass and interface classes
- if node.type != 'class':
- return
- # Does the class contain more than 5 public methods ?
- if nb_public_methods < self.config.min_public_methods:
- self.add_message('too-few-public-methods', node=node,
- args=(nb_public_methods,
- self.config.min_public_methods))
-
- @check_messages('too-many-return-statements', 'too-many-branches',
- 'too-many-arguments', 'too-many-locals',
- 'too-many-statements')
- def visit_function(self, node):
- """check function name, docstring, arguments, redefinition,
- variable names, max locals
- """
- # init branch and returns counters
- self._returns.append(0)
- # check number of arguments
- args = node.args.args
- if args is not None:
- ignored_args_num = len(
- [arg for arg in args
- if self.config.ignored_argument_names.match(arg.name)])
- argnum = len(args) - ignored_args_num
- if argnum > self.config.max_args:
- self.add_message('too-many-arguments', node=node,
- args=(len(args), self.config.max_args))
- else:
- ignored_args_num = 0
- # check number of local variables
- locnum = len(node.locals) - ignored_args_num
- if locnum > self.config.max_locals:
- self.add_message('too-many-locals', node=node,
- args=(locnum, self.config.max_locals))
- # init statements counter
- self._stmts = 1
-
- @check_messages('too-many-return-statements', 'too-many-branches',
- 'too-many-arguments', 'too-many-locals',
- 'too-many-statements')
- def leave_function(self, node):
- """most of the work is done here on close:
- checks for max returns, branch, return in __init__
- """
- returns = self._returns.pop()
- if returns > self.config.max_returns:
- self.add_message('too-many-return-statements', node=node,
- args=(returns, self.config.max_returns))
- branches = self._branches[node]
- if branches > self.config.max_branches:
- self.add_message('too-many-branches', node=node,
- args=(branches, self.config.max_branches))
- # check number of statements
- if self._stmts > self.config.max_statements:
- self.add_message('too-many-statements', node=node,
- args=(self._stmts, self.config.max_statements))
-
- def visit_return(self, _):
- """count number of returns"""
- if not self._returns:
- return # return outside function, reported by the base checker
- self._returns[-1] += 1
-
- def visit_default(self, node):
- """default visit method -> increments the statements counter if
- necessary
- """
- if node.is_statement:
- self._stmts += 1
-
- def visit_tryexcept(self, node):
- """increments the branches counter"""
- branches = len(node.handlers)
- if node.orelse:
- branches += 1
- self._inc_branch(node, branches)
- self._stmts += branches
-
- def visit_tryfinally(self, node):
- """increments the branches counter"""
- self._inc_branch(node, 2)
- self._stmts += 2
-
- def visit_if(self, node):
- """increments the branches counter"""
- branches = 1
- # don't double count If nodes coming from some 'elif'
- if node.orelse and (len(node.orelse) > 1 or
- not isinstance(node.orelse[0], If)):
- branches += 1
- self._inc_branch(node, branches)
- self._stmts += branches
-
- def visit_while(self, node):
- """increments the branches counter"""
- branches = 1
- if node.orelse:
- branches += 1
- self._inc_branch(node, branches)
-
- visit_for = visit_while
-
- def _inc_branch(self, node, branchesnum=1):
- """increments the branches counter"""
- self._branches[node.scope()] += branchesnum
-
- # FIXME: make a nice report...
-
-def register(linter):
- """required method to auto register this checker """
- linter.register_checker(MisdesignChecker(linter))
diff --git a/chromium/third_party/pylint/pylint/checkers/exceptions.py b/chromium/third_party/pylint/pylint/checkers/exceptions.py
deleted file mode 100644
index 88a8f225e2e..00000000000
--- a/chromium/third_party/pylint/pylint/checkers/exceptions.py
+++ /dev/null
@@ -1,332 +0,0 @@
-# Copyright (c) 2003-2013 LOGILAB S.A. (Paris, FRANCE).
-# http://www.logilab.fr/ -- mailto:contact@logilab.fr
-# 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 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.
-"""exceptions handling (raising, catching, exceptions classes) checker
-"""
-import sys
-
-import astroid
-from astroid import YES, Instance, unpack_infer, List, Tuple
-from logilab.common.compat import builtins
-
-from pylint.checkers import BaseChecker
-from pylint.checkers.utils import (
- is_empty,
- is_raising,
- check_messages,
- inherit_from_std_ex,
- EXCEPTIONS_MODULE,
- has_known_bases,
- safe_infer)
-from pylint.interfaces import IAstroidChecker, INFERENCE, INFERENCE_FAILURE
-
-
-def _annotated_unpack_infer(stmt, context=None):
- """
- Recursively generate nodes inferred by the given statement.
- If the inferred value is a list or a tuple, recurse on the elements.
- Returns an iterator which yields tuples in the format
- ('original node', 'infered node').
- """
- if isinstance(stmt, (List, Tuple)):
- for elt in stmt.elts:
- inferred = safe_infer(elt)
- if inferred and inferred is not YES:
- yield elt, inferred
- return
- for infered in stmt.infer(context):
- if infered is YES:
- continue
- yield stmt, infered
-
-
-PY3K = sys.version_info >= (3, 0)
-OVERGENERAL_EXCEPTIONS = ('Exception',)
-BUILTINS_NAME = builtins.__name__
-MSGS = {
- 'E0701': ('Bad except clauses order (%s)',
- 'bad-except-order',
- 'Used when except clauses are not in the correct order (from the '
- 'more specific to the more generic). If you don\'t fix the order, '
- 'some exceptions may not be catched by the most specific handler.'),
- 'E0702': ('Raising %s while only classes or instances are allowed',
- 'raising-bad-type',
- 'Used when something which is neither a class, an instance or a \
- string is raised (i.e. a `TypeError` will be raised).'),
- 'E0703': ('Exception context set to something which is not an '
- 'exception, nor None',
- 'bad-exception-context',
- 'Used when using the syntax "raise ... from ...", '
- 'where the exception context is not an exception, '
- 'nor None.',
- {'minversion': (3, 0)}),
- 'E0710': ('Raising a new style class which doesn\'t inherit from BaseException',
- 'raising-non-exception',
- 'Used when a new style class which doesn\'t inherit from \
- BaseException is raised.'),
- 'E0711': ('NotImplemented raised - should raise NotImplementedError',
- 'notimplemented-raised',
- 'Used when NotImplemented is raised instead of \
- NotImplementedError'),
- 'E0712': ('Catching an exception which doesn\'t inherit from BaseException: %s',
- 'catching-non-exception',
- 'Used when a class which doesn\'t inherit from \
- BaseException is used as an exception in an except clause.'),
- 'W0702': ('No exception type(s) specified',
- 'bare-except',
- 'Used when an except clause doesn\'t specify exceptions type to \
- catch.'),
- 'W0703': ('Catching too general exception %s',
- 'broad-except',
- 'Used when an except catches a too general exception, \
- possibly burying unrelated errors.'),
- 'W0704': ('Except doesn\'t do anything',
- 'pointless-except',
- 'Used when an except clause does nothing but "pass" and there is\
- no "else" clause.'),
- 'W0710': ('Exception doesn\'t inherit from standard "Exception" class',
- 'nonstandard-exception',
- 'Used when a custom exception class is raised but doesn\'t \
- inherit from the builtin "Exception" class.',
- {'maxversion': (3, 0)}),
- 'W0711': ('Exception to catch is the result of a binary "%s" operation',
- 'binary-op-exception',
- 'Used when the exception to catch is of the form \
- "except A or B:". If intending to catch multiple, \
- rewrite as "except (A, B):"'),
- }
-
-
-class ExceptionsChecker(BaseChecker):
- """checks for
- * excepts without exception filter
- * type of raise argument : string, Exceptions, other values
- """
-
- __implements__ = IAstroidChecker
-
- name = 'exceptions'
- msgs = MSGS
- priority = -4
- options = (('overgeneral-exceptions',
- {'default' : OVERGENERAL_EXCEPTIONS,
- 'type' :'csv', 'metavar' : '<comma-separated class names>',
- 'help' : 'Exceptions that will emit a warning '
- 'when being caught. Defaults to "%s"' % (
- ', '.join(OVERGENERAL_EXCEPTIONS),)}
- ),
- )
-
- @check_messages('nonstandard-exception',
- 'raising-bad-type', 'raising-non-exception',
- 'notimplemented-raised', 'bad-exception-context')
- def visit_raise(self, node):
- """visit raise possibly inferring value"""
- # ignore empty raise
- if node.exc is None:
- return
- if PY3K and node.cause:
- self._check_bad_exception_context(node)
-
- expr = node.exc
- if self._check_raise_value(node, expr):
- return
- else:
- try:
- value = next(unpack_infer(expr))
- except astroid.InferenceError:
- return
- self._check_raise_value(node, value)
-
- def _check_bad_exception_context(self, node):
- """Verify that the exception context is properly set.
-
- An exception context can be only `None` or an exception.
- """
- cause = safe_infer(node.cause)
- if cause in (YES, None):
- return
- if isinstance(cause, astroid.Const):
- if cause.value is not None:
- self.add_message('bad-exception-context',
- node=node)
- elif (not isinstance(cause, astroid.Class) and
- not inherit_from_std_ex(cause)):
- self.add_message('bad-exception-context',
- node=node)
-
- def _check_raise_value(self, node, expr):
- """check for bad values, string exception and class inheritance
- """
- value_found = True
- if isinstance(expr, astroid.Const):
- value = expr.value
- if not isinstance(value, str):
- # raising-string will be emitted from python3 porting checker.
- self.add_message('raising-bad-type', node=node,
- args=value.__class__.__name__)
- elif ((isinstance(expr, astroid.Name) and
- expr.name in ('None', 'True', 'False')) or
- isinstance(expr, (astroid.List, astroid.Dict, astroid.Tuple,
- astroid.Module, astroid.Function))):
- emit = True
- if not PY3K and isinstance(expr, astroid.Tuple):
- # On Python 2, using the following is not an error:
- # raise (ZeroDivisionError, None)
- # raise (ZeroDivisionError, )
- # What's left to do is to check that the first
- # argument is indeed an exception.
- # Verifying the other arguments is not
- # the scope of this check.
- first = expr.elts[0]
- inferred = safe_infer(first)
- if isinstance(inferred, Instance):
- # pylint: disable=protected-access
- inferred = inferred._proxied
- if (inferred is YES or
- isinstance(inferred, astroid.Class)
- and inherit_from_std_ex(inferred)):
- emit = False
- if emit:
- self.add_message('raising-bad-type',
- node=node,
- args=expr.name)
- elif ((isinstance(expr, astroid.Name) and expr.name == 'NotImplemented')
- or (isinstance(expr, astroid.CallFunc) and
- isinstance(expr.func, astroid.Name) and
- expr.func.name == 'NotImplemented')):
- self.add_message('notimplemented-raised', node=node)
- elif isinstance(expr, (Instance, astroid.Class)):
- if isinstance(expr, Instance):
- # pylint: disable=protected-access
- expr = expr._proxied
- if (isinstance(expr, astroid.Class) and
- not inherit_from_std_ex(expr)):
- if expr.newstyle:
- self.add_message('raising-non-exception', node=node)
- else:
- if has_known_bases(expr):
- confidence = INFERENCE
- else:
- confidence = INFERENCE_FAILURE
- self.add_message(
- 'nonstandard-exception', node=node,
- confidence=confidence)
- else:
- value_found = False
- else:
- value_found = False
- return value_found
-
- def _check_catching_non_exception(self, handler, exc, part):
- if isinstance(exc, astroid.Tuple):
- # Check if it is a tuple of exceptions.
- inferred = [safe_infer(elt) for elt in exc.elts]
- if any(node is astroid.YES for node in inferred):
- # Don't emit if we don't know every component.
- return
- if all(node and inherit_from_std_ex(node)
- for node in inferred):
- return
-
- if not isinstance(exc, astroid.Class):
- # Don't emit the warning if the infered stmt
- # is None, but the exception handler is something else,
- # maybe it was redefined.
- if (isinstance(exc, astroid.Const) and
- exc.value is None):
- if ((isinstance(handler.type, astroid.Const) and
- handler.type.value is None) or
- handler.type.parent_of(exc)):
- # If the exception handler catches None or
- # the exception component, which is None, is
- # defined by the entire exception handler, then
- # emit a warning.
- self.add_message('catching-non-exception',
- node=handler.type,
- args=(part.as_string(), ))
- else:
- self.add_message('catching-non-exception',
- node=handler.type,
- args=(part.as_string(), ))
- return
- if (not inherit_from_std_ex(exc) and
- exc.root().name != BUILTINS_NAME):
- if has_known_bases(exc):
- self.add_message('catching-non-exception',
- node=handler.type,
- args=(exc.name, ))
-
- @check_messages('bare-except', 'broad-except', 'pointless-except',
- 'binary-op-exception', 'bad-except-order',
- 'catching-non-exception')
- def visit_tryexcept(self, node):
- """check for empty except"""
- exceptions_classes = []
- nb_handlers = len(node.handlers)
- for index, handler in enumerate(node.handlers):
- # single except doing nothing but "pass" without else clause
- if is_empty(handler.body) and not node.orelse:
- self.add_message('pointless-except',
- node=handler.type or handler.body[0])
- if handler.type is None:
- if not is_raising(handler.body):
- self.add_message('bare-except', node=handler)
- # check if a "except:" is followed by some other
- # except
- if index < (nb_handlers - 1):
- msg = 'empty except clause should always appear last'
- self.add_message('bad-except-order', node=node, args=msg)
-
- elif isinstance(handler.type, astroid.BoolOp):
- self.add_message('binary-op-exception',
- node=handler, args=handler.type.op)
- else:
- try:
- excs = list(_annotated_unpack_infer(handler.type))
- except astroid.InferenceError:
- continue
- for part, exc in excs:
- if exc is YES:
- continue
- if (isinstance(exc, astroid.Instance)
- and inherit_from_std_ex(exc)):
- # pylint: disable=protected-access
- exc = exc._proxied
-
- self._check_catching_non_exception(handler, exc, part)
-
- if not isinstance(exc, astroid.Class):
- continue
-
- exc_ancestors = [anc for anc in exc.ancestors()
- if isinstance(anc, astroid.Class)]
- for previous_exc in exceptions_classes:
- if previous_exc in exc_ancestors:
- msg = '%s is an ancestor class of %s' % (
- previous_exc.name, exc.name)
- self.add_message('bad-except-order',
- node=handler.type, args=msg)
- if (exc.name in self.config.overgeneral_exceptions
- and exc.root().name == EXCEPTIONS_MODULE
- and not is_raising(handler.body)):
- self.add_message('broad-except',
- args=exc.name, node=handler.type)
-
- exceptions_classes += [exc for _, exc in excs]
-
-
-def register(linter):
- """required method to auto register this checker"""
- linter.register_checker(ExceptionsChecker(linter))
diff --git a/chromium/third_party/pylint/pylint/checkers/format.py b/chromium/third_party/pylint/pylint/checkers/format.py
deleted file mode 100644
index 94a9e8eb8d0..00000000000
--- a/chromium/third_party/pylint/pylint/checkers/format.py
+++ /dev/null
@@ -1,964 +0,0 @@
-# Copyright (c) 2003-2013 LOGILAB S.A. (Paris, FRANCE).
-#
-# 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 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.
-"""Python code format's checker.
-
-By default try to follow Guido's style guide :
-
-http://www.python.org/doc/essays/styleguide.html
-
-Some parts of the process_token method is based from The Tab Nanny std module.
-"""
-
-import keyword
-import sys
-import tokenize
-from functools import reduce # pylint: disable=redefined-builtin
-
-import six
-from six.moves import zip, map, filter # pylint: disable=redefined-builtin
-
-from astroid import nodes
-
-from pylint.interfaces import ITokenChecker, IAstroidChecker, IRawChecker
-from pylint.checkers import BaseTokenChecker
-from pylint.checkers.utils import check_messages
-from pylint.utils import WarningScope, OPTION_RGX
-
-_CONTINUATION_BLOCK_OPENERS = ['elif', 'except', 'for', 'if', 'while', 'def', 'class']
-_KEYWORD_TOKENS = ['assert', 'del', 'elif', 'except', 'for', 'if', 'in', 'not',
- 'raise', 'return', 'while', 'yield']
-if sys.version_info < (3, 0):
- _KEYWORD_TOKENS.append('print')
-
-_SPACED_OPERATORS = ['==', '<', '>', '!=', '<>', '<=', '>=',
- '+=', '-=', '*=', '**=', '/=', '//=', '&=', '|=', '^=',
- '%=', '>>=', '<<=']
-_OPENING_BRACKETS = ['(', '[', '{']
-_CLOSING_BRACKETS = [')', ']', '}']
-_TAB_LENGTH = 8
-
-_EOL = frozenset([tokenize.NEWLINE, tokenize.NL, tokenize.COMMENT])
-_JUNK_TOKENS = (tokenize.COMMENT, tokenize.NL)
-
-# Whitespace checking policy constants
-_MUST = 0
-_MUST_NOT = 1
-_IGNORE = 2
-
-# Whitespace checking config constants
-_DICT_SEPARATOR = 'dict-separator'
-_TRAILING_COMMA = 'trailing-comma'
-_NO_SPACE_CHECK_CHOICES = [_TRAILING_COMMA, _DICT_SEPARATOR]
-
-MSGS = {
- 'C0301': ('Line too long (%s/%s)',
- 'line-too-long',
- 'Used when a line is longer than a given number of characters.'),
- 'C0302': ('Too many lines in module (%s/%s)', # was W0302
- 'too-many-lines',
- 'Used when a module has too much lines, reducing its readability.'
- ),
- 'C0303': ('Trailing whitespace',
- 'trailing-whitespace',
- 'Used when there is whitespace between the end of a line and the '
- 'newline.'),
- 'C0304': ('Final newline missing',
- 'missing-final-newline',
- 'Used when the last line in a file is missing a newline.'),
- 'W0311': ('Bad indentation. Found %s %s, expected %s',
- 'bad-indentation',
- 'Used when an unexpected number of indentation\'s tabulations or '
- 'spaces has been found.'),
- 'C0330': ('Wrong %s indentation%s.\n%s%s',
- 'bad-continuation',
- 'TODO'),
- 'W0312': ('Found indentation with %ss instead of %ss',
- 'mixed-indentation',
- 'Used when there are some mixed tabs and spaces in a module.'),
- 'W0301': ('Unnecessary semicolon', # was W0106
- 'unnecessary-semicolon',
- 'Used when a statement is ended by a semi-colon (";"), which \
- isn\'t necessary (that\'s python, not C ;).'),
- 'C0321': ('More than one statement on a single line',
- 'multiple-statements',
- 'Used when more than on statement are found on the same line.',
- {'scope': WarningScope.NODE}),
- 'C0325' : ('Unnecessary parens after %r keyword',
- 'superfluous-parens',
- 'Used when a single item in parentheses follows an if, for, or '
- 'other keyword.'),
- 'C0326': ('%s space %s %s %s\n%s',
- 'bad-whitespace',
- ('Used when a wrong number of spaces is used around an operator, '
- 'bracket or block opener.'),
- {'old_names': [('C0323', 'no-space-after-operator'),
- ('C0324', 'no-space-after-comma'),
- ('C0322', 'no-space-before-operator')]}),
- 'W0332': ('Use of "l" as long integer identifier',
- 'lowercase-l-suffix',
- 'Used when a lower case "l" is used to mark a long integer. You '
- 'should use a upper case "L" since the letter "l" looks too much '
- 'like the digit "1"',
- {'maxversion': (3, 0)}),
- 'C0327': ('Mixed line endings LF and CRLF',
- 'mixed-line-endings',
- 'Used when there are mixed (LF and CRLF) newline signs in a file.'),
- 'C0328': ('Unexpected line ending format. There is \'%s\' while it should be \'%s\'.',
- 'unexpected-line-ending-format',
- 'Used when there is different newline than expected.'),
- }
-
-
-def _underline_token(token):
- length = token[3][1] - token[2][1]
- offset = token[2][1]
- return token[4] + (' ' * offset) + ('^' * length)
-
-
-def _column_distance(token1, token2):
- if token1 == token2:
- return 0
- if token2[3] < token1[3]:
- token1, token2 = token2, token1
- if token1[3][0] != token2[2][0]:
- return None
- return token2[2][1] - token1[3][1]
-
-
-def _last_token_on_line_is(tokens, line_end, token):
- return (line_end > 0 and tokens.token(line_end-1) == token or
- line_end > 1 and tokens.token(line_end-2) == token
- and tokens.type(line_end-1) == tokenize.COMMENT)
-
-
-def _token_followed_by_eol(tokens, position):
- return (tokens.type(position+1) == tokenize.NL or
- tokens.type(position+1) == tokenize.COMMENT and
- tokens.type(position+2) == tokenize.NL)
-
-
-def _get_indent_length(line):
- """Return the length of the indentation on the given token's line."""
- result = 0
- for char in line:
- if char == ' ':
- result += 1
- elif char == '\t':
- result += _TAB_LENGTH
- else:
- break
- return result
-
-
-def _get_indent_hint_line(bar_positions, bad_position):
- """Return a line with |s for each of the positions in the given lists."""
- if not bar_positions:
- return ''
- markers = [(pos, '|') for pos in bar_positions]
- markers.append((bad_position, '^'))
- markers.sort()
- line = [' '] * (markers[-1][0] + 1)
- for position, marker in markers:
- line[position] = marker
- return ''.join(line)
-
-
-class _ContinuedIndent(object):
- __slots__ = ('valid_outdent_offsets',
- 'valid_continuation_offsets',
- 'context_type',
- 'token',
- 'position')
-
- def __init__(self,
- context_type,
- token,
- position,
- valid_outdent_offsets,
- valid_continuation_offsets):
- self.valid_outdent_offsets = valid_outdent_offsets
- self.valid_continuation_offsets = valid_continuation_offsets
- self.context_type = context_type
- self.position = position
- self.token = token
-
-
-# The contexts for hanging indents.
-# A hanging indented dictionary value after :
-HANGING_DICT_VALUE = 'dict-value'
-# Hanging indentation in an expression.
-HANGING = 'hanging'
-# Hanging indentation in a block header.
-HANGING_BLOCK = 'hanging-block'
-# Continued indentation inside an expression.
-CONTINUED = 'continued'
-# Continued indentation in a block header.
-CONTINUED_BLOCK = 'continued-block'
-
-SINGLE_LINE = 'single'
-WITH_BODY = 'multi'
-
-_CONTINUATION_MSG_PARTS = {
- HANGING_DICT_VALUE: ('hanging', ' in dict value'),
- HANGING: ('hanging', ''),
- HANGING_BLOCK: ('hanging', ' before block'),
- CONTINUED: ('continued', ''),
- CONTINUED_BLOCK: ('continued', ' before block'),
-}
-
-
-def _Offsets(*args):
- """Valid indentation offsets for a continued line."""
- return dict((a, None) for a in args)
-
-
-def _BeforeBlockOffsets(single, with_body):
- """Valid alternative indent offsets for continued lines before blocks.
-
- :param single: Valid offset for statements on a single logical line.
- :param with_body: Valid offset for statements on several lines.
- """
- return {single: SINGLE_LINE, with_body: WITH_BODY}
-
-
-class TokenWrapper(object):
- """A wrapper for readable access to token information."""
-
- def __init__(self, tokens):
- self._tokens = tokens
-
- def token(self, idx):
- return self._tokens[idx][1]
-
- def type(self, idx):
- return self._tokens[idx][0]
-
- def start_line(self, idx):
- return self._tokens[idx][2][0]
-
- def start_col(self, idx):
- return self._tokens[idx][2][1]
-
- def line(self, idx):
- return self._tokens[idx][4]
-
-
-class ContinuedLineState(object):
- """Tracker for continued indentation inside a logical line."""
-
- def __init__(self, tokens, config):
- self._line_start = -1
- self._cont_stack = []
- self._is_block_opener = False
- self.retained_warnings = []
- self._config = config
- self._tokens = TokenWrapper(tokens)
-
- @property
- def has_content(self):
- return bool(self._cont_stack)
-
- @property
- def _block_indent_size(self):
- return len(self._config.indent_string.replace('\t', ' ' * _TAB_LENGTH))
-
- @property
- def _continuation_size(self):
- return self._config.indent_after_paren
-
- def handle_line_start(self, pos):
- """Record the first non-junk token at the start of a line."""
- if self._line_start > -1:
- return
- self._is_block_opener = self._tokens.token(pos) in _CONTINUATION_BLOCK_OPENERS
- self._line_start = pos
-
- def next_physical_line(self):
- """Prepares the tracker for a new physical line (NL)."""
- self._line_start = -1
- self._is_block_opener = False
-
- def next_logical_line(self):
- """Prepares the tracker for a new logical line (NEWLINE).
-
- A new logical line only starts with block indentation.
- """
- self.next_physical_line()
- self.retained_warnings = []
- self._cont_stack = []
-
- def add_block_warning(self, token_position, state, valid_offsets):
- self.retained_warnings.append((token_position, state, valid_offsets))
-
- def get_valid_offsets(self, idx):
- """"Returns the valid offsets for the token at the given position."""
- # The closing brace on a dict or the 'for' in a dict comprehension may
- # reset two indent levels because the dict value is ended implicitly
- stack_top = -1
- if self._tokens.token(idx) in ('}', 'for') and self._cont_stack[-1].token == ':':
- stack_top = -2
- indent = self._cont_stack[stack_top]
- if self._tokens.token(idx) in _CLOSING_BRACKETS:
- valid_offsets = indent.valid_outdent_offsets
- else:
- valid_offsets = indent.valid_continuation_offsets
- return indent, valid_offsets.copy()
-
- def _hanging_indent_after_bracket(self, bracket, position):
- """Extracts indentation information for a hanging indent."""
- indentation = _get_indent_length(self._tokens.line(position))
- if self._is_block_opener and self._continuation_size == self._block_indent_size:
- return _ContinuedIndent(
- HANGING_BLOCK,
- bracket,
- position,
- _Offsets(indentation + self._continuation_size, indentation),
- _BeforeBlockOffsets(indentation + self._continuation_size,
- indentation + self._continuation_size * 2))
- elif bracket == ':':
- # If the dict key was on the same line as the open brace, the new
- # correct indent should be relative to the key instead of the
- # current indent level
- paren_align = self._cont_stack[-1].valid_outdent_offsets
- next_align = self._cont_stack[-1].valid_continuation_offsets.copy()
- next_align_keys = list(next_align.keys())
- next_align[next_align_keys[0] + self._continuation_size] = True
- # Note that the continuation of
- # d = {
- # 'a': 'b'
- # 'c'
- # }
- # is handled by the special-casing for hanging continued string indents.
- return _ContinuedIndent(HANGING_DICT_VALUE, bracket, position, paren_align, next_align)
- else:
- return _ContinuedIndent(
- HANGING,
- bracket,
- position,
- _Offsets(indentation, indentation + self._continuation_size),
- _Offsets(indentation + self._continuation_size))
-
- def _continuation_inside_bracket(self, bracket, pos):
- """Extracts indentation information for a continued indent."""
- indentation = _get_indent_length(self._tokens.line(pos))
- if self._is_block_opener and self._tokens.start_col(pos+1) - indentation == self._block_indent_size:
- return _ContinuedIndent(
- CONTINUED_BLOCK,
- bracket,
- pos,
- _Offsets(self._tokens.start_col(pos)),
- _BeforeBlockOffsets(self._tokens.start_col(pos+1),
- self._tokens.start_col(pos+1) + self._continuation_size))
- else:
- return _ContinuedIndent(
- CONTINUED,
- bracket,
- pos,
- _Offsets(self._tokens.start_col(pos)),
- _Offsets(self._tokens.start_col(pos+1)))
-
- def pop_token(self):
- self._cont_stack.pop()
-
- def push_token(self, token, position):
- """Pushes a new token for continued indentation on the stack.
-
- Tokens that can modify continued indentation offsets are:
- * opening brackets
- * 'lambda'
- * : inside dictionaries
-
- push_token relies on the caller to filter out those
- interesting tokens.
-
- :param token: The concrete token
- :param position: The position of the token in the stream.
- """
- if _token_followed_by_eol(self._tokens, position):
- self._cont_stack.append(
- self._hanging_indent_after_bracket(token, position))
- else:
- self._cont_stack.append(
- self._continuation_inside_bracket(token, position))
-
-
-class FormatChecker(BaseTokenChecker):
- """checks for :
- * unauthorized constructions
- * strict indentation
- * line length
- """
-
- __implements__ = (ITokenChecker, IAstroidChecker, IRawChecker)
-
- # configuration section name
- name = 'format'
- # messages
- msgs = MSGS
- # configuration options
- # for available dict keys/values see the optik parser 'add_option' method
- options = (('max-line-length',
- {'default' : 100, 'type' : "int", 'metavar' : '<int>',
- 'help' : 'Maximum number of characters on a single line.'}),
- ('ignore-long-lines',
- {'type': 'regexp', 'metavar': '<regexp>',
- 'default': r'^\s*(# )?<?https?://\S+>?$',
- 'help': ('Regexp for a line that is allowed to be longer than '
- 'the limit.')}),
- ('single-line-if-stmt',
- {'default': False, 'type' : 'yn', 'metavar' : '<y_or_n>',
- 'help' : ('Allow the body of an if to be on the same '
- 'line as the test if there is no else.')}),
- ('no-space-check',
- {'default': ','.join(_NO_SPACE_CHECK_CHOICES),
- 'type': 'multiple_choice',
- 'choices': _NO_SPACE_CHECK_CHOICES,
- 'help': ('List of optional constructs for which whitespace '
- 'checking is disabled')}),
- ('max-module-lines',
- {'default' : 1000, 'type' : 'int', 'metavar' : '<int>',
- 'help': 'Maximum number of lines in a module'}
- ),
- ('indent-string',
- {'default' : ' ', 'type' : "string", 'metavar' : '<string>',
- 'help' : 'String used as indentation unit. This is usually '
- '" " (4 spaces) or "\\t" (1 tab).'}),
- ('indent-after-paren',
- {'type': 'int', 'metavar': '<int>', 'default': 4,
- 'help': 'Number of spaces of indent required inside a hanging '
- ' or continued line.'}),
- ('expected-line-ending-format',
- {'type': 'choice', 'metavar': '<empty or LF or CRLF>', 'default': '',
- 'choices': ['', 'LF', 'CRLF'],
- 'help': 'Expected format of line ending, e.g. empty (any line ending), LF or CRLF.'}),
- )
-
- def __init__(self, linter=None):
- BaseTokenChecker.__init__(self, linter)
- self._lines = None
- self._visited_lines = None
- self._bracket_stack = [None]
-
- def _pop_token(self):
- self._bracket_stack.pop()
- self._current_line.pop_token()
-
- def _push_token(self, token, idx):
- self._bracket_stack.append(token)
- self._current_line.push_token(token, idx)
-
- def new_line(self, tokens, line_end, line_start):
- """a new line has been encountered, process it if necessary"""
- if _last_token_on_line_is(tokens, line_end, ';'):
- self.add_message('unnecessary-semicolon', line=tokens.start_line(line_end))
-
- line_num = tokens.start_line(line_start)
- line = tokens.line(line_start)
- if tokens.type(line_start) not in _JUNK_TOKENS:
- self._lines[line_num] = line.split('\n')[0]
- self.check_lines(line, line_num)
-
- def process_module(self, module):
- self._keywords_with_parens = set()
- if 'print_function' in module.future_imports:
- self._keywords_with_parens.add('print')
-
- def _check_keyword_parentheses(self, tokens, start):
- """Check that there are not unnecessary parens after a keyword.
-
- Parens are unnecessary if there is exactly one balanced outer pair on a
- line, and it is followed by a colon, and contains no commas (i.e. is not a
- tuple).
-
- Args:
- tokens: list of Tokens; the entire list of Tokens.
- start: int; the position of the keyword in the token list.
- """
- # If the next token is not a paren, we're fine.
- if self._inside_brackets(':') and tokens[start][1] == 'for':
- self._pop_token()
- if tokens[start+1][1] != '(':
- return
-
- found_and_or = False
- depth = 0
- keyword_token = tokens[start][1]
- line_num = tokens[start][2][0]
-
- for i in range(start, len(tokens) - 1):
- token = tokens[i]
-
- # If we hit a newline, then assume any parens were for continuation.
- if token[0] == tokenize.NL:
- return
-
- if token[1] == '(':
- depth += 1
- elif token[1] == ')':
- depth -= 1
- if not depth:
- # ')' can't happen after if (foo), since it would be a syntax error.
- if (tokens[i+1][1] in (':', ')', ']', '}', 'in') or
- tokens[i+1][0] in (tokenize.NEWLINE,
- tokenize.ENDMARKER,
- tokenize.COMMENT)):
- # The empty tuple () is always accepted.
- if i == start + 2:
- return
- if keyword_token == 'not':
- if not found_and_or:
- self.add_message('superfluous-parens', line=line_num,
- args=keyword_token)
- elif keyword_token in ('return', 'yield'):
- self.add_message('superfluous-parens', line=line_num,
- args=keyword_token)
- elif keyword_token not in self._keywords_with_parens:
- if not (tokens[i+1][1] == 'in' and found_and_or):
- self.add_message('superfluous-parens', line=line_num,
- args=keyword_token)
- return
- elif depth == 1:
- # This is a tuple, which is always acceptable.
- if token[1] == ',':
- return
- # 'and' and 'or' are the only boolean operators with lower precedence
- # than 'not', so parens are only required when they are found.
- elif token[1] in ('and', 'or'):
- found_and_or = True
- # A yield inside an expression must always be in parentheses,
- # quit early without error.
- elif token[1] == 'yield':
- return
- # A generator expression always has a 'for' token in it, and
- # the 'for' token is only legal inside parens when it is in a
- # generator expression. The parens are necessary here, so bail
- # without an error.
- elif token[1] == 'for':
- return
-
- def _opening_bracket(self, tokens, i):
- self._push_token(tokens[i][1], i)
- # Special case: ignore slices
- if tokens[i][1] == '[' and tokens[i+1][1] == ':':
- return
-
- if (i > 0 and (tokens[i-1][0] == tokenize.NAME and
- not (keyword.iskeyword(tokens[i-1][1]))
- or tokens[i-1][1] in _CLOSING_BRACKETS)):
- self._check_space(tokens, i, (_MUST_NOT, _MUST_NOT))
- else:
- self._check_space(tokens, i, (_IGNORE, _MUST_NOT))
-
- def _closing_bracket(self, tokens, i):
- if self._inside_brackets(':'):
- self._pop_token()
- self._pop_token()
- # Special case: ignore slices
- if tokens[i-1][1] == ':' and tokens[i][1] == ']':
- return
- policy_before = _MUST_NOT
- if tokens[i][1] in _CLOSING_BRACKETS and tokens[i-1][1] == ',':
- if _TRAILING_COMMA in self.config.no_space_check:
- policy_before = _IGNORE
-
- self._check_space(tokens, i, (policy_before, _IGNORE))
-
- def _check_equals_spacing(self, tokens, i):
- """Check the spacing of a single equals sign."""
- if self._inside_brackets('(') or self._inside_brackets('lambda'):
- self._check_space(tokens, i, (_MUST_NOT, _MUST_NOT))
- else:
- self._check_space(tokens, i, (_MUST, _MUST))
-
- def _open_lambda(self, tokens, i): # pylint:disable=unused-argument
- self._push_token('lambda', i)
-
- def _handle_colon(self, tokens, i):
- # Special case: ignore slices
- if self._inside_brackets('['):
- return
- if (self._inside_brackets('{') and
- _DICT_SEPARATOR in self.config.no_space_check):
- policy = (_IGNORE, _IGNORE)
- else:
- policy = (_MUST_NOT, _MUST)
- self._check_space(tokens, i, policy)
-
- if self._inside_brackets('lambda'):
- self._pop_token()
- elif self._inside_brackets('{'):
- self._push_token(':', i)
-
- def _handle_comma(self, tokens, i):
- # Only require a following whitespace if this is
- # not a hanging comma before a closing bracket.
- if tokens[i+1][1] in _CLOSING_BRACKETS:
- self._check_space(tokens, i, (_MUST_NOT, _IGNORE))
- else:
- self._check_space(tokens, i, (_MUST_NOT, _MUST))
- if self._inside_brackets(':'):
- self._pop_token()
-
- def _check_surrounded_by_space(self, tokens, i):
- """Check that a binary operator is surrounded by exactly one space."""
- self._check_space(tokens, i, (_MUST, _MUST))
-
- def _check_space(self, tokens, i, policies):
- def _policy_string(policy):
- if policy == _MUST:
- return 'Exactly one', 'required'
- else:
- return 'No', 'allowed'
-
- def _name_construct(token):
- if token[1] == ',':
- return 'comma'
- elif token[1] == ':':
- return ':'
- elif token[1] in '()[]{}':
- return 'bracket'
- elif token[1] in ('<', '>', '<=', '>=', '!=', '=='):
- return 'comparison'
- else:
- if self._inside_brackets('('):
- return 'keyword argument assignment'
- else:
- return 'assignment'
-
- good_space = [True, True]
- token = tokens[i]
- pairs = [(tokens[i-1], token), (token, tokens[i+1])]
-
- for other_idx, (policy, token_pair) in enumerate(zip(policies, pairs)):
- if token_pair[other_idx][0] in _EOL or policy == _IGNORE:
- continue
-
- distance = _column_distance(*token_pair)
- if distance is None:
- continue
- good_space[other_idx] = (
- (policy == _MUST and distance == 1) or
- (policy == _MUST_NOT and distance == 0))
-
- warnings = []
- if not any(good_space) and policies[0] == policies[1]:
- warnings.append((policies[0], 'around'))
- else:
- for ok, policy, position in zip(good_space, policies, ('before', 'after')):
- if not ok:
- warnings.append((policy, position))
- for policy, position in warnings:
- construct = _name_construct(token)
- count, state = _policy_string(policy)
- self.add_message('bad-whitespace', line=token[2][0],
- args=(count, state, position, construct,
- _underline_token(token)))
-
- def _inside_brackets(self, left):
- return self._bracket_stack[-1] == left
-
- def _prepare_token_dispatcher(self):
- raw = [
- (_KEYWORD_TOKENS,
- self._check_keyword_parentheses),
-
- (_OPENING_BRACKETS, self._opening_bracket),
-
- (_CLOSING_BRACKETS, self._closing_bracket),
-
- (['='], self._check_equals_spacing),
-
- (_SPACED_OPERATORS, self._check_surrounded_by_space),
-
- ([','], self._handle_comma),
-
- ([':'], self._handle_colon),
-
- (['lambda'], self._open_lambda),
-
- ]
-
- dispatch = {}
- for tokens, handler in raw:
- for token in tokens:
- dispatch[token] = handler
- return dispatch
-
- def process_tokens(self, tokens):
- """process tokens and search for :
-
- _ non strict indentation (i.e. not always using the <indent> parameter as
- indent unit)
- _ too long lines (i.e. longer than <max_chars>)
- _ optionally bad construct (if given, bad_construct must be a compiled
- regular expression).
- """
- self._bracket_stack = [None]
- indents = [0]
- check_equal = False
- line_num = 0
- self._lines = {}
- self._visited_lines = {}
- token_handlers = self._prepare_token_dispatcher()
- self._last_line_ending = None
-
- self._current_line = ContinuedLineState(tokens, self.config)
- for idx, (tok_type, token, start, _, line) in enumerate(tokens):
- if start[0] != line_num:
- line_num = start[0]
- # A tokenizer oddity: if an indented line contains a multi-line
- # docstring, the line member of the INDENT token does not contain
- # the full line; therefore we check the next token on the line.
- if tok_type == tokenize.INDENT:
- self.new_line(TokenWrapper(tokens), idx-1, idx+1)
- else:
- self.new_line(TokenWrapper(tokens), idx-1, idx)
-
- if tok_type == tokenize.NEWLINE:
- # a program statement, or ENDMARKER, will eventually follow,
- # after some (possibly empty) run of tokens of the form
- # (NL | COMMENT)* (INDENT | DEDENT+)?
- # If an INDENT appears, setting check_equal is wrong, and will
- # be undone when we see the INDENT.
- check_equal = True
- self._process_retained_warnings(TokenWrapper(tokens), idx)
- self._current_line.next_logical_line()
- self._check_line_ending(token, line_num)
- elif tok_type == tokenize.INDENT:
- check_equal = False
- self.check_indent_level(token, indents[-1]+1, line_num)
- indents.append(indents[-1]+1)
- elif tok_type == tokenize.DEDENT:
- # there's nothing we need to check here! what's important is
- # that when the run of DEDENTs ends, the indentation of the
- # program statement (or ENDMARKER) that triggered the run is
- # equal to what's left at the top of the indents stack
- check_equal = True
- if len(indents) > 1:
- del indents[-1]
- elif tok_type == tokenize.NL:
- self._check_continued_indentation(TokenWrapper(tokens), idx+1)
- self._current_line.next_physical_line()
- elif tok_type != tokenize.COMMENT:
- self._current_line.handle_line_start(idx)
- # This is the first concrete token following a NEWLINE, so it
- # must be the first token of the next program statement, or an
- # ENDMARKER; the "line" argument exposes the leading whitespace
- # for this statement; in the case of ENDMARKER, line is an empty
- # string, so will properly match the empty string with which the
- # "indents" stack was seeded
- if check_equal:
- check_equal = False
- self.check_indent_level(line, indents[-1], line_num)
-
- if tok_type == tokenize.NUMBER and token.endswith('l'):
- self.add_message('lowercase-l-suffix', line=line_num)
-
- try:
- handler = token_handlers[token]
- except KeyError:
- pass
- else:
- handler(tokens, idx)
-
- line_num -= 1 # to be ok with "wc -l"
- if line_num > self.config.max_module_lines:
- # Get the line where the too-many-lines (or its message id)
- # was disabled or default to 1.
- symbol = self.linter.msgs_store.check_message_id('too-many-lines')
- names = (symbol.msgid, 'too-many-lines')
- line = next(filter(None,
- map(self.linter._pragma_lineno.get, names)), 1)
- self.add_message('too-many-lines',
- args=(line_num, self.config.max_module_lines),
- line=line)
-
- def _check_line_ending(self, line_ending, line_num):
- # check if line endings are mixed
- if self._last_line_ending is not None:
- if line_ending != self._last_line_ending:
- self.add_message('mixed-line-endings', line=line_num)
-
- self._last_line_ending = line_ending
-
- # check if line ending is as expected
- expected = self.config.expected_line_ending_format
- if expected:
- line_ending = reduce(lambda x, y: x + y if x != y else x, line_ending, "") # reduce multiple \n\n\n\n to one \n
- line_ending = 'LF' if line_ending == '\n' else 'CRLF'
- if line_ending != expected:
- self.add_message('unexpected-line-ending-format', args=(line_ending, expected), line=line_num)
-
-
- def _process_retained_warnings(self, tokens, current_pos):
- single_line_block_stmt = not _last_token_on_line_is(tokens, current_pos, ':')
-
- for indent_pos, state, offsets in self._current_line.retained_warnings:
- block_type = offsets[tokens.start_col(indent_pos)]
- hints = dict((k, v) for k, v in six.iteritems(offsets)
- if v != block_type)
- if single_line_block_stmt and block_type == WITH_BODY:
- self._add_continuation_message(state, hints, tokens, indent_pos)
- elif not single_line_block_stmt and block_type == SINGLE_LINE:
- self._add_continuation_message(state, hints, tokens, indent_pos)
-
- def _check_continued_indentation(self, tokens, next_idx):
- def same_token_around_nl(token_type):
- return (tokens.type(next_idx) == token_type and
- tokens.type(next_idx-2) == token_type)
-
- # Do not issue any warnings if the next line is empty.
- if not self._current_line.has_content or tokens.type(next_idx) == tokenize.NL:
- return
-
- state, valid_offsets = self._current_line.get_valid_offsets(next_idx)
- # Special handling for hanging comments and strings. If the last line ended
- # with a comment (string) and the new line contains only a comment, the line
- # may also be indented to the start of the previous token.
- if same_token_around_nl(tokenize.COMMENT) or same_token_around_nl(tokenize.STRING):
- valid_offsets[tokens.start_col(next_idx-2)] = True
-
- # We can only decide if the indentation of a continued line before opening
- # a new block is valid once we know of the body of the block is on the
- # same line as the block opener. Since the token processing is single-pass,
- # emitting those warnings is delayed until the block opener is processed.
- if (state.context_type in (HANGING_BLOCK, CONTINUED_BLOCK)
- and tokens.start_col(next_idx) in valid_offsets):
- self._current_line.add_block_warning(next_idx, state, valid_offsets)
- elif tokens.start_col(next_idx) not in valid_offsets:
- self._add_continuation_message(state, valid_offsets, tokens, next_idx)
-
- def _add_continuation_message(self, state, offsets, tokens, position):
- readable_type, readable_position = _CONTINUATION_MSG_PARTS[state.context_type]
- hint_line = _get_indent_hint_line(offsets, tokens.start_col(position))
- self.add_message(
- 'bad-continuation',
- line=tokens.start_line(position),
- args=(readable_type, readable_position, tokens.line(position), hint_line))
-
- @check_messages('multiple-statements')
- def visit_default(self, node):
- """check the node line number and check it if not yet done"""
- if not node.is_statement:
- return
- if not node.root().pure_python:
- return # XXX block visit of child nodes
- prev_sibl = node.previous_sibling()
- if prev_sibl is not None:
- prev_line = prev_sibl.fromlineno
- else:
- # The line on which a finally: occurs in a try/finally
- # is not directly represented in the AST. We infer it
- # by taking the last line of the body and adding 1, which
- # should be the line of finally:
- if (isinstance(node.parent, nodes.TryFinally)
- and node in node.parent.finalbody):
- prev_line = node.parent.body[0].tolineno + 1
- else:
- prev_line = node.parent.statement().fromlineno
- line = node.fromlineno
- assert line, node
- if prev_line == line and self._visited_lines.get(line) != 2:
- self._check_multi_statement_line(node, line)
- return
- if line in self._visited_lines:
- return
- try:
- tolineno = node.blockstart_tolineno
- except AttributeError:
- tolineno = node.tolineno
- assert tolineno, node
- lines = []
- for line in range(line, tolineno + 1):
- self._visited_lines[line] = 1
- try:
- lines.append(self._lines[line].rstrip())
- except KeyError:
- lines.append('')
-
- def _check_multi_statement_line(self, node, line):
- """Check for lines containing multiple statements."""
- # Do not warn about multiple nested context managers
- # in with statements.
- if isinstance(node, nodes.With):
- return
- # For try... except... finally..., the two nodes
- # appear to be on the same line due to how the AST is built.
- if (isinstance(node, nodes.TryExcept) and
- isinstance(node.parent, nodes.TryFinally)):
- return
- if (isinstance(node.parent, nodes.If) and not node.parent.orelse
- and self.config.single_line_if_stmt):
- return
- self.add_message('multiple-statements', node=node)
- self._visited_lines[line] = 2
-
- def check_lines(self, lines, i):
- """check lines have less than a maximum number of characters
- """
- max_chars = self.config.max_line_length
- ignore_long_line = self.config.ignore_long_lines
-
- for line in lines.splitlines(True):
- if not line.endswith('\n'):
- self.add_message('missing-final-newline', line=i)
- else:
- stripped_line = line.rstrip()
- if line[len(stripped_line):] not in ('\n', '\r\n'):
- self.add_message('trailing-whitespace', line=i)
- # Don't count excess whitespace in the line length.
- line = stripped_line
- mobj = OPTION_RGX.search(line)
- if mobj and mobj.group(1).split('=', 1)[0].strip() == 'disable':
- line = line.split('#')[0].rstrip()
-
- if len(line) > max_chars and not ignore_long_line.search(line):
- self.add_message('line-too-long', line=i, args=(len(line), max_chars))
- i += 1
-
- def check_indent_level(self, string, expected, line_num):
- """return the indent level of the string
- """
- indent = self.config.indent_string
- if indent == '\\t': # \t is not interpreted in the configuration file
- indent = '\t'
- level = 0
- unit_size = len(indent)
- while string[:unit_size] == indent:
- string = string[unit_size:]
- level += 1
- suppl = ''
- while string and string[0] in ' \t':
- if string[0] != indent[0]:
- if string[0] == '\t':
- args = ('tab', 'space')
- else:
- args = ('space', 'tab')
- self.add_message('mixed-indentation', args=args, line=line_num)
- return level
- suppl += string[0]
- string = string[1:]
- if level != expected or suppl:
- i_type = 'spaces'
- if indent[0] == '\t':
- i_type = 'tabs'
- self.add_message('bad-indentation', line=line_num,
- args=(level * unit_size + len(suppl), i_type,
- expected * unit_size))
-
-
-def register(linter):
- """required method to auto register this checker """
- linter.register_checker(FormatChecker(linter))
diff --git a/chromium/third_party/pylint/pylint/checkers/imports.py b/chromium/third_party/pylint/pylint/checkers/imports.py
deleted file mode 100644
index 1969eeb1bae..00000000000
--- a/chromium/third_party/pylint/pylint/checkers/imports.py
+++ /dev/null
@@ -1,413 +0,0 @@
-# Copyright (c) 2003-2013 LOGILAB S.A. (Paris, FRANCE).
-# http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# 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 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.
-"""imports checkers for Python code"""
-
-import sys
-from collections import defaultdict
-
-import six
-from six.moves import map # pylint: disable=redefined-builtin
-
-from logilab.common.graph import get_cycles, DotBackend
-from logilab.common.ureports import VerbatimText, Paragraph
-
-import astroid
-from astroid import are_exclusive
-from astroid.modutils import get_module_part, is_standard_module
-
-from pylint.interfaces import IAstroidChecker
-from pylint.utils import EmptyReport
-from pylint.checkers import BaseChecker
-from pylint.checkers.utils import check_messages, is_import_error
-
-def _except_import_error(node):
- """
- Check if the try-except node has an ImportError handler.
- Return True if an ImportError handler was infered, False otherwise.
- """
- if not isinstance(node, astroid.TryExcept):
- return
- return any(map(is_import_error, node.handlers))
-
-def get_first_import(node, context, name, base, level):
- """return the node where [base.]<name> is imported or None if not found
- """
- fullname = '%s.%s' % (base, name) if base else name
-
- first = None
- found = False
- for first in context.body:
- if first is node:
- continue
- if first.scope() is node.scope() and first.fromlineno > node.fromlineno:
- continue
- if isinstance(first, astroid.Import):
- if any(fullname == iname[0] for iname in first.names):
- found = True
- break
- elif isinstance(first, astroid.From):
- if level == first.level and any(
- fullname == '%s.%s' % (first.modname, iname[0])
- for iname in first.names):
- found = True
- break
- if found and not are_exclusive(first, node):
- return first
-
-# utilities to represents import dependencies as tree and dot graph ###########
-
-def make_tree_defs(mod_files_list):
- """get a list of 2-uple (module, list_of_files_which_import_this_module),
- it will return a dictionary to represent this as a tree
- """
- tree_defs = {}
- for mod, files in mod_files_list:
- node = (tree_defs, ())
- for prefix in mod.split('.'):
- node = node[0].setdefault(prefix, [{}, []])
- node[1] += files
- return tree_defs
-
-def repr_tree_defs(data, indent_str=None):
- """return a string which represents imports as a tree"""
- lines = []
- nodes = data.items()
- for i, (mod, (sub, files)) in enumerate(sorted(nodes, key=lambda x: x[0])):
- if not files:
- files = ''
- else:
- files = '(%s)' % ','.join(files)
- if indent_str is None:
- lines.append('%s %s' % (mod, files))
- sub_indent_str = ' '
- else:
- lines.append(r'%s\-%s %s' % (indent_str, mod, files))
- if i == len(nodes)-1:
- sub_indent_str = '%s ' % indent_str
- else:
- sub_indent_str = '%s| ' % indent_str
- if sub:
- lines.append(repr_tree_defs(sub, sub_indent_str))
- return '\n'.join(lines)
-
-
-def dependencies_graph(filename, dep_info):
- """write dependencies as a dot (graphviz) file
- """
- done = {}
- printer = DotBackend(filename[:-4], rankdir='LR')
- printer.emit('URL="." node[shape="box"]')
- for modname, dependencies in sorted(six.iteritems(dep_info)):
- done[modname] = 1
- printer.emit_node(modname)
- for modname in dependencies:
- if modname not in done:
- done[modname] = 1
- printer.emit_node(modname)
- for depmodname, dependencies in sorted(six.iteritems(dep_info)):
- for modname in dependencies:
- printer.emit_edge(modname, depmodname)
- printer.generate(filename)
-
-
-def make_graph(filename, dep_info, sect, gtype):
- """generate a dependencies graph and add some information about it in the
- report's section
- """
- dependencies_graph(filename, dep_info)
- sect.append(Paragraph('%simports graph has been written to %s'
- % (gtype, filename)))
-
-
-# the import checker itself ###################################################
-
-MSGS = {
- 'F0401': ('Unable to import %s',
- 'import-error',
- 'Used when pylint has been unable to import a module.'),
- 'R0401': ('Cyclic import (%s)',
- 'cyclic-import',
- 'Used when a cyclic import between two or more modules is \
- detected.'),
-
- 'W0401': ('Wildcard import %s',
- 'wildcard-import',
- 'Used when `from module import *` is detected.'),
- 'W0402': ('Uses of a deprecated module %r',
- 'deprecated-module',
- 'Used a module marked as deprecated is imported.'),
- 'W0403': ('Relative import %r, should be %r',
- 'relative-import',
- 'Used when an import relative to the package directory is '
- 'detected.',
- {'maxversion': (3, 0)}),
- 'W0404': ('Reimport %r (imported line %s)',
- 'reimported',
- 'Used when a module is reimported multiple times.'),
- 'W0406': ('Module import itself',
- 'import-self',
- 'Used when a module is importing itself.'),
-
- 'W0410': ('__future__ import is not the first non docstring statement',
- 'misplaced-future',
- 'Python 2.5 and greater require __future__ import to be the \
- first non docstring statement in the module.',
- {'maxversion': (3, 0)}),
- }
-
-class ImportsChecker(BaseChecker):
- """checks for
- * external modules dependencies
- * relative / wildcard imports
- * cyclic imports
- * uses of deprecated modules
- """
-
- __implements__ = IAstroidChecker
-
- name = 'imports'
- msgs = MSGS
- priority = -2
-
- if sys.version_info < (3,):
- deprecated_modules = ('regsub', 'TERMIOS', 'Bastion', 'rexec')
- else:
- deprecated_modules = ('stringprep', 'optparse')
- options = (('deprecated-modules',
- {'default' : deprecated_modules,
- 'type' : 'csv',
- 'metavar' : '<modules>',
- 'help' : 'Deprecated modules which should not be used, \
-separated by a comma'}
- ),
- ('import-graph',
- {'default' : '',
- 'type' : 'string',
- 'metavar' : '<file.dot>',
- 'help' : 'Create a graph of every (i.e. internal and \
-external) dependencies in the given file (report RP0402 must not be disabled)'}
- ),
- ('ext-import-graph',
- {'default' : '',
- 'type' : 'string',
- 'metavar' : '<file.dot>',
- 'help' : 'Create a graph of external dependencies in the \
-given file (report RP0402 must not be disabled)'}
- ),
- ('int-import-graph',
- {'default' : '',
- 'type' : 'string',
- 'metavar' : '<file.dot>',
- 'help' : 'Create a graph of internal dependencies in the \
-given file (report RP0402 must not be disabled)'}
- ),
- )
-
- def __init__(self, linter=None):
- BaseChecker.__init__(self, linter)
- self.stats = None
- self.import_graph = None
- self.__int_dep_info = self.__ext_dep_info = None
- self.reports = (('RP0401', 'External dependencies',
- self.report_external_dependencies),
- ('RP0402', 'Modules dependencies graph',
- self.report_dependencies_graph),
- )
-
- def open(self):
- """called before visiting project (i.e set of modules)"""
- self.linter.add_stats(dependencies={})
- self.linter.add_stats(cycles=[])
- self.stats = self.linter.stats
- self.import_graph = defaultdict(set)
-
- def close(self):
- """called before visiting project (i.e set of modules)"""
- # don't try to compute cycles if the associated message is disabled
- if self.linter.is_message_enabled('cyclic-import'):
- vertices = list(self.import_graph)
- for cycle in get_cycles(self.import_graph, vertices=vertices):
- self.add_message('cyclic-import', args=' -> '.join(cycle))
-
- def visit_import(self, node):
- """triggered when an import statement is seen"""
- modnode = node.root()
- for name, _ in node.names:
- importedmodnode = self.get_imported_module(node, name)
- if importedmodnode is None:
- continue
- self._check_relative_import(modnode, node, importedmodnode, name)
- self._add_imported_module(node, importedmodnode.name)
- self._check_deprecated_module(node, name)
- self._check_reimport(node, name)
-
- # TODO This appears to be the list of all messages of the checker...
- # @check_messages('W0410', 'W0401', 'W0403', 'W0402', 'W0404', 'W0406', 'F0401')
- @check_messages(*(MSGS.keys()))
- def visit_from(self, node):
- """triggered when a from statement is seen"""
- basename = node.modname
- if basename == '__future__':
- # check if this is the first non-docstring statement in the module
- prev = node.previous_sibling()
- if prev:
- # consecutive future statements are possible
- if not (isinstance(prev, astroid.From)
- and prev.modname == '__future__'):
- self.add_message('misplaced-future', node=node)
- return
- for name, _ in node.names:
- if name == '*':
- self.add_message('wildcard-import', args=basename, node=node)
- modnode = node.root()
- importedmodnode = self.get_imported_module(node, basename)
- if importedmodnode is None:
- return
- self._check_relative_import(modnode, node, importedmodnode, basename)
- self._check_deprecated_module(node, basename)
- for name, _ in node.names:
- if name != '*':
- self._add_imported_module(node, '%s.%s' % (importedmodnode.name, name))
- self._check_reimport(node, name, basename, node.level)
-
- def get_imported_module(self, importnode, modname):
- try:
- return importnode.do_import_module(modname)
- except astroid.InferenceError as ex:
- if str(ex) != modname:
- args = '%r (%s)' % (modname, ex)
- else:
- args = repr(modname)
- if not _except_import_error(importnode.parent):
- self.add_message("import-error", args=args, node=importnode)
-
- def _check_relative_import(self, modnode, importnode, importedmodnode,
- importedasname):
- """check relative import. node is either an Import or From node, modname
- the imported module name.
- """
- if not self.linter.is_message_enabled('relative-import'):
- return
- if importedmodnode.file is None:
- return False # built-in module
- if modnode is importedmodnode:
- return False # module importing itself
- if modnode.absolute_import_activated() or getattr(importnode, 'level', None):
- return False
- if importedmodnode.name != importedasname:
- # this must be a relative import...
- self.add_message('relative-import',
- args=(importedasname, importedmodnode.name),
- node=importnode)
-
- def _add_imported_module(self, node, importedmodname):
- """notify an imported module, used to analyze dependencies"""
- try:
- importedmodname = get_module_part(importedmodname)
- except ImportError:
- pass
- context_name = node.root().name
- if context_name == importedmodname:
- # module importing itself !
- self.add_message('import-self', node=node)
- elif not is_standard_module(importedmodname):
- # handle dependencies
- importedmodnames = self.stats['dependencies'].setdefault(
- importedmodname, set())
- if not context_name in importedmodnames:
- importedmodnames.add(context_name)
- # update import graph
- mgraph = self.import_graph[context_name]
- if importedmodname not in mgraph:
- mgraph.add(importedmodname)
-
- def _check_deprecated_module(self, node, mod_path):
- """check if the module is deprecated"""
- for mod_name in self.config.deprecated_modules:
- if mod_path == mod_name or mod_path.startswith(mod_name + '.'):
- self.add_message('deprecated-module', node=node, args=mod_path)
-
- def _check_reimport(self, node, name, basename=None, level=None):
- """check if the import is necessary (i.e. not already done)"""
- if not self.linter.is_message_enabled('reimported'):
- return
- frame = node.frame()
- root = node.root()
- contexts = [(frame, level)]
- if root is not frame:
- contexts.append((root, None))
- for context, level in contexts:
- first = get_first_import(node, context, name, basename, level)
- if first is not None:
- self.add_message('reimported', node=node,
- args=(name, first.fromlineno))
-
-
- def report_external_dependencies(self, sect, _, dummy):
- """return a verbatim layout for displaying dependencies"""
- dep_info = make_tree_defs(six.iteritems(self._external_dependencies_info()))
- if not dep_info:
- raise EmptyReport()
- tree_str = repr_tree_defs(dep_info)
- sect.append(VerbatimText(tree_str))
-
- def report_dependencies_graph(self, sect, _, dummy):
- """write dependencies as a dot (graphviz) file"""
- dep_info = self.stats['dependencies']
- if not dep_info or not (self.config.import_graph
- or self.config.ext_import_graph
- or self.config.int_import_graph):
- raise EmptyReport()
- filename = self.config.import_graph
- if filename:
- make_graph(filename, dep_info, sect, '')
- filename = self.config.ext_import_graph
- if filename:
- make_graph(filename, self._external_dependencies_info(),
- sect, 'external ')
- filename = self.config.int_import_graph
- if filename:
- make_graph(filename, self._internal_dependencies_info(),
- sect, 'internal ')
-
- def _external_dependencies_info(self):
- """return cached external dependencies information or build and
- cache them
- """
- if self.__ext_dep_info is None:
- package = self.linter.current_name
- self.__ext_dep_info = result = {}
- for importee, importers in six.iteritems(self.stats['dependencies']):
- if not importee.startswith(package):
- result[importee] = importers
- return self.__ext_dep_info
-
- def _internal_dependencies_info(self):
- """return cached internal dependencies information or build and
- cache them
- """
- if self.__int_dep_info is None:
- package = self.linter.current_name
- self.__int_dep_info = result = {}
- for importee, importers in six.iteritems(self.stats['dependencies']):
- if importee.startswith(package):
- result[importee] = importers
- return self.__int_dep_info
-
-
-def register(linter):
- """required method to auto register this checker """
- linter.register_checker(ImportsChecker(linter))
diff --git a/chromium/third_party/pylint/pylint/checkers/logging.py b/chromium/third_party/pylint/pylint/checkers/logging.py
deleted file mode 100644
index 897c1c7fd40..00000000000
--- a/chromium/third_party/pylint/pylint/checkers/logging.py
+++ /dev/null
@@ -1,256 +0,0 @@
-# Copyright (c) 2009-2010 Google, 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 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.
-"""checker for use of Python logging
-"""
-
-import astroid
-from pylint import checkers
-from pylint import interfaces
-from pylint.checkers import utils
-from pylint.checkers.utils import check_messages
-
-import six
-
-
-MSGS = {
- 'W1201': ('Specify string format arguments as logging function parameters',
- 'logging-not-lazy',
- 'Used when a logging statement has a call form of '
- '"logging.<logging method>(format_string % (format_args...))". '
- 'Such calls should leave string interpolation to the logging '
- 'method itself and be written '
- '"logging.<logging method>(format_string, format_args...)" '
- 'so that the program may avoid incurring the cost of the '
- 'interpolation in those cases in which no message will be '
- 'logged. For more, see '
- 'http://www.python.org/dev/peps/pep-0282/.'),
- 'W1202': ('Use % formatting in logging functions but pass the % '
- 'parameters as arguments',
- 'logging-format-interpolation',
- 'Used when a logging statement has a call form of '
- '"logging.<logging method>(format_string.format(format_args...))"'
- '. Such calls should use % formatting instead, but leave '
- 'interpolation to the logging function by passing the parameters '
- 'as arguments.'),
- 'E1200': ('Unsupported logging format character %r (%#02x) at index %d',
- 'logging-unsupported-format',
- 'Used when an unsupported format character is used in a logging\
- statement format string.'),
- 'E1201': ('Logging format string ends in middle of conversion specifier',
- 'logging-format-truncated',
- 'Used when a logging statement format string terminates before\
- the end of a conversion specifier.'),
- 'E1205': ('Too many arguments for logging format string',
- 'logging-too-many-args',
- 'Used when a logging format string is given too few arguments.'),
- 'E1206': ('Not enough arguments for logging format string',
- 'logging-too-few-args',
- 'Used when a logging format string is given too many arguments'),
- }
-
-
-CHECKED_CONVENIENCE_FUNCTIONS = set([
- 'critical', 'debug', 'error', 'exception', 'fatal', 'info', 'warn',
- 'warning'])
-
-def is_method_call(callfunc_node, types=(), methods=()):
- """Determines if a CallFunc node represents a method call.
-
- Args:
- callfunc_node: The CallFunc AST node to check.
- types: Optional sequence of caller type names to restrict check.
- methods: Optional sequence of method names to restrict check.
-
- Returns:
- True, if the node represents a method call for the given type and
- method names, False otherwise.
- """
- if not isinstance(callfunc_node, astroid.CallFunc):
- return False
- func = utils.safe_infer(callfunc_node.func)
- return (isinstance(func, astroid.BoundMethod)
- and isinstance(func.bound, astroid.Instance)
- and (func.bound.name in types if types else True)
- and (func.name in methods if methods else True))
-
-
-
-class LoggingChecker(checkers.BaseChecker):
- """Checks use of the logging module."""
-
- __implements__ = interfaces.IAstroidChecker
- name = 'logging'
- msgs = MSGS
-
- options = (('logging-modules',
- {'default': ('logging',),
- 'type': 'csv',
- 'metavar': '<comma separated list>',
- 'help': 'Logging modules to check that the string format '
- 'arguments are in logging function parameter format'}
- ),
- )
-
- def visit_module(self, node): # pylint: disable=unused-argument
- """Clears any state left in this checker from last module checked."""
- # The code being checked can just as easily "import logging as foo",
- # so it is necessary to process the imports and store in this field
- # what name the logging module is actually given.
- self._logging_names = set()
- logging_mods = self.config.logging_modules
-
- self._logging_modules = set(logging_mods)
- self._from_imports = {}
- for logging_mod in logging_mods:
- parts = logging_mod.rsplit('.', 1)
- if len(parts) > 1:
- self._from_imports[parts[0]] = parts[1]
-
- def visit_from(self, node):
- """Checks to see if a module uses a non-Python logging module."""
- try:
- logging_name = self._from_imports[node.modname]
- for module, as_name in node.names:
- if module == logging_name:
- self._logging_names.add(as_name or module)
- except KeyError:
- pass
-
- def visit_import(self, node):
- """Checks to see if this module uses Python's built-in logging."""
- for module, as_name in node.names:
- if module in self._logging_modules:
- self._logging_names.add(as_name or module)
-
- @check_messages(*(MSGS.keys()))
- def visit_callfunc(self, node):
- """Checks calls to logging methods."""
- def is_logging_name():
- return (isinstance(node.func, astroid.Getattr) and
- isinstance(node.func.expr, astroid.Name) and
- node.func.expr.name in self._logging_names)
-
- def is_logger_class():
- try:
- for inferred in node.func.infer():
- if isinstance(inferred, astroid.BoundMethod):
- parent = inferred._proxied.parent
- if (isinstance(parent, astroid.Class) and
- (parent.qname() == 'logging.Logger' or
- any(ancestor.qname() == 'logging.Logger'
- for ancestor in parent.ancestors()))):
- return True, inferred._proxied.name
- except astroid.exceptions.InferenceError:
- pass
- return False, None
-
- if is_logging_name():
- name = node.func.attrname
- else:
- result, name = is_logger_class()
- if not result:
- return
- self._check_log_method(node, name)
-
- def _check_log_method(self, node, name):
- """Checks calls to logging.log(level, format, *format_args)."""
- if name == 'log':
- if node.starargs or node.kwargs or len(node.args) < 2:
- # Either a malformed call, star args, or double-star args. Beyond
- # the scope of this checker.
- return
- format_pos = 1
- elif name in CHECKED_CONVENIENCE_FUNCTIONS:
- if node.starargs or node.kwargs or not node.args:
- # Either no args, star args, or double-star args. Beyond the
- # scope of this checker.
- return
- format_pos = 0
- else:
- return
-
- if isinstance(node.args[format_pos], astroid.BinOp) and node.args[format_pos].op == '%':
- self.add_message('logging-not-lazy', node=node)
- elif isinstance(node.args[format_pos], astroid.CallFunc):
- self._check_call_func(node.args[format_pos])
- elif isinstance(node.args[format_pos], astroid.Const):
- self._check_format_string(node, format_pos)
-
- def _check_call_func(self, callfunc_node):
- """Checks that function call is not format_string.format().
-
- Args:
- callfunc_node: CallFunc AST node to be checked.
- """
- if is_method_call(callfunc_node, ('str', 'unicode'), ('format',)):
- self.add_message('logging-format-interpolation', node=callfunc_node)
-
- def _check_format_string(self, node, format_arg):
- """Checks that format string tokens match the supplied arguments.
-
- Args:
- node: AST node to be checked.
- format_arg: Index of the format string in the node arguments.
- """
- num_args = _count_supplied_tokens(node.args[format_arg + 1:])
- if not num_args:
- # If no args were supplied, then all format strings are valid -
- # don't check any further.
- return
- format_string = node.args[format_arg].value
- if not isinstance(format_string, six.string_types):
- # If the log format is constant non-string (e.g. logging.debug(5)),
- # ensure there are no arguments.
- required_num_args = 0
- else:
- try:
- keyword_args, required_num_args = \
- utils.parse_format_string(format_string)
- if keyword_args:
- # Keyword checking on logging strings is complicated by
- # special keywords - out of scope.
- return
- except utils.UnsupportedFormatCharacter as ex:
- char = format_string[ex.index]
- self.add_message('logging-unsupported-format', node=node,
- args=(char, ord(char), ex.index))
- return
- except utils.IncompleteFormatString:
- self.add_message('logging-format-truncated', node=node)
- return
- if num_args > required_num_args:
- self.add_message('logging-too-many-args', node=node)
- elif num_args < required_num_args:
- self.add_message('logging-too-few-args', node=node)
-
-
-def _count_supplied_tokens(args):
- """Counts the number of tokens in an args list.
-
- The Python log functions allow for special keyword arguments: func,
- exc_info and extra. To handle these cases correctly, we only count
- arguments that aren't keywords.
-
- Args:
- args: List of AST nodes that are arguments for a log format string.
-
- Returns:
- Number of AST nodes that aren't keywords.
- """
- return sum(1 for arg in args if not isinstance(arg, astroid.Keyword))
-
-
-def register(linter):
- """Required method to auto-register this checker."""
- linter.register_checker(LoggingChecker(linter))
diff --git a/chromium/third_party/pylint/pylint/checkers/misc.py b/chromium/third_party/pylint/pylint/checkers/misc.py
deleted file mode 100644
index 7fbe70bf3c3..00000000000
--- a/chromium/third_party/pylint/pylint/checkers/misc.py
+++ /dev/null
@@ -1,104 +0,0 @@
-# pylint: disable=W0511
-# 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 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.
-""" Copyright (c) 2000-2010 LOGILAB S.A. (Paris, FRANCE).
- http://www.logilab.fr/ -- mailto:contact@logilab.fr
-
-Check source code is ascii only or has an encoding declaration (PEP 263)
-"""
-
-import re
-
-from pylint.interfaces import IRawChecker
-from pylint.checkers import BaseChecker
-import six
-
-
-MSGS = {
- 'W0511': ('%s',
- 'fixme',
- 'Used when a warning note as FIXME or XXX is detected.'),
- 'W0512': ('Cannot decode using encoding "%s", unexpected byte at position %d',
- 'invalid-encoded-data',
- 'Used when a source line cannot be decoded using the specified '
- 'source file encoding.',
- {'maxversion': (3, 0)}),
-}
-
-
-class EncodingChecker(BaseChecker):
-
- """checks for:
- * warning notes in the code like FIXME, XXX
- * encoding issues.
- """
- __implements__ = IRawChecker
-
- # configuration section name
- name = 'miscellaneous'
- msgs = MSGS
-
- options = (('notes',
- {'type': 'csv', 'metavar': '<comma separated values>',
- 'default': ('FIXME', 'XXX', 'TODO'),
- 'help': ('List of note tags to take in consideration, '
- 'separated by a comma.')}),)
-
- def _check_note(self, notes, lineno, line):
- # First, simply check if the notes are in the line at all. This is an
- # optimisation to prevent using the regular expression on every line,
- # but rather only on lines which may actually contain one of the notes.
- # This prevents a pathological problem with lines that are hundreds
- # of thousands of characters long.
- for note in self.config.notes:
- if note in line:
- break
- else:
- return
-
- match = notes.search(line)
- if not match:
- return
- self.add_message('fixme', args=line[match.start(1):-1], line=lineno)
-
- def _check_encoding(self, lineno, line, file_encoding):
- try:
- return six.text_type(line, file_encoding)
- except UnicodeDecodeError as ex:
- self.add_message('invalid-encoded-data', line=lineno,
- args=(file_encoding, ex.args[2]))
-
- def process_module(self, module):
- """inspect the source file to find encoding problem or fixmes like
- notes
- """
- if self.config.notes:
- notes = re.compile(
- r'.*?#\s*(%s)(:*\s*.+)' % "|".join(self.config.notes))
- else:
- notes = None
- if module.file_encoding:
- encoding = module.file_encoding
- else:
- encoding = 'ascii'
-
- with module.stream() as stream:
- for lineno, line in enumerate(stream):
- line = self._check_encoding(lineno + 1, line, encoding)
- if line is not None and notes:
- self._check_note(notes, lineno + 1, line)
-
-
-def register(linter):
- """required method to auto register this checker"""
- linter.register_checker(EncodingChecker(linter))
diff --git a/chromium/third_party/pylint/pylint/checkers/newstyle.py b/chromium/third_party/pylint/pylint/checkers/newstyle.py
deleted file mode 100644
index f74e7f150ef..00000000000
--- a/chromium/third_party/pylint/pylint/checkers/newstyle.py
+++ /dev/null
@@ -1,172 +0,0 @@
-# Copyright (c) 2005-2014 LOGILAB S.A. (Paris, FRANCE).
-# http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# 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 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.
-"""check for new / old style related problems
-"""
-import sys
-
-import astroid
-
-from pylint.interfaces import IAstroidChecker, INFERENCE, INFERENCE_FAILURE, HIGH
-from pylint.checkers import BaseChecker
-from pylint.checkers.utils import (
- check_messages,
- has_known_bases,
- node_frame_class,
-)
-
-MSGS = {
- 'E1001': ('Use of __slots__ on an old style class',
- 'slots-on-old-class',
- 'Used when an old style class uses the __slots__ attribute.',
- {'maxversion': (3, 0)}),
- 'E1002': ('Use of super on an old style class',
- 'super-on-old-class',
- 'Used when an old style class uses the super builtin.',
- {'maxversion': (3, 0)}),
- 'E1003': ('Bad first argument %r given to super()',
- 'bad-super-call',
- 'Used when another argument than the current class is given as \
- first argument of the super builtin.'),
- 'E1004': ('Missing argument to super()',
- 'missing-super-argument',
- 'Used when the super builtin didn\'t receive an \
- argument.',
- {'maxversion': (3, 0)}),
- 'W1001': ('Use of "property" on an old style class',
- 'property-on-old-class',
- 'Used when Pylint detect the use of the builtin "property" \
- on an old style class while this is relying on new style \
- classes features.',
- {'maxversion': (3, 0)}),
- 'C1001': ('Old-style class defined.',
- 'old-style-class',
- 'Used when a class is defined that does not inherit from another'
- 'class and does not inherit explicitly from "object".',
- {'maxversion': (3, 0)})
- }
-
-
-class NewStyleConflictChecker(BaseChecker):
- """checks for usage of new style capabilities on old style classes and
- other new/old styles conflicts problems
- * use of property, __slots__, super
- * "super" usage
- """
-
- __implements__ = (IAstroidChecker,)
-
- # configuration section name
- name = 'newstyle'
- # messages
- msgs = MSGS
- priority = -2
- # configuration options
- options = ()
-
- @check_messages('slots-on-old-class', 'old-style-class')
- def visit_class(self, node):
- """ Check __slots__ in old style classes and old
- style class definition.
- """
- if '__slots__' in node and not node.newstyle:
- confidence = (INFERENCE if has_known_bases(node)
- else INFERENCE_FAILURE)
- self.add_message('slots-on-old-class', node=node,
- confidence=confidence)
- # The node type could be class, exception, metaclass, or
- # interface. Presumably, the non-class-type nodes would always
- # have an explicit base class anyway.
- if not node.bases and node.type == 'class' and not node.metaclass():
- # We use confidence HIGH here because this message should only ever
- # be emitted for classes at the root of the inheritance hierarchyself.
- self.add_message('old-style-class', node=node, confidence=HIGH)
-
- @check_messages('property-on-old-class')
- def visit_callfunc(self, node):
- """check property usage"""
- parent = node.parent.frame()
- if (isinstance(parent, astroid.Class) and
- not parent.newstyle and
- isinstance(node.func, astroid.Name)):
- confidence = (INFERENCE if has_known_bases(parent)
- else INFERENCE_FAILURE)
- name = node.func.name
- if name == 'property':
- self.add_message('property-on-old-class', node=node,
- confidence=confidence)
-
- @check_messages('super-on-old-class', 'bad-super-call', 'missing-super-argument')
- def visit_function(self, node):
- """check use of super"""
- # ignore actual functions or method within a new style class
- if not node.is_method():
- return
- klass = node.parent.frame()
- for stmt in node.nodes_of_class(astroid.CallFunc):
- if node_frame_class(stmt) != node_frame_class(node):
- # Don't look down in other scopes.
- continue
- expr = stmt.func
- if not isinstance(expr, astroid.Getattr):
- continue
- call = expr.expr
- # skip the test if using super
- if isinstance(call, astroid.CallFunc) and \
- isinstance(call.func, astroid.Name) and \
- call.func.name == 'super':
- confidence = (INFERENCE if has_known_bases(klass)
- else INFERENCE_FAILURE)
- if not klass.newstyle:
- # super should not be used on an old style class
- self.add_message('super-on-old-class', node=node,
- confidence=confidence)
- else:
- # super first arg should be the class
- if not call.args and sys.version_info[0] == 3:
- # unless Python 3
- continue
-
- try:
- supcls = (call.args and next(call.args[0].infer())
- or None)
- except astroid.InferenceError:
- continue
-
- if supcls is None:
- self.add_message('missing-super-argument', node=call,
- confidence=confidence)
- continue
-
- if klass is not supcls:
- name = None
- # if supcls is not YES, then supcls was infered
- # and use its name. Otherwise, try to look
- # for call.args[0].name
- if supcls is not astroid.YES:
- name = supcls.name
- else:
- if hasattr(call.args[0], 'name'):
- name = call.args[0].name
- if name is not None:
- self.add_message('bad-super-call',
- node=call,
- args=(name, ),
- confidence=confidence)
-
-
-def register(linter):
- """required method to auto register this checker """
- linter.register_checker(NewStyleConflictChecker(linter))
diff --git a/chromium/third_party/pylint/pylint/checkers/python3.py b/chromium/third_party/pylint/pylint/checkers/python3.py
deleted file mode 100644
index 59c37bf9c91..00000000000
--- a/chromium/third_party/pylint/pylint/checkers/python3.py
+++ /dev/null
@@ -1,476 +0,0 @@
-# Copyright 2014 Google 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 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.
-"""Check Python 2 code for Python 2/3 source-compatible issues."""
-from __future__ import absolute_import
-
-import re
-import tokenize
-
-import astroid
-from pylint import checkers, interfaces
-from pylint.utils import WarningScope
-from pylint.checkers import utils
-
-
-_ZERO = re.compile("^0+$")
-
-def _is_old_octal(literal):
- if _ZERO.match(literal):
- return False
- if re.match('0\d+', literal):
- try:
- int(literal, 8)
- except ValueError:
- return False
- return True
-
-def _check_dict_node(node):
- inferred_types = set()
- try:
- inferred = node.infer()
- for inferred_node in inferred:
- inferred_types.add(inferred_node)
- except (astroid.InferenceError, astroid.UnresolvableName):
- pass
- return (not inferred_types
- or any(isinstance(x, astroid.Dict) for x in inferred_types))
-
-
-class Python3Checker(checkers.BaseChecker):
-
- __implements__ = interfaces.IAstroidChecker
- enabled = False
- name = 'python3'
-
- msgs = {
- # Errors for what will syntactically break in Python 3, warnings for
- # everything else.
- 'E1601': ('print statement used',
- 'print-statement',
- 'Used when a print statement is used '
- '(`print` is a function in Python 3)',
- {'maxversion': (3, 0)}),
- 'E1602': ('Parameter unpacking specified',
- 'parameter-unpacking',
- 'Used when parameter unpacking is specified for a function'
- "(Python 3 doesn't allow it)",
- {'maxversion': (3, 0)}),
- 'E1603': ('Implicit unpacking of exceptions is not supported '
- 'in Python 3',
- 'unpacking-in-except',
- 'Python3 will not allow implicit unpacking of '
- 'exceptions in except clauses. '
- 'See http://www.python.org/dev/peps/pep-3110/',
- {'maxversion': (3, 0),
- 'old_names': [('W0712', 'unpacking-in-except')]}),
- 'E1604': ('Use raise ErrorClass(args) instead of '
- 'raise ErrorClass, args.',
- 'old-raise-syntax',
- "Used when the alternate raise syntax "
- "'raise foo, bar' is used "
- "instead of 'raise foo(bar)'.",
- {'maxversion': (3, 0),
- 'old_names': [('W0121', 'old-raise-syntax')]}),
- 'E1605': ('Use of the `` operator',
- 'backtick',
- 'Used when the deprecated "``" (backtick) operator is used '
- 'instead of the str() function.',
- {'scope': WarningScope.NODE,
- 'maxversion': (3, 0),
- 'old_names': [('W0333', 'backtick')]}),
- 'W1601': ('apply built-in referenced',
- 'apply-builtin',
- 'Used when the apply built-in function is referenced '
- '(missing from Python 3)',
- {'maxversion': (3, 0)}),
- 'W1602': ('basestring built-in referenced',
- 'basestring-builtin',
- 'Used when the basestring built-in function is referenced '
- '(missing from Python 3)',
- {'maxversion': (3, 0)}),
- 'W1603': ('buffer built-in referenced',
- 'buffer-builtin',
- 'Used when the buffer built-in function is referenced '
- '(missing from Python 3)',
- {'maxversion': (3, 0)}),
- 'W1604': ('cmp built-in referenced',
- 'cmp-builtin',
- 'Used when the cmp built-in function is referenced '
- '(missing from Python 3)',
- {'maxversion': (3, 0)}),
- 'W1605': ('coerce built-in referenced',
- 'coerce-builtin',
- 'Used when the coerce built-in function is referenced '
- '(missing from Python 3)',
- {'maxversion': (3, 0)}),
- 'W1606': ('execfile built-in referenced',
- 'execfile-builtin',
- 'Used when the execfile built-in function is referenced '
- '(missing from Python 3)',
- {'maxversion': (3, 0)}),
- 'W1607': ('file built-in referenced',
- 'file-builtin',
- 'Used when the file built-in function is referenced '
- '(missing from Python 3)',
- {'maxversion': (3, 0)}),
- 'W1608': ('long built-in referenced',
- 'long-builtin',
- 'Used when the long built-in function is referenced '
- '(missing from Python 3)',
- {'maxversion': (3, 0)}),
- 'W1609': ('raw_input built-in referenced',
- 'raw_input-builtin',
- 'Used when the raw_input built-in function is referenced '
- '(missing from Python 3)',
- {'maxversion': (3, 0)}),
- 'W1610': ('reduce built-in referenced',
- 'reduce-builtin',
- 'Used when the reduce built-in function is referenced '
- '(missing from Python 3)',
- {'maxversion': (3, 0)}),
- 'W1611': ('StandardError built-in referenced',
- 'standarderror-builtin',
- 'Used when the StandardError built-in function is referenced '
- '(missing from Python 3)',
- {'maxversion': (3, 0)}),
- 'W1612': ('unicode built-in referenced',
- 'unicode-builtin',
- 'Used when the unicode built-in function is referenced '
- '(missing from Python 3)',
- {'maxversion': (3, 0)}),
- 'W1613': ('xrange built-in referenced',
- 'xrange-builtin',
- 'Used when the xrange built-in function is referenced '
- '(missing from Python 3)',
- {'maxversion': (3, 0)}),
- 'W1614': ('__coerce__ method defined',
- 'coerce-method',
- 'Used when a __coerce__ method is defined '
- '(method is not used by Python 3)',
- {'maxversion': (3, 0)}),
- 'W1615': ('__delslice__ method defined',
- 'delslice-method',
- 'Used when a __delslice__ method is defined '
- '(method is not used by Python 3)',
- {'maxversion': (3, 0)}),
- 'W1616': ('__getslice__ method defined',
- 'getslice-method',
- 'Used when a __getslice__ method is defined '
- '(method is not used by Python 3)',
- {'maxversion': (3, 0)}),
- 'W1617': ('__setslice__ method defined',
- 'setslice-method',
- 'Used when a __setslice__ method is defined '
- '(method is not used by Python 3)',
- {'maxversion': (3, 0)}),
- 'W1618': ('import missing `from __future__ import absolute_import`',
- 'no-absolute-import',
- 'Used when an import is not accompanied by '
- '`from __future__ import absolute_import`'
- ' (default behaviour in Python 3)',
- {'maxversion': (3, 0)}),
- 'W1619': ('division w/o __future__ statement',
- 'old-division',
- 'Used for non-floor division w/o a float literal or '
- '``from __future__ import division``'
- '(Python 3 returns a float for int division unconditionally)',
- {'maxversion': (3, 0)}),
- 'W1620': ('Calling a dict.iter*() method',
- 'dict-iter-method',
- 'Used for calls to dict.iterkeys(), itervalues() or iteritems() '
- '(Python 3 lacks these methods)',
- {'maxversion': (3, 0)}),
- 'W1621': ('Calling a dict.view*() method',
- 'dict-view-method',
- 'Used for calls to dict.viewkeys(), viewvalues() or viewitems() '
- '(Python 3 lacks these methods)',
- {'maxversion': (3, 0)}),
- 'W1622': ('Called a next() method on an object',
- 'next-method-called',
- "Used when an object's next() method is called "
- '(Python 3 uses the next() built-in function)',
- {'maxversion': (3, 0)}),
- 'W1623': ("Assigning to a class' __metaclass__ attribute",
- 'metaclass-assignment',
- "Used when a metaclass is specified by assigning to __metaclass__ "
- '(Python 3 specifies the metaclass as a class statement argument)',
- {'maxversion': (3, 0)}),
- 'W1624': ('Indexing exceptions will not work on Python 3',
- 'indexing-exception',
- 'Indexing exceptions will not work on Python 3. Use '
- '`exception.args[index]` instead.',
- {'maxversion': (3, 0),
- 'old_names': [('W0713', 'indexing-exception')]}),
- 'W1625': ('Raising a string exception',
- 'raising-string',
- 'Used when a string exception is raised. This will not '
- 'work on Python 3.',
- {'maxversion': (3, 0),
- 'old_names': [('W0701', 'raising-string')]}),
- 'W1626': ('reload built-in referenced',
- 'reload-builtin',
- 'Used when the reload built-in function is referenced '
- '(missing from Python 3). You can use instead imp.reload '
- 'or importlib.reload.',
- {'maxversion': (3, 0)}),
- 'W1627': ('__oct__ method defined',
- 'oct-method',
- 'Used when a __oct__ method is defined '
- '(method is not used by Python 3)',
- {'maxversion': (3, 0)}),
- 'W1628': ('__hex__ method defined',
- 'hex-method',
- 'Used when a __hex__ method is defined '
- '(method is not used by Python 3)',
- {'maxversion': (3, 0)}),
- 'W1629': ('__nonzero__ method defined',
- 'nonzero-method',
- 'Used when a __nonzero__ method is defined '
- '(method is not used by Python 3)',
- {'maxversion': (3, 0)}),
- 'W1630': ('__cmp__ method defined',
- 'cmp-method',
- 'Used when a __cmp__ method is defined '
- '(method is not used by Python 3)',
- {'maxversion': (3, 0)}),
- 'W1631': ('map is used as implicitly evaluated call',
- 'implicit-map-evaluation',
- 'Used when the map builtin is used as implicitly '
- 'evaluated call, as in "map(func, args)" on a single line. '
- 'This behaviour will not work in Python 3, where '
- 'map is a generator and must be evaluated. '
- 'Prefer a for-loop as alternative.',
- {'maxversion': (3, 0)}),
- 'W1632': ('input built-in referenced',
- 'input-builtin',
- 'Used when the input built-in is referenced '
- '(backwards-incompatible semantics in Python 3)',
- {'maxversion': (3, 0)}),
- 'W1633': ('round built-in referenced',
- 'round-builtin',
- 'Used when the round built-in is referenced '
- '(backwards-incompatible semantics in Python 3)',
- {'maxversion': (3, 0)}),
- }
-
- _bad_builtins = frozenset([
- 'apply',
- 'basestring',
- 'buffer',
- 'cmp',
- 'coerce',
- 'execfile',
- 'file',
- 'input', # Not missing, but incompatible semantics
- 'long',
- 'raw_input',
- 'reduce',
- 'round', # Not missing, but incompatible semantics
- 'StandardError',
- 'unicode',
- 'xrange',
- 'reload',
- ])
-
- _unused_magic_methods = frozenset([
- '__coerce__',
- '__delslice__',
- '__getslice__',
- '__setslice__',
- '__oct__',
- '__hex__',
- '__nonzero__',
- '__cmp__',
- ])
-
- def __init__(self, *args, **kwargs):
- self._future_division = False
- self._future_absolute_import = False
- super(Python3Checker, self).__init__(*args, **kwargs)
-
- def visit_function(self, node):
- if node.is_method() and node.name in self._unused_magic_methods:
- method_name = node.name
- if node.name.startswith('__'):
- method_name = node.name[2:-2]
- self.add_message(method_name + '-method', node=node)
-
- @utils.check_messages('parameter-unpacking')
- def visit_arguments(self, node):
- for arg in node.args:
- if isinstance(arg, astroid.Tuple):
- self.add_message('parameter-unpacking', node=arg)
-
- @utils.check_messages('implicit-map-evaluation')
- def visit_discard(self, node):
- if (isinstance(node.value, astroid.CallFunc) and
- isinstance(node.value.func, astroid.Name) and
- node.value.func.name == 'map'):
- module = node.value.func.lookup('map')[0]
- if getattr(module, 'name', None) == '__builtin__':
- self.add_message('implicit-map-evaluation', node=node)
-
- def visit_name(self, node):
- """Detect when a "bad" built-in is referenced."""
- found_node = node.lookup(node.name)[0]
- if getattr(found_node, 'name', None) == '__builtin__':
- if node.name in self._bad_builtins:
- message = node.name.lower() + '-builtin'
- self.add_message(message, node=node)
-
- @utils.check_messages('print-statement')
- def visit_print(self, node):
- self.add_message('print-statement', node=node)
-
- @utils.check_messages('no-absolute-import')
- def visit_from(self, node):
- if node.modname == '__future__':
- for name, _ in node.names:
- if name == 'division':
- self._future_division = True
- elif name == 'absolute_import':
- self._future_absolute_import = True
- elif not self._future_absolute_import:
- self.add_message('no-absolute-import', node=node)
-
- @utils.check_messages('no-absolute-import')
- def visit_import(self, node):
- if not self._future_absolute_import:
- self.add_message('no-absolute-import', node=node)
-
- @utils.check_messages('metaclass-assignment')
- def visit_class(self, node):
- if '__metaclass__' in node.locals:
- self.add_message('metaclass-assignment', node=node)
-
- @utils.check_messages('old-division')
- def visit_binop(self, node):
- if not self._future_division and node.op == '/':
- for arg in (node.left, node.right):
- if isinstance(arg, astroid.Const) and isinstance(arg.value, float):
- break
- else:
- self.add_message('old-division', node=node)
-
- @utils.check_messages('next-method-called',
- 'dict-iter-method',
- 'dict-view-method')
- def visit_callfunc(self, node):
- if not isinstance(node.func, astroid.Getattr):
- return
- if any([node.args, node.starargs, node.kwargs]):
- return
- if node.func.attrname == 'next':
- self.add_message('next-method-called', node=node)
- else:
- if _check_dict_node(node.func.expr):
- if node.func.attrname in ('iterkeys', 'itervalues', 'iteritems'):
- self.add_message('dict-iter-method', node=node)
- elif node.func.attrname in ('viewkeys', 'viewvalues', 'viewitems'):
- self.add_message('dict-view-method', node=node)
-
- @utils.check_messages('indexing-exception')
- def visit_subscript(self, node):
- """ Look for indexing exceptions. """
- try:
- for infered in node.value.infer():
- if not isinstance(infered, astroid.Instance):
- continue
- if utils.inherit_from_std_ex(infered):
- self.add_message('indexing-exception', node=node)
- except astroid.InferenceError:
- return
-
- @utils.check_messages('unpacking-in-except')
- def visit_excepthandler(self, node):
- """Visit an except handler block and check for exception unpacking."""
- if isinstance(node.name, (astroid.Tuple, astroid.List)):
- self.add_message('unpacking-in-except', node=node)
-
- @utils.check_messages('backtick')
- def visit_backquote(self, node):
- self.add_message('backtick', node=node)
-
- @utils.check_messages('raising-string', 'old-raise-syntax')
- def visit_raise(self, node):
- """Visit a raise statement and check for raising
- strings or old-raise-syntax.
- """
- if (node.exc is not None and
- node.inst is not None and
- node.tback is None):
- self.add_message('old-raise-syntax', node=node)
-
- # Ignore empty raise.
- if node.exc is None:
- return
- expr = node.exc
- if self._check_raise_value(node, expr):
- return
- else:
- try:
- value = next(astroid.unpack_infer(expr))
- except astroid.InferenceError:
- return
- self._check_raise_value(node, value)
-
- def _check_raise_value(self, node, expr):
- if isinstance(expr, astroid.Const):
- value = expr.value
- if isinstance(value, str):
- self.add_message('raising-string', node=node)
- return True
-
-
-class Python3TokenChecker(checkers.BaseTokenChecker):
- __implements__ = interfaces.ITokenChecker
- name = 'python3'
- enabled = False
-
- msgs = {
- 'E1606': ('Use of long suffix',
- 'long-suffix',
- 'Used when "l" or "L" is used to mark a long integer. '
- 'This will not work in Python 3, since `int` and `long` '
- 'types have merged.',
- {'maxversion': (3, 0)}),
- 'E1607': ('Use of the <> operator',
- 'old-ne-operator',
- 'Used when the deprecated "<>" operator is used instead '
- 'of "!=". This is removed in Python 3.',
- {'maxversion': (3, 0),
- 'old_names': [('W0331', 'old-ne-operator')]}),
- 'E1608': ('Use of old octal literal',
- 'old-octal-literal',
- 'Usen when encountering the old octal syntax, '
- 'removed in Python 3. To use the new syntax, '
- 'prepend 0o on the number.',
- {'maxversion': (3, 0)}),
- }
-
- def process_tokens(self, tokens):
- for idx, (tok_type, token, start, _, _) in enumerate(tokens):
- if tok_type == tokenize.NUMBER:
- if token.lower().endswith('l'):
- # This has a different semantic than lowercase-l-suffix.
- self.add_message('long-suffix', line=start[0])
- elif _is_old_octal(token):
- self.add_message('old-octal-literal', line=start[0])
- if tokens[idx][1] == '<>':
- self.add_message('old-ne-operator', line=tokens[idx][2][0])
-
-
-def register(linter):
- linter.register_checker(Python3Checker(linter))
- linter.register_checker(Python3TokenChecker(linter))
diff --git a/chromium/third_party/pylint/pylint/checkers/raw_metrics.py b/chromium/third_party/pylint/pylint/checkers/raw_metrics.py
deleted file mode 100644
index 71fecf68f08..00000000000
--- a/chromium/third_party/pylint/pylint/checkers/raw_metrics.py
+++ /dev/null
@@ -1,129 +0,0 @@
-# Copyright (c) 2003-2013 LOGILAB S.A. (Paris, FRANCE).
-# http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# 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 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.
-""" Copyright (c) 2003-2010 LOGILAB S.A. (Paris, FRANCE).
- http://www.logilab.fr/ -- mailto:contact@logilab.fr
-
-Raw metrics checker
-"""
-
-import tokenize
-
-# pylint now requires pylint >= 2.2, so this is no longer necessary
-#if not hasattr(tokenize, 'NL'):
-# raise ValueError("tokenize.NL doesn't exist -- tokenize module too old")
-
-from logilab.common.ureports import Table
-
-from pylint.interfaces import ITokenChecker
-from pylint.utils import EmptyReport
-from pylint.checkers import BaseTokenChecker
-from pylint.reporters import diff_string
-
-def report_raw_stats(sect, stats, old_stats):
- """calculate percentage of code / doc / comment / empty
- """
- total_lines = stats['total_lines']
- if not total_lines:
- raise EmptyReport()
- sect.description = '%s lines have been analyzed' % total_lines
- lines = ('type', 'number', '%', 'previous', 'difference')
- for node_type in ('code', 'docstring', 'comment', 'empty'):
- key = node_type + '_lines'
- total = stats[key]
- percent = float(total * 100) / total_lines
- old = old_stats.get(key, None)
- if old is not None:
- diff_str = diff_string(old, total)
- else:
- old, diff_str = 'NC', 'NC'
- lines += (node_type, str(total), '%.2f' % percent,
- str(old), diff_str)
- sect.append(Table(children=lines, cols=5, rheaders=1))
-
-
-class RawMetricsChecker(BaseTokenChecker):
- """does not check anything but gives some raw metrics :
- * total number of lines
- * total number of code lines
- * total number of docstring lines
- * total number of comments lines
- * total number of empty lines
- """
-
- __implements__ = (ITokenChecker,)
-
- # configuration section name
- name = 'metrics'
- # configuration options
- options = ()
- # messages
- msgs = {}
- # reports
- reports = (('RP0701', 'Raw metrics', report_raw_stats),)
-
- def __init__(self, linter):
- BaseTokenChecker.__init__(self, linter)
- self.stats = None
-
- def open(self):
- """init statistics"""
- self.stats = self.linter.add_stats(total_lines=0, code_lines=0,
- empty_lines=0, docstring_lines=0,
- comment_lines=0)
-
- def process_tokens(self, tokens):
- """update stats"""
- i = 0
- tokens = list(tokens)
- while i < len(tokens):
- i, lines_number, line_type = get_type(tokens, i)
- self.stats['total_lines'] += lines_number
- self.stats[line_type] += lines_number
-
-
-JUNK = (tokenize.NL, tokenize.INDENT, tokenize.NEWLINE, tokenize.ENDMARKER)
-
-def get_type(tokens, start_index):
- """return the line type : docstring, comment, code, empty"""
- i = start_index
- tok_type = tokens[i][0]
- start = tokens[i][2]
- pos = start
- line_type = None
- while i < len(tokens) and tokens[i][2][0] == start[0]:
- tok_type = tokens[i][0]
- pos = tokens[i][3]
- if line_type is None:
- if tok_type == tokenize.STRING:
- line_type = 'docstring_lines'
- elif tok_type == tokenize.COMMENT:
- line_type = 'comment_lines'
- elif tok_type in JUNK:
- pass
- else:
- line_type = 'code_lines'
- i += 1
- if line_type is None:
- line_type = 'empty_lines'
- elif i < len(tokens) and tok_type == tokenize.NEWLINE:
- i += 1
- return i, pos[0] - start[0] + 1, line_type
-
-
-def register(linter):
- """ required method to auto register this checker """
- linter.register_checker(RawMetricsChecker(linter))
-
diff --git a/chromium/third_party/pylint/pylint/checkers/similar.py b/chromium/third_party/pylint/pylint/checkers/similar.py
deleted file mode 100644
index 95420776110..00000000000
--- a/chromium/third_party/pylint/pylint/checkers/similar.py
+++ /dev/null
@@ -1,372 +0,0 @@
-# pylint: disable=W0622
-# Copyright (c) 2004-2013 LOGILAB S.A. (Paris, FRANCE).
-# http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# 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 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.
-"""a similarities / code duplication command line tool and pylint checker
-"""
-from __future__ import print_function
-import sys
-from collections import defaultdict
-
-from logilab.common.ureports import Table
-
-from pylint.interfaces import IRawChecker
-from pylint.checkers import BaseChecker, table_lines_from_stats
-
-import six
-from six.moves import zip
-
-
-class Similar(object):
- """finds copy-pasted lines of code in a project"""
-
- def __init__(self, min_lines=4, ignore_comments=False,
- ignore_docstrings=False, ignore_imports=False):
- self.min_lines = min_lines
- self.ignore_comments = ignore_comments
- self.ignore_docstrings = ignore_docstrings
- self.ignore_imports = ignore_imports
- self.linesets = []
-
- def append_stream(self, streamid, stream, encoding=None):
- """append a file to search for similarities"""
- if encoding is None:
- readlines = stream.readlines
- else:
- readlines = lambda: [line.decode(encoding) for line in stream]
- try:
- self.linesets.append(LineSet(streamid,
- readlines(),
- self.ignore_comments,
- self.ignore_docstrings,
- self.ignore_imports))
- except UnicodeDecodeError:
- pass
-
- def run(self):
- """start looking for similarities and display results on stdout"""
- self._display_sims(self._compute_sims())
-
- def _compute_sims(self):
- """compute similarities in appended files"""
- no_duplicates = defaultdict(list)
- for num, lineset1, idx1, lineset2, idx2 in self._iter_sims():
- duplicate = no_duplicates[num]
- for couples in duplicate:
- if (lineset1, idx1) in couples or (lineset2, idx2) in couples:
- couples.add((lineset1, idx1))
- couples.add((lineset2, idx2))
- break
- else:
- duplicate.append(set([(lineset1, idx1), (lineset2, idx2)]))
- sims = []
- for num, ensembles in six.iteritems(no_duplicates):
- for couples in ensembles:
- sims.append((num, couples))
- sims.sort()
- sims.reverse()
- return sims
-
- def _display_sims(self, sims):
- """display computed similarities on stdout"""
- nb_lignes_dupliquees = 0
- for num, couples in sims:
- print()
- print(num, "similar lines in", len(couples), "files")
- couples = sorted(couples)
- for lineset, idx in couples:
- print("==%s:%s" % (lineset.name, idx))
- # pylint: disable=W0631
- for line in lineset._real_lines[idx:idx+num]:
- print(" ", line.rstrip())
- nb_lignes_dupliquees += num * (len(couples)-1)
- nb_total_lignes = sum([len(lineset) for lineset in self.linesets])
- print("TOTAL lines=%s duplicates=%s percent=%.2f" \
- % (nb_total_lignes, nb_lignes_dupliquees,
- nb_lignes_dupliquees*100. / nb_total_lignes))
-
- def _find_common(self, lineset1, lineset2):
- """find similarities in the two given linesets"""
- lines1 = lineset1.enumerate_stripped
- lines2 = lineset2.enumerate_stripped
- find = lineset2.find
- index1 = 0
- min_lines = self.min_lines
- while index1 < len(lineset1):
- skip = 1
- num = 0
- for index2 in find(lineset1[index1]):
- non_blank = 0
- for num, ((_, line1), (_, line2)) in enumerate(
- zip(lines1(index1), lines2(index2))):
- if line1 != line2:
- if non_blank > min_lines:
- yield num, lineset1, index1, lineset2, index2
- skip = max(skip, num)
- break
- if line1:
- non_blank += 1
- else:
- # we may have reach the end
- num += 1
- if non_blank > min_lines:
- yield num, lineset1, index1, lineset2, index2
- skip = max(skip, num)
- index1 += skip
-
- def _iter_sims(self):
- """iterate on similarities among all files, by making a cartesian
- product
- """
- for idx, lineset in enumerate(self.linesets[:-1]):
- for lineset2 in self.linesets[idx+1:]:
- for sim in self._find_common(lineset, lineset2):
- yield sim
-
-def stripped_lines(lines, ignore_comments, ignore_docstrings, ignore_imports):
- """return lines with leading/trailing whitespace and any ignored code
- features removed
- """
-
- strippedlines = []
- docstring = None
- for line in lines:
- line = line.strip()
- if ignore_docstrings:
- if not docstring and \
- (line.startswith('"""') or line.startswith("'''")):
- docstring = line[:3]
- line = line[3:]
- if docstring:
- if line.endswith(docstring):
- docstring = None
- line = ''
- if ignore_imports:
- if line.startswith("import ") or line.startswith("from "):
- line = ''
- if ignore_comments:
- # XXX should use regex in checkers/format to avoid cutting
- # at a "#" in a string
- line = line.split('#', 1)[0].strip()
- strippedlines.append(line)
- return strippedlines
-
-
-class LineSet(object):
- """Holds and indexes all the lines of a single source file"""
- def __init__(self, name, lines, ignore_comments=False,
- ignore_docstrings=False, ignore_imports=False):
- self.name = name
- self._real_lines = lines
- self._stripped_lines = stripped_lines(lines, ignore_comments,
- ignore_docstrings,
- ignore_imports)
- self._index = self._mk_index()
-
- def __str__(self):
- return '<Lineset for %s>' % self.name
-
- def __len__(self):
- return len(self._real_lines)
-
- def __getitem__(self, index):
- return self._stripped_lines[index]
-
- def __lt__(self, other):
- return self.name < other.name
-
- def __hash__(self):
- return id(self)
-
- def enumerate_stripped(self, start_at=0):
- """return an iterator on stripped lines, starting from a given index
- if specified, else 0
- """
- idx = start_at
- if start_at:
- lines = self._stripped_lines[start_at:]
- else:
- lines = self._stripped_lines
- for line in lines:
- #if line:
- yield idx, line
- idx += 1
-
- def find(self, stripped_line):
- """return positions of the given stripped line in this set"""
- return self._index.get(stripped_line, ())
-
- def _mk_index(self):
- """create the index for this set"""
- index = defaultdict(list)
- for line_no, line in enumerate(self._stripped_lines):
- if line:
- index[line].append(line_no)
- return index
-
-
-MSGS = {'R0801': ('Similar lines in %s files\n%s',
- 'duplicate-code',
- 'Indicates that a set of similar lines has been detected \
- among multiple file. This usually means that the code should \
- be refactored to avoid this duplication.')}
-
-def report_similarities(sect, stats, old_stats):
- """make a layout with some stats about duplication"""
- lines = ['', 'now', 'previous', 'difference']
- lines += table_lines_from_stats(stats, old_stats,
- ('nb_duplicated_lines',
- 'percent_duplicated_lines'))
- sect.append(Table(children=lines, cols=4, rheaders=1, cheaders=1))
-
-
-# wrapper to get a pylint checker from the similar class
-class SimilarChecker(BaseChecker, Similar):
- """checks for similarities and duplicated code. This computation may be
- memory / CPU intensive, so you should disable it if you experiment some
- problems.
- """
-
- __implements__ = (IRawChecker,)
- # configuration section name
- name = 'similarities'
- # messages
- msgs = MSGS
- # configuration options
- # for available dict keys/values see the optik parser 'add_option' method
- options = (('min-similarity-lines',
- {'default' : 4, 'type' : "int", 'metavar' : '<int>',
- 'help' : 'Minimum lines number of a similarity.'}),
- ('ignore-comments',
- {'default' : True, 'type' : 'yn', 'metavar' : '<y or n>',
- 'help': 'Ignore comments when computing similarities.'}
- ),
- ('ignore-docstrings',
- {'default' : True, 'type' : 'yn', 'metavar' : '<y or n>',
- 'help': 'Ignore docstrings when computing similarities.'}
- ),
- ('ignore-imports',
- {'default' : False, 'type' : 'yn', 'metavar' : '<y or n>',
- 'help': 'Ignore imports when computing similarities.'}
- ),
- )
- # reports
- reports = (('RP0801', 'Duplication', report_similarities),)
-
- def __init__(self, linter=None):
- BaseChecker.__init__(self, linter)
- Similar.__init__(self, min_lines=4,
- ignore_comments=True, ignore_docstrings=True)
- self.stats = None
-
- def set_option(self, optname, value, action=None, optdict=None):
- """method called to set an option (registered in the options list)
-
- overridden to report options setting to Similar
- """
- BaseChecker.set_option(self, optname, value, action, optdict)
- if optname == 'min-similarity-lines':
- self.min_lines = self.config.min_similarity_lines
- elif optname == 'ignore-comments':
- self.ignore_comments = self.config.ignore_comments
- elif optname == 'ignore-docstrings':
- self.ignore_docstrings = self.config.ignore_docstrings
- elif optname == 'ignore-imports':
- self.ignore_imports = self.config.ignore_imports
-
- def open(self):
- """init the checkers: reset linesets and statistics information"""
- self.linesets = []
- self.stats = self.linter.add_stats(nb_duplicated_lines=0,
- percent_duplicated_lines=0)
-
- def process_module(self, node):
- """process a module
-
- the module's content is accessible via the stream object
-
- stream must implement the readlines method
- """
- with node.stream() as stream:
- self.append_stream(self.linter.current_name,
- stream,
- node.file_encoding)
-
- def close(self):
- """compute and display similarities on closing (i.e. end of parsing)"""
- total = sum([len(lineset) for lineset in self.linesets])
- duplicated = 0
- stats = self.stats
- for num, couples in self._compute_sims():
- msg = []
- for lineset, idx in couples:
- msg.append("==%s:%s" % (lineset.name, idx))
- msg.sort()
- # pylint: disable=W0631
- for line in lineset._real_lines[idx:idx+num]:
- msg.append(line.rstrip())
- self.add_message('R0801', args=(len(couples), '\n'.join(msg)))
- duplicated += num * (len(couples) - 1)
- stats['nb_duplicated_lines'] = duplicated
- stats['percent_duplicated_lines'] = total and duplicated * 100. / total
-
-
-def register(linter):
- """required method to auto register this checker """
- linter.register_checker(SimilarChecker(linter))
-
-def usage(status=0):
- """display command line usage information"""
- print("finds copy pasted blocks in a set of files")
- print()
- print('Usage: symilar [-d|--duplicates min_duplicated_lines] \
-[-i|--ignore-comments] [--ignore-docstrings] [--ignore-imports] file1...')
- sys.exit(status)
-
-def Run(argv=None):
- """standalone command line access point"""
- if argv is None:
- argv = sys.argv[1:]
- from getopt import getopt
- s_opts = 'hdi'
- l_opts = ('help', 'duplicates=', 'ignore-comments', 'ignore-imports',
- 'ignore-docstrings')
- min_lines = 4
- ignore_comments = False
- ignore_docstrings = False
- ignore_imports = False
- opts, args = getopt(argv, s_opts, l_opts)
- for opt, val in opts:
- if opt in ('-d', '--duplicates'):
- min_lines = int(val)
- elif opt in ('-h', '--help'):
- usage()
- elif opt in ('-i', '--ignore-comments'):
- ignore_comments = True
- elif opt in ('--ignore-docstrings',):
- ignore_docstrings = True
- elif opt in ('--ignore-imports',):
- ignore_imports = True
- if not args:
- usage(1)
- sim = Similar(min_lines, ignore_comments, ignore_docstrings, ignore_imports)
- for filename in args:
- with open(filename) as stream:
- sim.append_stream(filename, stream)
- sim.run()
- sys.exit(0)
-
-if __name__ == '__main__':
- Run()
diff --git a/chromium/third_party/pylint/pylint/checkers/spelling.py b/chromium/third_party/pylint/pylint/checkers/spelling.py
deleted file mode 100644
index 6cc604ad89e..00000000000
--- a/chromium/third_party/pylint/pylint/checkers/spelling.py
+++ /dev/null
@@ -1,241 +0,0 @@
-# Copyright 2014 Michal Nowikowski.
-#
-# 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 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.
-"""Checker for spelling errors in comments and docstrings.
-"""
-
-import sys
-import tokenize
-import string
-import re
-
-if sys.version_info[0] >= 3:
- maketrans = str.maketrans
-else:
- maketrans = string.maketrans
-
-from pylint.interfaces import ITokenChecker, IAstroidChecker
-from pylint.checkers import BaseTokenChecker
-from pylint.checkers.utils import check_messages
-
-try:
- import enchant
-except ImportError:
- enchant = None
-
-if enchant is not None:
- br = enchant.Broker()
- dicts = br.list_dicts()
- dict_choices = [''] + [d[0] for d in dicts]
- dicts = ["%s (%s)" % (d[0], d[1].name) for d in dicts]
- dicts = ", ".join(dicts)
- instr = ""
-else:
- dicts = "none"
- dict_choices = ['']
- instr = " To make it working install python-enchant package."
-
-table = maketrans("", "")
-
-class SpellingChecker(BaseTokenChecker):
- """Check spelling in comments and docstrings"""
- __implements__ = (ITokenChecker, IAstroidChecker)
- name = 'spelling'
- msgs = {
- 'C0401': ('Wrong spelling of a word \'%s\' in a comment:\n%s\n'
- '%s\nDid you mean: \'%s\'?',
- 'wrong-spelling-in-comment',
- 'Used when a word in comment is not spelled correctly.'),
- 'C0402': ('Wrong spelling of a word \'%s\' in a docstring:\n%s\n'
- '%s\nDid you mean: \'%s\'?',
- 'wrong-spelling-in-docstring',
- 'Used when a word in docstring is not spelled correctly.'),
- }
- options = (('spelling-dict',
- {'default' : '', 'type' : 'choice', 'metavar' : '<dict name>',
- 'choices': dict_choices,
- 'help' : 'Spelling dictionary name. '
- 'Available dictionaries: %s.%s' % (dicts, instr)}),
- ('spelling-ignore-words',
- {'default' : '',
- 'type' : 'string',
- 'metavar' : '<comma separated words>',
- 'help' : 'List of comma separated words that '
- 'should not be checked.'}),
- ('spelling-private-dict-file',
- {'default' : '',
- 'type' : 'string',
- 'metavar' : '<path to file>',
- 'help' : 'A path to a file that contains private '
- 'dictionary; one word per line.'}),
- ('spelling-store-unknown-words',
- {'default' : 'n', 'type' : 'yn', 'metavar' : '<y_or_n>',
- 'help' : 'Tells whether to store unknown words to '
- 'indicated private dictionary in '
- '--spelling-private-dict-file option instead of '
- 'raising a message.'}),
- )
-
- def open(self):
- self.initialized = False
- self.private_dict_file = None
-
- if enchant is None:
- return
- dict_name = self.config.spelling_dict
- if not dict_name:
- return
-
- self.ignore_list = [w.strip() for w in self.config.spelling_ignore_words.split(",")]
- # "param" appears in docstring in param description and
- # "pylint" appears in comments in pylint pragmas.
- self.ignore_list.extend(["param", "pylint"])
-
- if self.config.spelling_private_dict_file:
- self.spelling_dict = enchant.DictWithPWL(
- dict_name, self.config.spelling_private_dict_file)
- self.private_dict_file = open(
- self.config.spelling_private_dict_file, "a")
- else:
- self.spelling_dict = enchant.Dict(dict_name)
-
- if self.config.spelling_store_unknown_words:
- self.unknown_words = set()
-
- # Prepare regex for stripping punctuation signs from text.
- # ' and _ are treated in a special way.
- puncts = string.punctuation.replace("'", "").replace("_", "")
- self.punctuation_regex = re.compile('[%s]' % re.escape(puncts))
- self.initialized = True
-
- def close(self):
- if self.private_dict_file:
- self.private_dict_file.close()
-
- def _check_spelling(self, msgid, line, line_num):
- line2 = line.strip()
- # Replace ['afadf with afadf (but preserve don't)
- line2 = re.sub("'([^a-zA-Z]|$)", " ", line2)
- # Replace afadf'] with afadf (but preserve don't)
- line2 = re.sub("([^a-zA-Z]|^)'", " ", line2)
- # Replace punctuation signs with space e.g. and/or -> and or
- line2 = self.punctuation_regex.sub(' ', line2)
-
- words = []
- for word in line2.split():
- # Skip words with digits.
- if len(re.findall(r"\d", word)) > 0:
- continue
-
- # Skip words with mixed big and small letters,
- # they are probaly class names.
- if (len(re.findall("[A-Z]", word)) > 0 and
- len(re.findall("[a-z]", word)) > 0 and
- len(word) > 2):
- continue
-
- # Skip words with _ - they are probably function parameter names.
- if word.count('_') > 0:
- continue
-
- words.append(word)
-
- # Go through words and check them.
- for word in words:
- # Skip words from ignore list.
- if word in self.ignore_list:
- continue
-
- orig_word = word
- word = word.lower()
-
- # Strip starting u' from unicode literals and r' from raw strings.
- if (word.startswith("u'") or
- word.startswith('u"') or
- word.startswith("r'") or
- word.startswith('r"')) and len(word) > 2:
- word = word[2:]
-
- # If it is a known word, then continue.
- if self.spelling_dict.check(word):
- continue
-
- # Store word to private dict or raise a message.
- if self.config.spelling_store_unknown_words:
- if word not in self.unknown_words:
- self.private_dict_file.write("%s\n" % word)
- self.unknown_words.add(word)
- else:
- # Present up to 4 suggestions.
- # TODO: add support for customising this.
- suggestions = self.spelling_dict.suggest(word)[:4]
-
- m = re.search(r"(\W|^)(%s)(\W|$)" % word, line.lower())
- if m:
- # Start position of second group in regex.
- col = m.regs[2][0]
- else:
- col = line.lower().index(word)
- indicator = (" " * col) + ("^" * len(word))
-
- self.add_message(msgid, line=line_num,
- args=(orig_word, line,
- indicator,
- "' or '".join(suggestions)))
-
- def process_tokens(self, tokens):
- if not self.initialized:
- return
-
- # Process tokens and look for comments.
- for (tok_type, token, (start_row, _), _, _) in tokens:
- if tok_type == tokenize.COMMENT:
- self._check_spelling('wrong-spelling-in-comment',
- token, start_row)
-
- @check_messages('wrong-spelling-in-docstring')
- def visit_module(self, node):
- if not self.initialized:
- return
- self._check_docstring(node)
-
- @check_messages('wrong-spelling-in-docstring')
- def visit_class(self, node):
- if not self.initialized:
- return
- self._check_docstring(node)
-
- @check_messages('wrong-spelling-in-docstring')
- def visit_function(self, node):
- if not self.initialized:
- return
- self._check_docstring(node)
-
- def _check_docstring(self, node):
- """check the node has any spelling errors"""
- docstring = node.doc
- if not docstring:
- return
-
- start_line = node.lineno + 1
-
- # Go through lines of docstring
- for idx, line in enumerate(docstring.splitlines()):
- self._check_spelling('wrong-spelling-in-docstring',
- line, start_line + idx)
-
-
-def register(linter):
- """required method to auto register this checker """
- linter.register_checker(SpellingChecker(linter))
diff --git a/chromium/third_party/pylint/pylint/checkers/stdlib.py b/chromium/third_party/pylint/pylint/checkers/stdlib.py
deleted file mode 100644
index b6b80262337..00000000000
--- a/chromium/third_party/pylint/pylint/checkers/stdlib.py
+++ /dev/null
@@ -1,173 +0,0 @@
-# Copyright 2012 Google Inc.
-#
-# http://www.logilab.fr/ -- mailto:contact@logilab.fr
-# 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 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.
-"""Checkers for various standard library functions."""
-
-import re
-import six
-import sys
-
-import astroid
-from astroid.bases import Instance
-
-from pylint.interfaces import IAstroidChecker
-from pylint.checkers import BaseChecker
-from pylint.checkers import utils
-
-
-if sys.version_info >= (3, 0):
- OPEN_MODULE = '_io'
-else:
- OPEN_MODULE = '__builtin__'
-
-
-def _check_mode_str(mode):
- # check type
- if not isinstance(mode, six.string_types):
- return False
- # check syntax
- modes = set(mode)
- _mode = "rwatb+U"
- creating = False
- if six.PY3:
- _mode += "x"
- creating = "x" in modes
- if modes - set(_mode) or len(mode) > len(modes):
- return False
- # check logic
- reading = "r" in modes
- writing = "w" in modes
- appending = "a" in modes
- updating = "+" in modes
- text = "t" in modes
- binary = "b" in modes
- if "U" in modes:
- if writing or appending or creating and six.PY3:
- return False
- reading = True
- if not six.PY3:
- binary = True
- if text and binary:
- return False
- total = reading + writing + appending + (creating if six.PY3 else 0)
- if total > 1:
- return False
- if not (reading or writing or appending or creating and six.PY3):
- return False
- # other 2.x constraints
- if not six.PY3:
- if "U" in mode:
- mode = mode.replace("U", "")
- if "r" not in mode:
- mode = "r" + mode
- return mode[0] in ("r", "w", "a", "U")
- return True
-
-
-class StdlibChecker(BaseChecker):
- __implements__ = (IAstroidChecker,)
- name = 'stdlib'
-
- msgs = {
- 'W1501': ('"%s" is not a valid mode for open.',
- 'bad-open-mode',
- 'Python supports: r, w, a[, x] modes with b, +, '
- 'and U (only with r) options. '
- 'See http://docs.python.org/2/library/functions.html#open'),
- 'W1502': ('Using datetime.time in a boolean context.',
- 'boolean-datetime',
- 'Using datetetime.time in a boolean context can hide '
- 'subtle bugs when the time they represent matches '
- 'midnight UTC. This behaviour was fixed in Python 3.5. '
- 'See http://bugs.python.org/issue13936 for reference.',
- {'maxversion': (3, 5)}),
- 'W1503': ('Redundant use of %s with constant '
- 'value %r',
- 'redundant-unittest-assert',
- 'The first argument of assertTrue and assertFalse is'
- 'a condition. If a constant is passed as parameter, that'
- 'condition will be always true. In this case a warning '
- 'should be emitted.')
- }
-
- @utils.check_messages('bad-open-mode', 'redundant-unittest-assert')
- def visit_callfunc(self, node):
- """Visit a CallFunc node."""
- if hasattr(node, 'func'):
- infer = utils.safe_infer(node.func)
- if infer:
- if infer.root().name == OPEN_MODULE:
- if getattr(node.func, 'name', None) in ('open', 'file'):
- self._check_open_mode(node)
- if infer.root().name == 'unittest.case':
- self._check_redundant_assert(node, infer)
-
- @utils.check_messages('boolean-datetime')
- def visit_unaryop(self, node):
- if node.op == 'not':
- self._check_datetime(node.operand)
-
- @utils.check_messages('boolean-datetime')
- def visit_if(self, node):
- self._check_datetime(node.test)
-
- @utils.check_messages('boolean-datetime')
- def visit_ifexp(self, node):
- self._check_datetime(node.test)
-
- @utils.check_messages('boolean-datetime')
- def visit_boolop(self, node):
- for value in node.values:
- self._check_datetime(value)
-
- def _check_redundant_assert(self, node, infer):
- if (isinstance(infer, astroid.BoundMethod) and
- node.args and isinstance(node.args[0], astroid.Const) and
- infer.name in ['assertTrue', 'assertFalse']):
- self.add_message('redundant-unittest-assert',
- args=(infer.name, node.args[0].value, ),
- node=node)
-
- def _check_datetime(self, node):
- """ Check that a datetime was infered.
- If so, emit boolean-datetime warning.
- """
- try:
- infered = next(node.infer())
- except astroid.InferenceError:
- return
- if (isinstance(infered, Instance) and
- infered.qname() == 'datetime.time'):
- self.add_message('boolean-datetime', node=node)
-
-
- def _check_open_mode(self, node):
- """Check that the mode argument of an open or file call is valid."""
- try:
- mode_arg = utils.get_argument_from_call(node, position=1,
- keyword='mode')
- except utils.NoSuchArgumentError:
- return
- if mode_arg:
- mode_arg = utils.safe_infer(mode_arg)
- if (isinstance(mode_arg, astroid.Const)
- and not _check_mode_str(mode_arg.value)):
- self.add_message('bad-open-mode', node=node,
- args=mode_arg.value)
-
-
-def register(linter):
- """required method to auto register this checker """
- linter.register_checker(StdlibChecker(linter))
diff --git a/chromium/third_party/pylint/pylint/checkers/strings.py b/chromium/third_party/pylint/pylint/checkers/strings.py
deleted file mode 100644
index e88085d44a4..00000000000
--- a/chromium/third_party/pylint/pylint/checkers/strings.py
+++ /dev/null
@@ -1,615 +0,0 @@
-# Copyright (c) 2009-2010 Arista Networks, Inc. - James Lingard
-# Copyright (c) 2004-2013 LOGILAB S.A. (Paris, FRANCE).
-# Copyright 2012 Google Inc.
-#
-# http://www.logilab.fr/ -- mailto:contact@logilab.fr
-# 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 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.
-"""Checker for string formatting operations.
-"""
-
-import sys
-import tokenize
-import string
-import numbers
-
-import astroid
-
-from pylint.interfaces import ITokenChecker, IAstroidChecker, IRawChecker
-from pylint.checkers import BaseChecker, BaseTokenChecker
-from pylint.checkers import utils
-from pylint.checkers.utils import check_messages
-
-import six
-
-
-_PY3K = sys.version_info[:2] >= (3, 0)
-_PY27 = sys.version_info[:2] == (2, 7)
-
-MSGS = {
- 'E1300': ("Unsupported format character %r (%#02x) at index %d",
- "bad-format-character",
- "Used when a unsupported format character is used in a format\
- string."),
- 'E1301': ("Format string ends in middle of conversion specifier",
- "truncated-format-string",
- "Used when a format string terminates before the end of a \
- conversion specifier."),
- 'E1302': ("Mixing named and unnamed conversion specifiers in format string",
- "mixed-format-string",
- "Used when a format string contains both named (e.g. '%(foo)d') \
- and unnamed (e.g. '%d') conversion specifiers. This is also \
- used when a named conversion specifier contains * for the \
- minimum field width and/or precision."),
- 'E1303': ("Expected mapping for format string, not %s",
- "format-needs-mapping",
- "Used when a format string that uses named conversion specifiers \
- is used with an argument that is not a mapping."),
- 'W1300': ("Format string dictionary key should be a string, not %s",
- "bad-format-string-key",
- "Used when a format string that uses named conversion specifiers \
- is used with a dictionary whose keys are not all strings."),
- 'W1301': ("Unused key %r in format string dictionary",
- "unused-format-string-key",
- "Used when a format string that uses named conversion specifiers \
- is used with a dictionary that conWtains keys not required by the \
- format string."),
- 'E1304': ("Missing key %r in format string dictionary",
- "missing-format-string-key",
- "Used when a format string that uses named conversion specifiers \
- is used with a dictionary that doesn't contain all the keys \
- required by the format string."),
- 'E1305': ("Too many arguments for format string",
- "too-many-format-args",
- "Used when a format string that uses unnamed conversion \
- specifiers is given too many arguments."),
- 'E1306': ("Not enough arguments for format string",
- "too-few-format-args",
- "Used when a format string that uses unnamed conversion \
- specifiers is given too few arguments"),
-
- 'W1302': ("Invalid format string",
- "bad-format-string",
- "Used when a PEP 3101 format string is invalid.",
- {'minversion': (2, 7)}),
- 'W1303': ("Missing keyword argument %r for format string",
- "missing-format-argument-key",
- "Used when a PEP 3101 format string that uses named fields "
- "doesn't receive one or more required keywords.",
- {'minversion': (2, 7)}),
- 'W1304': ("Unused format argument %r",
- "unused-format-string-argument",
- "Used when a PEP 3101 format string that uses named "
- "fields is used with an argument that "
- "is not required by the format string.",
- {'minversion': (2, 7)}),
- 'W1305': ("Format string contains both automatic field numbering "
- "and manual field specification",
- "format-combined-specification",
- "Usen when a PEP 3101 format string contains both automatic "
- "field numbering (e.g. '{}') and manual field "
- "specification (e.g. '{0}').",
- {'minversion': (2, 7)}),
- 'W1306': ("Missing format attribute %r in format specifier %r",
- "missing-format-attribute",
- "Used when a PEP 3101 format string uses an "
- "attribute specifier ({0.length}), but the argument "
- "passed for formatting doesn't have that attribute.",
- {'minversion': (2, 7)}),
- 'W1307': ("Using invalid lookup key %r in format specifier %r",
- "invalid-format-index",
- "Used when a PEP 3101 format string uses a lookup specifier "
- "({a[1]}), but the argument passed for formatting "
- "doesn't contain or doesn't have that key as an attribute.",
- {'minversion': (2, 7)})
- }
-
-OTHER_NODES = (astroid.Const, astroid.List, astroid.Backquote,
- astroid.Lambda, astroid.Function,
- astroid.ListComp, astroid.SetComp, astroid.GenExpr)
-
-if _PY3K:
- import _string
-
- def split_format_field_names(format_string):
- return _string.formatter_field_name_split(format_string)
-else:
- def _field_iterator_convertor(iterator):
- for is_attr, key in iterator:
- if isinstance(key, numbers.Number):
- yield is_attr, int(key)
- else:
- yield is_attr, key
-
- def split_format_field_names(format_string):
- keyname, fielditerator = format_string._formatter_field_name_split()
- # it will return longs, instead of ints, which will complicate
- # the output
- return keyname, _field_iterator_convertor(fielditerator)
-
-
-def collect_string_fields(format_string):
- """ Given a format string, return an iterator
- of all the valid format fields. It handles nested fields
- as well.
- """
-
- formatter = string.Formatter()
- try:
- parseiterator = formatter.parse(format_string)
- for result in parseiterator:
- if all(item is None for item in result[1:]):
- # not a replacement format
- continue
- name = result[1]
- nested = result[2]
- yield name
- if nested:
- for field in collect_string_fields(nested):
- yield field
- except ValueError:
- # probably the format string is invalid
- # should we check the argument of the ValueError?
- raise utils.IncompleteFormatString(format_string)
-
-def parse_format_method_string(format_string):
- """
- Parses a PEP 3101 format string, returning a tuple of
- (keys, num_args, manual_pos_arg),
- where keys is the set of mapping keys in the format string, num_args
- is the number of arguments required by the format string and
- manual_pos_arg is the number of arguments passed with the position.
- """
- keys = []
- num_args = 0
- manual_pos_arg = set()
- for name in collect_string_fields(format_string):
- if name and str(name).isdigit():
- manual_pos_arg.add(str(name))
- elif name:
- keyname, fielditerator = split_format_field_names(name)
- if isinstance(keyname, numbers.Number):
- # In Python 2 it will return long which will lead
- # to different output between 2 and 3
- manual_pos_arg.add(keyname)
- keyname = int(keyname)
- keys.append((keyname, list(fielditerator)))
- else:
- num_args += 1
- return keys, num_args, len(manual_pos_arg)
-
-def get_args(callfunc):
- """ Get the arguments from the given `CallFunc` node.
- Return a tuple, where the first element is the
- number of positional arguments and the second element
- is the keyword arguments in a dict.
- """
- positional = 0
- named = {}
-
- for arg in callfunc.args:
- if isinstance(arg, astroid.Keyword):
- named[arg.arg] = utils.safe_infer(arg.value)
- else:
- positional += 1
- return positional, named
-
-def get_access_path(key, parts):
- """ Given a list of format specifiers, returns
- the final access path (e.g. a.b.c[0][1]).
- """
- path = []
- for is_attribute, specifier in parts:
- if is_attribute:
- path.append(".{}".format(specifier))
- else:
- path.append("[{!r}]".format(specifier))
- return str(key) + "".join(path)
-
-
-class StringFormatChecker(BaseChecker):
- """Checks string formatting operations to ensure that the format string
- is valid and the arguments match the format string.
- """
-
- __implements__ = (IAstroidChecker,)
- name = 'string'
- msgs = MSGS
-
- @check_messages(*(MSGS.keys()))
- def visit_binop(self, node):
- if node.op != '%':
- return
- left = node.left
- args = node.right
-
- if not (isinstance(left, astroid.Const)
- and isinstance(left.value, six.string_types)):
- return
- format_string = left.value
- try:
- required_keys, required_num_args = \
- utils.parse_format_string(format_string)
- except utils.UnsupportedFormatCharacter as e:
- c = format_string[e.index]
- self.add_message('bad-format-character',
- node=node, args=(c, ord(c), e.index))
- return
- except utils.IncompleteFormatString:
- self.add_message('truncated-format-string', node=node)
- return
- if required_keys and required_num_args:
- # The format string uses both named and unnamed format
- # specifiers.
- self.add_message('mixed-format-string', node=node)
- elif required_keys:
- # The format string uses only named format specifiers.
- # Check that the RHS of the % operator is a mapping object
- # that contains precisely the set of keys required by the
- # format string.
- if isinstance(args, astroid.Dict):
- keys = set()
- unknown_keys = False
- for k, _ in args.items:
- if isinstance(k, astroid.Const):
- key = k.value
- if isinstance(key, six.string_types):
- keys.add(key)
- else:
- self.add_message('bad-format-string-key',
- node=node, args=key)
- else:
- # One of the keys was something other than a
- # constant. Since we can't tell what it is,
- # supress checks for missing keys in the
- # dictionary.
- unknown_keys = True
- if not unknown_keys:
- for key in required_keys:
- if key not in keys:
- self.add_message('missing-format-string-key',
- node=node, args=key)
- for key in keys:
- if key not in required_keys:
- self.add_message('unused-format-string-key',
- node=node, args=key)
- elif isinstance(args, OTHER_NODES + (astroid.Tuple,)):
- type_name = type(args).__name__
- self.add_message('format-needs-mapping',
- node=node, args=type_name)
- # else:
- # The RHS of the format specifier is a name or
- # expression. It may be a mapping object, so
- # there's nothing we can check.
- else:
- # The format string uses only unnamed format specifiers.
- # Check that the number of arguments passed to the RHS of
- # the % operator matches the number required by the format
- # string.
- if isinstance(args, astroid.Tuple):
- num_args = len(args.elts)
- elif isinstance(args, OTHER_NODES + (astroid.Dict, astroid.DictComp)):
- num_args = 1
- else:
- # The RHS of the format specifier is a name or
- # expression. It could be a tuple of unknown size, so
- # there's nothing we can check.
- num_args = None
- if num_args is not None:
- if num_args > required_num_args:
- self.add_message('too-many-format-args', node=node)
- elif num_args < required_num_args:
- self.add_message('too-few-format-args', node=node)
-
-
-class StringMethodsChecker(BaseChecker):
- __implements__ = (IAstroidChecker,)
- name = 'string'
- msgs = {
- 'E1310': ("Suspicious argument in %s.%s call",
- "bad-str-strip-call",
- "The argument to a str.{l,r,}strip call contains a"
- " duplicate character, "),
- }
-
- @check_messages(*(MSGS.keys()))
- def visit_callfunc(self, node):
- func = utils.safe_infer(node.func)
- if (isinstance(func, astroid.BoundMethod)
- and isinstance(func.bound, astroid.Instance)
- and func.bound.name in ('str', 'unicode', 'bytes')):
- if func.name in ('strip', 'lstrip', 'rstrip') and node.args:
- arg = utils.safe_infer(node.args[0])
- if not isinstance(arg, astroid.Const):
- return
- if len(arg.value) != len(set(arg.value)):
- self.add_message('bad-str-strip-call', node=node,
- args=(func.bound.name, func.name))
- elif func.name == 'format':
- if _PY27 or _PY3K:
- self._check_new_format(node, func)
-
- def _check_new_format(self, node, func):
- """ Check the new string formatting. """
- # TODO: skip (for now) format nodes which don't have
- # an explicit string on the left side of the format operation.
- # We do this because our inference engine can't properly handle
- # redefinitions of the original string.
- # For more details, see issue 287.
- #
- # Note that there may not be any left side at all, if the format method
- # has been assigned to another variable. See issue 351. For example:
- #
- # fmt = 'some string {}'.format
- # fmt('arg')
- if (isinstance(node.func, astroid.Getattr)
- and not isinstance(node.func.expr, astroid.Const)):
- return
- try:
- strnode = next(func.bound.infer())
- except astroid.InferenceError:
- return
- if not isinstance(strnode, astroid.Const):
- return
- if node.starargs or node.kwargs:
- # TODO: Don't complicate the logic, skip these for now.
- return
- try:
- positional, named = get_args(node)
- except astroid.InferenceError:
- return
- try:
- fields, num_args, manual_pos = parse_format_method_string(strnode.value)
- except utils.IncompleteFormatString:
- self.add_message('bad-format-string', node=node)
- return
-
- named_fields = set(field[0] for field in fields
- if isinstance(field[0], six.string_types))
- if num_args and manual_pos:
- self.add_message('format-combined-specification',
- node=node)
- return
-
- check_args = False
- # Consider "{[0]} {[1]}" as num_args.
- num_args += sum(1 for field in named_fields
- if field == '')
- if named_fields:
- for field in named_fields:
- if field not in named and field:
- self.add_message('missing-format-argument-key',
- node=node,
- args=(field, ))
- for field in named:
- if field not in named_fields:
- self.add_message('unused-format-string-argument',
- node=node,
- args=(field, ))
- # num_args can be 0 if manual_pos is not.
- num_args = num_args or manual_pos
- if positional or num_args:
- empty = any(True for field in named_fields
- if field == '')
- if named or empty:
- # Verify the required number of positional arguments
- # only if the .format got at least one keyword argument.
- # This means that the format strings accepts both
- # positional and named fields and we should warn
- # when one of the them is missing or is extra.
- check_args = True
- else:
- check_args = True
- if check_args:
- # num_args can be 0 if manual_pos is not.
- num_args = num_args or manual_pos
- if positional > num_args:
- self.add_message('too-many-format-args', node=node)
- elif positional < num_args:
- self.add_message('too-few-format-args', node=node)
-
- self._check_new_format_specifiers(node, fields, named)
-
- def _check_new_format_specifiers(self, node, fields, named):
- """
- Check attribute and index access in the format
- string ("{0.a}" and "{0[a]}").
- """
- for key, specifiers in fields:
- # Obtain the argument. If it can't be obtained
- # or infered, skip this check.
- if key == '':
- # {[0]} will have an unnamed argument, defaulting
- # to 0. It will not be present in `named`, so use the value
- # 0 for it.
- key = 0
- if isinstance(key, numbers.Number):
- try:
- argname = utils.get_argument_from_call(node, key)
- except utils.NoSuchArgumentError:
- continue
- else:
- if key not in named:
- continue
- argname = named[key]
- if argname in (astroid.YES, None):
- continue
- try:
- argument = next(argname.infer())
- except astroid.InferenceError:
- continue
- if not specifiers or argument is astroid.YES:
- # No need to check this key if it doesn't
- # use attribute / item access
- continue
- if argument.parent and isinstance(argument.parent, astroid.Arguments):
- # Ignore any object coming from an argument,
- # because we can't infer its value properly.
- continue
- previous = argument
- parsed = []
- for is_attribute, specifier in specifiers:
- if previous is astroid.YES:
- break
- parsed.append((is_attribute, specifier))
- if is_attribute:
- try:
- previous = previous.getattr(specifier)[0]
- except astroid.NotFoundError:
- if (hasattr(previous, 'has_dynamic_getattr') and
- previous.has_dynamic_getattr()):
- # Don't warn if the object has a custom __getattr__
- break
- path = get_access_path(key, parsed)
- self.add_message('missing-format-attribute',
- args=(specifier, path),
- node=node)
- break
- else:
- warn_error = False
- if hasattr(previous, 'getitem'):
- try:
- previous = previous.getitem(specifier)
- except (IndexError, TypeError):
- warn_error = True
- else:
- try:
- # Lookup __getitem__ in the current node,
- # but skip further checks, because we can't
- # retrieve the looked object
- previous.getattr('__getitem__')
- break
- except astroid.NotFoundError:
- warn_error = True
- if warn_error:
- path = get_access_path(key, parsed)
- self.add_message('invalid-format-index',
- args=(specifier, path),
- node=node)
- break
-
- try:
- previous = next(previous.infer())
- except astroid.InferenceError:
- # can't check further if we can't infer it
- break
-
-
-
-class StringConstantChecker(BaseTokenChecker):
- """Check string literals"""
- __implements__ = (ITokenChecker, IRawChecker)
- name = 'string_constant'
- msgs = {
- 'W1401': ('Anomalous backslash in string: \'%s\'. '
- 'String constant might be missing an r prefix.',
- 'anomalous-backslash-in-string',
- 'Used when a backslash is in a literal string but not as an '
- 'escape.'),
- 'W1402': ('Anomalous Unicode escape in byte string: \'%s\'. '
- 'String constant might be missing an r or u prefix.',
- 'anomalous-unicode-escape-in-string',
- 'Used when an escape like \\u is encountered in a byte '
- 'string where it has no effect.'),
- }
-
- # Characters that have a special meaning after a backslash in either
- # Unicode or byte strings.
- ESCAPE_CHARACTERS = 'abfnrtvx\n\r\t\\\'\"01234567'
-
- # TODO(mbp): Octal characters are quite an edge case today; people may
- # prefer a separate warning where they occur. \0 should be allowed.
-
- # Characters that have a special meaning after a backslash but only in
- # Unicode strings.
- UNICODE_ESCAPE_CHARACTERS = 'uUN'
-
- def process_module(self, module):
- self._unicode_literals = 'unicode_literals' in module.future_imports
-
- def process_tokens(self, tokens):
- for (tok_type, token, (start_row, _), _, _) in tokens:
- if tok_type == tokenize.STRING:
- # 'token' is the whole un-parsed token; we can look at the start
- # of it to see whether it's a raw or unicode string etc.
- self.process_string_token(token, start_row)
-
- def process_string_token(self, token, start_row):
- for i, c in enumerate(token):
- if c in '\'\"':
- quote_char = c
- break
- # pylint: disable=undefined-loop-variable
- prefix = token[:i].lower() # markers like u, b, r.
- after_prefix = token[i:]
- if after_prefix[:3] == after_prefix[-3:] == 3 * quote_char:
- string_body = after_prefix[3:-3]
- else:
- string_body = after_prefix[1:-1] # Chop off quotes
- # No special checks on raw strings at the moment.
- if 'r' not in prefix:
- self.process_non_raw_string_token(prefix, string_body, start_row)
-
- def process_non_raw_string_token(self, prefix, string_body, start_row):
- """check for bad escapes in a non-raw string.
-
- prefix: lowercase string of eg 'ur' string prefix markers.
- string_body: the un-parsed body of the string, not including the quote
- marks.
- start_row: integer line number in the source.
- """
- # Walk through the string; if we see a backslash then escape the next
- # character, and skip over it. If we see a non-escaped character,
- # alert, and continue.
- #
- # Accept a backslash when it escapes a backslash, or a quote, or
- # end-of-line, or one of the letters that introduce a special escape
- # sequence <http://docs.python.org/reference/lexical_analysis.html>
- #
- # TODO(mbp): Maybe give a separate warning about the rarely-used
- # \a \b \v \f?
- #
- # TODO(mbp): We could give the column of the problem character, but
- # add_message doesn't seem to have a way to pass it through at present.
- i = 0
- while True:
- i = string_body.find('\\', i)
- if i == -1:
- break
- # There must be a next character; having a backslash at the end
- # of the string would be a SyntaxError.
- next_char = string_body[i+1]
- match = string_body[i:i+2]
- if next_char in self.UNICODE_ESCAPE_CHARACTERS:
- if 'u' in prefix:
- pass
- elif (_PY3K or self._unicode_literals) and 'b' not in prefix:
- pass # unicode by default
- else:
- self.add_message('anomalous-unicode-escape-in-string',
- line=start_row, args=(match, ))
- elif next_char not in self.ESCAPE_CHARACTERS:
- self.add_message('anomalous-backslash-in-string',
- line=start_row, args=(match, ))
- # Whether it was a valid escape or not, backslash followed by
- # another character can always be consumed whole: the second
- # character can never be the start of a new backslash escape.
- i += 2
-
-
-
-def register(linter):
- """required method to auto register this checker """
- linter.register_checker(StringFormatChecker(linter))
- linter.register_checker(StringMethodsChecker(linter))
- linter.register_checker(StringConstantChecker(linter))
diff --git a/chromium/third_party/pylint/pylint/checkers/typecheck.py b/chromium/third_party/pylint/pylint/checkers/typecheck.py
deleted file mode 100644
index 9f074ae05f6..00000000000
--- a/chromium/third_party/pylint/pylint/checkers/typecheck.py
+++ /dev/null
@@ -1,627 +0,0 @@
-# Copyright (c) 2006-2013 LOGILAB S.A. (Paris, FRANCE).
-# http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# 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 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.
-"""try to find more bugs in the code using astroid inference capabilities
-"""
-
-import re
-import shlex
-
-import astroid
-from astroid import InferenceError, NotFoundError, YES, Instance
-from astroid.bases import BUILTINS
-
-from pylint.interfaces import IAstroidChecker, INFERENCE, INFERENCE_FAILURE
-from pylint.checkers import BaseChecker
-from pylint.checkers.utils import (
- safe_infer, is_super,
- check_messages, decorated_with_property)
-
-MSGS = {
- 'E1101': ('%s %r has no %r member',
- 'no-member',
- 'Used when a variable is accessed for an unexistent member.',
- {'old_names': [('E1103', 'maybe-no-member')]}),
- 'E1102': ('%s is not callable',
- 'not-callable',
- 'Used when an object being called has been inferred to a non \
- callable object'),
- 'E1111': ('Assigning to function call which doesn\'t return',
- 'assignment-from-no-return',
- 'Used when an assignment is done on a function call but the \
- inferred function doesn\'t return anything.'),
- 'W1111': ('Assigning to function call which only returns None',
- 'assignment-from-none',
- 'Used when an assignment is done on a function call but the \
- inferred function returns nothing but None.'),
-
- 'E1120': ('No value for argument %s in %s call',
- 'no-value-for-parameter',
- 'Used when a function call passes too few arguments.'),
- 'E1121': ('Too many positional arguments for %s call',
- 'too-many-function-args',
- 'Used when a function call passes too many positional \
- arguments.'),
- 'E1123': ('Unexpected keyword argument %r in %s call',
- 'unexpected-keyword-arg',
- 'Used when a function call passes a keyword argument that \
- doesn\'t correspond to one of the function\'s parameter names.'),
- 'E1124': ('Argument %r passed by position and keyword in %s call',
- 'redundant-keyword-arg',
- 'Used when a function call would result in assigning multiple \
- values to a function parameter, one value from a positional \
- argument and one from a keyword argument.'),
- 'E1125': ('Missing mandatory keyword argument %r in %s call',
- 'missing-kwoa',
- ('Used when a function call does not pass a mandatory'
- ' keyword-only argument.'),
- {'minversion': (3, 0)}),
- 'E1126': ('Sequence index is not an int, slice, or instance with __index__',
- 'invalid-sequence-index',
- 'Used when a sequence type is indexed with an invalid type. '
- 'Valid types are ints, slices, and objects with an __index__ '
- 'method.'),
- 'E1127': ('Slice index is not an int, None, or instance with __index__',
- 'invalid-slice-index',
- 'Used when a slice index is not an integer, None, or an object \
- with an __index__ method.'),
- }
-
-# builtin sequence types in Python 2 and 3.
-SEQUENCE_TYPES = set(['str', 'unicode', 'list', 'tuple', 'bytearray',
- 'xrange', 'range', 'bytes', 'memoryview'])
-
-def _determine_callable(callable_obj):
- # Ordering is important, since BoundMethod is a subclass of UnboundMethod,
- # and Function inherits Lambda.
- if isinstance(callable_obj, astroid.BoundMethod):
- # Bound methods have an extra implicit 'self' argument.
- return callable_obj, 1, callable_obj.type
- elif isinstance(callable_obj, astroid.UnboundMethod):
- return callable_obj, 0, 'unbound method'
- elif isinstance(callable_obj, astroid.Function):
- return callable_obj, 0, callable_obj.type
- elif isinstance(callable_obj, astroid.Lambda):
- return callable_obj, 0, 'lambda'
- elif isinstance(callable_obj, astroid.Class):
- # Class instantiation, lookup __new__ instead.
- # If we only find object.__new__, we can safely check __init__
- # instead.
- try:
- # Use the last definition of __new__.
- new = callable_obj.local_attr('__new__')[-1]
- except astroid.NotFoundError:
- new = None
-
- if not new or new.parent.scope().name == 'object':
- try:
- # Use the last definition of __init__.
- callable_obj = callable_obj.local_attr('__init__')[-1]
- except astroid.NotFoundError:
- # do nothing, covered by no-init.
- raise ValueError
- else:
- callable_obj = new
-
- if not isinstance(callable_obj, astroid.Function):
- raise ValueError
- # both have an extra implicit 'cls'/'self' argument.
- return callable_obj, 1, 'constructor'
- else:
- raise ValueError
-
-class TypeChecker(BaseChecker):
- """try to find bugs in the code using type inference
- """
-
- __implements__ = (IAstroidChecker,)
-
- # configuration section name
- name = 'typecheck'
- # messages
- msgs = MSGS
- priority = -1
- # configuration options
- options = (('ignore-mixin-members',
- {'default' : True, 'type' : 'yn', 'metavar': '<y_or_n>',
- 'help' : 'Tells whether missing members accessed in mixin \
-class should be ignored. A mixin class is detected if its name ends with \
-"mixin" (case insensitive).'}
- ),
- ('ignored-modules',
- {'default': (),
- 'type': 'csv',
- 'metavar': '<module names>',
- 'help': 'List of module names for which member attributes \
-should not be checked (useful for modules/projects where namespaces are \
-manipulated during runtime and thus existing member attributes cannot be \
-deduced by static analysis'},
- ),
- ('ignored-classes',
- {'default' : ('SQLObject',),
- 'type' : 'csv',
- 'metavar' : '<members names>',
- 'help' : 'List of classes names for which member attributes \
-should not be checked (useful for classes with attributes dynamically set).'}
- ),
-
- ('zope',
- {'default' : False, 'type' : 'yn', 'metavar': '<y_or_n>',
- 'help' : 'When zope mode is activated, add a predefined set \
-of Zope acquired attributes to generated-members.'}
- ),
- ('generated-members',
- {'default' : ('REQUEST', 'acl_users', 'aq_parent'),
- 'type' : 'string',
- 'metavar' : '<members names>',
- 'help' : 'List of members which are set dynamically and \
-missed by pylint inference system, and so shouldn\'t trigger E0201 when \
-accessed. Python regular expressions are accepted.'}
- ),
- )
-
- def open(self):
- # do this in open since config not fully initialized in __init__
- self.generated_members = list(self.config.generated_members)
- if self.config.zope:
- self.generated_members.extend(('REQUEST', 'acl_users', 'aq_parent'))
-
- def visit_assattr(self, node):
- if isinstance(node.ass_type(), astroid.AugAssign):
- self.visit_getattr(node)
-
- def visit_delattr(self, node):
- self.visit_getattr(node)
-
- @check_messages('no-member')
- def visit_getattr(self, node):
- """check that the accessed attribute exists
-
- to avoid to much false positives for now, we'll consider the code as
- correct if a single of the inferred nodes has the accessed attribute.
-
- function/method, super call and metaclasses are ignored
- """
- # generated_members may containt regular expressions
- # (surrounded by quote `"` and followed by a comma `,`)
- # REQUEST,aq_parent,"[a-zA-Z]+_set{1,2}"' =>
- # ('REQUEST', 'aq_parent', '[a-zA-Z]+_set{1,2}')
- if isinstance(self.config.generated_members, str):
- gen = shlex.shlex(self.config.generated_members)
- gen.whitespace += ','
- gen.wordchars += '[]-+'
- self.config.generated_members = tuple(tok.strip('"') for tok in gen)
- for pattern in self.config.generated_members:
- # attribute is marked as generated, stop here
- if re.match(pattern, node.attrname):
- return
- try:
- infered = list(node.expr.infer())
- except InferenceError:
- return
- # list of (node, nodename) which are missing the attribute
- missingattr = set()
- ignoremim = self.config.ignore_mixin_members
- inference_failure = False
- for owner in infered:
- # skip yes object
- if owner is YES:
- inference_failure = True
- continue
- # skip None anyway
- if isinstance(owner, astroid.Const) and owner.value is None:
- continue
- # XXX "super" / metaclass call
- if is_super(owner) or getattr(owner, 'type', None) == 'metaclass':
- continue
- name = getattr(owner, 'name', 'None')
- if name in self.config.ignored_classes:
- continue
- if ignoremim and name[-5:].lower() == 'mixin':
- continue
- try:
- if not [n for n in owner.getattr(node.attrname)
- if not isinstance(n.statement(), astroid.AugAssign)]:
- missingattr.add((owner, name))
- continue
- except AttributeError:
- # XXX method / function
- continue
- except NotFoundError:
- if isinstance(owner, astroid.Function) and owner.decorators:
- continue
- if isinstance(owner, Instance) and owner.has_dynamic_getattr():
- continue
- # explicit skipping of module member access
- if owner.root().name in self.config.ignored_modules:
- continue
- if isinstance(owner, astroid.Class):
- # Look up in the metaclass only if the owner is itself
- # a class.
- # TODO: getattr doesn't return by default members
- # from the metaclass, because handling various cases
- # of methods accessible from the metaclass itself
- # and/or subclasses only is too complicated for little to
- # no benefit.
- metaclass = owner.metaclass()
- try:
- if metaclass and metaclass.getattr(node.attrname):
- continue
- except NotFoundError:
- pass
- missingattr.add((owner, name))
- continue
- # stop on the first found
- break
- else:
- # we have not found any node with the attributes, display the
- # message for infered nodes
- done = set()
- for owner, name in missingattr:
- if isinstance(owner, Instance):
- actual = owner._proxied
- else:
- actual = owner
- if actual in done:
- continue
- done.add(actual)
- confidence = INFERENCE if not inference_failure else INFERENCE_FAILURE
- self.add_message('no-member', node=node,
- args=(owner.display_type(), name,
- node.attrname),
- confidence=confidence)
-
- @check_messages('assignment-from-no-return', 'assignment-from-none')
- def visit_assign(self, node):
- """check that if assigning to a function call, the function is
- possibly returning something valuable
- """
- if not isinstance(node.value, astroid.CallFunc):
- return
- function_node = safe_infer(node.value.func)
- # skip class, generator and incomplete function definition
- if not (isinstance(function_node, astroid.Function) and
- function_node.root().fully_defined()):
- return
- if function_node.is_generator() \
- or function_node.is_abstract(pass_is_abstract=False):
- return
- returns = list(function_node.nodes_of_class(astroid.Return,
- skip_klass=astroid.Function))
- if len(returns) == 0:
- self.add_message('assignment-from-no-return', node=node)
- else:
- for rnode in returns:
- if not (isinstance(rnode.value, astroid.Const)
- and rnode.value.value is None
- or rnode.value is None):
- break
- else:
- self.add_message('assignment-from-none', node=node)
-
- def _check_uninferable_callfunc(self, node):
- """
- Check that the given uninferable CallFunc node does not
- call an actual function.
- """
- if not isinstance(node.func, astroid.Getattr):
- return
-
- # Look for properties. First, obtain
- # the lhs of the Getattr node and search the attribute
- # there. If that attribute is a property or a subclass of properties,
- # then most likely it's not callable.
-
- # TODO: since astroid doesn't understand descriptors very well
- # we will not handle them here, right now.
-
- expr = node.func.expr
- klass = safe_infer(expr)
- if (klass is None or klass is astroid.YES or
- not isinstance(klass, astroid.Instance)):
- return
-
- try:
- attrs = klass._proxied.getattr(node.func.attrname)
- except astroid.NotFoundError:
- return
-
- for attr in attrs:
- if attr is astroid.YES:
- continue
- if not isinstance(attr, astroid.Function):
- continue
-
- # Decorated, see if it is decorated with a property.
- # Also, check the returns and see if they are callable.
- if decorated_with_property(attr):
- if all(return_node.callable()
- for return_node in attr.infer_call_result(node)):
- continue
- else:
- self.add_message('not-callable', node=node,
- args=node.func.as_string())
- break
-
- @check_messages(*(list(MSGS.keys())))
- def visit_callfunc(self, node):
- """check that called functions/methods are inferred to callable objects,
- and that the arguments passed to the function match the parameters in
- the inferred function's definition
- """
- # Build the set of keyword arguments, checking for duplicate keywords,
- # and count the positional arguments.
- keyword_args = set()
- num_positional_args = 0
- for arg in node.args:
- if isinstance(arg, astroid.Keyword):
- keyword_args.add(arg.arg)
- else:
- num_positional_args += 1
-
- called = safe_infer(node.func)
- # only function, generator and object defining __call__ are allowed
- if called is not None and not called.callable():
- self.add_message('not-callable', node=node,
- args=node.func.as_string())
-
- self._check_uninferable_callfunc(node)
-
- try:
- called, implicit_args, callable_name = _determine_callable(called)
- except ValueError:
- # Any error occurred during determining the function type, most of
- # those errors are handled by different warnings.
- return
- num_positional_args += implicit_args
- if called.args.args is None:
- # Built-in functions have no argument information.
- return
-
- if len(called.argnames()) != len(set(called.argnames())):
- # Duplicate parameter name (see E9801). We can't really make sense
- # of the function call in this case, so just return.
- return
-
- # Analyze the list of formal parameters.
- num_mandatory_parameters = len(called.args.args) - len(called.args.defaults)
- parameters = []
- parameter_name_to_index = {}
- for i, arg in enumerate(called.args.args):
- if isinstance(arg, astroid.Tuple):
- name = None
- # Don't store any parameter names within the tuple, since those
- # are not assignable from keyword arguments.
- else:
- if isinstance(arg, astroid.Keyword):
- name = arg.arg
- else:
- assert isinstance(arg, astroid.AssName)
- # This occurs with:
- # def f( (a), (b) ): pass
- name = arg.name
- parameter_name_to_index[name] = i
- if i >= num_mandatory_parameters:
- defval = called.args.defaults[i - num_mandatory_parameters]
- else:
- defval = None
- parameters.append([(name, defval), False])
-
- kwparams = {}
- for i, arg in enumerate(called.args.kwonlyargs):
- if isinstance(arg, astroid.Keyword):
- name = arg.arg
- else:
- assert isinstance(arg, astroid.AssName)
- name = arg.name
- kwparams[name] = [called.args.kw_defaults[i], False]
-
- # Match the supplied arguments against the function parameters.
-
- # 1. Match the positional arguments.
- for i in range(num_positional_args):
- if i < len(parameters):
- parameters[i][1] = True
- elif called.args.vararg is not None:
- # The remaining positional arguments get assigned to the *args
- # parameter.
- break
- else:
- # Too many positional arguments.
- self.add_message('too-many-function-args',
- node=node, args=(callable_name,))
- break
-
- # 2. Match the keyword arguments.
- for keyword in keyword_args:
- if keyword in parameter_name_to_index:
- i = parameter_name_to_index[keyword]
- if parameters[i][1]:
- # Duplicate definition of function parameter.
- self.add_message('redundant-keyword-arg',
- node=node, args=(keyword, callable_name))
- else:
- parameters[i][1] = True
- elif keyword in kwparams:
- if kwparams[keyword][1]: # XXX is that even possible?
- # Duplicate definition of function parameter.
- self.add_message('redundant-keyword-arg', node=node,
- args=(keyword, callable_name))
- else:
- kwparams[keyword][1] = True
- elif called.args.kwarg is not None:
- # The keyword argument gets assigned to the **kwargs parameter.
- pass
- else:
- # Unexpected keyword argument.
- self.add_message('unexpected-keyword-arg', node=node,
- args=(keyword, callable_name))
-
- # 3. Match the *args, if any. Note that Python actually processes
- # *args _before_ any keyword arguments, but we wait until after
- # looking at the keyword arguments so as to make a more conservative
- # guess at how many values are in the *args sequence.
- if node.starargs is not None:
- for i in range(num_positional_args, len(parameters)):
- [(name, defval), assigned] = parameters[i]
- # Assume that *args provides just enough values for all
- # non-default parameters after the last parameter assigned by
- # the positional arguments but before the first parameter
- # assigned by the keyword arguments. This is the best we can
- # get without generating any false positives.
- if (defval is not None) or assigned:
- break
- parameters[i][1] = True
-
- # 4. Match the **kwargs, if any.
- if node.kwargs is not None:
- for i, [(name, defval), assigned] in enumerate(parameters):
- # Assume that *kwargs provides values for all remaining
- # unassigned named parameters.
- if name is not None:
- parameters[i][1] = True
- else:
- # **kwargs can't assign to tuples.
- pass
-
- # Check that any parameters without a default have been assigned
- # values.
- for [(name, defval), assigned] in parameters:
- if (defval is None) and not assigned:
- if name is None:
- display_name = '<tuple>'
- else:
- display_name = repr(name)
- self.add_message('no-value-for-parameter', node=node,
- args=(display_name, callable_name))
-
- for name in kwparams:
- defval, assigned = kwparams[name]
- if defval is None and not assigned:
- self.add_message('missing-kwoa', node=node,
- args=(name, callable_name))
-
- @check_messages('invalid-sequence-index')
- def visit_extslice(self, node):
- # Check extended slice objects as if they were used as a sequence
- # index to check if the object being sliced can support them
- return self.visit_index(node)
-
- @check_messages('invalid-sequence-index')
- def visit_index(self, node):
- if not node.parent or not hasattr(node.parent, "value"):
- return
-
- # Look for index operations where the parent is a sequence type.
- # If the types can be determined, only allow indices to be int,
- # slice or instances with __index__.
-
- parent_type = safe_infer(node.parent.value)
- if not isinstance(parent_type, (astroid.Class, astroid.Instance)):
- return
-
- # Determine what method on the parent this index will use
- # The parent of this node will be a Subscript, and the parent of that
- # node determines if the Subscript is a get, set, or delete operation.
- operation = node.parent.parent
- if isinstance(operation, astroid.Assign):
- methodname = '__setitem__'
- elif isinstance(operation, astroid.Delete):
- methodname = '__delitem__'
- else:
- methodname = '__getitem__'
-
- # Check if this instance's __getitem__, __setitem__, or __delitem__, as
- # appropriate to the statement, is implemented in a builtin sequence
- # type. This way we catch subclasses of sequence types but skip classes
- # that override __getitem__ and which may allow non-integer indices.
- try:
- methods = parent_type.getattr(methodname)
- if methods is astroid.YES:
- return
- itemmethod = methods[0]
- except (astroid.NotFoundError, IndexError):
- return
-
- if not isinstance(itemmethod, astroid.Function):
- return
- if itemmethod.root().name != BUILTINS:
- return
- if not itemmethod.parent:
- return
- if itemmethod.parent.name not in SEQUENCE_TYPES:
- return
-
- # For ExtSlice objects coming from visit_extslice, no further
- # inference is necessary, since if we got this far the ExtSlice
- # is an error.
- if isinstance(node, astroid.ExtSlice):
- index_type = node
- else:
- index_type = safe_infer(node)
- if index_type is None or index_type is astroid.YES:
- return
-
- # Constants must be of type int
- if isinstance(index_type, astroid.Const):
- if isinstance(index_type.value, int):
- return
- # Instance values must be int, slice, or have an __index__ method
- elif isinstance(index_type, astroid.Instance):
- if index_type.pytype() in (BUILTINS + '.int', BUILTINS + '.slice'):
- return
- try:
- index_type.getattr('__index__')
- return
- except astroid.NotFoundError:
- pass
-
- # Anything else is an error
- self.add_message('invalid-sequence-index', node=node)
-
- @check_messages('invalid-slice-index')
- def visit_slice(self, node):
- # Check the type of each part of the slice
- for index in (node.lower, node.upper, node.step):
- if index is None:
- continue
-
- index_type = safe_infer(index)
- if index_type is None or index_type is astroid.YES:
- continue
-
- # Constants must of type int or None
- if isinstance(index_type, astroid.Const):
- if isinstance(index_type.value, (int, type(None))):
- continue
- # Instance values must be of type int, None or an object
- # with __index__
- elif isinstance(index_type, astroid.Instance):
- if index_type.pytype() in (BUILTINS + '.int',
- BUILTINS + '.NoneType'):
- continue
-
- try:
- index_type.getattr('__index__')
- return
- except astroid.NotFoundError:
- pass
-
- # Anything else is an error
- self.add_message('invalid-slice-index', node=node)
-
-def register(linter):
- """required method to auto register this checker """
- linter.register_checker(TypeChecker(linter))
diff --git a/chromium/third_party/pylint/pylint/checkers/utils.py b/chromium/third_party/pylint/pylint/checkers/utils.py
deleted file mode 100644
index 2cb01d558e0..00000000000
--- a/chromium/third_party/pylint/pylint/checkers/utils.py
+++ /dev/null
@@ -1,564 +0,0 @@
-# pylint: disable=W0611
-#
-# Copyright (c) 2003-2013 LOGILAB S.A. (Paris, FRANCE).
-# http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# 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 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.
-"""some functions that may be useful for various checkers
-"""
-
-import re
-import sys
-import string
-
-import astroid
-from astroid import scoped_nodes
-from logilab.common.compat import builtins
-
-BUILTINS_NAME = builtins.__name__
-COMP_NODE_TYPES = astroid.ListComp, astroid.SetComp, astroid.DictComp, astroid.GenExpr
-PY3K = sys.version_info[0] == 3
-
-if not PY3K:
- EXCEPTIONS_MODULE = "exceptions"
-else:
- EXCEPTIONS_MODULE = "builtins"
-ABC_METHODS = set(('abc.abstractproperty', 'abc.abstractmethod',
- 'abc.abstractclassmethod', 'abc.abstractstaticmethod'))
-
-
-class NoSuchArgumentError(Exception):
- pass
-
-def is_inside_except(node):
- """Returns true if node is inside the name of an except handler."""
- current = node
- while current and not isinstance(current.parent, astroid.ExceptHandler):
- current = current.parent
-
- return current and current is current.parent.name
-
-
-def get_all_elements(node):
- """Recursively returns all atoms in nested lists and tuples."""
- if isinstance(node, (astroid.Tuple, astroid.List)):
- for child in node.elts:
- for e in get_all_elements(child):
- yield e
- else:
- yield node
-
-
-def clobber_in_except(node):
- """Checks if an assignment node in an except handler clobbers an existing
- variable.
-
- Returns (True, args for W0623) if assignment clobbers an existing variable,
- (False, None) otherwise.
- """
- if isinstance(node, astroid.AssAttr):
- return (True, (node.attrname, 'object %r' % (node.expr.as_string(),)))
- elif isinstance(node, astroid.AssName):
- name = node.name
- if is_builtin(name):
- return (True, (name, 'builtins'))
- else:
- stmts = node.lookup(name)[1]
- if (stmts and not isinstance(stmts[0].ass_type(),
- (astroid.Assign, astroid.AugAssign,
- astroid.ExceptHandler))):
- return (True, (name, 'outer scope (line %s)' % stmts[0].fromlineno))
- return (False, None)
-
-
-def safe_infer(node):
- """return the inferred value for the given node.
- Return None if inference failed or if there is some ambiguity (more than
- one node has been inferred)
- """
- try:
- inferit = node.infer()
- value = next(inferit)
- except astroid.InferenceError:
- return
- try:
- next(inferit)
- return # None if there is ambiguity on the inferred node
- except astroid.InferenceError:
- return # there is some kind of ambiguity
- except StopIteration:
- return value
-
-def is_super(node):
- """return True if the node is referencing the "super" builtin function
- """
- if getattr(node, 'name', None) == 'super' and \
- node.root().name == BUILTINS_NAME:
- return True
- return False
-
-def is_error(node):
- """return true if the function does nothing but raising an exception"""
- for child_node in node.get_children():
- if isinstance(child_node, astroid.Raise):
- return True
- return False
-
-def is_raising(body):
- """return true if the given statement node raise an exception"""
- for node in body:
- if isinstance(node, astroid.Raise):
- return True
- return False
-
-def is_empty(body):
- """return true if the given node does nothing but 'pass'"""
- return len(body) == 1 and isinstance(body[0], astroid.Pass)
-
-builtins = builtins.__dict__.copy()
-SPECIAL_BUILTINS = ('__builtins__',) # '__path__', '__file__')
-
-def is_builtin_object(node):
- """Returns True if the given node is an object from the __builtin__ module."""
- return node and node.root().name == BUILTINS_NAME
-
-def is_builtin(name): # was is_native_builtin
- """return true if <name> could be considered as a builtin defined by python
- """
- if name in builtins:
- return True
- if name in SPECIAL_BUILTINS:
- return True
- return False
-
-def is_defined_before(var_node):
- """return True if the variable node is defined by a parent node (list,
- set, dict, or generator comprehension, lambda) or in a previous sibling
- node on the same line (statement_defining ; statement_using)
- """
- varname = var_node.name
- _node = var_node.parent
- while _node:
- if isinstance(_node, COMP_NODE_TYPES):
- for ass_node in _node.nodes_of_class(astroid.AssName):
- if ass_node.name == varname:
- return True
- elif isinstance(_node, astroid.For):
- for ass_node in _node.target.nodes_of_class(astroid.AssName):
- if ass_node.name == varname:
- return True
- elif isinstance(_node, astroid.With):
- for expr, ids in _node.items:
- if expr.parent_of(var_node):
- break
- if (ids and
- isinstance(ids, astroid.AssName) and
- ids.name == varname):
- return True
- elif isinstance(_node, (astroid.Lambda, astroid.Function)):
- if _node.args.is_argument(varname):
- return True
- if getattr(_node, 'name', None) == varname:
- return True
- break
- elif isinstance(_node, astroid.ExceptHandler):
- if isinstance(_node.name, astroid.AssName):
- ass_node = _node.name
- if ass_node.name == varname:
- return True
- _node = _node.parent
- # possibly multiple statements on the same line using semi colon separator
- stmt = var_node.statement()
- _node = stmt.previous_sibling()
- lineno = stmt.fromlineno
- while _node and _node.fromlineno == lineno:
- for ass_node in _node.nodes_of_class(astroid.AssName):
- if ass_node.name == varname:
- return True
- for imp_node in _node.nodes_of_class((astroid.From, astroid.Import)):
- if varname in [name[1] or name[0] for name in imp_node.names]:
- return True
- _node = _node.previous_sibling()
- return False
-
-def is_func_default(node):
- """return true if the given Name node is used in function default argument's
- value
- """
- parent = node.scope()
- if isinstance(parent, astroid.Function):
- for default_node in parent.args.defaults:
- for default_name_node in default_node.nodes_of_class(astroid.Name):
- if default_name_node is node:
- return True
- return False
-
-def is_func_decorator(node):
- """return true if the name is used in function decorator"""
- parent = node.parent
- while parent is not None:
- if isinstance(parent, astroid.Decorators):
- return True
- if (parent.is_statement or
- isinstance(parent, astroid.Lambda) or
- isinstance(parent, (scoped_nodes.ComprehensionScope,
- scoped_nodes.ListComp))):
- break
- parent = parent.parent
- return False
-
-def is_ancestor_name(frame, node):
- """return True if `frame` is a astroid.Class node with `node` in the
- subtree of its bases attribute
- """
- try:
- bases = frame.bases
- except AttributeError:
- return False
- for base in bases:
- if node in base.nodes_of_class(astroid.Name):
- return True
- return False
-
-def assign_parent(node):
- """return the higher parent which is not an AssName, Tuple or List node
- """
- while node and isinstance(node, (astroid.AssName,
- astroid.Tuple,
- astroid.List)):
- node = node.parent
- return node
-
-def overrides_an_abstract_method(class_node, name):
- """return True if pnode is a parent of node"""
- for ancestor in class_node.ancestors():
- if name in ancestor and isinstance(ancestor[name], astroid.Function) and \
- ancestor[name].is_abstract(pass_is_abstract=False):
- return True
- return False
-
-def overrides_a_method(class_node, name):
- """return True if <name> is a method overridden from an ancestor"""
- for ancestor in class_node.ancestors():
- if name in ancestor and isinstance(ancestor[name], astroid.Function):
- return True
- return False
-
-PYMETHODS = set(('__new__', '__init__', '__del__', '__hash__',
- '__str__', '__repr__',
- '__len__', '__iter__',
- '__delete__', '__get__', '__set__',
- '__getitem__', '__setitem__', '__delitem__', '__contains__',
- '__getattribute__', '__getattr__', '__setattr__', '__delattr__',
- '__call__',
- '__enter__', '__exit__',
- '__cmp__', '__ge__', '__gt__', '__le__', '__lt__', '__eq__',
- '__nonzero__', '__neg__', '__invert__',
- '__mul__', '__imul__', '__rmul__',
- '__div__', '__idiv__', '__rdiv__',
- '__add__', '__iadd__', '__radd__',
- '__sub__', '__isub__', '__rsub__',
- '__pow__', '__ipow__', '__rpow__',
- '__mod__', '__imod__', '__rmod__',
- '__and__', '__iand__', '__rand__',
- '__or__', '__ior__', '__ror__',
- '__xor__', '__ixor__', '__rxor__',
- # XXX To be continued
- ))
-
-def check_messages(*messages):
- """decorator to store messages that are handled by a checker method"""
-
- def store_messages(func):
- func.checks_msgs = messages
- return func
- return store_messages
-
-class IncompleteFormatString(Exception):
- """A format string ended in the middle of a format specifier."""
- pass
-
-class UnsupportedFormatCharacter(Exception):
- """A format character in a format string is not one of the supported
- format characters."""
- def __init__(self, index):
- Exception.__init__(self, index)
- self.index = index
-
-def parse_format_string(format_string):
- """Parses a format string, returning a tuple of (keys, num_args), where keys
- is the set of mapping keys in the format string, and num_args is the number
- of arguments required by the format string. Raises
- IncompleteFormatString or UnsupportedFormatCharacter if a
- parse error occurs."""
- keys = set()
- num_args = 0
- def next_char(i):
- i += 1
- if i == len(format_string):
- raise IncompleteFormatString
- return (i, format_string[i])
- i = 0
- while i < len(format_string):
- char = format_string[i]
- if char == '%':
- i, char = next_char(i)
- # Parse the mapping key (optional).
- key = None
- if char == '(':
- depth = 1
- i, char = next_char(i)
- key_start = i
- while depth != 0:
- if char == '(':
- depth += 1
- elif char == ')':
- depth -= 1
- i, char = next_char(i)
- key_end = i - 1
- key = format_string[key_start:key_end]
-
- # Parse the conversion flags (optional).
- while char in '#0- +':
- i, char = next_char(i)
- # Parse the minimum field width (optional).
- if char == '*':
- num_args += 1
- i, char = next_char(i)
- else:
- while char in string.digits:
- i, char = next_char(i)
- # Parse the precision (optional).
- if char == '.':
- i, char = next_char(i)
- if char == '*':
- num_args += 1
- i, char = next_char(i)
- else:
- while char in string.digits:
- i, char = next_char(i)
- # Parse the length modifier (optional).
- if char in 'hlL':
- i, char = next_char(i)
- # Parse the conversion type (mandatory).
- if PY3K:
- flags = 'diouxXeEfFgGcrs%a'
- else:
- flags = 'diouxXeEfFgGcrs%'
- if char not in flags:
- raise UnsupportedFormatCharacter(i)
- if key:
- keys.add(key)
- elif char != '%':
- num_args += 1
- i += 1
- return keys, num_args
-
-
-def is_attr_protected(attrname):
- """return True if attribute name is protected (start with _ and some other
- details), False otherwise.
- """
- return attrname[0] == '_' and not attrname == '_' and not (
- attrname.startswith('__') and attrname.endswith('__'))
-
-def node_frame_class(node):
- """return klass node for a method node (or a staticmethod or a
- classmethod), return null otherwise
- """
- klass = node.frame()
-
- while klass is not None and not isinstance(klass, astroid.Class):
- if klass.parent is None:
- klass = None
- else:
- klass = klass.parent.frame()
-
- return klass
-
-def is_super_call(expr):
- """return True if expression node is a function call and if function name
- is super. Check before that you're in a method.
- """
- return (isinstance(expr, astroid.CallFunc) and
- isinstance(expr.func, astroid.Name) and
- expr.func.name == 'super')
-
-def is_attr_private(attrname):
- """Check that attribute name is private (at least two leading underscores,
- at most one trailing underscore)
- """
- regex = re.compile('^_{2,}.*[^_]+_?$')
- return regex.match(attrname)
-
-def get_argument_from_call(callfunc_node, position=None, keyword=None):
- """Returns the specified argument from a function call.
-
- :param callfunc_node: Node representing a function call to check.
- :param int position: position of the argument.
- :param str keyword: the keyword of the argument.
-
- :returns: The node representing the argument, None if the argument is not found.
- :raises ValueError: if both position and keyword are None.
- :raises NoSuchArgumentError: if no argument at the provided position or with
- the provided keyword.
- """
- if position is None and keyword is None:
- raise ValueError('Must specify at least one of: position or keyword.')
- try:
- if position is not None and not isinstance(callfunc_node.args[position], astroid.Keyword):
- return callfunc_node.args[position]
- except IndexError as error:
- raise NoSuchArgumentError(error)
- if keyword:
- for arg in callfunc_node.args:
- if isinstance(arg, astroid.Keyword) and arg.arg == keyword:
- return arg.value
- raise NoSuchArgumentError
-
-def inherit_from_std_ex(node):
- """
- Return true if the given class node is subclass of
- exceptions.Exception.
- """
- if node.name in ('Exception', 'BaseException') \
- and node.root().name == EXCEPTIONS_MODULE:
- return True
- return any(inherit_from_std_ex(parent)
- for parent in node.ancestors(recurs=False))
-
-def is_import_error(handler):
- """
- Check if the given exception handler catches
- ImportError.
-
- :param handler: A node, representing an ExceptHandler node.
- :returns: True if the handler catches ImportError, False otherwise.
- """
- names = None
- if isinstance(handler.type, astroid.Tuple):
- names = [name for name in handler.type.elts
- if isinstance(name, astroid.Name)]
- elif isinstance(handler.type, astroid.Name):
- names = [handler.type]
- else:
- # Don't try to infer that.
- return
- for name in names:
- try:
- for infered in name.infer():
- if (isinstance(infered, astroid.Class) and
- inherit_from_std_ex(infered) and
- infered.name == 'ImportError'):
- return True
- except astroid.InferenceError:
- continue
-
-def has_known_bases(klass):
- """Returns true if all base classes of a class could be inferred."""
- try:
- return klass._all_bases_known
- except AttributeError:
- pass
- for base in klass.bases:
- result = safe_infer(base)
- # TODO: check for A->B->A->B pattern in class structure too?
- if (not isinstance(result, astroid.Class) or
- result is klass or
- not has_known_bases(result)):
- klass._all_bases_known = False
- return False
- klass._all_bases_known = True
- return True
-
-def decorated_with_property(node):
- """ Detect if the given function node is decorated with a property. """
- if not node.decorators:
- return False
- for decorator in node.decorators.nodes:
- if not isinstance(decorator, astroid.Name):
- continue
- try:
- for infered in decorator.infer():
- if isinstance(infered, astroid.Class):
- if (infered.root().name == BUILTINS_NAME and
- infered.name == 'property'):
- return True
- for ancestor in infered.ancestors():
- if (ancestor.name == 'property' and
- ancestor.root().name == BUILTINS_NAME):
- return True
- except astroid.InferenceError:
- pass
-
-
-def decorated_with_abc(func):
- """Determine if the `func` node is decorated with `abc` decorators."""
- if func.decorators:
- for node in func.decorators.nodes:
- try:
- infered = next(node.infer())
- except astroid.InferenceError:
- continue
- if infered and infered.qname() in ABC_METHODS:
- return True
-
-
-def unimplemented_abstract_methods(node, is_abstract_cb=decorated_with_abc):
- """
- Get the unimplemented abstract methods for the given *node*.
-
- A method can be considered abstract if the callback *is_abstract_cb*
- returns a ``True`` value. The check defaults to verifying that
- a method is decorated with abstract methods.
- The function will work only for new-style classes. For old-style
- classes, it will simply return an empty dictionary.
- For the rest of them, it will return a dictionary of abstract method
- names and their inferred objects.
- """
- visited = {}
- try:
- mro = reversed(node.mro())
- except NotImplementedError:
- # Old style class, it will not have a mro.
- return {}
- except astroid.ResolveError:
- # Probably inconsistent hierarchy, don'try
- # to figure this out here.
- return {}
- for ancestor in mro:
- for obj in ancestor.values():
- infered = obj
- if isinstance(obj, astroid.AssName):
- infered = safe_infer(obj)
- if not infered:
- continue
- if not isinstance(infered, astroid.Function):
- if obj.name in visited:
- del visited[obj.name]
- if isinstance(infered, astroid.Function):
- # It's critical to use the original name,
- # since after inferring, an object can be something
- # else than expected, as in the case of the
- # following assignment.
- #
- # class A:
- # def keys(self): pass
- # __iter__ = keys
- abstract = is_abstract_cb(infered)
- if abstract:
- visited[obj.name] = infered
- elif not abstract and obj.name in visited:
- del visited[obj.name]
- return visited
diff --git a/chromium/third_party/pylint/pylint/checkers/variables.py b/chromium/third_party/pylint/pylint/checkers/variables.py
deleted file mode 100644
index 8f6f9574322..00000000000
--- a/chromium/third_party/pylint/pylint/checkers/variables.py
+++ /dev/null
@@ -1,1069 +0,0 @@
-# Copyright (c) 2003-2014 LOGILAB S.A. (Paris, FRANCE).
-# http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# 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 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.
-"""variables checkers for Python code
-"""
-import os
-import sys
-import re
-from copy import copy
-
-import astroid
-from astroid import are_exclusive, builtin_lookup
-from astroid import modutils
-
-from pylint.interfaces import IAstroidChecker, INFERENCE, INFERENCE_FAILURE, HIGH
-from pylint.utils import get_global_option
-from pylint.checkers import BaseChecker
-from pylint.checkers.utils import (
- PYMETHODS, is_ancestor_name, is_builtin,
- is_defined_before, is_error, is_func_default, is_func_decorator,
- assign_parent, check_messages, is_inside_except, clobber_in_except,
- get_all_elements, has_known_bases)
-import six
-
-SPECIAL_OBJ = re.compile("^_{2}[a-z]+_{2}$")
-
-PY3K = sys.version_info >= (3, 0)
-
-def in_for_else_branch(parent, stmt):
- """Returns True if stmt in inside the else branch for a parent For stmt."""
- return (isinstance(parent, astroid.For) and
- any(else_stmt.parent_of(stmt) for else_stmt in parent.orelse))
-
-def overridden_method(klass, name):
- """get overridden method if any"""
- try:
- parent = next(klass.local_attr_ancestors(name))
- except (StopIteration, KeyError):
- return None
- try:
- meth_node = parent[name]
- except KeyError:
- # We have found an ancestor defining <name> but it's not in the local
- # dictionary. This may happen with astroid built from living objects.
- return None
- if isinstance(meth_node, astroid.Function):
- return meth_node
- return None
-
-def _get_unpacking_extra_info(node, infered):
- """return extra information to add to the message for unpacking-non-sequence
- and unbalanced-tuple-unpacking errors
- """
- more = ''
- infered_module = infered.root().name
- if node.root().name == infered_module:
- if node.lineno == infered.lineno:
- more = ' %s' % infered.as_string()
- elif infered.lineno:
- more = ' defined at line %s' % infered.lineno
- elif infered.lineno:
- more = ' defined at line %s of %s' % (infered.lineno, infered_module)
- return more
-
-def _detect_global_scope(node, frame, defframe):
- """ Detect that the given frames shares a global
- scope.
-
- Two frames shares a global scope when neither
- of them are hidden under a function scope, as well
- as any of parent scope of them, until the root scope.
- In this case, depending from something defined later on
- will not work, because it is still undefined.
-
- Example:
- class A:
- # B has the same global scope as `C`, leading to a NameError.
- class B(C): ...
- class C: ...
-
- """
- def_scope = scope = None
- if frame and frame.parent:
- scope = frame.parent.scope()
- if defframe and defframe.parent:
- def_scope = defframe.parent.scope()
- if isinstance(frame, astroid.Function):
- # If the parent of the current node is a
- # function, then it can be under its scope
- # (defined in, which doesn't concern us) or
- # the `->` part of annotations. The same goes
- # for annotations of function arguments, they'll have
- # their parent the Arguments node.
- if not isinstance(node.parent,
- (astroid.Function, astroid.Arguments)):
- return False
- elif any(not isinstance(f, (astroid.Class, astroid.Module))
- for f in (frame, defframe)):
- # Not interested in other frames, since they are already
- # not in a global scope.
- return False
-
- break_scopes = []
- for s in (scope, def_scope):
- # Look for parent scopes. If there is anything different
- # than a module or a class scope, then they frames don't
- # share a global scope.
- parent_scope = s
- while parent_scope:
- if not isinstance(parent_scope, (astroid.Class, astroid.Module)):
- break_scopes.append(parent_scope)
- break
- if parent_scope.parent:
- parent_scope = parent_scope.parent.scope()
- else:
- break
- if break_scopes and len(set(break_scopes)) != 1:
- # Store different scopes than expected.
- # If the stored scopes are, in fact, the very same, then it means
- # that the two frames (frame and defframe) shares the same scope,
- # and we could apply our lineno analysis over them.
- # For instance, this works when they are inside a function, the node
- # that uses a definition and the definition itself.
- return False
- # At this point, we are certain that frame and defframe shares a scope
- # and the definition of the first depends on the second.
- return frame.lineno < defframe.lineno
-
-def _fix_dot_imports(not_consumed):
- """ Try to fix imports with multiple dots, by returning a dictionary
- with the import names expanded. The function unflattens root imports,
- like 'xml' (when we have both 'xml.etree' and 'xml.sax'), to 'xml.etree'
- and 'xml.sax' respectively.
- """
- # TODO: this should be improved in issue astroid #46
- names = {}
- for name, stmts in six.iteritems(not_consumed):
- if any(isinstance(stmt, astroid.AssName)
- and isinstance(stmt.ass_type(), astroid.AugAssign)
- for stmt in stmts):
- continue
- for stmt in stmts:
- if not isinstance(stmt, (astroid.From, astroid.Import)):
- continue
- for imports in stmt.names:
- second_name = None
- if imports[0] == "*":
- # In case of wildcard imports,
- # pick the name from inside the imported module.
- second_name = name
- else:
- if imports[0].find(".") > -1 or name in imports:
- # Most likely something like 'xml.etree',
- # which will appear in the .locals as 'xml'.
- # Only pick the name if it wasn't consumed.
- second_name = imports[0]
- if second_name and second_name not in names:
- names[second_name] = stmt
- return sorted(names.items(), key=lambda a: a[1].fromlineno)
-
-def _find_frame_imports(name, frame):
- """
- Detect imports in the frame, with the required
- *name*. Such imports can be considered assignments.
- Returns True if an import for the given name was found.
- """
- imports = frame.nodes_of_class((astroid.Import, astroid.From))
- for import_node in imports:
- for import_name, import_alias in import_node.names:
- # If the import uses an alias, check only that.
- # Otherwise, check only the import name.
- if import_alias:
- if import_alias == name:
- return True
- elif import_name and import_name == name:
- return True
-
-
-MSGS = {
- 'E0601': ('Using variable %r before assignment',
- 'used-before-assignment',
- 'Used when a local variable is accessed before it\'s \
- assignment.'),
- 'E0602': ('Undefined variable %r',
- 'undefined-variable',
- 'Used when an undefined variable is accessed.'),
- 'E0603': ('Undefined variable name %r in __all__',
- 'undefined-all-variable',
- 'Used when an undefined variable name is referenced in __all__.'),
- 'E0604': ('Invalid object %r in __all__, must contain only strings',
- 'invalid-all-object',
- 'Used when an invalid (non-string) object occurs in __all__.'),
- 'E0611': ('No name %r in module %r',
- 'no-name-in-module',
- 'Used when a name cannot be found in a module.'),
-
- 'W0601': ('Global variable %r undefined at the module level',
- 'global-variable-undefined',
- 'Used when a variable is defined through the "global" statement \
- but the variable is not defined in the module scope.'),
- 'W0602': ('Using global for %r but no assignment is done',
- 'global-variable-not-assigned',
- 'Used when a variable is defined through the "global" statement \
- but no assignment to this variable is done.'),
- 'W0603': ('Using the global statement', # W0121
- 'global-statement',
- 'Used when you use the "global" statement to update a global \
- variable. Pylint just try to discourage this \
- usage. That doesn\'t mean you can not use it !'),
- 'W0604': ('Using the global statement at the module level', # W0103
- 'global-at-module-level',
- 'Used when you use the "global" statement at the module level \
- since it has no effect'),
- 'W0611': ('Unused %s',
- 'unused-import',
- 'Used when an imported module or variable is not used.'),
- 'W0612': ('Unused variable %r',
- 'unused-variable',
- 'Used when a variable is defined but not used.'),
- 'W0613': ('Unused argument %r',
- 'unused-argument',
- 'Used when a function or method argument is not used.'),
- 'W0614': ('Unused import %s from wildcard import',
- 'unused-wildcard-import',
- 'Used when an imported module or variable is not used from a \
- \'from X import *\' style import.'),
-
- 'W0621': ('Redefining name %r from outer scope (line %s)',
- 'redefined-outer-name',
- 'Used when a variable\'s name hide a name defined in the outer \
- scope.'),
- 'W0622': ('Redefining built-in %r',
- 'redefined-builtin',
- 'Used when a variable or function override a built-in.'),
- 'W0623': ('Redefining name %r from %s in exception handler',
- 'redefine-in-handler',
- 'Used when an exception handler assigns the exception \
- to an existing name'),
-
- 'W0631': ('Using possibly undefined loop variable %r',
- 'undefined-loop-variable',
- 'Used when an loop variable (i.e. defined by a for loop or \
- a list comprehension or a generator expression) is used outside \
- the loop.'),
-
- 'W0632': ('Possible unbalanced tuple unpacking with '
- 'sequence%s: '
- 'left side has %d label(s), right side has %d value(s)',
- 'unbalanced-tuple-unpacking',
- 'Used when there is an unbalanced tuple unpacking in assignment'),
-
- 'W0633': ('Attempting to unpack a non-sequence%s',
- 'unpacking-non-sequence',
- 'Used when something which is not '
- 'a sequence is used in an unpack assignment'),
-
- 'W0640': ('Cell variable %s defined in loop',
- 'cell-var-from-loop',
- 'A variable used in a closure is defined in a loop. '
- 'This will result in all closures using the same value for '
- 'the closed-over variable.'),
-
- }
-
-class VariablesChecker(BaseChecker):
- """checks for
- * unused variables / imports
- * undefined variables
- * redefinition of variable from builtins or from an outer scope
- * use of variable before assignment
- * __all__ consistency
- """
-
- __implements__ = IAstroidChecker
-
- name = 'variables'
- msgs = MSGS
- priority = -1
- options = (("init-import",
- {'default': 0, 'type' : 'yn', 'metavar' : '<y_or_n>',
- 'help' : 'Tells whether we should check for unused import in \
-__init__ files.'}),
- ("dummy-variables-rgx",
- {'default': ('_$|dummy'),
- 'type' :'regexp', 'metavar' : '<regexp>',
- 'help' : 'A regular expression matching the name of dummy \
-variables (i.e. expectedly not used).'}),
- ("additional-builtins",
- {'default': (), 'type' : 'csv',
- 'metavar' : '<comma separated list>',
- 'help' : 'List of additional names supposed to be defined in \
-builtins. Remember that you should avoid to define new builtins when possible.'
- }),
- ("callbacks",
- {'default' : ('cb_', '_cb'), 'type' : 'csv',
- 'metavar' : '<callbacks>',
- 'help' : 'List of strings which can identify a callback '
- 'function by name. A callback name must start or '
- 'end with one of those strings.'}
- )
- )
- def __init__(self, linter=None):
- BaseChecker.__init__(self, linter)
- self._to_consume = None
- self._checking_mod_attr = None
-
- def visit_module(self, node):
- """visit module : update consumption analysis variable
- checks globals doesn't overrides builtins
- """
- self._to_consume = [(copy(node.locals), {}, 'module')]
- for name, stmts in six.iteritems(node.locals):
- if is_builtin(name) and not is_inside_except(stmts[0]):
- # do not print Redefining builtin for additional builtins
- self.add_message('redefined-builtin', args=name, node=stmts[0])
-
- @check_messages('unused-import', 'unused-wildcard-import',
- 'redefined-builtin', 'undefined-all-variable',
- 'invalid-all-object')
- def leave_module(self, node):
- """leave module: check globals
- """
- assert len(self._to_consume) == 1
- not_consumed = self._to_consume.pop()[0]
- # attempt to check for __all__ if defined
- if '__all__' in node.locals:
- assigned = next(node.igetattr('__all__'))
- if assigned is not astroid.YES:
- for elt in getattr(assigned, 'elts', ()):
- try:
- elt_name = next(elt.infer())
- except astroid.InferenceError:
- continue
-
- if not isinstance(elt_name, astroid.Const) \
- or not isinstance(elt_name.value, six.string_types):
- self.add_message('invalid-all-object',
- args=elt.as_string(), node=elt)
- continue
- elt_name = elt_name.value
- # If elt is in not_consumed, remove it from not_consumed
- if elt_name in not_consumed:
- del not_consumed[elt_name]
- continue
- if elt_name not in node.locals:
- if not node.package:
- self.add_message('undefined-all-variable',
- args=elt_name,
- node=elt)
- else:
- basename = os.path.splitext(node.file)[0]
- if os.path.basename(basename) == '__init__':
- name = node.name + "." + elt_name
- try:
- modutils.file_from_modpath(name.split("."))
- except ImportError:
- self.add_message('undefined-all-variable',
- args=elt_name,
- node=elt)
- except SyntaxError:
- # don't yield an syntax-error warning,
- # because it will be later yielded
- # when the file will be checked
- pass
- # don't check unused imports in __init__ files
- if not self.config.init_import and node.package:
- return
-
- self._check_imports(not_consumed)
-
- def _check_imports(self, not_consumed):
- local_names = _fix_dot_imports(not_consumed)
- checked = set()
- for name, stmt in local_names:
- for imports in stmt.names:
- real_name = imported_name = imports[0]
- if imported_name == "*":
- real_name = name
- as_name = imports[1]
- if real_name in checked:
- continue
- if name not in (real_name, as_name):
- continue
- checked.add(real_name)
-
- if (isinstance(stmt, astroid.Import) or
- (isinstance(stmt, astroid.From) and
- not stmt.modname)):
- if (isinstance(stmt, astroid.From) and
- SPECIAL_OBJ.search(imported_name)):
- # Filter special objects (__doc__, __all__) etc.,
- # because they can be imported for exporting.
- continue
- if as_name is None:
- msg = "import %s" % imported_name
- else:
- msg = "%s imported as %s" % (imported_name, as_name)
- self.add_message('unused-import', args=msg, node=stmt)
- elif isinstance(stmt, astroid.From) and stmt.modname != '__future__':
- if SPECIAL_OBJ.search(imported_name):
- # Filter special objects (__doc__, __all__) etc.,
- # because they can be imported for exporting.
- continue
- if imported_name == '*':
- self.add_message('unused-wildcard-import',
- args=name, node=stmt)
- else:
- if as_name is None:
- msg = "%s imported from %s" % (imported_name, stmt.modname)
- else:
- fields = (imported_name, stmt.modname, as_name)
- msg = "%s imported from %s as %s" % fields
- self.add_message('unused-import', args=msg, node=stmt)
- del self._to_consume
-
- def visit_class(self, node):
- """visit class: update consumption analysis variable
- """
- self._to_consume.append((copy(node.locals), {}, 'class'))
-
- def leave_class(self, _):
- """leave class: update consumption analysis variable
- """
- # do not check for not used locals here (no sense)
- self._to_consume.pop()
-
- def visit_lambda(self, node):
- """visit lambda: update consumption analysis variable
- """
- self._to_consume.append((copy(node.locals), {}, 'lambda'))
-
- def leave_lambda(self, _):
- """leave lambda: update consumption analysis variable
- """
- # do not check for not used locals here
- self._to_consume.pop()
-
- def visit_genexpr(self, node):
- """visit genexpr: update consumption analysis variable
- """
- self._to_consume.append((copy(node.locals), {}, 'comprehension'))
-
- def leave_genexpr(self, _):
- """leave genexpr: update consumption analysis variable
- """
- # do not check for not used locals here
- self._to_consume.pop()
-
- def visit_dictcomp(self, node):
- """visit dictcomp: update consumption analysis variable
- """
- self._to_consume.append((copy(node.locals), {}, 'comprehension'))
-
- def leave_dictcomp(self, _):
- """leave dictcomp: update consumption analysis variable
- """
- # do not check for not used locals here
- self._to_consume.pop()
-
- def visit_setcomp(self, node):
- """visit setcomp: update consumption analysis variable
- """
- self._to_consume.append((copy(node.locals), {}, 'comprehension'))
-
- def leave_setcomp(self, _):
- """leave setcomp: update consumption analysis variable
- """
- # do not check for not used locals here
- self._to_consume.pop()
-
- def visit_function(self, node):
- """visit function: update consumption analysis variable and check locals
- """
- self._to_consume.append((copy(node.locals), {}, 'function'))
- if not (self.linter.is_message_enabled('redefined-outer-name') or
- self.linter.is_message_enabled('redefined-builtin')):
- return
- globs = node.root().globals
- for name, stmt in node.items():
- if is_inside_except(stmt):
- continue
- if name in globs and not isinstance(stmt, astroid.Global):
- line = globs[name][0].fromlineno
- dummy_rgx = self.config.dummy_variables_rgx
- if not dummy_rgx.match(name):
- self.add_message('redefined-outer-name', args=(name, line), node=stmt)
- elif is_builtin(name):
- # do not print Redefining builtin for additional builtins
- self.add_message('redefined-builtin', args=name, node=stmt)
-
- def leave_function(self, node):
- """leave function: check function's locals are consumed"""
- not_consumed = self._to_consume.pop()[0]
- if not (self.linter.is_message_enabled('unused-variable') or
- self.linter.is_message_enabled('unused-argument')):
- return
- # don't check arguments of function which are only raising an exception
- if is_error(node):
- return
- # don't check arguments of abstract methods or within an interface
- is_method = node.is_method()
- klass = node.parent.frame()
- if is_method and (klass.type == 'interface' or node.is_abstract()):
- return
- if is_method and isinstance(klass, astroid.Class):
- confidence = INFERENCE if has_known_bases(klass) else INFERENCE_FAILURE
- else:
- confidence = HIGH
- authorized_rgx = self.config.dummy_variables_rgx
- called_overridden = False
- argnames = node.argnames()
- global_names = set()
- nonlocal_names = set()
- for global_stmt in node.nodes_of_class(astroid.Global):
- global_names.update(set(global_stmt.names))
- for nonlocal_stmt in node.nodes_of_class(astroid.Nonlocal):
- nonlocal_names.update(set(nonlocal_stmt.names))
-
- for name, stmts in six.iteritems(not_consumed):
- # ignore some special names specified by user configuration
- if authorized_rgx.match(name):
- continue
- # ignore names imported by the global statement
- # FIXME: should only ignore them if it's assigned latter
- stmt = stmts[0]
- if isinstance(stmt, astroid.Global):
- continue
- if isinstance(stmt, (astroid.Import, astroid.From)):
- # Detect imports, assigned to global statements.
- if global_names:
- skip = False
- for import_name, import_alias in stmt.names:
- # If the import uses an alias, check only that.
- # Otherwise, check only the import name.
- if import_alias:
- if import_alias in global_names:
- skip = True
- break
- elif import_name in global_names:
- skip = True
- break
- if skip:
- continue
-
- # care about functions with unknown argument (builtins)
- if name in argnames:
- if is_method:
- # don't warn for the first argument of a (non static) method
- if node.type != 'staticmethod' and name == argnames[0]:
- continue
- # don't warn for argument of an overridden method
- if not called_overridden:
- overridden = overridden_method(klass, node.name)
- called_overridden = True
- if overridden is not None and name in overridden.argnames():
- continue
- if node.name in PYMETHODS and node.name not in ('__init__', '__new__'):
- continue
- # don't check callback arguments
- if any(node.name.startswith(cb) or node.name.endswith(cb)
- for cb in self.config.callbacks):
- continue
- self.add_message('unused-argument', args=name, node=stmt,
- confidence=confidence)
- else:
- if stmt.parent and isinstance(stmt.parent, astroid.Assign):
- if name in nonlocal_names:
- continue
- self.add_message('unused-variable', args=name, node=stmt)
-
- @check_messages('global-variable-undefined', 'global-variable-not-assigned', 'global-statement',
- 'global-at-module-level', 'redefined-builtin')
- def visit_global(self, node):
- """check names imported exists in the global scope"""
- frame = node.frame()
- if isinstance(frame, astroid.Module):
- self.add_message('global-at-module-level', node=node)
- return
- module = frame.root()
- default_message = True
- for name in node.names:
- try:
- assign_nodes = module.getattr(name)
- except astroid.NotFoundError:
- # unassigned global, skip
- assign_nodes = []
- for anode in assign_nodes:
- if anode.parent is None:
- # node returned for builtin attribute such as __file__,
- # __doc__, etc...
- continue
- if anode.frame() is frame:
- # same scope level assignment
- break
- else:
- if not _find_frame_imports(name, frame):
- self.add_message('global-variable-not-assigned',
- args=name, node=node)
- default_message = False
- if not assign_nodes:
- continue
- for anode in assign_nodes:
- if anode.parent is None:
- self.add_message('redefined-builtin', args=name, node=node)
- break
- if anode.frame() is module:
- # module level assignment
- break
- else:
- # global undefined at the module scope
- self.add_message('global-variable-undefined', args=name, node=node)
- default_message = False
- if default_message:
- self.add_message('global-statement', node=node)
-
- def _check_late_binding_closure(self, node, assignment_node):
- def _is_direct_lambda_call():
- return (isinstance(node_scope.parent, astroid.CallFunc)
- and node_scope.parent.func is node_scope)
-
- node_scope = node.scope()
- if not isinstance(node_scope, (astroid.Lambda, astroid.Function)):
- return
- if isinstance(node.parent, astroid.Arguments):
- return
-
- if isinstance(assignment_node, astroid.Comprehension):
- if assignment_node.parent.parent_of(node.scope()):
- self.add_message('cell-var-from-loop', node=node, args=node.name)
- else:
- assign_scope = assignment_node.scope()
- maybe_for = assignment_node
- while not isinstance(maybe_for, astroid.For):
- if maybe_for is assign_scope:
- break
- maybe_for = maybe_for.parent
- else:
- if (maybe_for.parent_of(node_scope)
- and not _is_direct_lambda_call()
- and not isinstance(node_scope.statement(), astroid.Return)):
- self.add_message('cell-var-from-loop', node=node, args=node.name)
-
- def _loopvar_name(self, node, name):
- # filter variables according to node's scope
- # XXX used to filter parents but don't remember why, and removing this
- # fixes a W0631 false positive reported by Paul Hachmann on 2008/12 on
- # python-projects (added to func_use_for_or_listcomp_var test)
- #astmts = [stmt for stmt in node.lookup(name)[1]
- # if hasattr(stmt, 'ass_type')] and
- # not stmt.statement().parent_of(node)]
- if not self.linter.is_message_enabled('undefined-loop-variable'):
- return
- astmts = [stmt for stmt in node.lookup(name)[1]
- if hasattr(stmt, 'ass_type')]
- # filter variables according their respective scope test is_statement
- # and parent to avoid #74747. This is not a total fix, which would
- # introduce a mechanism similar to special attribute lookup in
- # modules. Also, in order to get correct inference in this case, the
- # scope lookup rules would need to be changed to return the initial
- # assignment (which does not exist in code per se) as well as any later
- # modifications.
- if not astmts or (astmts[0].is_statement or astmts[0].parent) \
- and astmts[0].statement().parent_of(node):
- _astmts = []
- else:
- _astmts = astmts[:1]
- for i, stmt in enumerate(astmts[1:]):
- if (astmts[i].statement().parent_of(stmt)
- and not in_for_else_branch(astmts[i].statement(), stmt)):
- continue
- _astmts.append(stmt)
- astmts = _astmts
- if len(astmts) == 1:
- ass = astmts[0].ass_type()
- if isinstance(ass, (astroid.For, astroid.Comprehension, astroid.GenExpr)) \
- and not ass.statement() is node.statement():
- self.add_message('undefined-loop-variable', args=name, node=node)
-
- @check_messages('redefine-in-handler')
- def visit_excepthandler(self, node):
- for name in get_all_elements(node.name):
- clobbering, args = clobber_in_except(name)
- if clobbering:
- self.add_message('redefine-in-handler', args=args, node=name)
-
- def visit_assname(self, node):
- if isinstance(node.ass_type(), astroid.AugAssign):
- self.visit_name(node)
-
- def visit_delname(self, node):
- self.visit_name(node)
-
- @check_messages(*(MSGS.keys()))
- def visit_name(self, node):
- """check that a name is defined if the current scope and doesn't
- redefine a built-in
- """
- stmt = node.statement()
- if stmt.fromlineno is None:
- # name node from a astroid built from live code, skip
- assert not stmt.root().file.endswith('.py')
- return
- name = node.name
- frame = stmt.scope()
- # if the name node is used as a function default argument's value or as
- # a decorator, then start from the parent frame of the function instead
- # of the function frame - and thus open an inner class scope
- if (is_func_default(node) or is_func_decorator(node)
- or is_ancestor_name(frame, node)):
- start_index = len(self._to_consume) - 2
- else:
- start_index = len(self._to_consume) - 1
- # iterates through parent scopes, from the inner to the outer
- base_scope_type = self._to_consume[start_index][-1]
- for i in range(start_index, -1, -1):
- to_consume, consumed, scope_type = self._to_consume[i]
- # if the current scope is a class scope but it's not the inner
- # scope, ignore it. This prevents to access this scope instead of
- # the globals one in function members when there are some common
- # names. The only exception is when the starting scope is a
- # comprehension and its direct outer scope is a class
- if scope_type == 'class' and i != start_index and not (
- base_scope_type == 'comprehension' and i == start_index-1):
- # Detect if we are in a local class scope, as an assignment.
- # For example, the following is fair game.
- #
- # class A:
- # b = 1
- # c = lambda b=b: b * b
- #
- # class B:
- # tp = 1
- # def func(self, arg: tp):
- # ...
-
- in_annotation = (
- PY3K and isinstance(frame, astroid.Function)
- and node.statement() is frame and
- (node in frame.args.annotations
- or node is frame.args.varargannotation
- or node is frame.args.kwargannotation))
- if in_annotation:
- frame_locals = frame.parent.scope().locals
- else:
- frame_locals = frame.locals
- if not ((isinstance(frame, astroid.Class) or in_annotation)
- and name in frame_locals):
- continue
- # the name has already been consumed, only check it's not a loop
- # variable used outside the loop
- if name in consumed:
- defnode = assign_parent(consumed[name][0])
- self._check_late_binding_closure(node, defnode)
- self._loopvar_name(node, name)
- break
- # mark the name as consumed if it's defined in this scope
- # (i.e. no KeyError is raised by "to_consume[name]")
- try:
- consumed[name] = to_consume[name]
- except KeyError:
- continue
- # checks for use before assignment
- defnode = assign_parent(to_consume[name][0])
- if defnode is not None:
- self._check_late_binding_closure(node, defnode)
- defstmt = defnode.statement()
- defframe = defstmt.frame()
- maybee0601 = True
- if not frame is defframe:
- maybee0601 = _detect_global_scope(node, frame, defframe)
- elif defframe.parent is None:
- # we are at the module level, check the name is not
- # defined in builtins
- if name in defframe.scope_attrs or builtin_lookup(name)[1]:
- maybee0601 = False
- else:
- # we are in a local scope, check the name is not
- # defined in global or builtin scope
- if defframe.root().lookup(name)[1]:
- maybee0601 = False
- else:
- # check if we have a nonlocal
- if name in defframe.locals:
- maybee0601 = not any(isinstance(child, astroid.Nonlocal)
- and name in child.names
- for child in defframe.get_children())
-
- # Handle a couple of class scoping issues.
- annotation_return = False
- # The class reuses itself in the class scope.
- recursive_klass = (frame is defframe and
- defframe.parent_of(node) and
- isinstance(defframe, astroid.Class) and
- node.name == defframe.name)
- if (self._to_consume[-1][-1] == 'lambda' and
- isinstance(frame, astroid.Class)
- and name in frame.locals):
- maybee0601 = True
- elif (isinstance(defframe, astroid.Class) and
- isinstance(frame, astroid.Function)):
- # Special rule for function return annotations,
- # which uses the same name as the class where
- # the function lives.
- if (PY3K and node is frame.returns and
- defframe.parent_of(frame.returns)):
- maybee0601 = annotation_return = True
-
- if (maybee0601 and defframe.name in defframe.locals and
- defframe.locals[name][0].lineno < frame.lineno):
- # Detect class assignments with the same
- # name as the class. In this case, no warning
- # should be raised.
- maybee0601 = False
- elif recursive_klass:
- maybee0601 = True
- else:
- maybee0601 = maybee0601 and stmt.fromlineno <= defstmt.fromlineno
-
- if (maybee0601
- and not is_defined_before(node)
- and not are_exclusive(stmt, defstmt, ('NameError',
- 'Exception',
- 'BaseException'))):
- if recursive_klass or (defstmt is stmt and
- isinstance(node, (astroid.DelName,
- astroid.AssName))):
- self.add_message('undefined-variable', args=name, node=node)
- elif annotation_return:
- self.add_message('undefined-variable', args=name, node=node)
- elif self._to_consume[-1][-1] != 'lambda':
- # E0601 may *not* occurs in lambda scope.
- self.add_message('used-before-assignment', args=name, node=node)
- elif self._to_consume[-1][-1] == 'lambda':
- # E0601 can occur in class-level scope in lambdas, as in
- # the following example:
- # class A:
- # x = lambda attr: f + attr
- # f = 42
- if isinstance(frame, astroid.Class) and name in frame.locals:
- if isinstance(node.parent, astroid.Arguments):
- # Doing the following is fine:
- # class A:
- # x = 42
- # y = lambda attr=x: attr
- if stmt.fromlineno <= defstmt.fromlineno:
- self.add_message('used-before-assignment',
- args=name, node=node)
- else:
- self.add_message('undefined-variable',
- args=name, node=node)
-
- if isinstance(node, astroid.AssName): # Aug AssName
- del consumed[name]
- else:
- del to_consume[name]
- # check it's not a loop variable used outside the loop
- self._loopvar_name(node, name)
- break
- else:
- # we have not found the name, if it isn't a builtin, that's an
- # undefined name !
- if not (name in astroid.Module.scope_attrs or is_builtin(name)
- or name in self.config.additional_builtins):
- self.add_message('undefined-variable', args=name, node=node)
-
- @check_messages('no-name-in-module')
- def visit_import(self, node):
- """check modules attribute accesses"""
- for name, _ in node.names:
- parts = name.split('.')
- try:
- module = next(node.infer_name_module(parts[0]))
- except astroid.ResolveError:
- continue
- self._check_module_attrs(node, module, parts[1:])
-
- @check_messages('no-name-in-module')
- def visit_from(self, node):
- """check modules attribute accesses"""
- name_parts = node.modname.split('.')
- level = getattr(node, 'level', None)
- try:
- module = node.root().import_module(name_parts[0], level=level)
- except Exception: # pylint: disable=broad-except
- return
- module = self._check_module_attrs(node, module, name_parts[1:])
- if not module:
- return
- for name, _ in node.names:
- if name == '*':
- continue
- self._check_module_attrs(node, module, name.split('.'))
-
- @check_messages('unbalanced-tuple-unpacking', 'unpacking-non-sequence')
- def visit_assign(self, node):
- """Check unbalanced tuple unpacking for assignments
- and unpacking non-sequences.
- """
- if not isinstance(node.targets[0], (astroid.Tuple, astroid.List)):
- return
-
- targets = node.targets[0].itered()
- try:
- for infered in node.value.infer():
- self._check_unpacking(infered, node, targets)
- except astroid.InferenceError:
- return
-
- def _check_unpacking(self, infered, node, targets):
- """ Check for unbalanced tuple unpacking
- and unpacking non sequences.
- """
- if infered is astroid.YES:
- return
- if (isinstance(infered.parent, astroid.Arguments) and
- isinstance(node.value, astroid.Name) and
- node.value.name == infered.parent.vararg):
- # Variable-length argument, we can't determine the length.
- return
- if isinstance(infered, (astroid.Tuple, astroid.List)):
- # attempt to check unpacking is properly balanced
- values = infered.itered()
- if len(targets) != len(values):
- # Check if we have starred nodes.
- if any(isinstance(target, astroid.Starred)
- for target in targets):
- return
- self.add_message('unbalanced-tuple-unpacking', node=node,
- args=(_get_unpacking_extra_info(node, infered),
- len(targets),
- len(values)))
- # attempt to check unpacking may be possible (ie RHS is iterable)
- elif isinstance(infered, astroid.Instance):
- for meth in ('__iter__', '__getitem__'):
- try:
- infered.getattr(meth)
- break
- except astroid.NotFoundError:
- continue
- else:
- self.add_message('unpacking-non-sequence', node=node,
- args=(_get_unpacking_extra_info(node, infered),))
- else:
- self.add_message('unpacking-non-sequence', node=node,
- args=(_get_unpacking_extra_info(node, infered),))
-
-
- def _check_module_attrs(self, node, module, module_names):
- """check that module_names (list of string) are accessible through the
- given module
- if the latest access name corresponds to a module, return it
- """
- assert isinstance(module, astroid.Module), module
- ignored_modules = get_global_option(self, 'ignored-modules',
- default=[])
- while module_names:
- name = module_names.pop(0)
- if name == '__dict__':
- module = None
- break
- try:
- module = next(module.getattr(name)[0].infer())
- if module is astroid.YES:
- return None
- except astroid.NotFoundError:
- if module.name in ignored_modules:
- return None
- self.add_message('no-name-in-module',
- args=(name, module.name), node=node)
- return None
- except astroid.InferenceError:
- return None
- if module_names:
- # FIXME: other message if name is not the latest part of
- # module_names ?
- modname = module and module.name or '__dict__'
- self.add_message('no-name-in-module', node=node,
- args=('.'.join(module_names), modname))
- return None
- if isinstance(module, astroid.Module):
- return module
- return None
-
-
-class VariablesChecker3k(VariablesChecker):
- '''Modified variables checker for 3k'''
- # listcomp have now also their scope
-
- def visit_listcomp(self, node):
- """visit dictcomp: update consumption analysis variable
- """
- self._to_consume.append((copy(node.locals), {}, 'comprehension'))
-
- def leave_listcomp(self, _):
- """leave dictcomp: update consumption analysis variable
- """
- # do not check for not used locals here
- self._to_consume.pop()
-
- def leave_module(self, node):
- """ Update consumption analysis variable
- for metaclasses.
- """
- module_locals = self._to_consume[0][0]
- module_imports = self._to_consume[0][1]
- consumed = {}
-
- for klass in node.nodes_of_class(astroid.Class):
- found = metaclass = name = None
- if not klass._metaclass:
- # Skip if this class doesn't use
- # explictly a metaclass, but inherits it from ancestors
- continue
-
- metaclass = klass.metaclass()
-
- # Look the name in the already found locals.
- # If it's not found there, look in the module locals
- # and in the imported modules.
- if isinstance(klass._metaclass, astroid.Name):
- name = klass._metaclass.name
- elif metaclass:
- # if it uses a `metaclass=module.Class`
- name = metaclass.root().name
-
- if name:
- found = consumed.setdefault(
- name, module_locals.get(name, module_imports.get(name)))
-
- if found is None and not metaclass:
- name = None
- if isinstance(klass._metaclass, astroid.Name):
- name = klass._metaclass.name
- elif isinstance(klass._metaclass, astroid.Getattr):
- name = klass._metaclass.as_string()
-
- if name is not None:
- if not (name in astroid.Module.scope_attrs or
- is_builtin(name) or
- name in self.config.additional_builtins or
- name in node.locals):
- self.add_message('undefined-variable',
- node=klass,
- args=(name, ))
- # Pop the consumed items, in order to
- # avoid having unused-import false positives
- for name in consumed:
- module_locals.pop(name, None)
- super(VariablesChecker3k, self).leave_module(node)
-
-if sys.version_info >= (3, 0):
- VariablesChecker = VariablesChecker3k
-
-
-def register(linter):
- """required method to auto register this checker"""
- linter.register_checker(VariablesChecker(linter))
diff --git a/chromium/third_party/pylint/pylint/config.py b/chromium/third_party/pylint/pylint/config.py
deleted file mode 100644
index ebfe57897e5..00000000000
--- a/chromium/third_party/pylint/pylint/config.py
+++ /dev/null
@@ -1,157 +0,0 @@
-# Copyright (c) 2003-2013 LOGILAB S.A. (Paris, FRANCE).
-# 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 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.
-"""utilities for Pylint configuration :
-
-* pylintrc
-* pylint.d (PYLINTHOME)
-"""
-from __future__ import with_statement
-from __future__ import print_function
-
-import pickle
-import os
-import sys
-from os.path import exists, isfile, join, expanduser, abspath, dirname
-
-# pylint home is used to save old runs results ################################
-
-USER_HOME = expanduser('~')
-if 'PYLINTHOME' in os.environ:
- PYLINT_HOME = os.environ['PYLINTHOME']
- if USER_HOME == '~':
- USER_HOME = dirname(PYLINT_HOME)
-elif USER_HOME == '~':
- PYLINT_HOME = ".pylint.d"
-else:
- PYLINT_HOME = join(USER_HOME, '.pylint.d')
-
-def get_pdata_path(base_name, recurs):
- """return the path of the file which should contain old search data for the
- given base_name with the given options values
- """
- base_name = base_name.replace(os.sep, '_')
- return join(PYLINT_HOME, "%s%s%s"%(base_name, recurs, '.stats'))
-
-def load_results(base):
- """try to unpickle and return data from file if it exists and is not
- corrupted
-
- return an empty dictionary if it doesn't exists
- """
- data_file = get_pdata_path(base, 1)
- try:
- with open(data_file, _PICK_LOAD) as stream:
- return pickle.load(stream)
- except Exception: # pylint: disable=broad-except
- return {}
-
-if sys.version_info < (3, 0):
- _PICK_DUMP, _PICK_LOAD = 'w', 'r'
-else:
- _PICK_DUMP, _PICK_LOAD = 'wb', 'rb'
-
-def save_results(results, base):
- """pickle results"""
- if not exists(PYLINT_HOME):
- try:
- os.mkdir(PYLINT_HOME)
- except OSError:
- print('Unable to create directory %s' % PYLINT_HOME, file=sys.stderr)
- data_file = get_pdata_path(base, 1)
- try:
- with open(data_file, _PICK_DUMP) as stream:
- pickle.dump(results, stream)
- except (IOError, OSError) as ex:
- print('Unable to create file %s: %s' % (data_file, ex), file=sys.stderr)
-
-# location of the configuration file ##########################################
-
-
-def find_pylintrc():
- """search the pylint rc file and return its path if it find it, else None
- """
- # is there a pylint rc file in the current directory ?
- if exists('pylintrc'):
- return abspath('pylintrc')
- if isfile('__init__.py'):
- curdir = abspath(os.getcwd())
- while isfile(join(curdir, '__init__.py')):
- curdir = abspath(join(curdir, '..'))
- if isfile(join(curdir, 'pylintrc')):
- return join(curdir, 'pylintrc')
- if 'PYLINTRC' in os.environ and exists(os.environ['PYLINTRC']):
- pylintrc = os.environ['PYLINTRC']
- else:
- user_home = expanduser('~')
- if user_home == '~' or user_home == '/root':
- pylintrc = ".pylintrc"
- else:
- pylintrc = join(user_home, '.pylintrc')
- if not isfile(pylintrc):
- pylintrc = join(user_home, '.config', 'pylintrc')
- if not isfile(pylintrc):
- if isfile('/etc/pylintrc'):
- pylintrc = '/etc/pylintrc'
- else:
- pylintrc = None
- return pylintrc
-
-PYLINTRC = find_pylintrc()
-
-ENV_HELP = '''
-The following environment variables are used:
- * PYLINTHOME
- Path to the directory where the persistent for the run will be stored. If
-not found, it defaults to ~/.pylint.d/ or .pylint.d (in the current working
-directory).
- * PYLINTRC
- Path to the configuration file. See the documentation for the method used
-to search for configuration file.
-''' % globals()
-
-# evaluation messages #########################################################
-
-def get_note_message(note):
- """return a message according to note
- note is a float < 10 (10 is the highest note)
- """
- assert note <= 10, "Note is %.2f. Either you cheated, or pylint's \
-broken!" % note
- if note < 0:
- msg = 'You have to do something quick !'
- elif note < 1:
- msg = 'Hey! This is really dreadful. Or maybe pylint is buggy?'
- elif note < 2:
- msg = "Come on! You can't be proud of this code"
- elif note < 3:
- msg = 'Hum... Needs work.'
- elif note < 4:
- msg = 'Wouldn\'t you be a bit lazy?'
- elif note < 5:
- msg = 'A little more work would make it acceptable.'
- elif note < 6:
- msg = 'Just the bare minimum. Give it a bit more polish. '
- elif note < 7:
- msg = 'This is okay-ish, but I\'m sure you can do better.'
- elif note < 8:
- msg = 'If you commit now, people should not be making nasty \
-comments about you on c.l.py'
- elif note < 9:
- msg = 'That\'s pretty good. Good work mate.'
- elif note < 10:
- msg = 'So close to being perfect...'
- else:
- msg = 'Wow ! Now this deserves our uttermost respect.\nPlease send \
-your code to python-projects@logilab.org'
- return msg
diff --git a/chromium/third_party/pylint/pylint/epylint.py b/chromium/third_party/pylint/pylint/epylint.py
deleted file mode 100644
index 4fd683eaf56..00000000000
--- a/chromium/third_party/pylint/pylint/epylint.py
+++ /dev/null
@@ -1,176 +0,0 @@
-# -*- coding: utf-8; mode: python; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=python:et:sw=4:ts=4:sts=4
-# Copyright (c) 2003-2013 LOGILAB S.A. (Paris, FRANCE).
-# http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# 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 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.
-"""Emacs and Flymake compatible Pylint.
-
-This script is for integration with emacs and is compatible with flymake mode.
-
-epylint walks out of python packages before invoking pylint. This avoids
-reporting import errors that occur when a module within a package uses the
-absolute import path to get another module within this package.
-
-For example:
- - Suppose a package is structured as
-
- a/__init__.py
- a/b/x.py
- a/c/y.py
-
- - Then if y.py imports x as "from a.b import x" the following produces pylint
- errors
-
- cd a/c; pylint y.py
-
- - The following obviously doesn't
-
- pylint a/c/y.py
-
- - As this script will be invoked by emacs within the directory of the file
- we are checking we need to go out of it to avoid these false positives.
-
-
-You may also use py_run to run pylint with desired options and get back (or not)
-its output.
-"""
-from __future__ import print_function
-
-import sys, os
-import os.path as osp
-from subprocess import Popen, PIPE
-
-def _get_env():
- '''Extracts the environment PYTHONPATH and appends the current sys.path to
- those.'''
- env = dict(os.environ)
- env['PYTHONPATH'] = os.pathsep.join(sys.path)
- return env
-
-def lint(filename, options=None):
- """Pylint the given file.
-
- When run from emacs we will be in the directory of a file, and passed its
- filename. If this file is part of a package and is trying to import other
- modules from within its own package or another package rooted in a directory
- below it, pylint will classify it as a failed import.
-
- To get around this, we traverse down the directory tree to find the root of
- the package this module is in. We then invoke pylint from this directory.
-
- Finally, we must correct the filenames in the output generated by pylint so
- Emacs doesn't become confused (it will expect just the original filename,
- while pylint may extend it with extra directories if we've traversed down
- the tree)
- """
- # traverse downwards until we are out of a python package
- full_path = osp.abspath(filename)
- parent_path = osp.dirname(full_path)
- child_path = osp.basename(full_path)
-
- while parent_path != "/" and osp.exists(osp.join(parent_path, '__init__.py')):
- child_path = osp.join(osp.basename(parent_path), child_path)
- parent_path = osp.dirname(parent_path)
-
- # Start pylint
- # Ensure we use the python and pylint associated with the running epylint
- from pylint import lint as lint_mod
- lint_path = lint_mod.__file__
- options = options or ['--disable=C,R,I']
- cmd = [sys.executable, lint_path] + options + [
- '--msg-template', '{path}:{line}: {category} ({msg_id}, {symbol}, {obj}) {msg}',
- '-r', 'n', child_path]
- process = Popen(cmd, stdout=PIPE, cwd=parent_path, env=_get_env(),
- universal_newlines=True)
-
- for line in process.stdout:
- # remove pylintrc warning
- if line.startswith("No config file found"):
- continue
-
- # modify the file name thats output to reverse the path traversal we made
- parts = line.split(":")
- if parts and parts[0] == child_path:
- line = ":".join([filename] + parts[1:])
- print(line, end=' ')
-
- process.wait()
- return process.returncode
-
-
-def py_run(command_options='', return_std=False, stdout=None, stderr=None,
- script='epylint'):
- """Run pylint from python
-
- ``command_options`` is a string containing ``pylint`` command line options;
- ``return_std`` (boolean) indicates return of created standard output
- and error (see below);
- ``stdout`` and ``stderr`` are 'file-like' objects in which standard output
- could be written.
-
- Calling agent is responsible for stdout/err management (creation, close).
- Default standard output and error are those from sys,
- or standalone ones (``subprocess.PIPE``) are used
- if they are not set and ``return_std``.
-
- If ``return_std`` is set to ``True``, this function returns a 2-uple
- containing standard output and error related to created process,
- as follows: ``(stdout, stderr)``.
-
- A trivial usage could be as follows:
- >>> py_run( '--version')
- No config file found, using default configuration
- pylint 0.18.1,
- ...
-
- To silently run Pylint on a module, and get its standard output and error:
- >>> (pylint_stdout, pylint_stderr) = py_run( 'module_name.py', True)
- """
- # Create command line to call pylint
- if os.name == 'nt':
- script += '.bat'
- command_line = script + ' ' + command_options
- # Providing standard output and/or error if not set
- if stdout is None:
- if return_std:
- stdout = PIPE
- else:
- stdout = sys.stdout
- if stderr is None:
- if return_std:
- stderr = PIPE
- else:
- stderr = sys.stderr
- # Call pylint in a subprocess
- p = Popen(command_line, shell=True, stdout=stdout, stderr=stderr,
- env=_get_env(), universal_newlines=True)
- p.wait()
- # Return standard output and error
- if return_std:
- return (p.stdout, p.stderr)
-
-
-def Run():
- if len(sys.argv) == 1:
- print("Usage: %s <filename> [options]" % sys.argv[0])
- sys.exit(1)
- elif not osp.exists(sys.argv[1]):
- print("%s does not exist" % sys.argv[1])
- sys.exit(1)
- else:
- sys.exit(lint(sys.argv[1], sys.argv[2:]))
-
-
-if __name__ == '__main__':
- Run()
diff --git a/chromium/third_party/pylint/pylint/gui.py b/chromium/third_party/pylint/pylint/gui.py
deleted file mode 100644
index 9c9b1389353..00000000000
--- a/chromium/third_party/pylint/pylint/gui.py
+++ /dev/null
@@ -1,531 +0,0 @@
-# Copyright (c) 2003-2013 LOGILAB S.A. (Paris, FRANCE).
-# http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# 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 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.
-"""Tkinker gui for pylint"""
-from __future__ import print_function
-
-import os
-import sys
-import re
-from threading import Thread
-
-import six
-
-from six.moves.tkinter import (
- Tk, Frame, Listbox, Entry, Label, Button, Scrollbar,
- Checkbutton, Radiobutton, IntVar, StringVar, PanedWindow,
- TOP, LEFT, RIGHT, BOTTOM, END, X, Y, BOTH, SUNKEN, W,
- HORIZONTAL, DISABLED, NORMAL, W,
-)
-from six.moves.tkinter_tkfiledialog import (
- askopenfilename, askdirectory,
-)
-
-import pylint.lint
-from pylint.reporters.guireporter import GUIReporter
-
-HOME = os.path.expanduser('~/')
-HISTORY = '.pylint-gui-history'
-COLORS = {'(I)':'lightblue',
- '(C)':'blue', '(R)':'darkblue',
- '(W)':'black', '(E)':'darkred',
- '(F)':'red'}
-
-
-def convert_to_string(msg):
- """make a string representation of a message"""
- module_object = msg.module
- if msg.obj:
- module_object += ".%s" % msg.obj
- return "(%s) %s [%d]: %s" % (msg.C, module_object, msg.line, msg.msg)
-
-class BasicStream(object):
- '''
- used in gui reporter instead of writing to stdout, it is written to
- this stream and saved in contents
- '''
- def __init__(self, gui):
- """init"""
- self.curline = ""
- self.gui = gui
- self.contents = []
- self.outdict = {}
- self.currout = None
- self.next_title = None
-
- def write(self, text):
- """write text to the stream"""
- if re.match('^--+$', text.strip()) or re.match('^==+$', text.strip()):
- if self.currout:
- self.outdict[self.currout].remove(self.next_title)
- self.outdict[self.currout].pop()
- self.currout = self.next_title
- self.outdict[self.currout] = ['']
-
- if text.strip():
- self.next_title = text.strip()
-
- if text.startswith(os.linesep):
- self.contents.append('')
- if self.currout:
- self.outdict[self.currout].append('')
- self.contents[-1] += text.strip(os.linesep)
- if self.currout:
- self.outdict[self.currout][-1] += text.strip(os.linesep)
- if text.endswith(os.linesep) and text.strip():
- self.contents.append('')
- if self.currout:
- self.outdict[self.currout].append('')
-
- def fix_contents(self):
- """finalize what the contents of the dict should look like before output"""
- for item in self.outdict:
- num_empty = self.outdict[item].count('')
- for _ in range(num_empty):
- self.outdict[item].remove('')
- if self.outdict[item]:
- self.outdict[item].pop(0)
-
- def output_contents(self):
- """output contents of dict to the gui, and set the rating"""
- self.fix_contents()
- self.gui.tabs = self.outdict
- try:
- self.gui.rating.set(self.outdict['Global evaluation'][0])
- except KeyError:
- self.gui.rating.set('Error')
- self.gui.refresh_results_window()
-
- #reset stream variables for next run
- self.contents = []
- self.outdict = {}
- self.currout = None
- self.next_title = None
-
-
-class LintGui(object):
- """Build and control a window to interact with pylint"""
-
- def __init__(self, root=None):
- """init"""
- self.root = root or Tk()
- self.root.title('Pylint')
- #reporter
- self.reporter = None
- #message queue for output from reporter
- self.msg_queue = six.moves.queue.Queue()
- self.msgs = []
- self.visible_msgs = []
- self.filenames = []
- self.rating = StringVar()
- self.tabs = {}
- self.report_stream = BasicStream(self)
- #gui objects
- self.lb_messages = None
- self.showhistory = None
- self.results = None
- self.btnRun = None
- self.information_box = None
- self.convention_box = None
- self.refactor_box = None
- self.warning_box = None
- self.error_box = None
- self.fatal_box = None
- self.txtModule = None
- self.status = None
- self.msg_type_dict = None
- self.init_gui()
-
- def init_gui(self):
- """init helper"""
-
- window = PanedWindow(self.root, orient="vertical")
- window.pack(side=TOP, fill=BOTH, expand=True)
-
- top_pane = Frame(window)
- window.add(top_pane)
- mid_pane = Frame(window)
- window.add(mid_pane)
- bottom_pane = Frame(window)
- window.add(bottom_pane)
-
- #setting up frames
- top_frame = Frame(top_pane)
- mid_frame = Frame(top_pane)
- history_frame = Frame(top_pane)
- radio_frame = Frame(mid_pane)
- rating_frame = Frame(mid_pane)
- res_frame = Frame(mid_pane)
- check_frame = Frame(bottom_pane)
- msg_frame = Frame(bottom_pane)
- btn_frame = Frame(bottom_pane)
- top_frame.pack(side=TOP, fill=X)
- mid_frame.pack(side=TOP, fill=X)
- history_frame.pack(side=TOP, fill=BOTH, expand=True)
- radio_frame.pack(side=TOP, fill=X)
- rating_frame.pack(side=TOP, fill=X)
- res_frame.pack(side=TOP, fill=BOTH, expand=True)
- check_frame.pack(side=TOP, fill=X)
- msg_frame.pack(side=TOP, fill=BOTH, expand=True)
- btn_frame.pack(side=TOP, fill=X)
-
- # Binding F5 application-wide to run lint
- self.root.bind('<F5>', self.run_lint)
-
- #Message ListBox
- rightscrollbar = Scrollbar(msg_frame)
- rightscrollbar.pack(side=RIGHT, fill=Y)
- bottomscrollbar = Scrollbar(msg_frame, orient=HORIZONTAL)
- bottomscrollbar.pack(side=BOTTOM, fill=X)
- self.lb_messages = Listbox(
- msg_frame,
- yscrollcommand=rightscrollbar.set,
- xscrollcommand=bottomscrollbar.set,
- bg="white")
- self.lb_messages.bind("<Double-Button-1>", self.show_sourcefile)
- self.lb_messages.pack(expand=True, fill=BOTH)
- rightscrollbar.config(command=self.lb_messages.yview)
- bottomscrollbar.config(command=self.lb_messages.xview)
-
- #History ListBoxes
- rightscrollbar2 = Scrollbar(history_frame)
- rightscrollbar2.pack(side=RIGHT, fill=Y)
- bottomscrollbar2 = Scrollbar(history_frame, orient=HORIZONTAL)
- bottomscrollbar2.pack(side=BOTTOM, fill=X)
- self.showhistory = Listbox(
- history_frame,
- yscrollcommand=rightscrollbar2.set,
- xscrollcommand=bottomscrollbar2.set,
- bg="white")
- self.showhistory.pack(expand=True, fill=BOTH)
- rightscrollbar2.config(command=self.showhistory.yview)
- bottomscrollbar2.config(command=self.showhistory.xview)
- self.showhistory.bind('<Double-Button-1>', self.select_recent_file)
- self.set_history_window()
-
- #status bar
- self.status = Label(self.root, text="", bd=1, relief=SUNKEN, anchor=W)
- self.status.pack(side=BOTTOM, fill=X)
-
- #labelbl_ratingls
- lbl_rating_label = Label(rating_frame, text='Rating:')
- lbl_rating_label.pack(side=LEFT)
- lbl_rating = Label(rating_frame, textvariable=self.rating)
- lbl_rating.pack(side=LEFT)
- Label(mid_frame, text='Recently Used:').pack(side=LEFT)
- Label(top_frame, text='Module or package').pack(side=LEFT)
-
- #file textbox
- self.txt_module = Entry(top_frame, background='white')
- self.txt_module.bind('<Return>', self.run_lint)
- self.txt_module.pack(side=LEFT, expand=True, fill=X)
-
- #results box
- rightscrollbar = Scrollbar(res_frame)
- rightscrollbar.pack(side=RIGHT, fill=Y)
- bottomscrollbar = Scrollbar(res_frame, orient=HORIZONTAL)
- bottomscrollbar.pack(side=BOTTOM, fill=X)
- self.results = Listbox(
- res_frame,
- yscrollcommand=rightscrollbar.set,
- xscrollcommand=bottomscrollbar.set,
- bg="white", font="Courier")
- self.results.pack(expand=True, fill=BOTH, side=BOTTOM)
- rightscrollbar.config(command=self.results.yview)
- bottomscrollbar.config(command=self.results.xview)
-
- #buttons
- Button(top_frame, text='Open', command=self.file_open).pack(side=LEFT)
- Button(top_frame, text='Open Package',
- command=(lambda: self.file_open(package=True))).pack(side=LEFT)
-
- self.btnRun = Button(top_frame, text='Run', command=self.run_lint)
- self.btnRun.pack(side=LEFT)
- Button(btn_frame, text='Quit', command=self.quit).pack(side=BOTTOM)
-
- #radio buttons
- self.information_box = IntVar()
- self.convention_box = IntVar()
- self.refactor_box = IntVar()
- self.warning_box = IntVar()
- self.error_box = IntVar()
- self.fatal_box = IntVar()
- i = Checkbutton(check_frame, text="Information", fg=COLORS['(I)'],
- variable=self.information_box, command=self.refresh_msg_window)
- c = Checkbutton(check_frame, text="Convention", fg=COLORS['(C)'],
- variable=self.convention_box, command=self.refresh_msg_window)
- r = Checkbutton(check_frame, text="Refactor", fg=COLORS['(R)'],
- variable=self.refactor_box, command=self.refresh_msg_window)
- w = Checkbutton(check_frame, text="Warning", fg=COLORS['(W)'],
- variable=self.warning_box, command=self.refresh_msg_window)
- e = Checkbutton(check_frame, text="Error", fg=COLORS['(E)'],
- variable=self.error_box, command=self.refresh_msg_window)
- f = Checkbutton(check_frame, text="Fatal", fg=COLORS['(F)'],
- variable=self.fatal_box, command=self.refresh_msg_window)
- i.select()
- c.select()
- r.select()
- w.select()
- e.select()
- f.select()
- i.pack(side=LEFT)
- c.pack(side=LEFT)
- r.pack(side=LEFT)
- w.pack(side=LEFT)
- e.pack(side=LEFT)
- f.pack(side=LEFT)
-
- #check boxes
- self.box = StringVar()
- # XXX should be generated
- report = Radiobutton(
- radio_frame, text="Report", variable=self.box,
- value="Report", command=self.refresh_results_window)
- raw_met = Radiobutton(
- radio_frame, text="Raw metrics", variable=self.box,
- value="Raw metrics", command=self.refresh_results_window)
- dup = Radiobutton(
- radio_frame, text="Duplication", variable=self.box,
- value="Duplication", command=self.refresh_results_window)
- ext = Radiobutton(
- radio_frame, text="External dependencies",
- variable=self.box, value="External dependencies",
- command=self.refresh_results_window)
- stat = Radiobutton(
- radio_frame, text="Statistics by type",
- variable=self.box, value="Statistics by type",
- command=self.refresh_results_window)
- msg_cat = Radiobutton(
- radio_frame, text="Messages by category",
- variable=self.box, value="Messages by category",
- command=self.refresh_results_window)
- msg = Radiobutton(
- radio_frame, text="Messages", variable=self.box,
- value="Messages", command=self.refresh_results_window)
- source_file = Radiobutton(
- radio_frame, text="Source File", variable=self.box,
- value="Source File", command=self.refresh_results_window)
- report.select()
- report.grid(column=0, row=0, sticky=W)
- raw_met.grid(column=1, row=0, sticky=W)
- dup.grid(column=2, row=0, sticky=W)
- msg.grid(column=3, row=0, sticky=W)
- stat.grid(column=0, row=1, sticky=W)
- msg_cat.grid(column=1, row=1, sticky=W)
- ext.grid(column=2, row=1, sticky=W)
- source_file.grid(column=3, row=1, sticky=W)
-
- #dictionary for check boxes and associated error term
- self.msg_type_dict = {
- 'I': lambda: self.information_box.get() == 1,
- 'C': lambda: self.convention_box.get() == 1,
- 'R': lambda: self.refactor_box.get() == 1,
- 'E': lambda: self.error_box.get() == 1,
- 'W': lambda: self.warning_box.get() == 1,
- 'F': lambda: self.fatal_box.get() == 1
- }
- self.txt_module.focus_set()
-
-
- def select_recent_file(self, event): # pylint: disable=unused-argument
- """adds the selected file in the history listbox to the Module box"""
- if not self.showhistory.size():
- return
-
- selected = self.showhistory.curselection()
- item = self.showhistory.get(selected)
- #update module
- self.txt_module.delete(0, END)
- self.txt_module.insert(0, item)
-
- def refresh_msg_window(self):
- """refresh the message window with current output"""
- #clear the window
- self.lb_messages.delete(0, END)
- self.visible_msgs = []
- for msg in self.msgs:
- if self.msg_type_dict.get(msg.C)():
- self.visible_msgs.append(msg)
- msg_str = convert_to_string(msg)
- self.lb_messages.insert(END, msg_str)
- fg_color = COLORS.get(msg_str[:3], 'black')
- self.lb_messages.itemconfigure(END, fg=fg_color)
-
- def refresh_results_window(self):
- """refresh the results window with current output"""
- #clear the window
- self.results.delete(0, END)
- try:
- for res in self.tabs[self.box.get()]:
- self.results.insert(END, res)
- except KeyError:
- pass
-
- def process_incoming(self):
- """process the incoming messages from running pylint"""
- while self.msg_queue.qsize():
- try:
- msg = self.msg_queue.get(0)
- if msg == "DONE":
- self.report_stream.output_contents()
- return False
-
- #adding message to list of msgs
- self.msgs.append(msg)
-
- #displaying msg if message type is selected in check box
- if self.msg_type_dict.get(msg.C)():
- self.visible_msgs.append(msg)
- msg_str = convert_to_string(msg)
- self.lb_messages.insert(END, msg_str)
- fg_color = COLORS.get(msg_str[:3], 'black')
- self.lb_messages.itemconfigure(END, fg=fg_color)
-
- except six.moves.queue.Empty:
- pass
- return True
-
- def periodic_call(self):
- """determine when to unlock the run button"""
- if self.process_incoming():
- self.root.after(100, self.periodic_call)
- else:
- #enabling button so it can be run again
- self.btnRun.config(state=NORMAL)
-
- def mainloop(self):
- """launch the mainloop of the application"""
- self.root.mainloop()
-
- def quit(self, _=None):
- """quit the application"""
- self.root.quit()
-
- def halt(self): # pylint: disable=no-self-use
- """program halt placeholder"""
- return
-
- def file_open(self, package=False, _=None):
- """launch a file browser"""
- if not package:
- filename = askopenfilename(parent=self.root,
- filetypes=[('pythonfiles', '*.py'),
- ('allfiles', '*')],
- title='Select Module')
- else:
- filename = askdirectory(title="Select A Folder", mustexist=1)
-
- if filename == ():
- return
-
- self.txt_module.delete(0, END)
- self.txt_module.insert(0, filename)
-
- def update_filenames(self):
- """update the list of recent filenames"""
- filename = self.txt_module.get()
- if not filename:
- filename = os.getcwd()
- if filename+'\n' in self.filenames:
- index = self.filenames.index(filename+'\n')
- self.filenames.pop(index)
-
- #ensure only 10 most recent are stored
- if len(self.filenames) == 10:
- self.filenames.pop()
- self.filenames.insert(0, filename+'\n')
-
- def set_history_window(self):
- """update the history window with info from the history file"""
- #clear the window
- self.showhistory.delete(0, END)
- # keep the last 10 most recent files
- try:
- view_history = open(HOME+HISTORY, 'r')
- for hist in view_history.readlines():
- if not hist in self.filenames:
- self.filenames.append(hist)
- self.showhistory.insert(END, hist.split('\n')[0])
- view_history.close()
- except IOError:
- # do nothing since history file will be created later
- return
-
- def run_lint(self, _=None):
- """launches pylint"""
- self.update_filenames()
- self.root.configure(cursor='watch')
- self.reporter = GUIReporter(self, output=self.report_stream)
- module = self.txt_module.get()
- if not module:
- module = os.getcwd()
-
- #cleaning up msgs and windows
- self.msgs = []
- self.visible_msgs = []
- self.lb_messages.delete(0, END)
- self.tabs = {}
- self.results.delete(0, END)
- self.btnRun.config(state=DISABLED)
-
- #setting up a worker thread to run pylint
- worker = Thread(target=lint_thread, args=(module, self.reporter, self,))
- self.periodic_call()
- worker.start()
-
- # Overwrite the .pylint-gui-history file with all the new recently added files
- # in order from filenames but only save last 10 files
- write_history = open(HOME+HISTORY, 'w')
- write_history.writelines(self.filenames)
- write_history.close()
- self.set_history_window()
-
- self.root.configure(cursor='')
-
- def show_sourcefile(self, event=None): # pylint: disable=unused-argument
- selected = self.lb_messages.curselection()
- if not selected:
- return
-
- msg = self.visible_msgs[int(selected[0])]
- scroll = msg.line - 3
- if scroll < 0:
- scroll = 0
-
- self.tabs["Source File"] = open(msg.path, "r").readlines()
- self.box.set("Source File")
- self.refresh_results_window()
- self.results.yview(scroll)
- self.results.select_set(msg.line - 1)
-
-
-def lint_thread(module, reporter, gui):
- """thread for pylint"""
- gui.status.text = "processing module(s)"
- pylint.lint.Run(args=[module], reporter=reporter, exit=False)
- gui.msg_queue.put("DONE")
-
-
-def Run(args):
- """launch pylint gui from args"""
- if args:
- print('USAGE: pylint-gui\n launch a simple pylint gui using Tk')
- sys.exit(1)
- gui = LintGui()
- gui.mainloop()
- sys.exit(0)
-
-if __name__ == '__main__':
- Run(sys.argv[1:])
diff --git a/chromium/third_party/pylint/pylint/interfaces.py b/chromium/third_party/pylint/pylint/interfaces.py
deleted file mode 100644
index 64f5a956198..00000000000
--- a/chromium/third_party/pylint/pylint/interfaces.py
+++ /dev/null
@@ -1,84 +0,0 @@
-# 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 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.
-"""Interfaces for Pylint objects"""
-from collections import namedtuple
-
-from logilab.common.interface import Interface
-
-Confidence = namedtuple('Confidence', ['name', 'description'])
-# Warning Certainties
-HIGH = Confidence('HIGH', 'No false positive possible.')
-INFERENCE = Confidence('INFERENCE', 'Warning based on inference result.')
-INFERENCE_FAILURE = Confidence('INFERENCE_FAILURE',
- 'Warning based on inference with failures.')
-UNDEFINED = Confidence('UNDEFINED',
- 'Warning without any associated confidence level.')
-
-CONFIDENCE_LEVELS = [HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED]
-
-
-class IChecker(Interface):
- """This is an base interface, not designed to be used elsewhere than for
- sub interfaces definition.
- """
-
- def open(self):
- """called before visiting project (i.e set of modules)"""
-
- def close(self):
- """called after visiting project (i.e set of modules)"""
-
-
-class IRawChecker(IChecker):
- """interface for checker which need to parse the raw file
- """
-
- def process_module(self, astroid):
- """ process a module
-
- the module's content is accessible via astroid.stream
- """
-
-
-class ITokenChecker(IChecker):
- """Interface for checkers that need access to the token list."""
- def process_tokens(self, tokens):
- """Process a module.
-
- tokens is a list of all source code tokens in the file.
- """
-
-
-class IAstroidChecker(IChecker):
- """ interface for checker which prefers receive events according to
- statement type
- """
-
-
-class IReporter(Interface):
- """ reporter collect messages and display results encapsulated in a layout
- """
- def add_message(self, msg_id, location, msg):
- """add a message of a given type
-
- msg_id is a message identifier
- location is a 3-uple (module, object, line)
- msg is the actual message
- """
-
- def display_results(self, layout):
- """display results encapsulated in the layout tree
- """
-
-
-__all__ = ('IRawChecker', 'IAstroidChecker', 'ITokenChecker', 'IReporter')
diff --git a/chromium/third_party/pylint/pylint/lint.py b/chromium/third_party/pylint/pylint/lint.py
deleted file mode 100644
index 082d8b3574d..00000000000
--- a/chromium/third_party/pylint/pylint/lint.py
+++ /dev/null
@@ -1,1333 +0,0 @@
-# Copyright (c) 2003-2014 LOGILAB S.A. (Paris, FRANCE).
-# http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# 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 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.
-""" %prog [options] module_or_package
-
- Check that a module satisfies a coding standard (and more !).
-
- %prog --help
-
- Display this help message and exit.
-
- %prog --help-msg <msg-id>[,<msg-id>]
-
- Display help messages about given message identifiers and exit.
-"""
-from __future__ import print_function
-
-import collections
-import contextlib
-import itertools
-import operator
-import os
-try:
- import multiprocessing
-except ImportError:
- multiprocessing = None
-import sys
-import tokenize
-import warnings
-
-import astroid
-from astroid.__pkginfo__ import version as astroid_version
-from astroid import modutils
-from logilab.common import configuration
-from logilab.common import optik_ext
-from logilab.common import interface
-from logilab.common import textutils
-from logilab.common import ureports
-from logilab.common.__pkginfo__ import version as common_version
-import six
-
-from pylint import checkers
-from pylint import interfaces
-from pylint import reporters
-from pylint import utils
-from pylint import config
-from pylint.__pkginfo__ import version
-
-
-MANAGER = astroid.MANAGER
-
-def _get_new_args(message):
- location = (
- message.abspath,
- message.path,
- message.module,
- message.obj,
- message.line,
- message.column,
- )
- return (
- message.msg_id,
- message.symbol,
- location,
- message.msg,
- message.confidence,
- )
-
-def _get_python_path(filepath):
- dirname = os.path.realpath(os.path.expanduser(filepath))
- if not os.path.isdir(dirname):
- dirname = os.path.dirname(dirname)
- while True:
- if not os.path.exists(os.path.join(dirname, "__init__.py")):
- return dirname
- old_dirname = dirname
- dirname = os.path.dirname(dirname)
- if old_dirname == dirname:
- return os.getcwd()
-
-
-def _merge_stats(stats):
- merged = {}
- for stat in stats:
- for key, item in six.iteritems(stat):
- if key not in merged:
- merged[key] = item
- else:
- if isinstance(item, dict):
- merged[key].update(item)
- else:
- merged[key] = merged[key] + item
- return merged
-
-
-# Python Linter class #########################################################
-
-MSGS = {
- 'F0001': ('%s',
- 'fatal',
- 'Used when an error occurred preventing the analysis of a \
- module (unable to find it for instance).'),
- 'F0002': ('%s: %s',
- 'astroid-error',
- 'Used when an unexpected error occurred while building the '
- 'Astroid representation. This is usually accompanied by a '
- 'traceback. Please report such errors !'),
- 'F0003': ('ignored builtin module %s',
- 'ignored-builtin-module',
- 'Used to indicate that the user asked to analyze a builtin '
- 'module which has been skipped.'),
- 'F0010': ('error while code parsing: %s',
- 'parse-error',
- 'Used when an exception occured while building the Astroid '
- 'representation which could be handled by astroid.'),
-
- 'I0001': ('Unable to run raw checkers on built-in module %s',
- 'raw-checker-failed',
- 'Used to inform that a built-in module has not been checked '
- 'using the raw checkers.'),
-
- 'I0010': ('Unable to consider inline option %r',
- 'bad-inline-option',
- 'Used when an inline option is either badly formatted or can\'t '
- 'be used inside modules.'),
-
- 'I0011': ('Locally disabling %s (%s)',
- 'locally-disabled',
- 'Used when an inline option disables a message or a messages '
- 'category.'),
- 'I0012': ('Locally enabling %s (%s)',
- 'locally-enabled',
- 'Used when an inline option enables a message or a messages '
- 'category.'),
- 'I0013': ('Ignoring entire file',
- 'file-ignored',
- 'Used to inform that the file will not be checked'),
- 'I0020': ('Suppressed %s (from line %d)',
- 'suppressed-message',
- 'A message was triggered on a line, but suppressed explicitly '
- 'by a disable= comment in the file. This message is not '
- 'generated for messages that are ignored due to configuration '
- 'settings.'),
- 'I0021': ('Useless suppression of %s',
- 'useless-suppression',
- 'Reported when a message is explicitly disabled for a line or '
- 'a block of code, but never triggered.'),
- 'I0022': ('Pragma "%s" is deprecated, use "%s" instead',
- 'deprecated-pragma',
- 'Some inline pylint options have been renamed or reworked, '
- 'only the most recent form should be used. '
- 'NOTE:skip-all is only available with pylint >= 0.26',
- {'old_names': [('I0014', 'deprecated-disable-all')]}),
-
- 'E0001': ('%s',
- 'syntax-error',
- 'Used when a syntax error is raised for a module.'),
-
- 'E0011': ('Unrecognized file option %r',
- 'unrecognized-inline-option',
- 'Used when an unknown inline option is encountered.'),
- 'E0012': ('Bad option value %r',
- 'bad-option-value',
- 'Used when a bad value for an inline option is encountered.'),
- }
-
-
-def _deprecated_option(shortname, opt_type):
- def _warn_deprecated(option, optname, *args): # pylint: disable=unused-argument
- sys.stderr.write('Warning: option %s is deprecated and ignored.\n' % (optname,))
- return {'short': shortname, 'help': 'DEPRECATED', 'hide': True,
- 'type': opt_type, 'action': 'callback', 'callback': _warn_deprecated}
-
-
-if multiprocessing is not None:
- class ChildLinter(multiprocessing.Process): # pylint: disable=no-member
- def run(self):
- tasks_queue, results_queue, self._config = self._args # pylint: disable=no-member
-
- self._config["jobs"] = 1 # Child does not parallelize any further.
-
- # Run linter for received files/modules.
- for file_or_module in iter(tasks_queue.get, 'STOP'):
- result = self._run_linter(file_or_module[0])
- try:
- results_queue.put(result)
- except Exception as ex:
- print("internal error with sending report for module %s" % file_or_module, file=sys.stderr)
- print(ex, file=sys.stderr)
- results_queue.put({})
-
- def _run_linter(self, file_or_module):
- linter = PyLinter()
-
- # Register standard checkers.
- linter.load_default_plugins()
- # Load command line plugins.
- # TODO linter.load_plugin_modules(self._plugins)
-
- linter.load_configuration(**self._config)
- linter.set_reporter(reporters.CollectingReporter())
-
- # Run the checks.
- linter.check(file_or_module)
-
- msgs = [_get_new_args(m) for m in linter.reporter.messages]
- return (file_or_module, linter.file_state.base_name, linter.current_name,
- msgs, linter.stats, linter.msg_status)
-
-
-class PyLinter(configuration.OptionsManagerMixIn,
- utils.MessagesHandlerMixIn,
- utils.ReportsHandlerMixIn,
- checkers.BaseTokenChecker):
- """lint Python modules using external checkers.
-
- This is the main checker controlling the other ones and the reports
- generation. It is itself both a raw checker and an astroid checker in order
- to:
- * handle message activation / deactivation at the module level
- * handle some basic but necessary stats'data (number of classes, methods...)
-
- IDE plugins developpers: you may have to call
- `astroid.builder.MANAGER.astroid_cache.clear()` accross run if you want
- to ensure the latest code version is actually checked.
- """
-
- __implements__ = (interfaces.ITokenChecker, )
-
- name = 'master'
- priority = 0
- level = 0
- msgs = MSGS
-
- @staticmethod
- def make_options():
- return (('ignore',
- {'type' : 'csv', 'metavar' : '<file>[,<file>...]',
- 'dest' : 'black_list', 'default' : ('CVS',),
- 'help' : 'Add files or directories to the blacklist. '
- 'They should be base names, not paths.'}),
- ('persistent',
- {'default': True, 'type' : 'yn', 'metavar' : '<y_or_n>',
- 'level': 1,
- 'help' : 'Pickle collected data for later comparisons.'}),
-
- ('load-plugins',
- {'type' : 'csv', 'metavar' : '<modules>', 'default' : (),
- 'level': 1,
- 'help' : 'List of plugins (as comma separated values of '
- 'python modules names) to load, usually to register '
- 'additional checkers.'}),
-
- ('output-format',
- {'default': 'text', 'type': 'string', 'metavar' : '<format>',
- 'short': 'f',
- 'group': 'Reports',
- 'help' : 'Set the output format. Available formats are text,'
- ' parseable, colorized, msvs (visual studio) and html. You '
- 'can also give a reporter class, eg mypackage.mymodule.'
- 'MyReporterClass.'}),
-
- ('files-output',
- {'default': 0, 'type' : 'yn', 'metavar' : '<y_or_n>',
- 'group': 'Reports', 'level': 1,
- 'help' : 'Put messages in a separate file for each module / '
- 'package specified on the command line instead of printing '
- 'them on stdout. Reports (if any) will be written in a file '
- 'name "pylint_global.[txt|html]".'}),
-
- ('reports',
- {'default': 1, 'type' : 'yn', 'metavar' : '<y_or_n>',
- 'short': 'r',
- 'group': 'Reports',
- 'help' : 'Tells whether to display a full report or only the '
- 'messages'}),
-
- ('evaluation',
- {'type' : 'string', 'metavar' : '<python_expression>',
- 'group': 'Reports', 'level': 1,
- 'default': '10.0 - ((float(5 * error + warning + refactor + '
- 'convention) / statement) * 10)',
- 'help' : 'Python expression which should return a note less '
- 'than 10 (10 is the highest note). You have access '
- 'to the variables errors warning, statement which '
- 'respectively contain the number of errors / '
- 'warnings messages and the total number of '
- 'statements analyzed. This is used by the global '
- 'evaluation report (RP0004).'}),
-
- ('comment',
- {'default': 0, 'type' : 'yn', 'metavar' : '<y_or_n>',
- 'group': 'Reports', 'level': 1,
- 'help' : 'Add a comment according to your evaluation note. '
- 'This is used by the global evaluation report (RP0004).'}),
-
- ('confidence',
- {'type' : 'multiple_choice', 'metavar': '<levels>',
- 'default': '',
- 'choices': [c.name for c in interfaces.CONFIDENCE_LEVELS],
- 'group': 'Messages control',
- 'help' : 'Only show warnings with the listed confidence levels.'
- ' Leave empty to show all. Valid levels: %s' % (
- ', '.join(c.name for c in interfaces.CONFIDENCE_LEVELS),)}),
-
- ('enable',
- {'type' : 'csv', 'metavar': '<msg ids>',
- 'short': 'e',
- 'group': 'Messages control',
- 'help' : 'Enable the message, report, category or checker with the '
- 'given id(s). You can either give multiple identifier '
- 'separated by comma (,) or put this option multiple time. '
- 'See also the "--disable" option for examples. '}),
-
- ('disable',
- {'type' : 'csv', 'metavar': '<msg ids>',
- 'short': 'd',
- 'group': 'Messages control',
- 'help' : 'Disable the message, report, category or checker '
- 'with the given id(s). You can either give multiple identifiers'
- ' separated by comma (,) or put this option multiple times '
- '(only on the command line, not in the configuration file '
- 'where it should appear only once).'
- 'You can also use "--disable=all" to disable everything first '
- 'and then reenable specific checks. For example, if you want '
- 'to run only the similarities checker, you can use '
- '"--disable=all --enable=similarities". '
- 'If you want to run only the classes checker, but have no '
- 'Warning level messages displayed, use'
- '"--disable=all --enable=classes --disable=W"'}),
-
- ('msg-template',
- {'type' : 'string', 'metavar': '<template>',
- 'group': 'Reports',
- 'help' : ('Template used to display messages. '
- 'This is a python new-style format string '
- 'used to format the message information. '
- 'See doc for all details')
- }),
-
- ('include-ids', _deprecated_option('i', 'yn')),
- ('symbols', _deprecated_option('s', 'yn')),
-
- ('jobs',
- {'type' : 'int', 'metavar': '<n-processes>',
- 'short': 'j',
- 'default': 1,
- 'help' : '''Use multiple processes to speed up Pylint.''',
- }),
-
- ('unsafe-load-any-extension',
- {'type': 'yn', 'metavar': '<yn>', 'default': False, 'hide': True,
- 'help': ('Allow loading of arbitrary C extensions. Extensions'
- ' are imported into the active Python interpreter and'
- ' may run arbitrary code.')}),
-
- ('extension-pkg-whitelist',
- {'type': 'csv', 'metavar': '<pkg[,pkg]>', 'default': [],
- 'help': ('A comma-separated list of package or module names'
- ' from where C extensions may be loaded. Extensions are'
- ' loading into the active Python interpreter and may run'
- ' arbitrary code')}
- ),
- )
-
- option_groups = (
- ('Messages control', 'Options controling analysis messages'),
- ('Reports', 'Options related to output formating and reporting'),
- )
-
- def __init__(self, options=(), reporter=None, option_groups=(),
- pylintrc=None):
- # some stuff has to be done before ancestors initialization...
- #
- # messages store / checkers / reporter / astroid manager
- self.msgs_store = utils.MessagesStore()
- self.reporter = None
- self._reporter_name = None
- self._reporters = {}
- self._checkers = collections.defaultdict(list)
- self._pragma_lineno = {}
- self._ignore_file = False
- # visit variables
- self.file_state = utils.FileState()
- self.current_name = None
- self.current_file = None
- self.stats = None
- # init options
- self._external_opts = options
- self.options = options + PyLinter.make_options()
- self.option_groups = option_groups + PyLinter.option_groups
- self._options_methods = {
- 'enable': self.enable,
- 'disable': self.disable}
- self._bw_options_methods = {'disable-msg': self.disable,
- 'enable-msg': self.enable}
- full_version = '%%prog %s, \nastroid %s, common %s\nPython %s' % (
- version, astroid_version, common_version, sys.version)
- configuration.OptionsManagerMixIn.__init__(
- self, usage=__doc__,
- version=full_version,
- config_file=pylintrc or config.PYLINTRC)
- utils.MessagesHandlerMixIn.__init__(self)
- utils.ReportsHandlerMixIn.__init__(self)
- checkers.BaseTokenChecker.__init__(self)
- # provided reports
- self.reports = (('RP0001', 'Messages by category',
- report_total_messages_stats),
- ('RP0002', '% errors / warnings by module',
- report_messages_by_module_stats),
- ('RP0003', 'Messages',
- report_messages_stats),
- ('RP0004', 'Global evaluation',
- self.report_evaluation),
- )
- self.register_checker(self)
- self._dynamic_plugins = set()
- self.load_provider_defaults()
- if reporter:
- self.set_reporter(reporter)
-
- def load_default_plugins(self):
- checkers.initialize(self)
- reporters.initialize(self)
- # Make sure to load the default reporter, because
- # the option has been set before the plugins had been loaded.
- if not self.reporter:
- self._load_reporter()
-
- def load_plugin_modules(self, modnames):
- """take a list of module names which are pylint plugins and load
- and register them
- """
- for modname in modnames:
- if modname in self._dynamic_plugins:
- continue
- self._dynamic_plugins.add(modname)
- module = modutils.load_module_from_name(modname)
- module.register(self)
-
- def _load_reporter(self):
- name = self._reporter_name.lower()
- if name in self._reporters:
- self.set_reporter(self._reporters[name]())
- else:
- qname = self._reporter_name
- module = modutils.load_module_from_name(
- modutils.get_module_part(qname))
- class_name = qname.split('.')[-1]
- reporter_class = getattr(module, class_name)
- self.set_reporter(reporter_class())
-
- def set_reporter(self, reporter):
- """set the reporter used to display messages and reports"""
- self.reporter = reporter
- reporter.linter = self
-
- def set_option(self, optname, value, action=None, optdict=None):
- """overridden from configuration.OptionsProviderMixin to handle some
- special options
- """
- if optname in self._options_methods or \
- optname in self._bw_options_methods:
- if value:
- try:
- meth = self._options_methods[optname]
- except KeyError:
- meth = self._bw_options_methods[optname]
- warnings.warn('%s is deprecated, replace it by %s' % (
- optname, optname.split('-')[0]),
- DeprecationWarning)
- value = optik_ext.check_csv(None, optname, value)
- if isinstance(value, (list, tuple)):
- for _id in value:
- meth(_id, ignore_unknown=True)
- else:
- meth(value)
- return # no need to call set_option, disable/enable methods do it
- elif optname == 'output-format':
- self._reporter_name = value
- # If the reporters are already available, load
- # the reporter class.
- if self._reporters:
- self._load_reporter()
-
- try:
- checkers.BaseTokenChecker.set_option(self, optname,
- value, action, optdict)
- except configuration.UnsupportedAction:
- print('option %s can\'t be read from config file' % \
- optname, file=sys.stderr)
-
- def register_reporter(self, reporter_class):
- self._reporters[reporter_class.name] = reporter_class
-
- def report_order(self):
- reports = sorted(self._reports, key=lambda x: getattr(x, 'name', ''))
- try:
- # Remove the current reporter and add it
- # at the end of the list.
- reports.pop(reports.index(self))
- except ValueError:
- pass
- else:
- reports.append(self)
- return reports
-
- # checkers manipulation methods ############################################
-
- def register_checker(self, checker):
- """register a new checker
-
- checker is an object implementing IRawChecker or / and IAstroidChecker
- """
- assert checker.priority <= 0, 'checker priority can\'t be >= 0'
- self._checkers[checker.name].append(checker)
- for r_id, r_title, r_cb in checker.reports:
- self.register_report(r_id, r_title, r_cb, checker)
- self.register_options_provider(checker)
- if hasattr(checker, 'msgs'):
- self.msgs_store.register_messages(checker)
- checker.load_defaults()
-
- # Register the checker, but disable all of its messages.
- # TODO(cpopa): we should have a better API for this.
- if not getattr(checker, 'enabled', True):
- self.disable(checker.name)
-
- def disable_noerror_messages(self):
- for msgcat, msgids in six.iteritems(self.msgs_store._msgs_by_category):
- if msgcat == 'E':
- for msgid in msgids:
- self.enable(msgid)
- else:
- for msgid in msgids:
- self.disable(msgid)
-
- def disable_reporters(self):
- """disable all reporters"""
- for reporters in six.itervalues(self._reports):
- for report_id, _, _ in reporters:
- self.disable_report(report_id)
-
- def error_mode(self):
- """error mode: enable only errors; no reports, no persistent"""
- self.disable_noerror_messages()
- self.disable('miscellaneous')
- self.set_option('reports', False)
- self.set_option('persistent', False)
-
- # block level option handling #############################################
- #
- # see func_block_disable_msg.py test case for expected behaviour
-
- def process_tokens(self, tokens):
- """process tokens from the current module to search for module/block
- level options
- """
- control_pragmas = {'disable', 'enable'}
- for (tok_type, content, start, _, _) in tokens:
- if tok_type != tokenize.COMMENT:
- continue
- match = utils.OPTION_RGX.search(content)
- if match is None:
- continue
- if match.group(1).strip() == "disable-all" or \
- match.group(1).strip() == 'skip-file':
- if match.group(1).strip() == "disable-all":
- self.add_message('deprecated-pragma', line=start[0],
- args=('disable-all', 'skip-file'))
- self.add_message('file-ignored', line=start[0])
- self._ignore_file = True
- return
- try:
- opt, value = match.group(1).split('=', 1)
- except ValueError:
- self.add_message('bad-inline-option', args=match.group(1).strip(),
- line=start[0])
- continue
- opt = opt.strip()
- if opt in self._options_methods or opt in self._bw_options_methods:
- try:
- meth = self._options_methods[opt]
- except KeyError:
- meth = self._bw_options_methods[opt]
- # found a "(dis|en)able-msg" pragma deprecated suppresssion
- self.add_message('deprecated-pragma', line=start[0], args=(opt, opt.replace('-msg', '')))
- for msgid in textutils.splitstrip(value):
- # Add the line where a control pragma was encountered.
- if opt in control_pragmas:
- self._pragma_lineno[msgid] = start[0]
-
- try:
- if (opt, msgid) == ('disable', 'all'):
- self.add_message('deprecated-pragma', line=start[0], args=('disable=all', 'skip-file'))
- self.add_message('file-ignored', line=start[0])
- self._ignore_file = True
- return
- meth(msgid, 'module', start[0])
- except utils.UnknownMessage:
- self.add_message('bad-option-value', args=msgid, line=start[0])
- else:
- self.add_message('unrecognized-inline-option', args=opt, line=start[0])
-
-
- # code checking methods ###################################################
-
- def get_checkers(self):
- """return all available checkers as a list"""
- return [self] + [c for checkers in six.itervalues(self._checkers)
- for c in checkers if c is not self]
-
- def prepare_checkers(self):
- """return checkers needed for activated messages and reports"""
- if not self.config.reports:
- self.disable_reporters()
- # get needed checkers
- neededcheckers = [self]
- for checker in self.get_checkers()[1:]:
- # fatal errors should not trigger enable / disabling a checker
- messages = set(msg for msg in checker.msgs
- if msg[0] != 'F' and self.is_message_enabled(msg))
- if (messages or
- any(self.report_is_enabled(r[0]) for r in checker.reports)):
- neededcheckers.append(checker)
- # Sort checkers by priority
- neededcheckers = sorted(neededcheckers,
- key=operator.attrgetter('priority'),
- reverse=True)
- return neededcheckers
-
- def should_analyze_file(self, modname, path): # pylint: disable=unused-argument, no-self-use
- """Returns whether or not a module should be checked.
-
- This implementation returns True for all python source file, indicating
- that all files should be linted.
-
- Subclasses may override this method to indicate that modules satisfying
- certain conditions should not be linted.
-
- :param str modname: The name of the module to be checked.
- :param str path: The full path to the source code of the module.
- :returns: True if the module should be checked.
- :rtype: bool
- """
- return path.endswith('.py')
-
- def check(self, files_or_modules):
- """main checking entry: check a list of files or modules from their
- name.
- """
- # initialize msgs_state now that all messages have been registered into
- # the store
- for msg in self.msgs_store.messages:
- if not msg.may_be_emitted():
- self._msgs_state[msg.msgid] = False
-
- if not isinstance(files_or_modules, (list, tuple)):
- files_or_modules = (files_or_modules,)
-
- if self.config.jobs == 1:
- with fix_import_path(files_or_modules):
- self._do_check(files_or_modules)
- else:
- # Hack that permits running pylint, on Windows, with -m switch
- # and with --jobs, as in 'python -2 -m pylint .. --jobs'.
- # For more details why this is needed,
- # see Python issue http://bugs.python.org/issue10845.
-
- mock_main = __name__ != '__main__' # -m switch
- if mock_main:
- sys.modules['__main__'] = sys.modules[__name__]
- try:
- self._parallel_check(files_or_modules)
- finally:
- if mock_main:
- sys.modules.pop('__main__')
-
- def _parallel_task(self, files_or_modules):
- # Prepare configuration for child linters.
- filter_options = {'symbols', 'include-ids', 'long-help'}
- filter_options.update([opt_name for opt_name, _ in self._external_opts])
- config = {}
- for opt_providers in six.itervalues(self._all_options):
- for optname, optdict, val in opt_providers.options_and_values():
- if optname not in filter_options:
- config[optname] = configuration.format_option_value(optdict, val)
-
- childs = []
- manager = multiprocessing.Manager() # pylint: disable=no-member
- tasks_queue = manager.Queue() # pylint: disable=no-member
- results_queue = manager.Queue() # pylint: disable=no-member
-
- for _ in range(self.config.jobs):
- cl = ChildLinter(args=(tasks_queue, results_queue, config))
- cl.start() # pylint: disable=no-member
- childs.append(cl)
-
- # send files to child linters
- for files_or_module in files_or_modules:
- tasks_queue.put([files_or_module])
-
- # collect results from child linters
- failed = False
- for _ in files_or_modules:
- try:
- result = results_queue.get()
- except Exception as ex:
- print("internal error while receiving results from child linter",
- file=sys.stderr)
- print(ex, file=sys.stderr)
- failed = True
- break
- yield result
-
- # Stop child linters and wait for their completion.
- for _ in range(self.config.jobs):
- tasks_queue.put('STOP')
- for cl in childs:
- cl.join()
-
- if failed:
- print("Error occured, stopping the linter.", file=sys.stderr)
- sys.exit(32)
-
- def _parallel_check(self, files_or_modules):
- # Reset stats.
- self.open()
-
- all_stats = []
- for result in self._parallel_task(files_or_modules):
- (
- file_or_module,
- self.file_state.base_name,
- module,
- messages,
- stats,
- msg_status
- ) = result
-
- if file_or_module == files_or_modules[-1]:
- last_module = module
-
- for msg in messages:
- msg = utils.Message(*msg)
- self.set_current_module(module)
- self.reporter.handle_message(msg)
-
- all_stats.append(stats)
- self.msg_status |= msg_status
-
- self.stats = _merge_stats(itertools.chain(all_stats, [self.stats]))
- self.current_name = last_module
-
- # Insert stats data to local checkers.
- for checker in self.get_checkers():
- if checker is not self:
- checker.stats = self.stats
-
- def _do_check(self, files_or_modules):
- walker = utils.PyLintASTWalker(self)
- checkers = self.prepare_checkers()
- tokencheckers = [c for c in checkers
- if interface.implements(c, interfaces.ITokenChecker)
- and c is not self]
- rawcheckers = [c for c in checkers
- if interface.implements(c, interfaces.IRawChecker)]
- # notify global begin
- for checker in checkers:
- checker.open()
- if interface.implements(checker, interfaces.IAstroidChecker):
- walker.add_checker(checker)
- # build ast and check modules or packages
- for descr in self.expand_files(files_or_modules):
- modname, filepath = descr['name'], descr['path']
- if not descr['isarg'] and not self.should_analyze_file(modname, filepath):
- continue
- if self.config.files_output:
- reportfile = 'pylint_%s.%s' % (modname, self.reporter.extension)
- self.reporter.set_output(open(reportfile, 'w'))
- self.set_current_module(modname, filepath)
- # get the module representation
- ast_node = self.get_ast(filepath, modname)
- if ast_node is None:
- continue
- # XXX to be correct we need to keep module_msgs_state for every
- # analyzed module (the problem stands with localized messages which
- # are only detected in the .close step)
- self.file_state = utils.FileState(descr['basename'])
- self._ignore_file = False
- # fix the current file (if the source file was not available or
- # if it's actually a c extension)
- self.current_file = ast_node.file # pylint: disable=maybe-no-member
- self.check_astroid_module(ast_node, walker, rawcheckers, tokencheckers)
- # warn about spurious inline messages handling
- for msgid, line, args in self.file_state.iter_spurious_suppression_messages(self.msgs_store):
- self.add_message(msgid, line, None, args)
- # notify global end
- self.stats['statement'] = walker.nbstatements
- checkers.reverse()
- for checker in checkers:
- checker.close()
-
- def expand_files(self, modules):
- """get modules and errors from a list of modules and handle errors
- """
- result, errors = utils.expand_modules(modules, self.config.black_list)
- for error in errors:
- message = modname = error["mod"]
- key = error["key"]
- self.set_current_module(modname)
- if key == "fatal":
- message = str(error["ex"]).replace(os.getcwd() + os.sep, '')
- self.add_message(key, args=message)
- return result
-
- def set_current_module(self, modname, filepath=None):
- """set the name of the currently analyzed module and
- init statistics for it
- """
- if not modname and filepath is None:
- return
- self.reporter.on_set_current_module(modname, filepath)
- self.current_name = modname
- self.current_file = filepath or modname
- self.stats['by_module'][modname] = {}
- self.stats['by_module'][modname]['statement'] = 0
- for msg_cat in six.itervalues(utils.MSG_TYPES):
- self.stats['by_module'][modname][msg_cat] = 0
-
- def get_ast(self, filepath, modname):
- """return a ast(roid) representation for a module"""
- try:
- return MANAGER.ast_from_file(filepath, modname, source=True)
- except SyntaxError as ex:
- self.add_message('syntax-error', line=ex.lineno, args=ex.msg)
- except astroid.AstroidBuildingException as ex:
- self.add_message('parse-error', args=ex)
- except Exception as ex: # pylint: disable=broad-except
- import traceback
- traceback.print_exc()
- self.add_message('astroid-error', args=(ex.__class__, ex))
-
- def check_astroid_module(self, ast_node, walker,
- rawcheckers, tokencheckers):
- """Check a module from its astroid representation."""
- try:
- tokens = utils.tokenize_module(ast_node)
- except tokenize.TokenError as ex:
- self.add_message('syntax-error', line=ex.args[1][0], args=ex.args[0])
- return
-
- if not ast_node.pure_python:
- self.add_message('raw-checker-failed', args=ast_node.name)
- else:
- #assert astroid.file.endswith('.py')
- # invoke ITokenChecker interface on self to fetch module/block
- # level options
- self.process_tokens(tokens)
- if self._ignore_file:
- return False
- # walk ast to collect line numbers
- self.file_state.collect_block_lines(self.msgs_store, ast_node)
- # run raw and tokens checkers
- for checker in rawcheckers:
- checker.process_module(ast_node)
- for checker in tokencheckers:
- checker.process_tokens(tokens)
- # generate events to astroid checkers
- walker.walk(ast_node)
- return True
-
- # IAstroidChecker interface #################################################
-
- def open(self):
- """initialize counters"""
- self.stats = {'by_module' : {},
- 'by_msg' : {},
- }
- MANAGER.always_load_extensions = self.config.unsafe_load_any_extension
- MANAGER.extension_package_whitelist.update(
- self.config.extension_pkg_whitelist)
- for msg_cat in six.itervalues(utils.MSG_TYPES):
- self.stats[msg_cat] = 0
-
- def generate_reports(self):
- """close the whole package /module, it's time to make reports !
-
- if persistent run, pickle results for later comparison
- """
- if self.file_state.base_name is not None:
- # load previous results if any
- previous_stats = config.load_results(self.file_state.base_name)
- # XXX code below needs refactoring to be more reporter agnostic
- self.reporter.on_close(self.stats, previous_stats)
- if self.config.reports:
- sect = self.make_reports(self.stats, previous_stats)
- if self.config.files_output:
- filename = 'pylint_global.' + self.reporter.extension
- self.reporter.set_output(open(filename, 'w'))
- else:
- sect = ureports.Section()
- if self.config.reports or self.config.output_format == 'html':
- self.reporter.display_results(sect)
- # save results if persistent run
- if self.config.persistent:
- config.save_results(self.stats, self.file_state.base_name)
- else:
- if self.config.output_format == 'html':
- # No output will be emitted for the html
- # reporter if the file doesn't exist, so emit
- # the results here.
- self.reporter.display_results(ureports.Section())
- self.reporter.on_close(self.stats, {})
-
- # specific reports ########################################################
-
- def report_evaluation(self, sect, stats, previous_stats):
- """make the global evaluation report"""
- # check with at least check 1 statements (usually 0 when there is a
- # syntax error preventing pylint from further processing)
- if stats['statement'] == 0:
- raise utils.EmptyReport()
- # get a global note for the code
- evaluation = self.config.evaluation
- try:
- note = eval(evaluation, {}, self.stats) # pylint: disable=eval-used
- except Exception as ex: # pylint: disable=broad-except
- msg = 'An exception occurred while rating: %s' % ex
- else:
- stats['global_note'] = note
- msg = 'Your code has been rated at %.2f/10' % note
- pnote = previous_stats.get('global_note')
- if pnote is not None:
- msg += ' (previous run: %.2f/10, %+.2f)' % (pnote, note - pnote)
- if self.config.comment:
- msg = '%s\n%s' % (msg, config.get_note_message(note))
- sect.append(ureports.Text(msg))
-
-# some reporting functions ####################################################
-
-def report_total_messages_stats(sect, stats, previous_stats):
- """make total errors / warnings report"""
- lines = ['type', 'number', 'previous', 'difference']
- lines += checkers.table_lines_from_stats(stats, previous_stats,
- ('convention', 'refactor',
- 'warning', 'error'))
- sect.append(ureports.Table(children=lines, cols=4, rheaders=1))
-
-def report_messages_stats(sect, stats, _):
- """make messages type report"""
- if not stats['by_msg']:
- # don't print this report when we didn't detected any errors
- raise utils.EmptyReport()
- in_order = sorted([(value, msg_id)
- for msg_id, value in six.iteritems(stats['by_msg'])
- if not msg_id.startswith('I')])
- in_order.reverse()
- lines = ('message id', 'occurrences')
- for value, msg_id in in_order:
- lines += (msg_id, str(value))
- sect.append(ureports.Table(children=lines, cols=2, rheaders=1))
-
-def report_messages_by_module_stats(sect, stats, _):
- """make errors / warnings by modules report"""
- if len(stats['by_module']) == 1:
- # don't print this report when we are analysing a single module
- raise utils.EmptyReport()
- by_mod = collections.defaultdict(dict)
- for m_type in ('fatal', 'error', 'warning', 'refactor', 'convention'):
- total = stats[m_type]
- for module in six.iterkeys(stats['by_module']):
- mod_total = stats['by_module'][module][m_type]
- if total == 0:
- percent = 0
- else:
- percent = float((mod_total)*100) / total
- by_mod[module][m_type] = percent
- sorted_result = []
- for module, mod_info in six.iteritems(by_mod):
- sorted_result.append((mod_info['error'],
- mod_info['warning'],
- mod_info['refactor'],
- mod_info['convention'],
- module))
- sorted_result.sort()
- sorted_result.reverse()
- lines = ['module', 'error', 'warning', 'refactor', 'convention']
- for line in sorted_result:
- # Don't report clean modules.
- if all(entry == 0 for entry in line[:-1]):
- continue
- lines.append(line[-1])
- for val in line[:-1]:
- lines.append('%.2f' % val)
- if len(lines) == 5:
- raise utils.EmptyReport()
- sect.append(ureports.Table(children=lines, cols=5, rheaders=1))
-
-
-# utilities ###################################################################
-
-
-class ArgumentPreprocessingError(Exception):
- """Raised if an error occurs during argument preprocessing."""
-
-
-def preprocess_options(args, search_for):
- """look for some options (keys of <search_for>) which have to be processed
- before others
-
- values of <search_for> are callback functions to call when the option is
- found
- """
- i = 0
- while i < len(args):
- arg = args[i]
- if arg.startswith('--'):
- try:
- option, val = arg[2:].split('=', 1)
- except ValueError:
- option, val = arg[2:], None
- try:
- cb, takearg = search_for[option]
- except KeyError:
- i += 1
- else:
- del args[i]
- if takearg and val is None:
- if i >= len(args) or args[i].startswith('-'):
- msg = 'Option %s expects a value' % option
- raise ArgumentPreprocessingError(msg)
- val = args[i]
- del args[i]
- elif not takearg and val is not None:
- msg = "Option %s doesn't expects a value" % option
- raise ArgumentPreprocessingError(msg)
- cb(option, val)
- else:
- i += 1
-
-
-@contextlib.contextmanager
-def fix_import_path(args):
- """Prepare sys.path for running the linter checks.
-
- Within this context, each of the given arguments is importable.
- Paths are added to sys.path in corresponding order to the arguments.
- We avoid adding duplicate directories to sys.path.
- `sys.path` is reset to its original value upon exitign this context.
- """
- orig = list(sys.path)
- changes = []
- for arg in args:
- path = _get_python_path(arg)
- if path in changes:
- continue
- else:
- changes.append(path)
- sys.path[:] = changes + sys.path
- try:
- yield
- finally:
- sys.path[:] = orig
-
-
-class Run(object):
- """helper class to use as main for pylint :
-
- run(*sys.argv[1:])
- """
- LinterClass = PyLinter
- option_groups = (
- ('Commands', 'Options which are actually commands. Options in this \
-group are mutually exclusive.'),
- )
-
- def __init__(self, args, reporter=None, exit=True):
- self._rcfile = None
- self._plugins = []
- try:
- preprocess_options(args, {
- # option: (callback, takearg)
- 'init-hook': (cb_init_hook, True),
- 'rcfile': (self.cb_set_rcfile, True),
- 'load-plugins': (self.cb_add_plugins, True),
- })
- except ArgumentPreprocessingError as ex:
- print(ex, file=sys.stderr)
- sys.exit(32)
-
- self.linter = linter = self.LinterClass((
- ('rcfile',
- {'action' : 'callback', 'callback' : lambda *args: 1,
- 'type': 'string', 'metavar': '<file>',
- 'help' : 'Specify a configuration file.'}),
-
- ('init-hook',
- {'action' : 'callback', 'callback' : lambda *args: 1,
- 'type' : 'string', 'metavar': '<code>',
- 'level': 1,
- 'help' : 'Python code to execute, usually for sys.path '
- 'manipulation such as pygtk.require().'}),
-
- ('help-msg',
- {'action' : 'callback', 'type' : 'string', 'metavar': '<msg-id>',
- 'callback' : self.cb_help_message,
- 'group': 'Commands',
- 'help' : 'Display a help message for the given message id and '
- 'exit. The value may be a comma separated list of message ids.'}),
-
- ('list-msgs',
- {'action' : 'callback', 'metavar': '<msg-id>',
- 'callback' : self.cb_list_messages,
- 'group': 'Commands', 'level': 1,
- 'help' : "Generate pylint's messages."}),
-
- ('list-conf-levels',
- {'action' : 'callback',
- 'callback' : cb_list_confidence_levels,
- 'group': 'Commands', 'level': 1,
- 'help' : "Generate pylint's messages."}),
-
- ('full-documentation',
- {'action' : 'callback', 'metavar': '<msg-id>',
- 'callback' : self.cb_full_documentation,
- 'group': 'Commands', 'level': 1,
- 'help' : "Generate pylint's full documentation."}),
-
- ('generate-rcfile',
- {'action' : 'callback', 'callback' : self.cb_generate_config,
- 'group': 'Commands',
- 'help' : 'Generate a sample configuration file according to '
- 'the current configuration. You can put other options '
- 'before this one to get them in the generated '
- 'configuration.'}),
-
- ('generate-man',
- {'action' : 'callback', 'callback' : self.cb_generate_manpage,
- 'group': 'Commands',
- 'help' : "Generate pylint's man page.", 'hide': True}),
-
- ('errors-only',
- {'action' : 'callback', 'callback' : self.cb_error_mode,
- 'short': 'E',
- 'help' : 'In error mode, checkers without error messages are '
- 'disabled and for others, only the ERROR messages are '
- 'displayed, and no reports are done by default'''}),
-
- ('py3k',
- {'action' : 'callback', 'callback' : self.cb_python3_porting_mode,
- 'help' : 'In Python 3 porting mode, all checkers will be '
- 'disabled and only messages emitted by the porting '
- 'checker will be displayed'}),
-
- ('profile',
- {'type' : 'yn', 'metavar' : '<y_or_n>',
- 'default': False, 'hide': True,
- 'help' : 'Profiled execution.'}),
-
- ), option_groups=self.option_groups, pylintrc=self._rcfile)
- # register standard checkers
- linter.load_default_plugins()
- # load command line plugins
- linter.load_plugin_modules(self._plugins)
- # add some help section
- linter.add_help_section('Environment variables', config.ENV_HELP, level=1)
- # pylint: disable=bad-continuation
- linter.add_help_section('Output',
-'Using the default text output, the message format is : \n'
-' \n'
-' MESSAGE_TYPE: LINE_NUM:[OBJECT:] MESSAGE \n'
-' \n'
-'There are 5 kind of message types : \n'
-' * (C) convention, for programming standard violation \n'
-' * (R) refactor, for bad code smell \n'
-' * (W) warning, for python specific problems \n'
-' * (E) error, for probable bugs in the code \n'
-' * (F) fatal, if an error occurred which prevented pylint from doing further\n'
-'processing.\n'
- , level=1)
- linter.add_help_section('Output status code',
-'Pylint should leave with following status code: \n'
-' * 0 if everything went fine \n'
-' * 1 if a fatal message was issued \n'
-' * 2 if an error message was issued \n'
-' * 4 if a warning message was issued \n'
-' * 8 if a refactor message was issued \n'
-' * 16 if a convention message was issued \n'
-' * 32 on usage error \n'
-' \n'
-'status 1 to 16 will be bit-ORed so you can know which different categories has\n'
-'been issued by analysing pylint output status code\n',
- level=1)
- # read configuration
- linter.disable('pointless-except')
- linter.disable('suppressed-message')
- linter.disable('useless-suppression')
- linter.read_config_file()
- config_parser = linter.cfgfile_parser
- # run init hook, if present, before loading plugins
- if config_parser.has_option('MASTER', 'init-hook'):
- cb_init_hook('init-hook',
- textutils.unquote(config_parser.get('MASTER',
- 'init-hook')))
- # is there some additional plugins in the file configuration, in
- if config_parser.has_option('MASTER', 'load-plugins'):
- plugins = textutils.splitstrip(
- config_parser.get('MASTER', 'load-plugins'))
- linter.load_plugin_modules(plugins)
- # now we can load file config and command line, plugins (which can
- # provide options) have been registered
- linter.load_config_file()
- if reporter:
- # if a custom reporter is provided as argument, it may be overridden
- # by file parameters, so re-set it here, but before command line
- # parsing so it's still overrideable by command line option
- linter.set_reporter(reporter)
- try:
- args = linter.load_command_line_configuration(args)
- except SystemExit as exc:
- if exc.code == 2: # bad options
- exc.code = 32
- raise
- if not args:
- print(linter.help())
- sys.exit(32)
-
- if linter.config.jobs < 0:
- print("Jobs number (%d) should be greater than 0"
- % linter.config.jobs, file=sys.stderr)
- sys.exit(32)
- if linter.config.jobs > 1 or linter.config.jobs == 0:
- if multiprocessing is None:
- print("Multiprocessing library is missing, "
- "fallback to single process", file=sys.stderr)
- linter.set_option("jobs", 1)
- else:
- if linter.config.jobs == 0:
- linter.config.jobs = multiprocessing.cpu_count()
-
- # insert current working directory to the python path to have a correct
- # behaviour
- if self.linter.config.profile:
- with fix_import_path(args):
- print('** profiled run', file=sys.stderr)
- import cProfile, pstats
- cProfile.runctx('linter.check(%r)' % args, globals(), locals(),
- 'stones.prof')
- data = pstats.Stats('stones.prof')
- data.strip_dirs()
- data.sort_stats('time', 'calls')
- data.print_stats(30)
- else:
- linter.check(args)
- linter.generate_reports()
- if exit:
- sys.exit(self.linter.msg_status)
-
- def cb_set_rcfile(self, name, value):
- """callback for option preprocessing (i.e. before option parsing)"""
- self._rcfile = value
-
- def cb_add_plugins(self, name, value):
- """callback for option preprocessing (i.e. before option parsing)"""
- self._plugins.extend(textutils.splitstrip(value))
-
- def cb_error_mode(self, *args, **kwargs):
- """error mode:
- * disable all but error messages
- * disable the 'miscellaneous' checker which can be safely deactivated in
- debug
- * disable reports
- * do not save execution information
- """
- self.linter.error_mode()
-
- def cb_generate_config(self, *args, **kwargs):
- """optik callback for sample config file generation"""
- self.linter.generate_config(skipsections=('COMMANDS',))
- sys.exit(0)
-
- def cb_generate_manpage(self, *args, **kwargs):
- """optik callback for sample config file generation"""
- from pylint import __pkginfo__
- self.linter.generate_manpage(__pkginfo__)
- sys.exit(0)
-
- def cb_help_message(self, option, optname, value, parser):
- """optik callback for printing some help about a particular message"""
- self.linter.msgs_store.help_message(textutils.splitstrip(value))
- sys.exit(0)
-
- def cb_full_documentation(self, option, optname, value, parser):
- """optik callback for printing full documentation"""
- self.linter.print_full_documentation()
- sys.exit(0)
-
- def cb_list_messages(self, option, optname, value, parser): # FIXME
- """optik callback for printing available messages"""
- self.linter.msgs_store.list_messages()
- sys.exit(0)
-
- def cb_python3_porting_mode(self, *args, **kwargs):
- """Activate only the python3 porting checker."""
- self.linter.disable('all')
- self.linter.enable('python3')
-
-
-def cb_list_confidence_levels(option, optname, value, parser):
- for level in interfaces.CONFIDENCE_LEVELS:
- print('%-18s: %s' % level)
- sys.exit(0)
-
-def cb_init_hook(optname, value):
- """exec arbitrary code to set sys.path for instance"""
- exec(value) # pylint: disable=exec-used
-
-
-if __name__ == '__main__':
- Run(sys.argv[1:])
diff --git a/chromium/third_party/pylint/pylint/pyreverse/__init__.py b/chromium/third_party/pylint/pylint/pyreverse/__init__.py
deleted file mode 100644
index 8c32ad96481..00000000000
--- a/chromium/third_party/pylint/pylint/pyreverse/__init__.py
+++ /dev/null
@@ -1,5 +0,0 @@
-"""
-pyreverse.extensions
-"""
-
-__revision__ = "$Id $"
diff --git a/chromium/third_party/pylint/pylint/pyreverse/diadefslib.py b/chromium/third_party/pylint/pylint/pyreverse/diadefslib.py
deleted file mode 100644
index e0dc8cfc7f6..00000000000
--- a/chromium/third_party/pylint/pylint/pyreverse/diadefslib.py
+++ /dev/null
@@ -1,233 +0,0 @@
-# Copyright (c) 2000-2013 LOGILAB S.A. (Paris, FRANCE).
-# http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# 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 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.
-"""handle diagram generation options for class diagram or default diagrams
-"""
-
-from logilab.common.compat import builtins
-
-import astroid
-from astroid.utils import LocalsVisitor
-
-from pylint.pyreverse.diagrams import PackageDiagram, ClassDiagram
-
-BUILTINS_NAME = builtins.__name__
-
-# diagram generators ##########################################################
-
-class DiaDefGenerator(object):
- """handle diagram generation options"""
-
- def __init__(self, linker, handler):
- """common Diagram Handler initialization"""
- self.config = handler.config
- self._set_default_options()
- self.linker = linker
- self.classdiagram = None # defined by subclasses
-
- def get_title(self, node):
- """get title for objects"""
- title = node.name
- if self.module_names:
- title = '%s.%s' % (node.root().name, title)
- return title
-
- def _set_option(self, option):
- """activate some options if not explicitly deactivated"""
- # if we have a class diagram, we want more information by default;
- # so if the option is None, we return True
- if option is None:
- if self.config.classes:
- return True
- else:
- return False
- return option
-
- def _set_default_options(self):
- """set different default options with _default dictionary"""
- self.module_names = self._set_option(self.config.module_names)
- all_ancestors = self._set_option(self.config.all_ancestors)
- all_associated = self._set_option(self.config.all_associated)
- anc_level, ass_level = (0, 0)
- if all_ancestors:
- anc_level = -1
- if all_associated:
- ass_level = -1
- if self.config.show_ancestors is not None:
- anc_level = self.config.show_ancestors
- if self.config.show_associated is not None:
- ass_level = self.config.show_associated
- self.anc_level, self.ass_level = anc_level, ass_level
-
- def _get_levels(self):
- """help function for search levels"""
- return self.anc_level, self.ass_level
-
- def show_node(self, node):
- """true if builtins and not show_builtins"""
- if self.config.show_builtin:
- return True
- return node.root().name != BUILTINS_NAME
-
- def add_class(self, node):
- """visit one class and add it to diagram"""
- self.linker.visit(node)
- self.classdiagram.add_object(self.get_title(node), node)
-
- def get_ancestors(self, node, level):
- """return ancestor nodes of a class node"""
- if level == 0:
- return
- for ancestor in node.ancestors(recurs=False):
- if not self.show_node(ancestor):
- continue
- yield ancestor
-
- def get_associated(self, klass_node, level):
- """return associated nodes of a class node"""
- if level == 0:
- return
- for ass_nodes in list(klass_node.instance_attrs_type.values()) + \
- list(klass_node.locals_type.values()):
- for ass_node in ass_nodes:
- if isinstance(ass_node, astroid.Instance):
- ass_node = ass_node._proxied
- if not (isinstance(ass_node, astroid.Class)
- and self.show_node(ass_node)):
- continue
- yield ass_node
-
- def extract_classes(self, klass_node, anc_level, ass_level):
- """extract recursively classes related to klass_node"""
- if self.classdiagram.has_node(klass_node) or not self.show_node(klass_node):
- return
- self.add_class(klass_node)
-
- for ancestor in self.get_ancestors(klass_node, anc_level):
- self.extract_classes(ancestor, anc_level-1, ass_level)
-
- for ass_node in self.get_associated(klass_node, ass_level):
- self.extract_classes(ass_node, anc_level, ass_level-1)
-
-
-class DefaultDiadefGenerator(LocalsVisitor, DiaDefGenerator):
- """generate minimum diagram definition for the project :
-
- * a package diagram including project's modules
- * a class diagram including project's classes
- """
-
- def __init__(self, linker, handler):
- DiaDefGenerator.__init__(self, linker, handler)
- LocalsVisitor.__init__(self)
-
- def visit_project(self, node):
- """visit an astroid.Project node
-
- create a diagram definition for packages
- """
- mode = self.config.mode
- if len(node.modules) > 1:
- self.pkgdiagram = PackageDiagram('packages %s' % node.name, mode)
- else:
- self.pkgdiagram = None
- self.classdiagram = ClassDiagram('classes %s' % node.name, mode)
-
- def leave_project(self, node): # pylint: disable=unused-argument
- """leave the astroid.Project node
-
- return the generated diagram definition
- """
- if self.pkgdiagram:
- return self.pkgdiagram, self.classdiagram
- return self.classdiagram,
-
- def visit_module(self, node):
- """visit an astroid.Module node
-
- add this class to the package diagram definition
- """
- if self.pkgdiagram:
- self.linker.visit(node)
- self.pkgdiagram.add_object(node.name, node)
-
- def visit_class(self, node):
- """visit an astroid.Class node
-
- add this class to the class diagram definition
- """
- anc_level, ass_level = self._get_levels()
- self.extract_classes(node, anc_level, ass_level)
-
- def visit_from(self, node):
- """visit astroid.From and catch modules for package diagram
- """
- if self.pkgdiagram:
- self.pkgdiagram.add_from_depend(node, node.modname)
-
-
-class ClassDiadefGenerator(DiaDefGenerator):
- """generate a class diagram definition including all classes related to a
- given class
- """
-
- def __init__(self, linker, handler):
- DiaDefGenerator.__init__(self, linker, handler)
-
- def class_diagram(self, project, klass):
- """return a class diagram definition for the given klass and its
- related klasses
- """
-
- self.classdiagram = ClassDiagram(klass, self.config.mode)
- if len(project.modules) > 1:
- module, klass = klass.rsplit('.', 1)
- module = project.get_module(module)
- else:
- module = project.modules[0]
- klass = klass.split('.')[-1]
- klass = next(module.ilookup(klass))
-
- anc_level, ass_level = self._get_levels()
- self.extract_classes(klass, anc_level, ass_level)
- return self.classdiagram
-
-# diagram handler #############################################################
-
-class DiadefsHandler(object):
- """handle diagram definitions :
-
- get it from user (i.e. xml files) or generate them
- """
-
- def __init__(self, config):
- self.config = config
-
- def get_diadefs(self, project, linker):
- """get the diagrams configuration data
- :param linker: astroid.inspector.Linker(IdGeneratorMixIn, LocalsVisitor)
- :param project: astroid.manager.Project
- """
-
- # read and interpret diagram definitions (Diadefs)
- diagrams = []
- generator = ClassDiadefGenerator(linker, self)
- for klass in self.config.classes:
- diagrams.append(generator.class_diagram(project, klass))
- if not diagrams:
- diagrams = DefaultDiadefGenerator(linker, self).visit(project)
- for diagram in diagrams:
- diagram.extract_relationships()
- return diagrams
diff --git a/chromium/third_party/pylint/pylint/pyreverse/diagrams.py b/chromium/third_party/pylint/pylint/pyreverse/diagrams.py
deleted file mode 100644
index f0d7a92c6d7..00000000000
--- a/chromium/third_party/pylint/pylint/pyreverse/diagrams.py
+++ /dev/null
@@ -1,247 +0,0 @@
-# Copyright (c) 2004-2013 LOGILAB S.A. (Paris, FRANCE).
-# http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# 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 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.
-"""diagram objects
-"""
-
-import astroid
-from pylint.pyreverse.utils import is_interface, FilterMixIn
-
-class Figure(object):
- """base class for counter handling"""
-
-class Relationship(Figure):
- """a relation ship from an object in the diagram to another
- """
- def __init__(self, from_object, to_object, relation_type, name=None):
- Figure.__init__(self)
- self.from_object = from_object
- self.to_object = to_object
- self.type = relation_type
- self.name = name
-
-
-class DiagramEntity(Figure):
- """a diagram object, i.e. a label associated to an astroid node
- """
- def __init__(self, title='No name', node=None):
- Figure.__init__(self)
- self.title = title
- self.node = node
-
-class ClassDiagram(Figure, FilterMixIn):
- """main class diagram handling
- """
- TYPE = 'class'
- def __init__(self, title, mode):
- FilterMixIn.__init__(self, mode)
- Figure.__init__(self)
- self.title = title
- self.objects = []
- self.relationships = {}
- self._nodes = {}
- self.depends = []
-
- def get_relationships(self, role):
- # sorted to get predictable (hence testable) results
- return sorted(self.relationships.get(role, ()),
- key=lambda x: (x.from_object.fig_id, x.to_object.fig_id))
-
- def add_relationship(self, from_object, to_object,
- relation_type, name=None):
- """create a relation ship
- """
- rel = Relationship(from_object, to_object, relation_type, name)
- self.relationships.setdefault(relation_type, []).append(rel)
-
- def get_relationship(self, from_object, relation_type):
- """return a relation ship or None
- """
- for rel in self.relationships.get(relation_type, ()):
- if rel.from_object is from_object:
- return rel
- raise KeyError(relation_type)
-
- def get_attrs(self, node):
- """return visible attributes, possibly with class name"""
- attrs = []
- for node_name, ass_nodes in list(node.instance_attrs_type.items()) + \
- list(node.locals_type.items()):
- if not self.show_attr(node_name):
- continue
- names = self.class_names(ass_nodes)
- if names:
- node_name = "%s : %s" % (node_name, ", ".join(names))
- attrs.append(node_name)
- return sorted(attrs)
-
- def get_methods(self, node):
- """return visible methods"""
- methods = [
- m for m in node.values()
- if isinstance(m, astroid.Function) and self.show_attr(m.name)
- ]
- return sorted(methods, key=lambda n: n.name)
-
- def add_object(self, title, node):
- """create a diagram object
- """
- assert node not in self._nodes
- ent = DiagramEntity(title, node)
- self._nodes[node] = ent
- self.objects.append(ent)
-
- def class_names(self, nodes):
- """return class names if needed in diagram"""
- names = []
- for ass_node in nodes:
- if isinstance(ass_node, astroid.Instance):
- ass_node = ass_node._proxied
- if isinstance(ass_node, astroid.Class) \
- and hasattr(ass_node, "name") and not self.has_node(ass_node):
- if ass_node.name not in names:
- ass_name = ass_node.name
- names.append(ass_name)
- return names
-
- def nodes(self):
- """return the list of underlying nodes
- """
- return self._nodes.keys()
-
- def has_node(self, node):
- """return true if the given node is included in the diagram
- """
- return node in self._nodes
-
- def object_from_node(self, node):
- """return the diagram object mapped to node
- """
- return self._nodes[node]
-
- def classes(self):
- """return all class nodes in the diagram"""
- return [o for o in self.objects if isinstance(o.node, astroid.Class)]
-
- def classe(self, name):
- """return a class by its name, raise KeyError if not found
- """
- for klass in self.classes():
- if klass.node.name == name:
- return klass
- raise KeyError(name)
-
- def extract_relationships(self):
- """extract relation ships between nodes in the diagram
- """
- for obj in self.classes():
- node = obj.node
- obj.attrs = self.get_attrs(node)
- obj.methods = self.get_methods(node)
- # shape
- if is_interface(node):
- obj.shape = 'interface'
- else:
- obj.shape = 'class'
- # inheritance link
- for par_node in node.ancestors(recurs=False):
- try:
- par_obj = self.object_from_node(par_node)
- self.add_relationship(obj, par_obj, 'specialization')
- except KeyError:
- continue
- # implements link
- for impl_node in node.implements:
- try:
- impl_obj = self.object_from_node(impl_node)
- self.add_relationship(obj, impl_obj, 'implements')
- except KeyError:
- continue
- # associations link
- for name, values in list(node.instance_attrs_type.items()) + \
- list(node.locals_type.items()):
- for value in values:
- if value is astroid.YES:
- continue
- if isinstance(value, astroid.Instance):
- value = value._proxied
- try:
- ass_obj = self.object_from_node(value)
- self.add_relationship(ass_obj, obj, 'association', name)
- except KeyError:
- continue
-
-
-class PackageDiagram(ClassDiagram):
- """package diagram handling
- """
- TYPE = 'package'
-
- def modules(self):
- """return all module nodes in the diagram"""
- return [o for o in self.objects if isinstance(o.node, astroid.Module)]
-
- def module(self, name):
- """return a module by its name, raise KeyError if not found
- """
- for mod in self.modules():
- if mod.node.name == name:
- return mod
- raise KeyError(name)
-
- def get_module(self, name, node):
- """return a module by its name, looking also for relative imports;
- raise KeyError if not found
- """
- for mod in self.modules():
- mod_name = mod.node.name
- if mod_name == name:
- return mod
- #search for fullname of relative import modules
- package = node.root().name
- if mod_name == "%s.%s" % (package, name):
- return mod
- if mod_name == "%s.%s" % (package.rsplit('.', 1)[0], name):
- return mod
- raise KeyError(name)
-
- def add_from_depend(self, node, from_module):
- """add dependencies created by from-imports
- """
- mod_name = node.root().name
- obj = self.module(mod_name)
- if from_module not in obj.node.depends:
- obj.node.depends.append(from_module)
-
- def extract_relationships(self):
- """extract relation ships between nodes in the diagram
- """
- ClassDiagram.extract_relationships(self)
- for obj in self.classes():
- # ownership
- try:
- mod = self.object_from_node(obj.node.root())
- self.add_relationship(obj, mod, 'ownership')
- except KeyError:
- continue
- for obj in self.modules():
- obj.shape = 'package'
- # dependencies
- for dep_name in obj.node.depends:
- try:
- dep = self.get_module(dep_name, obj.node)
- except KeyError:
- continue
- self.add_relationship(obj, dep, 'depends')
diff --git a/chromium/third_party/pylint/pylint/pyreverse/main.py b/chromium/third_party/pylint/pylint/pyreverse/main.py
deleted file mode 100644
index 408c1722413..00000000000
--- a/chromium/third_party/pylint/pylint/pyreverse/main.py
+++ /dev/null
@@ -1,124 +0,0 @@
-# # Copyright (c) 2000-2013 LOGILAB S.A. (Paris, FRANCE).
-# http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# 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 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.
-"""
- %prog [options] <packages>
-
- create UML diagrams for classes and modules in <packages>
-"""
-from __future__ import print_function
-
-import sys, os
-from logilab.common.configuration import ConfigurationMixIn
-from astroid.manager import AstroidManager
-from astroid.inspector import Linker
-
-from pylint.pyreverse.diadefslib import DiadefsHandler
-from pylint.pyreverse import writer
-from pylint.pyreverse.utils import insert_default_options
-
-OPTIONS = (
- ("filter-mode",
- dict(short='f', default='PUB_ONLY', dest='mode', type='string',
- action='store', metavar='<mode>',
- help="""filter attributes and functions according to
- <mode>. Correct modes are :
- 'PUB_ONLY' filter all non public attributes
- [DEFAULT], equivalent to PRIVATE+SPECIAL_A
- 'ALL' no filter
- 'SPECIAL' filter Python special functions
- except constructor
- 'OTHER' filter protected and private
- attributes""")),
-
- ("class",
- dict(short='c', action="append", metavar="<class>", dest="classes", default=[],
- help="create a class diagram with all classes related to <class>;\
- this uses by default the options -ASmy")),
-
- ("show-ancestors",
- dict(short="a", action="store", metavar='<ancestor>', type='int',
- help='show <ancestor> generations of ancestor classes not in <projects>')),
- ("all-ancestors",
- dict(short="A", default=None,
- help="show all ancestors off all classes in <projects>")),
- ("show-associated",
- dict(short='s', action="store", metavar='<ass_level>', type='int',
- help='show <ass_level> levels of associated classes not in <projects>')),
- ("all-associated",
- dict(short='S', default=None,
- help='show recursively all associated off all associated classes')),
- ("show-builtin",
- dict(short="b", action="store_true", default=False,
- help='include builtin objects in representation of classes')),
-
- ("module-names",
- dict(short="m", default=None, type='yn', metavar='[yn]',
- help='include module name in representation of classes')),
- # TODO : generate dependencies like in pylint
- # ("package-dependencies",
- # dict(short="M", action="store", metavar='<package_depth>', type='int',
- # help='show <package_depth> module dependencies beyond modules in \
- # <projects> (for the package diagram)')),
- ("only-classnames",
- dict(short='k', action="store_true", default=False,
- help="don't show attributes and methods in the class boxes; \
-this disables -f values")),
- ("output", dict(short="o", dest="output_format", action="store",
- default="dot", metavar="<format>",
- help="create a *.<format> output file if format available.")),
-)
-# FIXME : quiet mode
-#( ('quiet',
- #dict(help='run quietly', action='store_true', short='q')), )
-
-class Run(ConfigurationMixIn):
- """base class providing common behaviour for pyreverse commands"""
-
- options = OPTIONS
-
- def __init__(self, args):
- ConfigurationMixIn.__init__(self, usage=__doc__)
- insert_default_options()
- self.manager = AstroidManager()
- self.register_options_provider(self.manager)
- args = self.load_command_line_configuration()
- sys.exit(self.run(args))
-
- def run(self, args):
- """checking arguments and run project"""
- if not args:
- print(self.help())
- return 1
- # insert current working directory to the python path to recognize
- # dependencies to local modules even if cwd is not in the PYTHONPATH
- sys.path.insert(0, os.getcwd())
- try:
- project = self.manager.project_from_files(args)
- linker = Linker(project, tag=True)
- handler = DiadefsHandler(self.config)
- diadefs = handler.get_diadefs(project, linker)
- finally:
- sys.path.pop(0)
-
- if self.config.output_format == "vcg":
- writer.VCGWriter(self.config).write(diadefs)
- else:
- writer.DotWriter(self.config).write(diadefs)
- return 0
-
-
-if __name__ == '__main__':
- Run(sys.argv[1:])
diff --git a/chromium/third_party/pylint/pylint/pyreverse/utils.py b/chromium/third_party/pylint/pylint/pyreverse/utils.py
deleted file mode 100644
index 5d6d13356ae..00000000000
--- a/chromium/third_party/pylint/pylint/pyreverse/utils.py
+++ /dev/null
@@ -1,132 +0,0 @@
-# Copyright (c) 2002-2013 LOGILAB S.A. (Paris, FRANCE).
-# http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# 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 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.
-"""
-generic classes/functions for pyreverse core/extensions
-"""
-from __future__ import print_function
-
-import sys
-import re
-import os
-
-########### pyreverse option utils ##############################
-
-
-RCFILE = '.pyreverserc'
-
-def get_default_options():
- """
- Read config file and return list of options
- """
- options = []
- home = os.environ.get('HOME', '')
- if home:
- rcfile = os.path.join(home, RCFILE)
- try:
- options = open(rcfile).read().split()
- except IOError:
- pass # ignore if no config file found
- return options
-
-def insert_default_options():
- """insert default options to sys.argv
- """
- options = get_default_options()
- options.reverse()
- for arg in options:
- sys.argv.insert(1, arg)
-
-
-
-# astroid utilities ###########################################################
-
-SPECIAL = re.compile('^__[A-Za-z0-9]+[A-Za-z0-9_]*__$')
-PRIVATE = re.compile('^__[_A-Za-z0-9]*[A-Za-z0-9]+_?$')
-PROTECTED = re.compile('^_[_A-Za-z0-9]*$')
-
-def get_visibility(name):
- """return the visibility from a name: public, protected, private or special
- """
- if SPECIAL.match(name):
- visibility = 'special'
- elif PRIVATE.match(name):
- visibility = 'private'
- elif PROTECTED.match(name):
- visibility = 'protected'
-
- else:
- visibility = 'public'
- return visibility
-
-ABSTRACT = re.compile('^.*Abstract.*')
-FINAL = re.compile('^[A-Z_]*$')
-
-def is_abstract(node):
- """return true if the given class node correspond to an abstract class
- definition
- """
- return ABSTRACT.match(node.name)
-
-def is_final(node):
- """return true if the given class/function node correspond to final
- definition
- """
- return FINAL.match(node.name)
-
-def is_interface(node):
- # bw compat
- return node.type == 'interface'
-
-def is_exception(node):
- # bw compat
- return node.type == 'exception'
-
-
-# Helpers #####################################################################
-
-_CONSTRUCTOR = 1
-_SPECIAL = 2
-_PROTECTED = 4
-_PRIVATE = 8
-MODES = {
- 'ALL' : 0,
- 'PUB_ONLY' : _SPECIAL + _PROTECTED + _PRIVATE,
- 'SPECIAL' : _SPECIAL,
- 'OTHER' : _PROTECTED + _PRIVATE,
-}
-VIS_MOD = {'special': _SPECIAL, 'protected': _PROTECTED,
- 'private': _PRIVATE, 'public': 0}
-
-class FilterMixIn(object):
- """filter nodes according to a mode and nodes' visibility
- """
- def __init__(self, mode):
- "init filter modes"
- __mode = 0
- for nummod in mode.split('+'):
- try:
- __mode += MODES[nummod]
- except KeyError as ex:
- print('Unknown filter mode %s' % ex, file=sys.stderr)
- self.__mode = __mode
-
-
- def show_attr(self, node):
- """return true if the node should be treated
- """
- visibility = get_visibility(getattr(node, 'name', node))
- return not self.__mode & VIS_MOD[visibility]
-
diff --git a/chromium/third_party/pylint/pylint/pyreverse/writer.py b/chromium/third_party/pylint/pylint/pyreverse/writer.py
deleted file mode 100644
index 8628a8ccf18..00000000000
--- a/chromium/third_party/pylint/pylint/pyreverse/writer.py
+++ /dev/null
@@ -1,199 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2008-2013 LOGILAB S.A. (Paris, FRANCE).
-# http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# 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 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.
-"""Utilities for creating VCG and Dot diagrams"""
-
-from logilab.common.vcgutils import VCGPrinter
-from logilab.common.graph import DotBackend
-
-from pylint.pyreverse.utils import is_exception
-
-class DiagramWriter(object):
- """base class for writing project diagrams
- """
- def __init__(self, config, styles):
- self.config = config
- self.pkg_edges, self.inh_edges, self.imp_edges, self.ass_edges = styles
- self.printer = None # defined in set_printer
-
- def write(self, diadefs):
- """write files for <project> according to <diadefs>
- """
- for diagram in diadefs:
- basename = diagram.title.strip().replace(' ', '_')
- file_name = '%s.%s' % (basename, self.config.output_format)
- self.set_printer(file_name, basename)
- if diagram.TYPE == 'class':
- self.write_classes(diagram)
- else:
- self.write_packages(diagram)
- self.close_graph()
-
- def write_packages(self, diagram):
- """write a package diagram"""
- # sorted to get predictable (hence testable) results
- for i, obj in enumerate(sorted(diagram.modules(), key=lambda x: x.title)):
- self.printer.emit_node(i, label=self.get_title(obj), shape='box')
- obj.fig_id = i
- # package dependencies
- for rel in diagram.get_relationships('depends'):
- self.printer.emit_edge(rel.from_object.fig_id, rel.to_object.fig_id,
- **self.pkg_edges)
-
- def write_classes(self, diagram):
- """write a class diagram"""
- # sorted to get predictable (hence testable) results
- for i, obj in enumerate(sorted(diagram.objects, key=lambda x: x.title)):
- self.printer.emit_node(i, **self.get_values(obj))
- obj.fig_id = i
- # inheritance links
- for rel in diagram.get_relationships('specialization'):
- self.printer.emit_edge(rel.from_object.fig_id, rel.to_object.fig_id,
- **self.inh_edges)
- # implementation links
- for rel in diagram.get_relationships('implements'):
- self.printer.emit_edge(rel.from_object.fig_id, rel.to_object.fig_id,
- **self.imp_edges)
- # generate associations
- for rel in diagram.get_relationships('association'):
- self.printer.emit_edge(rel.from_object.fig_id, rel.to_object.fig_id,
- label=rel.name, **self.ass_edges)
-
- def set_printer(self, file_name, basename):
- """set printer"""
- raise NotImplementedError
-
- def get_title(self, obj):
- """get project title"""
- raise NotImplementedError
-
- def get_values(self, obj):
- """get label and shape for classes."""
- raise NotImplementedError
-
- def close_graph(self):
- """finalize the graph"""
- raise NotImplementedError
-
-
-class DotWriter(DiagramWriter):
- """write dot graphs from a diagram definition and a project
- """
-
- def __init__(self, config):
- styles = [dict(arrowtail='none', arrowhead="open"),
- dict(arrowtail='none', arrowhead='empty'),
- dict(arrowtail='node', arrowhead='empty', style='dashed'),
- dict(fontcolor='green', arrowtail='none',
- arrowhead='diamond', style='solid'),
- ]
- DiagramWriter.__init__(self, config, styles)
-
- def set_printer(self, file_name, basename):
- """initialize DotWriter and add options for layout.
- """
- layout = dict(rankdir="BT")
- self.printer = DotBackend(basename, additionnal_param=layout)
- self.file_name = file_name
-
- def get_title(self, obj):
- """get project title"""
- return obj.title
-
- def get_values(self, obj):
- """get label and shape for classes.
-
- The label contains all attributes and methods
- """
- label = obj.title
- if obj.shape == 'interface':
- label = u'«interface»\\n%s' % label
- if not self.config.only_classnames:
- label = r'%s|%s\l|' % (label, r'\l'.join(obj.attrs))
- for func in obj.methods:
- label = r'%s%s()\l' % (label, func.name)
- label = '{%s}' % label
- if is_exception(obj.node):
- return dict(fontcolor='red', label=label, shape='record')
- return dict(label=label, shape='record')
-
- def close_graph(self):
- """print the dot graph into <file_name>"""
- self.printer.generate(self.file_name)
-
-
-class VCGWriter(DiagramWriter):
- """write vcg graphs from a diagram definition and a project
- """
- def __init__(self, config):
- styles = [dict(arrowstyle='solid', backarrowstyle='none',
- backarrowsize=0),
- dict(arrowstyle='solid', backarrowstyle='none',
- backarrowsize=10),
- dict(arrowstyle='solid', backarrowstyle='none',
- linestyle='dotted', backarrowsize=10),
- dict(arrowstyle='solid', backarrowstyle='none',
- textcolor='green'),
- ]
- DiagramWriter.__init__(self, config, styles)
-
- def set_printer(self, file_name, basename):
- """initialize VCGWriter for a UML graph"""
- self.graph_file = open(file_name, 'w+')
- self.printer = VCGPrinter(self.graph_file)
- self.printer.open_graph(title=basename, layoutalgorithm='dfs',
- late_edge_labels='yes', port_sharing='no',
- manhattan_edges='yes')
- self.printer.emit_node = self.printer.node
- self.printer.emit_edge = self.printer.edge
-
- def get_title(self, obj):
- """get project title in vcg format"""
- return r'\fb%s\fn' % obj.title
-
- def get_values(self, obj):
- """get label and shape for classes.
-
- The label contains all attributes and methods
- """
- if is_exception(obj.node):
- label = r'\fb\f09%s\fn' % obj.title
- else:
- label = r'\fb%s\fn' % obj.title
- if obj.shape == 'interface':
- shape = 'ellipse'
- else:
- shape = 'box'
- if not self.config.only_classnames:
- attrs = obj.attrs
- methods = [func.name for func in obj.methods]
- # box width for UML like diagram
- maxlen = max(len(name) for name in [obj.title] + methods + attrs)
- line = '_' * (maxlen + 2)
- label = r'%s\n\f%s' % (label, line)
- for attr in attrs:
- label = r'%s\n\f08%s' % (label, attr)
- if attrs:
- label = r'%s\n\f%s' % (label, line)
- for func in methods:
- label = r'%s\n\f10%s()' % (label, func)
- return dict(label=label, shape=shape)
-
- def close_graph(self):
- """close graph and file"""
- self.printer.close_graph()
- self.graph_file.close()
-
diff --git a/chromium/third_party/pylint/pylint/reporters/__init__.py b/chromium/third_party/pylint/pylint/reporters/__init__.py
deleted file mode 100644
index ea3281ff7e8..00000000000
--- a/chromium/third_party/pylint/pylint/reporters/__init__.py
+++ /dev/null
@@ -1,133 +0,0 @@
-# Copyright (c) 2003-2013 LOGILAB S.A. (Paris, FRANCE).
-# 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 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.
-"""utilities methods and classes for reporters"""
-from __future__ import print_function
-
-import sys
-import locale
-import os
-
-
-from pylint import utils
-
-CMPS = ['=', '-', '+']
-
-# py3k has no more cmp builtin
-if sys.version_info >= (3, 0):
- def cmp(a, b): # pylint: disable=redefined-builtin
- return (a > b) - (a < b)
-
-def diff_string(old, new):
- """given a old and new int value, return a string representing the
- difference
- """
- diff = abs(old - new)
- diff_str = "%s%s" % (CMPS[cmp(old, new)], diff and ('%.2f' % diff) or '')
- return diff_str
-
-
-class BaseReporter(object):
- """base class for reporters
-
- symbols: show short symbolic names for messages.
- """
-
- extension = ''
-
- def __init__(self, output=None):
- self.linter = None
- # self.include_ids = None # Deprecated
- # self.symbols = None # Deprecated
- self.section = 0
- self.out = None
- self.out_encoding = None
- self.encode = None
- self.set_output(output)
- # Build the path prefix to strip to get relative paths
- self.path_strip_prefix = os.getcwd() + os.sep
-
- def handle_message(self, msg):
- """Handle a new message triggered on the current file.
-
- Invokes the legacy add_message API by default."""
- self.add_message(
- msg.msg_id, (msg.abspath, msg.module, msg.obj, msg.line, msg.column),
- msg.msg)
-
- def add_message(self, msg_id, location, msg):
- """Deprecated, do not use."""
- raise NotImplementedError
-
- def set_output(self, output=None):
- """set output stream"""
- self.out = output or sys.stdout
- # py3k streams handle their encoding :
- if sys.version_info >= (3, 0):
- self.encode = lambda x: x
- return
-
- def encode(string):
- if not isinstance(string, unicode):
- return string
- encoding = (getattr(self.out, 'encoding', None) or
- locale.getdefaultlocale()[1] or
- sys.getdefaultencoding())
- # errors=replace, we don't want to crash when attempting to show
- # source code line that can't be encoded with the current locale
- # settings
- return string.encode(encoding, 'replace')
- self.encode = encode
-
- def writeln(self, string=''):
- """write a line in the output buffer"""
- print(self.encode(string), file=self.out)
-
- def display_results(self, layout):
- """display results encapsulated in the layout tree"""
- self.section = 0
- if hasattr(layout, 'report_id'):
- layout.children[0].children[0].data += ' (%s)' % layout.report_id
- self._display(layout)
-
- def _display(self, layout):
- """display the layout"""
- raise NotImplementedError()
-
- # Event callbacks
-
- def on_set_current_module(self, module, filepath):
- """starting analyzis of a module"""
- pass
-
- def on_close(self, stats, previous_stats):
- """global end of analyzis"""
- pass
-
-
-class CollectingReporter(BaseReporter):
- """collects messages"""
-
- name = 'collector'
-
- def __init__(self):
- BaseReporter.__init__(self)
- self.messages = []
-
- def handle_message(self, msg):
- self.messages.append(msg)
-
-
-def initialize(linter):
- """initialize linter with reporters in this package """
- utils.register_plugins(linter, __path__[0])
diff --git a/chromium/third_party/pylint/pylint/reporters/guireporter.py b/chromium/third_party/pylint/pylint/reporters/guireporter.py
deleted file mode 100644
index 4ad4ebbf166..00000000000
--- a/chromium/third_party/pylint/pylint/reporters/guireporter.py
+++ /dev/null
@@ -1,27 +0,0 @@
-""" reporter used by gui.py """
-
-import sys
-
-from pylint.interfaces import IReporter
-from pylint.reporters import BaseReporter
-from logilab.common.ureports import TextWriter
-
-
-class GUIReporter(BaseReporter):
- """saves messages"""
-
- __implements__ = IReporter
- extension = ''
-
- def __init__(self, gui, output=sys.stdout):
- """init"""
- BaseReporter.__init__(self, output)
- self.gui = gui
-
- def handle_message(self, msg):
- """manage message of different type and in the context of path"""
- self.gui.msg_queue.put(msg)
-
- def _display(self, layout):
- """launch layouts display"""
- TextWriter().format(layout, self.out)
diff --git a/chromium/third_party/pylint/pylint/reporters/html.py b/chromium/third_party/pylint/pylint/reporters/html.py
deleted file mode 100644
index 1c6c26081de..00000000000
--- a/chromium/third_party/pylint/pylint/reporters/html.py
+++ /dev/null
@@ -1,69 +0,0 @@
-# Copyright (c) 2003-2013 LOGILAB S.A. (Paris, FRANCE).
-# 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 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.
-"""HTML reporter"""
-
-import sys
-from cgi import escape
-
-from logilab.common.ureports import HTMLWriter, Section, Table
-
-from pylint.interfaces import IReporter
-from pylint.reporters import BaseReporter
-
-
-class HTMLReporter(BaseReporter):
- """report messages and layouts in HTML"""
-
- __implements__ = IReporter
- name = 'html'
- extension = 'html'
-
- def __init__(self, output=sys.stdout):
- BaseReporter.__init__(self, output)
- self.msgs = []
-
- def handle_message(self, msg):
- """manage message of different type and in the context of path"""
- self.msgs += (msg.category, msg.module, msg.obj,
- str(msg.line), str(msg.column), escape(msg.msg))
-
- def set_output(self, output=None):
- """set output stream
-
- messages buffered for old output is processed first"""
- if self.out and self.msgs:
- self._display(Section())
- BaseReporter.set_output(self, output)
-
- def _display(self, layout):
- """launch layouts display
-
- overridden from BaseReporter to add insert the messages section
- (in add_message, message is not displayed, just collected so it
- can be displayed in an html table)
- """
- if self.msgs:
- # add stored messages to the layout
- msgs = ['type', 'module', 'object', 'line', 'col_offset', 'message']
- msgs += self.msgs
- sect = Section('Messages')
- layout.append(sect)
- sect.append(Table(cols=6, children=msgs, rheaders=1))
- self.msgs = []
- HTMLWriter().format(layout, self.out)
-
-
-def register(linter):
- """Register the reporter classes with the linter."""
- linter.register_reporter(HTMLReporter)
diff --git a/chromium/third_party/pylint/pylint/reporters/json.py b/chromium/third_party/pylint/pylint/reporters/json.py
deleted file mode 100644
index 7dba52b86ef..00000000000
--- a/chromium/third_party/pylint/pylint/reporters/json.py
+++ /dev/null
@@ -1,58 +0,0 @@
-# Copyright (c) 2003-2014 LOGILAB S.A. (Paris, FRANCE).
-# 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 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.
-"""JSON reporter"""
-from __future__ import absolute_import, print_function
-
-import json
-import sys
-from cgi import escape
-
-from pylint.interfaces import IReporter
-from pylint.reporters import BaseReporter
-
-
-class JSONReporter(BaseReporter):
- """Report messages and layouts in JSON."""
-
- __implements__ = IReporter
- name = 'json'
- extension = 'json'
-
- def __init__(self, output=sys.stdout):
- BaseReporter.__init__(self, output)
- self.messages = []
-
- def handle_message(self, message):
- """Manage message of different type and in the context of path."""
-
- self.messages.append({
- 'type': message.category,
- 'module': message.module,
- 'obj': message.obj,
- 'line': message.line,
- 'column': message.column,
- 'path': message.path,
- 'symbol': message.symbol,
- 'message': escape(message.msg or ''),
- })
-
- def _display(self, layout):
- """Launch layouts display"""
- if self.messages:
- print(json.dumps(self.messages, indent=4), file=self.out)
-
-
-def register(linter):
- """Register the reporter classes with the linter."""
- linter.register_reporter(JSONReporter)
diff --git a/chromium/third_party/pylint/pylint/reporters/text.py b/chromium/third_party/pylint/pylint/reporters/text.py
deleted file mode 100644
index 53c4a8da6a0..00000000000
--- a/chromium/third_party/pylint/pylint/reporters/text.py
+++ /dev/null
@@ -1,146 +0,0 @@
-# Copyright (c) 2003-2013 LOGILAB S.A. (Paris, FRANCE).
-# 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 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.
-"""Plain text reporters:
-
-:text: the default one grouping messages by module
-:colorized: an ANSI colorized text reporter
-"""
-from __future__ import print_function
-
-import warnings
-
-from logilab.common.ureports import TextWriter
-from logilab.common.textutils import colorize_ansi
-
-from pylint.interfaces import IReporter
-from pylint.reporters import BaseReporter
-import six
-
-TITLE_UNDERLINES = ['', '=', '-', '.']
-
-
-class TextReporter(BaseReporter):
- """reports messages and layouts in plain text"""
-
- __implements__ = IReporter
- name = 'text'
- extension = 'txt'
- line_format = '{C}:{line:3d},{column:2d}: {msg} ({symbol})'
-
- def __init__(self, output=None):
- BaseReporter.__init__(self, output)
- self._modules = set()
- self._template = None
-
- def on_set_current_module(self, module, filepath):
- self._template = six.text_type(self.linter.config.msg_template or self.line_format)
-
- def write_message(self, msg):
- """Convenience method to write a formated message with class default template"""
- self.writeln(msg.format(self._template))
-
- def handle_message(self, msg):
- """manage message of different type and in the context of path"""
- if msg.module not in self._modules:
- if msg.module:
- self.writeln('************* Module %s' % msg.module)
- self._modules.add(msg.module)
- else:
- self.writeln('************* ')
- self.write_message(msg)
-
- def _display(self, layout):
- """launch layouts display"""
- print(file=self.out)
- TextWriter().format(layout, self.out)
-
-
-class ParseableTextReporter(TextReporter):
- """a reporter very similar to TextReporter, but display messages in a form
- recognized by most text editors :
-
- <filename>:<linenum>:<msg>
- """
- name = 'parseable'
- line_format = '{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}'
-
- def __init__(self, output=None):
- warnings.warn('%s output format is deprecated. This is equivalent '
- 'to --msg-template=%s' % (self.name, self.line_format),
- DeprecationWarning)
- TextReporter.__init__(self, output)
-
-
-class VSTextReporter(ParseableTextReporter):
- """Visual studio text reporter"""
- name = 'msvs'
- line_format = '{path}({line}): [{msg_id}({symbol}){obj}] {msg}'
-
-
-class ColorizedTextReporter(TextReporter):
- """Simple TextReporter that colorizes text output"""
-
- name = 'colorized'
- COLOR_MAPPING = {
- "I" : ("green", None),
- 'C' : (None, "bold"),
- 'R' : ("magenta", "bold, italic"),
- 'W' : ("blue", None),
- 'E' : ("red", "bold"),
- 'F' : ("red", "bold, underline"),
- 'S' : ("yellow", "inverse"), # S stands for module Separator
- }
-
- def __init__(self, output=None, color_mapping=None):
- TextReporter.__init__(self, output)
- self.color_mapping = color_mapping or \
- dict(ColorizedTextReporter.COLOR_MAPPING)
-
- def _get_decoration(self, msg_id):
- """Returns the tuple color, style associated with msg_id as defined
- in self.color_mapping
- """
- try:
- return self.color_mapping[msg_id[0]]
- except KeyError:
- return None, None
-
- def handle_message(self, msg):
- """manage message of different types, and colorize output
- using ansi escape codes
- """
- if msg.module not in self._modules:
- color, style = self._get_decoration('S')
- if msg.module:
- modsep = colorize_ansi('************* Module %s' % msg.module,
- color, style)
- else:
- modsep = colorize_ansi('************* %s' % msg.module,
- color, style)
- self.writeln(modsep)
- self._modules.add(msg.module)
- color, style = self._get_decoration(msg.C)
-
- msg = msg._replace(
- **{attr: colorize_ansi(getattr(msg, attr), color, style)
- for attr in ('msg', 'symbol', 'category', 'C')})
- self.write_message(msg)
-
-
-def register(linter):
- """Register the reporter classes with the linter."""
- linter.register_reporter(TextReporter)
- linter.register_reporter(ParseableTextReporter)
- linter.register_reporter(VSTextReporter)
- linter.register_reporter(ColorizedTextReporter)
diff --git a/chromium/third_party/pylint/pylint/testutils.py b/chromium/third_party/pylint/pylint/testutils.py
deleted file mode 100644
index 2f9af4d102a..00000000000
--- a/chromium/third_party/pylint/pylint/testutils.py
+++ /dev/null
@@ -1,412 +0,0 @@
-# Copyright (c) 2003-2013 LOGILAB S.A. (Paris, FRANCE).
-# http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# 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 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.
-"""functional/non regression tests for pylint"""
-from __future__ import print_function
-
-import collections
-import contextlib
-import functools
-import os
-import sys
-import re
-import unittest
-import tempfile
-import tokenize
-
-from glob import glob
-from os import linesep, getcwd, sep
-from os.path import abspath, basename, dirname, isdir, join, splitext
-
-from astroid import test_utils
-
-from pylint import checkers
-from pylint.utils import PyLintASTWalker
-from pylint.reporters import BaseReporter
-from pylint.interfaces import IReporter
-from pylint.lint import PyLinter
-
-import six
-from six.moves import StringIO
-
-
-# Utils
-
-SYS_VERS_STR = '%d%d%d' % sys.version_info[:3]
-TITLE_UNDERLINES = ['', '=', '-', '.']
-PREFIX = abspath(dirname(__file__))
-PY3K = sys.version_info[0] == 3
-
-def fix_path():
- sys.path.insert(0, PREFIX)
-
-def get_tests_info(input_dir, msg_dir, prefix, suffix):
- """get python input examples and output messages
-
- We use following conventions for input files and messages:
- for different inputs:
- test for python >= x.y -> input = <name>_pyxy.py
- test for python < x.y -> input = <name>_py_xy.py
- for one input and different messages:
- message for python >= x.y -> message = <name>_pyxy.txt
- lower versions -> message with highest num
- """
- result = []
- for fname in glob(join(input_dir, prefix + '*' + suffix)):
- infile = basename(fname)
- fbase = splitext(infile)[0]
- # filter input files :
- pyrestr = fbase.rsplit('_py', 1)[-1] # like _26 or 26
- if pyrestr.isdigit(): # '24', '25'...
- if SYS_VERS_STR < pyrestr:
- continue
- if pyrestr.startswith('_') and pyrestr[1:].isdigit():
- # skip test for higher python versions
- if SYS_VERS_STR >= pyrestr[1:]:
- continue
- messages = glob(join(msg_dir, fbase + '*.txt'))
- # the last one will be without ext, i.e. for all or upper versions:
- if messages:
- for outfile in sorted(messages, reverse=True):
- py_rest = outfile.rsplit('_py', 1)[-1][:-4]
- if py_rest.isdigit() and SYS_VERS_STR >= py_rest:
- break
- else:
- # This will provide an error message indicating the missing filename.
- outfile = join(msg_dir, fbase + '.txt')
- result.append((infile, outfile))
- return result
-
-
-class TestReporter(BaseReporter):
- """reporter storing plain text messages"""
-
- __implements____ = IReporter
-
- def __init__(self): # pylint: disable=super-init-not-called
-
- self.message_ids = {}
- self.reset()
- self.path_strip_prefix = getcwd() + sep
-
- def reset(self):
- self.out = StringIO()
- self.messages = []
-
- def add_message(self, msg_id, location, msg):
- """manage message of different type and in the context of path """
- _, _, obj, line, _ = location
- self.message_ids[msg_id] = 1
- if obj:
- obj = ':%s' % obj
- sigle = msg_id[0]
- if PY3K and linesep != '\n':
- # 2to3 writes os.linesep instead of using
- # the previosly used line separators
- msg = msg.replace('\r\n', '\n')
- self.messages.append('%s:%3s%s: %s' % (sigle, line, obj, msg))
-
- def finalize(self):
- self.messages.sort()
- for msg in self.messages:
- print(msg, file=self.out)
- result = self.out.getvalue()
- self.reset()
- return result
-
- def display_results(self, layout):
- """ignore layouts"""
-
-
-class Message(collections.namedtuple('Message',
- ['msg_id', 'line', 'node', 'args'])):
- def __new__(cls, msg_id, line=None, node=None, args=None):
- return tuple.__new__(cls, (msg_id, line, node, args))
-
-
-class UnittestLinter(object):
- """A fake linter class to capture checker messages."""
- # pylint: disable=unused-argument, no-self-use
-
- def __init__(self):
- self._messages = []
- self.stats = {}
-
- def release_messages(self):
- try:
- return self._messages
- finally:
- self._messages = []
-
- def add_message(self, msg_id, line=None, node=None, args=None,
- confidence=None):
- self._messages.append(Message(msg_id, line, node, args))
-
- def is_message_enabled(self, *unused_args):
- return True
-
- def add_stats(self, **kwargs):
- for name, value in six.iteritems(kwargs):
- self.stats[name] = value
- return self.stats
-
- @property
- def options_providers(self):
- return linter.options_providers
-
-def set_config(**kwargs):
- """Decorator for setting config values on a checker."""
- def _Wrapper(fun):
- @functools.wraps(fun)
- def _Forward(self):
- for key, value in six.iteritems(kwargs):
- setattr(self.checker.config, key, value)
- if isinstance(self, CheckerTestCase):
- # reopen checker in case, it may be interested in configuration change
- self.checker.open()
- fun(self)
-
- return _Forward
- return _Wrapper
-
-
-class CheckerTestCase(unittest.TestCase):
- """A base testcase class for unittesting individual checker classes."""
- CHECKER_CLASS = None
- CONFIG = {}
-
- def setUp(self):
- self.linter = UnittestLinter()
- self.checker = self.CHECKER_CLASS(self.linter) # pylint: disable=not-callable
- for key, value in six.iteritems(self.CONFIG):
- setattr(self.checker.config, key, value)
- self.checker.open()
-
- @contextlib.contextmanager
- def assertNoMessages(self):
- """Assert that no messages are added by the given method."""
- with self.assertAddsMessages():
- yield
-
- @contextlib.contextmanager
- def assertAddsMessages(self, *messages):
- """Assert that exactly the given method adds the given messages.
-
- The list of messages must exactly match *all* the messages added by the
- method. Additionally, we check to see whether the args in each message can
- actually be substituted into the message string.
- """
- yield
- got = self.linter.release_messages()
- msg = ('Expected messages did not match actual.\n'
- 'Expected:\n%s\nGot:\n%s' % ('\n'.join(repr(m) for m in messages),
- '\n'.join(repr(m) for m in got)))
- self.assertEqual(list(messages), got, msg)
-
- def walk(self, node):
- """recursive walk on the given node"""
- walker = PyLintASTWalker(linter)
- walker.add_checker(self.checker)
- walker.walk(node)
-
-
-# Init
-test_reporter = TestReporter()
-linter = PyLinter()
-linter.set_reporter(test_reporter)
-linter.config.persistent = 0
-checkers.initialize(linter)
-linter.global_set_option('required-attributes', ('__revision__',))
-
-if linesep != '\n':
- LINE_RGX = re.compile(linesep)
- def ulines(string):
- return LINE_RGX.sub('\n', string)
-else:
- def ulines(string):
- return string
-
-INFO_TEST_RGX = re.compile(r'^func_i\d\d\d\d$')
-
-def exception_str(self, ex): # pylint: disable=unused-argument
- """function used to replace default __str__ method of exception instances"""
- return 'in %s\n:: %s' % (ex.file, ', '.join(ex.args))
-
-# Test classes
-
-class LintTestUsingModule(unittest.TestCase):
- INPUT_DIR = None
- DEFAULT_PACKAGE = 'input'
- package = DEFAULT_PACKAGE
- linter = linter
- module = None
- depends = None
- output = None
- _TEST_TYPE = 'module'
- maxDiff = None
-
- def shortDescription(self):
- values = {'mode' : self._TEST_TYPE,
- 'input': self.module,
- 'pkg': self.package,
- 'cls': self.__class__.__name__}
-
- if self.package == self.DEFAULT_PACKAGE:
- msg = '%(mode)s test of input file "%(input)s" (%(cls)s)'
- else:
- msg = '%(mode)s test of input file "%(input)s" in "%(pkg)s" (%(cls)s)'
- return msg % values
-
- def test_functionality(self):
- tocheck = [self.package+'.'+self.module]
- if self.depends:
- tocheck += [self.package+'.%s' % name.replace('.py', '')
- for name, _ in self.depends]
- self._test(tocheck)
-
- def _check_result(self, got):
- self.assertMultiLineEqual(self._get_expected().strip()+'\n',
- got.strip()+'\n')
-
- def _test(self, tocheck):
- if INFO_TEST_RGX.match(self.module):
- self.linter.enable('I')
- else:
- self.linter.disable('I')
- try:
- self.linter.check(tocheck)
- except Exception as ex:
- # need finalization to restore a correct state
- self.linter.reporter.finalize()
- ex.file = tocheck
- print(ex)
- ex.__str__ = exception_str
- raise
- self._check_result(self.linter.reporter.finalize())
-
- def _has_output(self):
- return not self.module.startswith('func_noerror_')
-
- def _get_expected(self):
- if self._has_output() and self.output:
- with open(self.output, 'U') as fobj:
- return fobj.read().strip() + '\n'
- else:
- return ''
-
-class LintTestUsingFile(LintTestUsingModule):
-
- _TEST_TYPE = 'file'
-
- def test_functionality(self):
- importable = join(self.INPUT_DIR, self.module)
- # python also prefers packages over simple modules.
- if not isdir(importable):
- importable += '.py'
- tocheck = [importable]
- if self.depends:
- tocheck += [join(self.INPUT_DIR, name) for name, _file in self.depends]
- self._test(tocheck)
-
-class LintTestUpdate(LintTestUsingModule):
-
- _TEST_TYPE = 'update'
-
- def _check_result(self, got):
- if self._has_output():
- try:
- expected = self._get_expected()
- except IOError:
- expected = ''
- if got != expected:
- with open(self.output, 'w') as fobj:
- fobj.write(got)
-
-# Callback
-
-def cb_test_gen(base_class):
- def call(input_dir, msg_dir, module_file, messages_file, dependencies):
- # pylint: disable=no-init
- class LintTC(base_class):
- module = module_file.replace('.py', '')
- output = messages_file
- depends = dependencies or None
- INPUT_DIR = input_dir
- MSG_DIR = msg_dir
- return LintTC
- return call
-
-# Main function
-
-def make_tests(input_dir, msg_dir, filter_rgx, callbacks):
- """generate tests classes from test info
-
- return the list of generated test classes
- """
- if filter_rgx:
- is_to_run = re.compile(filter_rgx).search
- else:
- is_to_run = lambda x: 1
- tests = []
- for module_file, messages_file in (
- get_tests_info(input_dir, msg_dir, 'func_', '')
- ):
- if not is_to_run(module_file) or module_file.endswith('.pyc'):
- continue
- base = module_file.replace('func_', '').replace('.py', '')
-
- dependencies = get_tests_info(input_dir, msg_dir, base, '.py')
-
- for callback in callbacks:
- test = callback(input_dir, msg_dir, module_file, messages_file,
- dependencies)
- if test:
- tests.append(test)
- return tests
-
-def tokenize_str(code):
- return list(tokenize.generate_tokens(StringIO(code).readline))
-
-@contextlib.contextmanager
-def create_tempfile(content=None):
- """Create a new temporary file.
-
- If *content* parameter is given, then it will be written
- in the temporary file, before passing it back.
- This is a context manager and should be used with a *with* statement.
- """
- # Can't use tempfile.NamedTemporaryFile here
- # because on Windows the file must be closed before writing to it,
- # see http://bugs.python.org/issue14243
- fd, tmp = tempfile.mkstemp()
- if content:
- if sys.version_info >= (3, 0):
- # erff
- os.write(fd, bytes(content, 'ascii'))
- else:
- os.write(fd, content)
- try:
- yield tmp
- finally:
- os.close(fd)
- os.remove(tmp)
-
-@contextlib.contextmanager
-def create_file_backed_module(code):
- """Create an astroid module for the given code, backed by a real file."""
- with create_tempfile() as temp:
- module = test_utils.build_module(code)
- module.file = temp
- yield module
diff --git a/chromium/third_party/pylint/pylint/utils.py b/chromium/third_party/pylint/pylint/utils.py
deleted file mode 100644
index 6685c4a25d2..00000000000
--- a/chromium/third_party/pylint/pylint/utils.py
+++ /dev/null
@@ -1,919 +0,0 @@
-# Copyright (c) 2003-2014 LOGILAB S.A. (Paris, FRANCE).
-# http://www.logilab.fr/ -- mailto:contact@logilab.fr
-#
-# 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 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.
-"""some various utilities and helper classes, most of them used in the
-main pylint class
-"""
-from __future__ import print_function
-
-import collections
-import os
-import re
-import sys
-import tokenize
-import warnings
-from os.path import dirname, basename, splitext, exists, isdir, join, normpath
-
-import six
-from six.moves import zip # pylint: disable=redefined-builtin
-
-from logilab.common.interface import implements
-from logilab.common.textutils import normalize_text
-from logilab.common.configuration import rest_format_section
-from logilab.common.ureports import Section
-
-from astroid import nodes, Module
-from astroid.modutils import modpath_from_file, get_module_files, \
- file_from_modpath, load_module_from_file
-
-from pylint.interfaces import IRawChecker, ITokenChecker, UNDEFINED
-
-
-class UnknownMessage(Exception):
- """raised when a unregistered message id is encountered"""
-
-class EmptyReport(Exception):
- """raised when a report is empty and so should not be displayed"""
-
-
-MSG_TYPES = {
- 'I' : 'info',
- 'C' : 'convention',
- 'R' : 'refactor',
- 'W' : 'warning',
- 'E' : 'error',
- 'F' : 'fatal'
- }
-MSG_TYPES_LONG = {v: k for k, v in six.iteritems(MSG_TYPES)}
-
-MSG_TYPES_STATUS = {
- 'I' : 0,
- 'C' : 16,
- 'R' : 8,
- 'W' : 4,
- 'E' : 2,
- 'F' : 1
- }
-
-_MSG_ORDER = 'EWRCIF'
-MSG_STATE_SCOPE_CONFIG = 0
-MSG_STATE_SCOPE_MODULE = 1
-MSG_STATE_CONFIDENCE = 2
-
-OPTION_RGX = re.compile(r'\s*#.*\bpylint:(.*)')
-
-# The line/node distinction does not apply to fatal errors and reports.
-_SCOPE_EXEMPT = 'FR'
-
-class WarningScope(object):
- LINE = 'line-based-msg'
- NODE = 'node-based-msg'
-
-_MsgBase = collections.namedtuple(
- '_MsgBase',
- ['msg_id', 'symbol', 'msg', 'C', 'category', 'confidence',
- 'abspath', 'path', 'module', 'obj', 'line', 'column'])
-
-
-class Message(_MsgBase):
- """This class represent a message to be issued by the reporters"""
- def __new__(cls, msg_id, symbol, location, msg, confidence):
- return _MsgBase.__new__(
- cls, msg_id, symbol, msg, msg_id[0], MSG_TYPES[msg_id[0]],
- confidence, *location)
-
- def format(self, template):
- """Format the message according to the given template.
-
- The template format is the one of the format method :
- cf. http://docs.python.org/2/library/string.html#formatstrings
- """
- # For some reason, _asdict on derived namedtuples does not work with
- # Python 3.4. Needs some investigation.
- return template.format(**dict(zip(self._fields, self)))
-
-
-def get_module_and_frameid(node):
- """return the module name and the frame id in the module"""
- frame = node.frame()
- module, obj = '', []
- while frame:
- if isinstance(frame, Module):
- module = frame.name
- else:
- obj.append(getattr(frame, 'name', '<lambda>'))
- try:
- frame = frame.parent.frame()
- except AttributeError:
- frame = None
- obj.reverse()
- return module, '.'.join(obj)
-
-def category_id(cid):
- cid = cid.upper()
- if cid in MSG_TYPES:
- return cid
- return MSG_TYPES_LONG.get(cid)
-
-
-def _decoding_readline(stream, module):
- return lambda: stream.readline().decode(module.file_encoding,
- 'replace')
-
-
-def tokenize_module(module):
- with module.stream() as stream:
- readline = stream.readline
- if sys.version_info < (3, 0):
- if module.file_encoding is not None:
- readline = _decoding_readline(stream, module)
- return list(tokenize.generate_tokens(readline))
- return list(tokenize.tokenize(readline))
-
-def build_message_def(checker, msgid, msg_tuple):
- if implements(checker, (IRawChecker, ITokenChecker)):
- default_scope = WarningScope.LINE
- else:
- default_scope = WarningScope.NODE
- options = {}
- if len(msg_tuple) > 3:
- (msg, symbol, descr, options) = msg_tuple
- elif len(msg_tuple) > 2:
- (msg, symbol, descr) = msg_tuple[:3]
- else:
- # messages should have a symbol, but for backward compatibility
- # they may not.
- (msg, descr) = msg_tuple
- warnings.warn("[pylint 0.26] description of message %s doesn't include "
- "a symbolic name" % msgid, DeprecationWarning)
- symbol = None
- options.setdefault('scope', default_scope)
- return MessageDefinition(checker, msgid, msg, descr, symbol, **options)
-
-
-class MessageDefinition(object):
- def __init__(self, checker, msgid, msg, descr, symbol, scope,
- minversion=None, maxversion=None, old_names=None):
- self.checker = checker
- assert len(msgid) == 5, 'Invalid message id %s' % msgid
- assert msgid[0] in MSG_TYPES, \
- 'Bad message type %s in %r' % (msgid[0], msgid)
- self.msgid = msgid
- self.msg = msg
- self.descr = descr
- self.symbol = symbol
- self.scope = scope
- self.minversion = minversion
- self.maxversion = maxversion
- self.old_names = old_names or []
-
- def may_be_emitted(self):
- """return True if message may be emitted using the current interpreter"""
- if self.minversion is not None and self.minversion > sys.version_info:
- return False
- if self.maxversion is not None and self.maxversion <= sys.version_info:
- return False
- return True
-
- def format_help(self, checkerref=False):
- """return the help string for the given message id"""
- desc = self.descr
- if checkerref:
- desc += ' This message belongs to the %s checker.' % \
- self.checker.name
- title = self.msg
- if self.symbol:
- msgid = '%s (%s)' % (self.symbol, self.msgid)
- else:
- msgid = self.msgid
- if self.minversion or self.maxversion:
- restr = []
- if self.minversion:
- restr.append('< %s' % '.'.join([str(n) for n in self.minversion]))
- if self.maxversion:
- restr.append('>= %s' % '.'.join([str(n) for n in self.maxversion]))
- restr = ' or '.join(restr)
- if checkerref:
- desc += " It can't be emitted when using Python %s." % restr
- else:
- desc += " This message can't be emitted when using Python %s." % restr
- desc = normalize_text(' '.join(desc.split()), indent=' ')
- if title != '%s':
- title = title.splitlines()[0]
- return ':%s: *%s*\n%s' % (msgid, title, desc)
- return ':%s:\n%s' % (msgid, desc)
-
-
-class MessagesHandlerMixIn(object):
- """a mix-in class containing all the messages related methods for the main
- lint class
- """
-
- def __init__(self):
- self._msgs_state = {}
- self.msg_status = 0
-
- def disable(self, msgid, scope='package', line=None, ignore_unknown=False):
- """don't output message of the given id"""
- assert scope in ('package', 'module')
- # handle disable=all by disabling all categories
- if msgid == 'all':
- for msgid in MSG_TYPES:
- self.disable(msgid, scope, line)
- return
- # msgid is a category?
- catid = category_id(msgid)
- if catid is not None:
- for _msgid in self.msgs_store._msgs_by_category.get(catid):
- self.disable(_msgid, scope, line)
- return
- # msgid is a checker name?
- if msgid.lower() in self._checkers:
- msgs_store = self.msgs_store
- for checker in self._checkers[msgid.lower()]:
- for _msgid in checker.msgs:
- if _msgid in msgs_store._alternative_names:
- self.disable(_msgid, scope, line)
- return
- # msgid is report id?
- if msgid.lower().startswith('rp'):
- self.disable_report(msgid)
- return
-
- try:
- # msgid is a symbolic or numeric msgid.
- msg = self.msgs_store.check_message_id(msgid)
- except UnknownMessage:
- if ignore_unknown:
- return
- raise
-
- if scope == 'module':
- self.file_state.set_msg_status(msg, line, False)
- if msg.symbol != 'locally-disabled':
- self.add_message('locally-disabled', line=line,
- args=(msg.symbol, msg.msgid))
-
- else:
- msgs = self._msgs_state
- msgs[msg.msgid] = False
- # sync configuration object
- self.config.disable = [mid for mid, val in six.iteritems(msgs)
- if not val]
-
- def enable(self, msgid, scope='package', line=None, ignore_unknown=False):
- """reenable message of the given id"""
- assert scope in ('package', 'module')
- catid = category_id(msgid)
- # msgid is a category?
- if catid is not None:
- for msgid in self.msgs_store._msgs_by_category.get(catid):
- self.enable(msgid, scope, line)
- return
- # msgid is a checker name?
- if msgid.lower() in self._checkers:
- for checker in self._checkers[msgid.lower()]:
- for msgid_ in checker.msgs:
- self.enable(msgid_, scope, line)
- return
- # msgid is report id?
- if msgid.lower().startswith('rp'):
- self.enable_report(msgid)
- return
-
- try:
- # msgid is a symbolic or numeric msgid.
- msg = self.msgs_store.check_message_id(msgid)
- except UnknownMessage:
- if ignore_unknown:
- return
- raise
-
- if scope == 'module':
- self.file_state.set_msg_status(msg, line, True)
- self.add_message('locally-enabled', line=line, args=(msg.symbol, msg.msgid))
- else:
- msgs = self._msgs_state
- msgs[msg.msgid] = True
- # sync configuration object
- self.config.enable = [mid for mid, val in six.iteritems(msgs) if val]
-
- def get_message_state_scope(self, msgid, line=None, confidence=UNDEFINED):
- """Returns the scope at which a message was enabled/disabled."""
- if self.config.confidence and confidence.name not in self.config.confidence:
- return MSG_STATE_CONFIDENCE
- try:
- if line in self.file_state._module_msgs_state[msgid]:
- return MSG_STATE_SCOPE_MODULE
- except (KeyError, TypeError):
- return MSG_STATE_SCOPE_CONFIG
-
- def is_message_enabled(self, msg_descr, line=None, confidence=None):
- """return true if the message associated to the given message id is
- enabled
-
- msgid may be either a numeric or symbolic message id.
- """
- if self.config.confidence and confidence:
- if confidence.name not in self.config.confidence:
- return False
- try:
- msgid = self.msgs_store.check_message_id(msg_descr).msgid
- except UnknownMessage:
- # The linter checks for messages that are not registered
- # due to version mismatch, just treat them as message IDs
- # for now.
- msgid = msg_descr
- if line is None:
- return self._msgs_state.get(msgid, True)
- try:
- return self.file_state._module_msgs_state[msgid][line]
- except KeyError:
- return self._msgs_state.get(msgid, True)
-
- def add_message(self, msg_descr, line=None, node=None, args=None, confidence=UNDEFINED):
- """Adds a message given by ID or name.
-
- If provided, the message string is expanded using args
-
- AST checkers should must the node argument (but may optionally
- provide line if the line number is different), raw and token checkers
- must provide the line argument.
- """
- msg_info = self.msgs_store.check_message_id(msg_descr)
- msgid = msg_info.msgid
- # backward compatibility, message may not have a symbol
- symbol = msg_info.symbol or msgid
- # Fatal messages and reports are special, the node/scope distinction
- # does not apply to them.
- if msgid[0] not in _SCOPE_EXEMPT:
- if msg_info.scope == WarningScope.LINE:
- assert node is None and line is not None, (
- 'Message %s must only provide line, got line=%s, node=%s' % (msgid, line, node))
- elif msg_info.scope == WarningScope.NODE:
- # Node-based warnings may provide an override line.
- assert node is not None, 'Message %s must provide Node, got None'
-
- if line is None and node is not None:
- line = node.fromlineno
- if hasattr(node, 'col_offset'):
- col_offset = node.col_offset # XXX measured in bytes for utf-8, divide by two for chars?
- else:
- col_offset = None
- # should this message be displayed
- if not self.is_message_enabled(msgid, line, confidence):
- self.file_state.handle_ignored_message(
- self.get_message_state_scope(msgid, line, confidence),
- msgid, line, node, args, confidence)
- return
- # update stats
- msg_cat = MSG_TYPES[msgid[0]]
- self.msg_status |= MSG_TYPES_STATUS[msgid[0]]
- self.stats[msg_cat] += 1
- self.stats['by_module'][self.current_name][msg_cat] += 1
- try:
- self.stats['by_msg'][symbol] += 1
- except KeyError:
- self.stats['by_msg'][symbol] = 1
- # expand message ?
- msg = msg_info.msg
- if args:
- msg %= args
- # get module and object
- if node is None:
- module, obj = self.current_name, ''
- abspath = self.current_file
- else:
- module, obj = get_module_and_frameid(node)
- abspath = node.root().file
- path = abspath.replace(self.reporter.path_strip_prefix, '')
- # add the message
- self.reporter.handle_message(
- Message(msgid, symbol,
- (abspath, path, module, obj, line or 1, col_offset or 0), msg, confidence))
-
- def print_full_documentation(self):
- """output a full documentation in ReST format"""
- print("Pylint global options and switches")
- print("----------------------------------")
- print("")
- print("Pylint provides global options and switches.")
- print("")
-
- by_checker = {}
- for checker in self.get_checkers():
- if checker.name == 'master':
- if checker.options:
- for section, options in checker.options_by_section():
- if section is None:
- title = 'General options'
- else:
- title = '%s options' % section.capitalize()
- print(title)
- print('~' * len(title))
- rest_format_section(sys.stdout, None, options)
- print("")
- else:
- try:
- by_checker[checker.name][0] += checker.options_and_values()
- by_checker[checker.name][1].update(checker.msgs)
- by_checker[checker.name][2] += checker.reports
- except KeyError:
- by_checker[checker.name] = [list(checker.options_and_values()),
- dict(checker.msgs),
- list(checker.reports)]
-
- print("Pylint checkers' options and switches")
- print("-------------------------------------")
- print("")
- print("Pylint checkers can provide three set of features:")
- print("")
- print("* options that control their execution,")
- print("* messages that they can raise,")
- print("* reports that they can generate.")
- print("")
- print("Below is a list of all checkers and their features.")
- print("")
-
- for checker, (options, msgs, reports) in six.iteritems(by_checker):
- title = '%s checker' % (checker.replace("_", " ").title())
- print(title)
- print('~' * len(title))
- print("")
- print("Verbatim name of the checker is ``%s``." % checker)
- print("")
- if options:
- title = 'Options'
- print(title)
- print('^' * len(title))
- rest_format_section(sys.stdout, None, options)
- print("")
- if msgs:
- title = 'Messages'
- print(title)
- print('~' * len(title))
- for msgid, msg in sorted(six.iteritems(msgs),
- key=lambda kv: (_MSG_ORDER.index(kv[0][0]), kv[1])):
- msg = build_message_def(checker, msgid, msg)
- print(msg.format_help(checkerref=False))
- print("")
- if reports:
- title = 'Reports'
- print(title)
- print('~' * len(title))
- for report in reports:
- print(':%s: %s' % report[:2])
- print("")
- print("")
-
-
-class FileState(object):
- """Hold internal state specific to the currently analyzed file"""
-
- def __init__(self, modname=None):
- self.base_name = modname
- self._module_msgs_state = {}
- self._raw_module_msgs_state = {}
- self._ignored_msgs = collections.defaultdict(set)
- self._suppression_mapping = {}
-
- def collect_block_lines(self, msgs_store, module_node):
- """Walk the AST to collect block level options line numbers."""
- for msg, lines in six.iteritems(self._module_msgs_state):
- self._raw_module_msgs_state[msg] = lines.copy()
- orig_state = self._module_msgs_state.copy()
- self._module_msgs_state = {}
- self._suppression_mapping = {}
- self._collect_block_lines(msgs_store, module_node, orig_state)
-
- def _collect_block_lines(self, msgs_store, node, msg_state):
- """Recursivly walk (depth first) AST to collect block level options line
- numbers.
- """
- for child in node.get_children():
- self._collect_block_lines(msgs_store, child, msg_state)
- first = node.fromlineno
- last = node.tolineno
- # first child line number used to distinguish between disable
- # which are the first child of scoped node with those defined later.
- # For instance in the code below:
- #
- # 1. def meth8(self):
- # 2. """test late disabling"""
- # 3. # pylint: disable=E1102
- # 4. print self.blip
- # 5. # pylint: disable=E1101
- # 6. print self.bla
- #
- # E1102 should be disabled from line 1 to 6 while E1101 from line 5 to 6
- #
- # this is necessary to disable locally messages applying to class /
- # function using their fromlineno
- if isinstance(node, (nodes.Module, nodes.Class, nodes.Function)) and node.body:
- firstchildlineno = node.body[0].fromlineno
- else:
- firstchildlineno = last
- for msgid, lines in six.iteritems(msg_state):
- for lineno, state in list(lines.items()):
- original_lineno = lineno
- if first <= lineno <= last:
- # Set state for all lines for this block, if the
- # warning is applied to nodes.
- if msgs_store.check_message_id(msgid).scope == WarningScope.NODE:
- if lineno > firstchildlineno:
- state = True
- first_, last_ = node.block_range(lineno)
- else:
- first_ = lineno
- last_ = last
- for line in range(first_, last_+1):
- # do not override existing entries
- if not line in self._module_msgs_state.get(msgid, ()):
- if line in lines: # state change in the same block
- state = lines[line]
- original_lineno = line
- if not state:
- self._suppression_mapping[(msgid, line)] = original_lineno
- try:
- self._module_msgs_state[msgid][line] = state
- except KeyError:
- self._module_msgs_state[msgid] = {line: state}
- del lines[lineno]
-
- def set_msg_status(self, msg, line, status):
- """Set status (enabled/disable) for a given message at a given line"""
- assert line > 0
- try:
- self._module_msgs_state[msg.msgid][line] = status
- except KeyError:
- self._module_msgs_state[msg.msgid] = {line: status}
-
- def handle_ignored_message(self, state_scope, msgid, line,
- node, args, confidence): # pylint: disable=unused-argument
- """Report an ignored message.
-
- state_scope is either MSG_STATE_SCOPE_MODULE or MSG_STATE_SCOPE_CONFIG,
- depending on whether the message was disabled locally in the module,
- or globally. The other arguments are the same as for add_message.
- """
- if state_scope == MSG_STATE_SCOPE_MODULE:
- try:
- orig_line = self._suppression_mapping[(msgid, line)]
- self._ignored_msgs[(msgid, orig_line)].add(line)
- except KeyError:
- pass
-
- def iter_spurious_suppression_messages(self, msgs_store):
- for warning, lines in six.iteritems(self._raw_module_msgs_state):
- for line, enable in six.iteritems(lines):
- if not enable and (warning, line) not in self._ignored_msgs:
- yield 'useless-suppression', line, \
- (msgs_store.get_msg_display_string(warning),)
- # don't use iteritems here, _ignored_msgs may be modified by add_message
- for (warning, from_), lines in list(self._ignored_msgs.items()):
- for line in lines:
- yield 'suppressed-message', line, \
- (msgs_store.get_msg_display_string(warning), from_)
-
-
-class MessagesStore(object):
- """The messages store knows information about every possible message but has
- no particular state during analysis.
- """
-
- def __init__(self):
- # Primary registry for all active messages (i.e. all messages
- # that can be emitted by pylint for the underlying Python
- # version). It contains the 1:1 mapping from symbolic names
- # to message definition objects.
- self._messages = {}
- # Maps alternative names (numeric IDs, deprecated names) to
- # message definitions. May contain several names for each definition
- # object.
- self._alternative_names = {}
- self._msgs_by_category = collections.defaultdict(list)
-
- @property
- def messages(self):
- """The list of all active messages."""
- return six.itervalues(self._messages)
-
- def add_renamed_message(self, old_id, old_symbol, new_symbol):
- """Register the old ID and symbol for a warning that was renamed.
-
- This allows users to keep using the old ID/symbol in suppressions.
- """
- msg = self.check_message_id(new_symbol)
- msg.old_names.append((old_id, old_symbol))
- self._alternative_names[old_id] = msg
- self._alternative_names[old_symbol] = msg
-
- def register_messages(self, checker):
- """register a dictionary of messages
-
- Keys are message ids, values are a 2-uple with the message type and the
- message itself
-
- message ids should be a string of len 4, where the two first characters
- are the checker id and the two last the message id in this checker
- """
- chkid = None
- for msgid, msg_tuple in six.iteritems(checker.msgs):
- msg = build_message_def(checker, msgid, msg_tuple)
- assert msg.symbol not in self._messages, \
- 'Message symbol %r is already defined' % msg.symbol
- # avoid duplicate / malformed ids
- assert msg.msgid not in self._alternative_names, \
- 'Message id %r is already defined' % msgid
- assert chkid is None or chkid == msg.msgid[1:3], \
- 'Inconsistent checker part in message id %r' % msgid
- chkid = msg.msgid[1:3]
- self._messages[msg.symbol] = msg
- self._alternative_names[msg.msgid] = msg
- for old_id, old_symbol in msg.old_names:
- self._alternative_names[old_id] = msg
- self._alternative_names[old_symbol] = msg
- self._msgs_by_category[msg.msgid[0]].append(msg.msgid)
-
- def check_message_id(self, msgid):
- """returns the Message object for this message.
-
- msgid may be either a numeric or symbolic id.
-
- Raises UnknownMessage if the message id is not defined.
- """
- if msgid[1:].isdigit():
- msgid = msgid.upper()
- for source in (self._alternative_names, self._messages):
- try:
- return source[msgid]
- except KeyError:
- pass
- raise UnknownMessage('No such message id %s' % msgid)
-
- def get_msg_display_string(self, msgid):
- """Generates a user-consumable representation of a message.
-
- Can be just the message ID or the ID and the symbol.
- """
- return repr(self.check_message_id(msgid).symbol)
-
- def help_message(self, msgids):
- """display help messages for the given message identifiers"""
- for msgid in msgids:
- try:
- print(self.check_message_id(msgid).format_help(checkerref=True))
- print("")
- except UnknownMessage as ex:
- print(ex)
- print("")
- continue
-
- def list_messages(self):
- """output full messages list documentation in ReST format"""
- msgs = sorted(six.itervalues(self._messages), key=lambda msg: msg.msgid)
- for msg in msgs:
- if not msg.may_be_emitted():
- continue
- print(msg.format_help(checkerref=False))
- print("")
-
-
-class ReportsHandlerMixIn(object):
- """a mix-in class containing all the reports and stats manipulation
- related methods for the main lint class
- """
- def __init__(self):
- self._reports = collections.defaultdict(list)
- self._reports_state = {}
-
- def report_order(self):
- """ Return a list of reports, sorted in the order
- in which they must be called.
- """
- return list(self._reports)
-
- def register_report(self, reportid, r_title, r_cb, checker):
- """register a report
-
- reportid is the unique identifier for the report
- r_title the report's title
- r_cb the method to call to make the report
- checker is the checker defining the report
- """
- reportid = reportid.upper()
- self._reports[checker].append((reportid, r_title, r_cb))
-
- def enable_report(self, reportid):
- """disable the report of the given id"""
- reportid = reportid.upper()
- self._reports_state[reportid] = True
-
- def disable_report(self, reportid):
- """disable the report of the given id"""
- reportid = reportid.upper()
- self._reports_state[reportid] = False
-
- def report_is_enabled(self, reportid):
- """return true if the report associated to the given identifier is
- enabled
- """
- return self._reports_state.get(reportid, True)
-
- def make_reports(self, stats, old_stats):
- """render registered reports"""
- sect = Section('Report',
- '%s statements analysed.'% (self.stats['statement']))
- for checker in self.report_order():
- for reportid, r_title, r_cb in self._reports[checker]:
- if not self.report_is_enabled(reportid):
- continue
- report_sect = Section(r_title)
- try:
- r_cb(report_sect, stats, old_stats)
- except EmptyReport:
- continue
- report_sect.report_id = reportid
- sect.append(report_sect)
- return sect
-
- def add_stats(self, **kwargs):
- """add some stats entries to the statistic dictionary
- raise an AssertionError if there is a key conflict
- """
- for key, value in six.iteritems(kwargs):
- if key[-1] == '_':
- key = key[:-1]
- assert key not in self.stats
- self.stats[key] = value
- return self.stats
-
-
-def expand_modules(files_or_modules, black_list):
- """take a list of files/modules/packages and return the list of tuple
- (file, module name) which have to be actually checked
- """
- result = []
- errors = []
- for something in files_or_modules:
- if exists(something):
- # this is a file or a directory
- try:
- modname = '.'.join(modpath_from_file(something))
- except ImportError:
- modname = splitext(basename(something))[0]
- if isdir(something):
- filepath = join(something, '__init__.py')
- else:
- filepath = something
- else:
- # suppose it's a module or package
- modname = something
- try:
- filepath = file_from_modpath(modname.split('.'))
- if filepath is None:
- errors.append({'key' : 'ignored-builtin-module', 'mod': modname})
- continue
- except (ImportError, SyntaxError) as ex:
- # FIXME p3k : the SyntaxError is a Python bug and should be
- # removed as soon as possible http://bugs.python.org/issue10588
- errors.append({'key': 'fatal', 'mod': modname, 'ex': ex})
- continue
- filepath = normpath(filepath)
- result.append({'path': filepath, 'name': modname, 'isarg': True,
- 'basepath': filepath, 'basename': modname})
- if not (modname.endswith('.__init__') or modname == '__init__') \
- and '__init__.py' in filepath:
- for subfilepath in get_module_files(dirname(filepath), black_list):
- if filepath == subfilepath:
- continue
- submodname = '.'.join(modpath_from_file(subfilepath))
- result.append({'path': subfilepath, 'name': submodname,
- 'isarg': False,
- 'basepath': filepath, 'basename': modname})
- return result, errors
-
-
-class PyLintASTWalker(object):
-
- def __init__(self, linter):
- # callbacks per node types
- self.nbstatements = 1
- self.visit_events = collections.defaultdict(list)
- self.leave_events = collections.defaultdict(list)
- self.linter = linter
-
- def _is_method_enabled(self, method):
- if not hasattr(method, 'checks_msgs'):
- return True
- for msg_desc in method.checks_msgs:
- if self.linter.is_message_enabled(msg_desc):
- return True
- return False
-
- def add_checker(self, checker):
- """walk to the checker's dir and collect visit and leave methods"""
- # XXX : should be possible to merge needed_checkers and add_checker
- vcids = set()
- lcids = set()
- visits = self.visit_events
- leaves = self.leave_events
- for member in dir(checker):
- cid = member[6:]
- if cid == 'default':
- continue
- if member.startswith('visit_'):
- v_meth = getattr(checker, member)
- # don't use visit_methods with no activated message:
- if self._is_method_enabled(v_meth):
- visits[cid].append(v_meth)
- vcids.add(cid)
- elif member.startswith('leave_'):
- l_meth = getattr(checker, member)
- # don't use leave_methods with no activated message:
- if self._is_method_enabled(l_meth):
- leaves[cid].append(l_meth)
- lcids.add(cid)
- visit_default = getattr(checker, 'visit_default', None)
- if visit_default:
- for cls in nodes.ALL_NODE_CLASSES:
- cid = cls.__name__.lower()
- if cid not in vcids:
- visits[cid].append(visit_default)
- # for now we have no "leave_default" method in Pylint
-
- def walk(self, astroid):
- """call visit events of astroid checkers for the given node, recurse on
- its children, then leave events.
- """
- cid = astroid.__class__.__name__.lower()
- if astroid.is_statement:
- self.nbstatements += 1
- # generate events for this node on each checker
- for cb in self.visit_events.get(cid, ()):
- cb(astroid)
- # recurse on children
- for child in astroid.get_children():
- self.walk(child)
- for cb in self.leave_events.get(cid, ()):
- cb(astroid)
-
-
-PY_EXTS = ('.py', '.pyc', '.pyo', '.pyw', '.so', '.dll')
-
-def register_plugins(linter, directory):
- """load all module and package in the given directory, looking for a
- 'register' function in each one, used to register pylint checkers
- """
- imported = {}
- for filename in os.listdir(directory):
- base, extension = splitext(filename)
- if base in imported or base == '__pycache__':
- continue
- if extension in PY_EXTS and base != '__init__' or (
- not extension and isdir(join(directory, base))):
- try:
- module = load_module_from_file(join(directory, filename))
- except ValueError:
- # empty module name (usually emacs auto-save files)
- continue
- except ImportError as exc:
- print("Problem importing module %s: %s" % (filename, exc),
- file=sys.stderr)
- else:
- if hasattr(module, 'register'):
- module.register(linter)
- imported[base] = 1
-
-def get_global_option(checker, option, default=None):
- """ Retrieve an option defined by the given *checker* or
- by all known option providers.
-
- It will look in the list of all options providers
- until the given *option* will be found.
- If the option wasn't found, the *default* value will be returned.
- """
- # First, try in the given checker's config.
- # After that, look in the options providers.
-
- try:
- return getattr(checker.config, option.replace("-", "_"))
- except AttributeError:
- pass
- for provider in checker.linter.options_providers:
- for options in provider.options:
- if options[0] == option:
- return getattr(provider.config, option.replace("-", "_"))
- return default
diff --git a/chromium/third_party/speech-dispatcher/COPYING b/chromium/third_party/speech-dispatcher/COPYING
deleted file mode 100644
index 999262f6785..00000000000
--- a/chromium/third_party/speech-dispatcher/COPYING
+++ /dev/null
@@ -1,808 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- 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 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 St, Fifth Floor, Boston, MA 02110-1301 USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) year name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
-Public License instead of this License.
-
-
-
-
-
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it. You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations
-below.
-
- When we speak of free software, we are referring to freedom of use,
-not price. Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License. We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom. The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
- We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License. It also provides other free software developers Less
-of an advantage over competing non-free programs. These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it
-becomes a de-facto standard. To achieve this, non-free programs must
-be allowed to use the library. A more frequent case is that a free
-library does the same job as widely used non-free libraries. In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software. For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
- Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control
-compilation and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
- 6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run time a
- copy of the library already present on the user's computer system,
- rather than copying library functions into the executable, and (2)
- will operate properly with a modified version of the library, if
- the user installs one, as long as the modified version is
- interface-compatible with the version that the work was made with.
-
- c) Accompany the work with a written offer, valid for at least
- three years, to give the same user the materials specified in
- Subsection 6a, above, for a charge no more than the cost of
- performing this distribution.
-
- d) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- e) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply, and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License
-may add an explicit geographical distribution limitation excluding those
-countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
-
-
diff --git a/chromium/third_party/speech-dispatcher/OWNERS b/chromium/third_party/speech-dispatcher/OWNERS
deleted file mode 100644
index 3f3d042ae3a..00000000000
--- a/chromium/third_party/speech-dispatcher/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-dtseng@chromium.org
-dmazzoni@chromium.org
diff --git a/chromium/third_party/speech-dispatcher/README.chromium b/chromium/third_party/speech-dispatcher/README.chromium
deleted file mode 100644
index e7f335b6666..00000000000
--- a/chromium/third_party/speech-dispatcher/README.chromium
+++ /dev/null
@@ -1,19 +0,0 @@
-Name: Speech Dispatcher
-URL: http://devel.freebsoft.org/speechd
-Version: 0.7.1
-License: GPL (v2 or later)
-Security Critical: yes
-
-Description:
-Speech Dispatcher project provides a high-level device independent layer for
-access to speech synthesis through a simple, stable and well documented
-interface.
-
-Local Modifications:
-Merged http://git.freebsoft.org/?p=speechd.git;a=commitdiff;h=c73bfee2b6ef683874b3fe7463239073f703c8b7
-Only the libspeechd.h file is imported, as the client library (libspeechd.so.2)
-is dynamically loaded (where present).
-
-This header is imported because later versions of Speech Dispatcher (>= 0.8)
-install it into a different location (${includedir}/speech-dispatcher instead
-of ${includedir}) and we still need to support older versions.
diff --git a/chromium/third_party/speech-dispatcher/libspeechd.h b/chromium/third_party/speech-dispatcher/libspeechd.h
deleted file mode 100644
index 66aea959b48..00000000000
--- a/chromium/third_party/speech-dispatcher/libspeechd.h
+++ /dev/null
@@ -1,268 +0,0 @@
-
-/*
- * libspeechd.h - Shared library for easy acces to Speech Dispatcher functions (header)
- *
- * Copyright (C) 2001, 2002, 2003, 2004 Brailcom, o.p.s.
- *
- * This 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.
- *
- * This software 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 package; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- * $Id: libspeechd.h,v 1.29 2008-07-30 09:47:00 hanke Exp $
- */
-
-#ifndef _LIBSPEECHD_H
-#define _LIBSPEECHD_H
-
-#include <stdio.h>
-#include <stddef.h>
-#include <pthread.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Arguments for spd_send_data() */
-#define SPD_WAIT_REPLY 1 /* Wait for reply */
-#define SPD_NO_REPLY 0 /* No reply requested */
-
-
-/* --------------------- Public data types ------------------------ */
-
-typedef enum{
- SPD_PUNCT_ALL = 0,
- SPD_PUNCT_NONE = 1,
- SPD_PUNCT_SOME = 2
-}SPDPunctuation;
-
-typedef enum{
- SPD_CAP_NONE = 0,
- SPD_CAP_SPELL = 1,
- SPD_CAP_ICON = 2
-}SPDCapitalLetters;
-
-typedef enum{
- SPD_SPELL_OFF = 0,
- SPD_SPELL_ON = 1
-}SPDSpelling;
-
-typedef enum{
- SPD_DATA_TEXT = 0,
- SPD_DATA_SSML = 1
-}SPDDataMode;
-
-typedef enum{
- SPD_MALE1 = 1,
- SPD_MALE2 = 2,
- SPD_MALE3 = 3,
- SPD_FEMALE1 = 4,
- SPD_FEMALE2 = 5,
- SPD_FEMALE3 = 6,
- SPD_CHILD_MALE = 7,
- SPD_CHILD_FEMALE = 8
-}SPDVoiceType;
-
-
-typedef struct{
- char *name; /* Name of the voice (id) */
- char *language; /* 2-letter ISO language code */
- char *variant; /* a not-well defined string describing dialect etc. */
-}SPDVoice;
-
-typedef enum{
- SPD_BEGIN = 1,
- SPD_END = 2,
- SPD_INDEX_MARKS = 4,
- SPD_CANCEL = 8,
- SPD_PAUSE = 16,
- SPD_RESUME = 32
-}SPDNotification;
-
-typedef enum{
- SPD_IMPORTANT = 1,
- SPD_MESSAGE = 2,
- SPD_TEXT = 3,
- SPD_NOTIFICATION = 4,
- SPD_PROGRESS = 5
-}SPDPriority;
-
-typedef enum{
- SPD_EVENT_BEGIN,
- SPD_EVENT_END,
- SPD_EVENT_CANCEL,
- SPD_EVENT_PAUSE,
- SPD_EVENT_RESUME,
- SPD_EVENT_INDEX_MARK
-}SPDNotificationType;
-
-typedef enum{
- SPD_MODE_SINGLE = 0,
- SPD_MODE_THREADED = 1
-}SPDConnectionMode;
-
-typedef enum{
- SPD_METHOD_UNIX_SOCKET = 0,
- SPD_METHOD_INET_SOCKET = 1,
-}SPDConnectionMethod;
-
-typedef struct{
- SPDConnectionMethod method;
- char *unix_socket_name;
- char *inet_socket_host;
- int inet_socket_port;
- char *dbus_bus;
-}SPDConnectionAddress;
-
-typedef void (*SPDCallback)(size_t msg_id, size_t client_id, SPDNotificationType state);
-typedef void (*SPDCallbackIM)(size_t msg_id, size_t client_id, SPDNotificationType state, char *index_mark);
-
-typedef struct{
-
- /* PUBLIC */
- SPDCallback callback_begin;
- SPDCallback callback_end;
- SPDCallback callback_cancel;
- SPDCallback callback_pause;
- SPDCallback callback_resume;
- SPDCallbackIM callback_im;
-
- /* PRIVATE */
- int socket;
- FILE *stream;
- SPDConnectionMode mode;
-
- pthread_mutex_t *ssip_mutex;
-
- pthread_t *events_thread;
- pthread_mutex_t *comm_mutex;
- pthread_cond_t *cond_reply_ready;
- pthread_mutex_t *mutex_reply_ready;
- pthread_cond_t *cond_reply_ack;
- pthread_mutex_t *mutex_reply_ack;
-
- char *reply;
-
-}SPDConnection;
-
-/* -------------- Public functions --------------------------*/
-
-/* Openning and closing Speech Dispatcher connection */
-SPDConnectionAddress* spd_get_default_address(char** error);
-SPDConnection* spd_open(const char* client_name, const char* connection_name, const char* user_name,
- SPDConnectionMode mode);
-SPDConnection* spd_open2(const char* client_name, const char* connection_name, const char* user_name,
- SPDConnectionMode mode, SPDConnectionAddress *address, int autospawn,
- char **error_result);
-
-void spd_close(SPDConnection* connection);
-
-/* Speaking */
-int spd_say(SPDConnection* connection, SPDPriority priority, const char* text);
-int spd_sayf(SPDConnection* connection, SPDPriority priority, const char *format, ...);
-
-/* Speech flow */
-int spd_stop(SPDConnection* connection);
-int spd_stop_all(SPDConnection* connection);
-int spd_stop_uid(SPDConnection* connection, int target_uid);
-
-int spd_cancel(SPDConnection* connection);
-int spd_cancel_all(SPDConnection* connection);
-int spd_cancel_uid(SPDConnection* connection, int target_uid);
-
-int spd_pause(SPDConnection* connection);
-int spd_pause_all(SPDConnection* connection);
-int spd_pause_uid(SPDConnection* connection, int target_uid);
-
-int spd_resume(SPDConnection* connection);
-int spd_resume_all(SPDConnection* connection);
-int spd_resume_uid(SPDConnection* connection, int target_uid);
-
-/* Characters and keys */
-int spd_key(SPDConnection* connection, SPDPriority priority, const char *key_name);
-int spd_char(SPDConnection* connection, SPDPriority priority, const char *character);
-int spd_wchar(SPDConnection* connection, SPDPriority priority, wchar_t wcharacter);
-
-/* Sound icons */
-int spd_sound_icon(SPDConnection* connection, SPDPriority priority, const char *icon_name);
-
-/* Setting parameters */
-int spd_set_voice_type(SPDConnection*, SPDVoiceType type);
-int spd_set_voice_type_all(SPDConnection*, SPDVoiceType type);
-int spd_set_voice_type_uid(SPDConnection*, SPDVoiceType type, unsigned int uid);
-
-int spd_set_synthesis_voice(SPDConnection*, const char *voice_name);
-int spd_set_synthesis_voice_all(SPDConnection*, const char *voice_name);
-int spd_set_synthesis_voice_uid(SPDConnection*, const char *voice_name, unsigned int uid);
-
-int spd_set_data_mode(SPDConnection *connection, SPDDataMode mode);
-
-int spd_set_notification_on(SPDConnection* connection, SPDNotification notification);
-int spd_set_notification_off(SPDConnection* connection, SPDNotification notification);
-int spd_set_notification(SPDConnection* connection, SPDNotification notification, const char* state);
-
-int spd_set_voice_rate(SPDConnection* connection, signed int rate);
-int spd_set_voice_rate_all(SPDConnection* connection, signed int rate);
-int spd_set_voice_rate_uid(SPDConnection* connection, signed int rate, unsigned int uid);
-
-int spd_set_voice_pitch(SPDConnection* connection, signed int pitch);
-int spd_set_voice_pitch_all(SPDConnection* connection, signed int pitch);
-int spd_set_voice_pitch_uid(SPDConnection* connection, signed int pitch, unsigned int uid);
-
-int spd_set_volume(SPDConnection* connection, signed int volume);
-int spd_set_volume_all(SPDConnection* connection, signed int volume);
-int spd_set_volume_uid(SPDConnection* connection, signed int volume, unsigned int uid);
-
-int spd_set_punctuation(SPDConnection* connection, SPDPunctuation type);
-int spd_set_punctuation_all(SPDConnection* connection, SPDPunctuation type);
-int spd_set_punctuation_uid(SPDConnection* connection, SPDPunctuation type, unsigned int uid);
-
-int spd_set_capital_letters(SPDConnection* connection, SPDCapitalLetters type);
-int spd_set_capital_letters_all(SPDConnection* connection, SPDCapitalLetters type);
-int spd_set_capital_letters_uid(SPDConnection* connection, SPDCapitalLetters type, unsigned int uid);
-
-int spd_set_spelling(SPDConnection* connection, SPDSpelling type);
-int spd_set_spelling_all(SPDConnection* connection, SPDSpelling type);
-int spd_set_spelling_uid(SPDConnection* connection, SPDSpelling type, unsigned int uid);
-
-int spd_set_language(SPDConnection* connection, const char* language);
-int spd_set_language_all(SPDConnection* connection, const char* language);
-int spd_set_language_uid(SPDConnection* connection, const char* language, unsigned int uid);
-
-int spd_set_output_module(SPDConnection* connection, const char* output_module);
-int spd_set_output_module_all(SPDConnection* connection, const char* output_module);
-int spd_set_output_module_uid(SPDConnection* connection, const char* output_module, unsigned int uid);
-
-int spd_get_client_list(SPDConnection *connection, char **client_names, int *client_ids, int* active);
-int spd_get_message_list_fd(SPDConnection *connection, int target, int *msg_ids, char **client_names);
-
-char** spd_list_modules(SPDConnection *connection);
-char** spd_list_voices(SPDConnection *connection);
-SPDVoice** spd_list_synthesis_voices(SPDConnection *connection);
-char** spd_execute_command_with_list_reply(SPDConnection *connection, char* command);
-
-
-/* Direct SSIP communication */
-int spd_execute_command(SPDConnection* connection, char* command);
-int spd_execute_command_with_reply(SPDConnection *connection, char* command, char **reply);
-int spd_execute_command_wo_mutex(SPDConnection *connection, char* command);
-char* spd_send_data(SPDConnection* connection, const char *message, int wfr);
-char* spd_send_data_wo_mutex(SPDConnection *connection, const char *message, int wfr);
-
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* ifndef _LIBSPEECHD_H */
diff --git a/chromium/third_party/talloc/LICENSE b/chromium/third_party/talloc/LICENSE
deleted file mode 100644
index 79b410ca966..00000000000
--- a/chromium/third_party/talloc/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
- Unix SMB/CIFS implementation.
- Samba temporary memory allocation functions
-
- Copyright (C) Andrew Tridgell 2004-2005
- Copyright (C) Stefan Metzmacher 2006
-
- ** NOTE! The following LGPL license applies to the talloc
- ** library. This does NOT imply that all of Samba is released
- ** under the LGPL
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, see <http://www.gnu.org/licenses/>.
diff --git a/chromium/third_party/talloc/Makefile.in b/chromium/third_party/talloc/Makefile.in
deleted file mode 100644
index 94f031a4bb4..00000000000
--- a/chromium/third_party/talloc/Makefile.in
+++ /dev/null
@@ -1,62 +0,0 @@
-#!gmake
-#
-prefix = @prefix@
-datarootdir = @datarootdir@
-exec_prefix = @exec_prefix@
-includedir = @includedir@
-libdir = @libdir@
-mandir = @mandir@
-VPATH = @srcdir@:@libreplacedir@
-srcdir = @srcdir@
-builddir = @builddir@
-sharedbuilddir = @sharedbuilddir@
-XSLTPROC = @XSLTPROC@
-INSTALLCMD = @INSTALL@
-CC = @CC@
-CFLAGS = @CFLAGS@ -DHAVE_CONFIG_H= -I. -I@srcdir@
-EXTRA_TARGETS = @DOC_TARGET@
-PICFLAG = @PICFLAG@
-TALLOC_VERSION = @TALLOC_VERSION@
-TALLOC_VERSION_MAJOR = @TALLOC_VERSION_MAJOR@
-TALLOC_VERSION_MINOR = @TALLOC_VERSION_MINOR@
-TALLOC_VERSION_RELEASE = @TALLOC_VERSION_RELEASE@
-SHLIBEXT = @SHLIBEXT@
-SHLD = @SHLD@
-SHLD_FLAGS = @SHLD_FLAGS@
-tallocdir = @tallocdir@
-
-LIBOBJ = $(TALLOC_OBJ) @LIBREPLACEOBJ@
-
-SONAMEFLAG = @SONAMEFLAG@
-VERSIONSCRIPT = @VERSIONSCRIPT@
-EXPORTSFILE = @EXPORTSFILE@
-
-all:: showflags $(EXTRA_TARGETS)
-
-include $(tallocdir)/rules.mk
-include $(tallocdir)/talloc.mk
-
-@TALLOC_COMPAT1_MK@
-
-$(TALLOC_SOLIB): $(LIBOBJ)
- $(SHLD) $(SHLD_FLAGS) -o $@ $(LIBOBJ) $(VERSIONSCRIPT) $(EXPORTSFILE) $(SONAMEFLAG)$(TALLOC_SONAME)
-
-shared-build: all
- ${INSTALLCMD} -d $(sharedbuilddir)/lib
- ${INSTALLCMD} -m 644 libtalloc.a $(sharedbuilddir)/lib
- ${INSTALLCMD} -m 755 $(TALLOC_SOLIB) $(sharedbuilddir)/lib
- ln -sf $(TALLOC_SOLIB) $(sharedbuilddir)/lib/$(TALLOC_SONAME)
- ln -sf $(TALLOC_SOLIB) $(sharedbuilddir)/lib/libtalloc.so
- ${INSTALLCMD} -d $(sharedbuilddir)/include
- ${INSTALLCMD} -m 644 $(srcdir)/talloc.h $(sharedbuilddir)/include
-
-check: test
-
-installcheck:: test install
-
-distclean:: clean
- rm -f Makefile
- rm -f config.log config.status config.h config.cache
-
-realdistclean:: distclean
- rm -f configure config.h.in
diff --git a/chromium/third_party/talloc/NEWS b/chromium/third_party/talloc/NEWS
deleted file mode 100644
index e5b3aa0731c..00000000000
--- a/chromium/third_party/talloc/NEWS
+++ /dev/null
@@ -1,13 +0,0 @@
-1.0.1 26 May 2007
-
- BUGS
-
- * Set name of correctly when using talloc_append_string() (metze)
-
- LICENSE
-
- * Change license of files in lib/replace to LGPL (was GPL). (jelmer)
-
-1.0.0 30 April 2007
-
- Initial release.
diff --git a/chromium/third_party/talloc/README.chromium b/chromium/third_party/talloc/README.chromium
deleted file mode 100644
index 64bcf307e2e..00000000000
--- a/chromium/third_party/talloc/README.chromium
+++ /dev/null
@@ -1,25 +0,0 @@
-Name: talloc
-URL: http://talloc.samba.org/talloc/doc/html/index.html
-Version: 2.0.1
-License: LGPL v3
-Security Critical: yes
-
-The talloc library is only being used by a portion of the Mesa
-software renderer, in ../mesa/MesaLib, and is only linked in to the
-OSMesa shared library.
-
-This is version 2.0.1 of talloc, with the following modifications (see
-chromium.patch):
-
- - #include "replace.h" was commented out in talloc.c.
- - "bool malloced" was changed to "int malloced" in talloc.c.
- - #include string.h, and conditional #include of stdint.h, were added
- to talloc.h.
- - Uses of the "inline" keyword were made conditional and disabled on
- Windows.
- - A "min_size" inline function was used in place of the MIN macro.
- - An implementation of strnlen was provided for platforms not
- supporting it (in particular, Mac OS X).
- - A use of ssize_t was changed to size_t on Windows.
- - a call to vsnprintf() querying the required buffer size was changed to use
- ptr NULL size 0 in order to satisfy MSVC
diff --git a/chromium/third_party/talloc/aclocal.m4 b/chromium/third_party/talloc/aclocal.m4
deleted file mode 100644
index 5605e476bab..00000000000
--- a/chromium/third_party/talloc/aclocal.m4
+++ /dev/null
@@ -1 +0,0 @@
-m4_include(libreplace.m4)
diff --git a/chromium/third_party/talloc/autogen.sh b/chromium/third_party/talloc/autogen.sh
deleted file mode 100755
index bf84eeee19a..00000000000
--- a/chromium/third_party/talloc/autogen.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-
-rm -rf autom4te.cache
-rm -f configure config.h.in
-
-IPATHS="-I libreplace -I lib/replace -I ../libreplace -I ../replace"
-autoconf $IPATHS || exit 1
-autoheader $IPATHS || exit 1
-
-rm -rf autom4te.cache
-
-echo "Now run ./configure and then make."
-exit 0
-
diff --git a/chromium/third_party/talloc/build_macros.m4 b/chromium/third_party/talloc/build_macros.m4
deleted file mode 100644
index c036668cd14..00000000000
--- a/chromium/third_party/talloc/build_macros.m4
+++ /dev/null
@@ -1,14 +0,0 @@
-AC_DEFUN(BUILD_WITH_SHARED_BUILD_DIR,
- [ AC_ARG_WITH([shared-build-dir],
- [AC_HELP_STRING([--with-shared-build-dir=DIR],
- [temporary build directory where libraries are installed [$srcdir/sharedbuild]])])
-
- sharedbuilddir="$srcdir/sharedbuild"
- if test x"$with_shared_build_dir" != x; then
- sharedbuilddir=$with_shared_build_dir
- CFLAGS="$CFLAGS -I$with_shared_build_dir/include"
- LDFLAGS="$LDFLAGS -L$with_shared_build_dir/lib"
- fi
- AC_SUBST(sharedbuilddir)
- ])
-
diff --git a/chromium/third_party/talloc/chromium.patch b/chromium/third_party/talloc/chromium.patch
deleted file mode 100644
index d9354516c7c..00000000000
--- a/chromium/third_party/talloc/chromium.patch
+++ /dev/null
@@ -1,371 +0,0 @@
-diff -c -r talloc-2.0.1/talloc.c talloc/talloc.c
-*** talloc-2.0.1/talloc.c Tue Dec 15 06:16:57 2009
---- talloc/talloc.c Fri Mar 18 13:03:11 2011
-***************
-*** 30,36 ****
- inspired by http://swapped.cc/halloc/
- */
-
-! #include "replace.h"
- #include "talloc.h"
-
- #ifdef TALLOC_BUILD_VERSION_MAJOR
---- 30,37 ----
- inspired by http://swapped.cc/halloc/
- */
-
-! /* Commented out for building within Chromium */
-! /* #include "replace.h" */
- #include "talloc.h"
-
- #ifdef TALLOC_BUILD_VERSION_MAJOR
-***************
-*** 97,102 ****
---- 98,110 ----
- #endif
- #endif
-
-+ /* inline isn't supported in C files in Visual Studio 2008 on Windows */
-+ #ifdef _MSC_VER
-+ #define INLINE
-+ #else
-+ #define INLINE inline
-+ #endif
-+
- /* this null_context is only used if talloc_enable_leak_report() or
- talloc_enable_leak_report_full() is called, otherwise it remains
- NULL
-***************
-*** 224,230 ****
- }
-
- /* panic if we get a bad magic value */
-! static inline struct talloc_chunk *talloc_chunk_from_ptr(const void *ptr)
- {
- const char *pp = (const char *)ptr;
- struct talloc_chunk *tc = discard_const_p(struct talloc_chunk, pp - TC_HDR_SIZE);
---- 232,238 ----
- }
-
- /* panic if we get a bad magic value */
-! static INLINE struct talloc_chunk *talloc_chunk_from_ptr(const void *ptr)
- {
- const char *pp = (const char *)ptr;
- struct talloc_chunk *tc = discard_const_p(struct talloc_chunk, pp - TC_HDR_SIZE);
-***************
-*** 277,283 ****
- /*
- return the parent chunk of a pointer
- */
-! static inline struct talloc_chunk *talloc_parent_chunk(const void *ptr)
- {
- struct talloc_chunk *tc;
-
---- 285,291 ----
- /*
- return the parent chunk of a pointer
- */
-! static INLINE struct talloc_chunk *talloc_parent_chunk(const void *ptr)
- {
- struct talloc_chunk *tc;
-
-***************
-*** 384,390 ****
- /*
- Allocate a bit of memory as a child of an existing pointer
- */
-! static inline void *__talloc(const void *context, size_t size)
- {
- struct talloc_chunk *tc = NULL;
-
---- 392,398 ----
- /*
- Allocate a bit of memory as a child of an existing pointer
- */
-! static INLINE void *__talloc(const void *context, size_t size)
- {
- struct talloc_chunk *tc = NULL;
-
-***************
-*** 500,506 ****
- more efficient way to add a name to a pointer - the name must point to a
- true string constant
- */
-! static inline void _talloc_set_name_const(const void *ptr, const char *name)
- {
- struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr);
- tc->name = name;
---- 508,514 ----
- more efficient way to add a name to a pointer - the name must point to a
- true string constant
- */
-! static INLINE void _talloc_set_name_const(const void *ptr, const char *name)
- {
- struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr);
- tc->name = name;
-***************
-*** 509,515 ****
- /*
- internal talloc_named_const()
- */
-! static inline void *_talloc_named_const(const void *context, size_t size, const char *name)
- {
- void *ptr;
-
---- 517,523 ----
- /*
- internal talloc_named_const()
- */
-! static INLINE void *_talloc_named_const(const void *context, size_t size, const char *name)
- {
- void *ptr;
-
-***************
-*** 559,565 ****
- /*
- internal talloc_free call
- */
-! static inline int _talloc_free_internal(void *ptr, const char *location)
- {
- struct talloc_chunk *tc;
-
---- 567,573 ----
- /*
- internal talloc_free call
- */
-! static INLINE int _talloc_free_internal(void *ptr, const char *location)
- {
- struct talloc_chunk *tc;
-
-***************
-*** 797,803 ****
- talloc_reference() has done. The context and pointer arguments
- must match those given to a talloc_reference()
- */
-! static inline int talloc_unreference(const void *context, const void *ptr)
- {
- struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr);
- struct talloc_reference_handle *h;
---- 805,811 ----
- talloc_reference() has done. The context and pointer arguments
- must match those given to a talloc_reference()
- */
-! static INLINE int talloc_unreference(const void *context, const void *ptr)
- {
- struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr);
- struct talloc_reference_handle *h;
-***************
-*** 877,885 ****
- /*
- add a name to an existing pointer - va_list version
- */
-! static inline const char *talloc_set_name_v(const void *ptr, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(2,0);
-
-! static inline const char *talloc_set_name_v(const void *ptr, const char *fmt, va_list ap)
- {
- struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr);
- tc->name = talloc_vasprintf(ptr, fmt, ap);
---- 885,893 ----
- /*
- add a name to an existing pointer - va_list version
- */
-! static INLINE const char *talloc_set_name_v(const void *ptr, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(2,0);
-
-! static INLINE const char *talloc_set_name_v(const void *ptr, const char *fmt, va_list ap)
- {
- struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr);
- tc->name = talloc_vasprintf(ptr, fmt, ap);
-***************
-*** 1134,1139 ****
---- 1142,1151 ----
- }
-
-
-+ static INLINE size_t min_size(size_t a, size_t b)
-+ {
-+ return a > b ? b : a;
-+ }
-
- /*
- A talloc version of realloc. The context argument is only used if
-***************
-*** 1143,1149 ****
- {
- struct talloc_chunk *tc;
- void *new_ptr;
-! bool malloced = false;
-
- /* size zero is equivalent to free() */
- if (unlikely(size == 0)) {
---- 1155,1161 ----
- {
- struct talloc_chunk *tc;
- void *new_ptr;
-! int malloced = 0;
-
- /* size zero is equivalent to free() */
- if (unlikely(size == 0)) {
-***************
-*** 1196,1206 ****
-
- if (new_ptr == NULL) {
- new_ptr = malloc(TC_HDR_SIZE+size);
-! malloced = true;
- }
-
- if (new_ptr) {
-! memcpy(new_ptr, tc, MIN(tc->size,size) + TC_HDR_SIZE);
- }
- }
- else {
---- 1208,1218 ----
-
- if (new_ptr == NULL) {
- new_ptr = malloc(TC_HDR_SIZE+size);
-! malloced = 1;
- }
-
- if (new_ptr) {
-! memcpy(new_ptr, tc, min_size(tc->size,size) + TC_HDR_SIZE);
- }
- }
- else {
-***************
-*** 1558,1564 ****
- return newp;
- }
-
-! static inline char *__talloc_strlendup(const void *t, const char *p, size_t len)
- {
- char *ret;
-
---- 1570,1576 ----
- return newp;
- }
-
-! static INLINE char *__talloc_strlendup(const void *t, const char *p, size_t len)
- {
- char *ret;
-
-***************
-*** 1581,1586 ****
---- 1593,1609 ----
- return __talloc_strlendup(t, p, strlen(p));
- }
-
-+ #ifndef HAVE_STRNLEN
-+ #define strnlen rep_strnlen
-+ static size_t rep_strnlen(const char* s, size_t n)
-+ {
-+ if (unlikely(!s)) return 0;
-+ int i = 0;
-+ while (i < n && *s++ != '\0')
-+ ++i;
-+ return i;
-+ }
-+ #endif
-+
- /*
- strndup with a talloc
- */
-***************
-*** 1590,1596 ****
- return __talloc_strlendup(t, p, strnlen(p, n));
- }
-
-! static inline char *__talloc_strlendup_append(char *s, size_t slen,
- const char *a, size_t alen)
- {
- char *ret;
---- 1613,1619 ----
- return __talloc_strlendup(t, p, strnlen(p, n));
- }
-
-! static INLINE char *__talloc_strlendup_append(char *s, size_t slen,
- const char *a, size_t alen)
- {
- char *ret;
-***************
-*** 1699,1709 ****
- int len;
- char *ret;
- va_list ap2;
-- char c;
-
-- /* this call looks strange, but it makes it work on older solaris boxes */
- va_copy(ap2, ap);
-! len = vsnprintf(&c, 1, fmt, ap2);
- va_end(ap2);
- if (unlikely(len < 0)) {
- return NULL;
---- 1722,1730 ----
- int len;
- char *ret;
- va_list ap2;
-
- va_copy(ap2, ap);
-! len = vsnprintf(NULL, 0, fmt, ap2);
- va_end(ap2);
- if (unlikely(len < 0)) {
- return NULL;
-***************
-*** 1736,1754 ****
- return ret;
- }
-
-! static inline char *__talloc_vaslenprintf_append(char *s, size_t slen,
- const char *fmt, va_list ap)
- PRINTF_ATTRIBUTE(3,0);
-
-! static inline char *__talloc_vaslenprintf_append(char *s, size_t slen,
- const char *fmt, va_list ap)
- {
- ssize_t alen;
- va_list ap2;
-- char c;
-
- va_copy(ap2, ap);
-! alen = vsnprintf(&c, 1, fmt, ap2);
- va_end(ap2);
-
- if (alen <= 0) {
---- 1757,1779 ----
- return ret;
- }
-
-! static INLINE char *__talloc_vaslenprintf_append(char *s, size_t slen,
- const char *fmt, va_list ap)
- PRINTF_ATTRIBUTE(3,0);
-
-! static INLINE char *__talloc_vaslenprintf_append(char *s, size_t slen,
- const char *fmt, va_list ap)
- {
-+ /* ssize_t isn't present on Windows. */
-+ #ifndef _MSC_VER
- ssize_t alen;
-+ #else
-+ size_t alen;
-+ #endif
- va_list ap2;
-
- va_copy(ap2, ap);
-! alen = vsnprintf(NULL, 0, fmt, ap2);
- va_end(ap2);
-
- if (alen <= 0) {
-diff -c -r talloc-2.0.1/talloc.h talloc/talloc.h
-*** talloc-2.0.1/talloc.h Wed Oct 28 16:14:20 2009
---- talloc/talloc.h Fri Mar 18 13:03:02 2011
-***************
-*** 28,33 ****
---- 28,37 ----
- #include <stdlib.h>
- #include <stdio.h>
- #include <stdarg.h>
-+ #ifndef _MSC_VER
-+ #include <stdint.h>
-+ #endif
-+ #include <string.h>
-
- #define TALLOC_VERSION_MAJOR 2
- #define TALLOC_VERSION_MINOR 0
diff --git a/chromium/third_party/talloc/compat/talloc_compat1.c b/chromium/third_party/talloc/compat/talloc_compat1.c
deleted file mode 100644
index 519e8c3a833..00000000000
--- a/chromium/third_party/talloc/compat/talloc_compat1.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- Samba trivial allocation library - compat functions
-
- Copyright (C) Stefan Metzmacher 2009
-
- ** NOTE! The following LGPL license applies to the talloc
- ** library. This does NOT imply that all of Samba is released
- ** under the LGPL
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, see <http://www.gnu.org/licenses/>.
-*/
-
-/*
- * This file contains only function to build a
- * compat talloc.so.1 library on top of talloc.so.2
- */
-
-#include "replace.h"
-#include "talloc.h"
-
-void *_talloc_reference(const void *context, const void *ptr);
-void *_talloc_reference(const void *context, const void *ptr) {
- return _talloc_reference_loc(context, ptr,
- "Called from talloc compat1 "
- "_talloc_reference");
-}
-
-void *_talloc_steal(const void *new_ctx, const void *ptr);
-void *_talloc_steal(const void *new_ctx, const void *ptr)
-{
- return talloc_reparent(talloc_parent(ptr), new_ctx, ptr);
-}
-
-#undef talloc_free
-int talloc_free(void *ptr);
-int talloc_free(void *ptr)
-{
- return talloc_unlink(talloc_parent(ptr), ptr);
-}
-
diff --git a/chromium/third_party/talloc/compat/talloc_compat1.m4 b/chromium/third_party/talloc/compat/talloc_compat1.m4
deleted file mode 100644
index 2ec530e0799..00000000000
--- a/chromium/third_party/talloc/compat/talloc_compat1.m4
+++ /dev/null
@@ -1,14 +0,0 @@
-TALLOC_COMPAT1_MK=""
-AC_SUBST(TALLOC_COMPAT1_MK)
-
-AC_ARG_ENABLE(talloc-compat1,
- [AS_HELP_STRING([--enable-talloc-compat1],
- [Build talloc 1.x.x compat library [default=no]])],
- [ enable_talloc_compat1=$enableval ],
- [ enable_talloc_compat1=no ]
-)
-
-if test "x$enable_talloc_compat1" = x"yes"; then
- TALLOC_COMPAT1_MK='include $(tallocdir)/compat/talloc_compat1.mk'
-fi
-
diff --git a/chromium/third_party/talloc/config.guess b/chromium/third_party/talloc/config.guess
deleted file mode 100755
index da833146088..00000000000
--- a/chromium/third_party/talloc/config.guess
+++ /dev/null
@@ -1,1561 +0,0 @@
-#! /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
-# Free Software Foundation, Inc.
-
-timestamp='2009-04-27'
-
-# 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.
-#
-# 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 <per@bothner.com>.
-# Please send patches to <config-patches@gnu.org>. Submit a context
-# diff and a properly formatted ChangeLog entry.
-#
-# 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.
-#
-# The plan is that this can be called by configure scripts if you
-# don't specify an explicit build system type.
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION]
-
-Output the configuration name of the system \`$me' is run on.
-
-Operation modes:
- -h, --help print this help, then exit
- -t, --time-stamp print date of last modification, then exit
- -v, --version print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-version="\
-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.
-
-This is free software; see the source for copying conditions. There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
- case $1 in
- --time-stamp | --time* | -t )
- echo "$timestamp" ; exit ;;
- --version | -v )
- echo "$version" ; exit ;;
- --help | --h* | -h )
- echo "$usage"; exit ;;
- -- ) # Stop option processing
- shift; break ;;
- - ) # Use stdin as input.
- break ;;
- -* )
- echo "$me: invalid option $1$help" >&2
- exit 1 ;;
- * )
- break ;;
- esac
-done
-
-if test $# != 0; then
- echo "$me: too many arguments$help" >&2
- exit 1
-fi
-
-trap 'exit 1' 1 2 15
-
-# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
-# compiler to aid in system detection is discouraged as it requires
-# temporary files to be created and, as you can see below, it is a
-# headache to deal with in a portable fashion.
-
-# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
-# use `HOST_CC' if defined, but it is deprecated.
-
-# Portable tmp directory creation inspired by the Autoconf team.
-
-set_cc_for_build='
-trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
-trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
-: ${TMPDIR=/tmp} ;
- { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
- { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
- { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
- { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
-dummy=$tmp/dummy ;
-tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
-case $CC_FOR_BUILD,$HOST_CC,$CC in
- ,,) echo "int x;" > $dummy.c ;
- for c in cc gcc c89 c99 ; do
- if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
- CC_FOR_BUILD="$c"; break ;
- fi ;
- done ;
- if test x"$CC_FOR_BUILD" = x ; then
- CC_FOR_BUILD=no_compiler_found ;
- fi
- ;;
- ,,*) CC_FOR_BUILD=$CC ;;
- ,*,*) CC_FOR_BUILD=$HOST_CC ;;
-esac ; set_cc_for_build= ;'
-
-# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
-# (ghazi@noc.rutgers.edu 1994-08-24)
-if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
- PATH=$PATH:/.attbin ; export PATH
-fi
-
-UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
-UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
-UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
-UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
-
-# Note: order is significant - the case branches are not exclusive.
-
-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*,
- # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
- # switched to ELF, *-*-netbsd* would select the old
- # object file format. This provides both forward
- # compatibility and a consistent mechanism for selecting the
- # object file format.
- #
- # Note: NetBSD doesn't particularly care about the vendor
- # portion of the name. We always set it to "unknown".
- sysctl="sysctl -n hw.machine_arch"
- UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
- /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
- case "${UNAME_MACHINE_ARCH}" in
- armeb) machine=armeb-unknown ;;
- arm*) machine=arm-unknown ;;
- sh3el) machine=shl-unknown ;;
- sh3eb) machine=sh-unknown ;;
- sh5el) machine=sh5le-unknown ;;
- *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
- esac
- # The Operating System including object format, if it has switched
- # to ELF recently, or will in the future.
- case "${UNAME_MACHINE_ARCH}" in
- arm*|i386|m68k|ns32k|sh3*|sparc|vax)
- eval $set_cc_for_build
- if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
- | grep __ELF__ >/dev/null
- then
- # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
- # Return netbsd for either. FIX?
- os=netbsd
- else
- os=netbsdelf
- fi
- ;;
- *)
- os=netbsd
- ;;
- esac
- # The OS release
- # Debian GNU/NetBSD machines have a different userland, and
- # thus, need a distinct triplet. However, they do not need
- # kernel version information, so it can be replaced with a
- # suitable tag, in the style of linux-gnu.
- case "${UNAME_VERSION}" in
- Debian*)
- release='-gnu'
- ;;
- *)
- release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
- ;;
- esac
- # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
- # contains redundant information, the shorter form:
- # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
- echo "${machine}-${os}${release}"
- exit ;;
- *:OpenBSD:*:*)
- UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
- echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
- exit ;;
- *:ekkoBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
- exit ;;
- *:SolidBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
- exit ;;
- macppc:MirBSD:*:*)
- echo powerpc-unknown-mirbsd${UNAME_RELEASE}
- exit ;;
- *:MirBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
- exit ;;
- alpha:OSF1:*:*)
- case $UNAME_RELEASE in
- *4.0)
- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
- ;;
- *5.*)
- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
- ;;
- esac
- # According to Compaq, /usr/sbin/psrinfo has been available on
- # OSF/1 and Tru64 systems produced since 1995. I hope that
- # covers most systems running today. This code pipes the CPU
- # types through head -n 1, so we only detect the type of CPU 0.
- ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
- case "$ALPHA_CPU_TYPE" in
- "EV4 (21064)")
- UNAME_MACHINE="alpha" ;;
- "EV4.5 (21064)")
- UNAME_MACHINE="alpha" ;;
- "LCA4 (21066/21068)")
- UNAME_MACHINE="alpha" ;;
- "EV5 (21164)")
- UNAME_MACHINE="alphaev5" ;;
- "EV5.6 (21164A)")
- UNAME_MACHINE="alphaev56" ;;
- "EV5.6 (21164PC)")
- UNAME_MACHINE="alphapca56" ;;
- "EV5.7 (21164PC)")
- UNAME_MACHINE="alphapca57" ;;
- "EV6 (21264)")
- UNAME_MACHINE="alphaev6" ;;
- "EV6.7 (21264A)")
- UNAME_MACHINE="alphaev67" ;;
- "EV6.8CB (21264C)")
- UNAME_MACHINE="alphaev68" ;;
- "EV6.8AL (21264B)")
- UNAME_MACHINE="alphaev68" ;;
- "EV6.8CX (21264D)")
- UNAME_MACHINE="alphaev68" ;;
- "EV6.9A (21264/EV69A)")
- UNAME_MACHINE="alphaev69" ;;
- "EV7 (21364)")
- UNAME_MACHINE="alphaev7" ;;
- "EV7.9 (21364A)")
- UNAME_MACHINE="alphaev79" ;;
- esac
- # A Pn.n version is a patched version.
- # A Vn.n version is a released version.
- # A Tn.n version is a released field test version.
- # 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 ;;
- 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
- # of the specific Alpha model?
- echo alpha-pc-interix
- exit ;;
- 21064:Windows_NT:50:3)
- echo alpha-dec-winnt3.5
- exit ;;
- Amiga*:UNIX_System_V:4.0:*)
- echo m68k-unknown-sysv4
- exit ;;
- *:[Aa]miga[Oo][Ss]:*:*)
- echo ${UNAME_MACHINE}-unknown-amigaos
- exit ;;
- *:[Mm]orph[Oo][Ss]:*:*)
- echo ${UNAME_MACHINE}-unknown-morphos
- exit ;;
- *:OS/390:*:*)
- echo i370-ibm-openedition
- exit ;;
- *:z/VM:*:*)
- echo s390-ibm-zvmoe
- exit ;;
- *: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:*:*)
- echo arm-unknown-riscos
- exit ;;
- SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
- echo hppa1.1-hitachi-hiuxmpp
- exit ;;
- Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
- # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
- if test "`(/bin/universe) 2>/dev/null`" = att ; then
- echo pyramid-pyramid-sysv3
- else
- echo pyramid-pyramid-bsd
- fi
- exit ;;
- NILE*:*:*:dcosx)
- echo pyramid-pyramid-svr4
- exit ;;
- DRS?6000:unix:4.0:6*)
- echo sparc-icl-nx6
- exit ;;
- DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
- case `/usr/bin/uname -p` in
- sparc) echo sparc-icl-nx7; exit ;;
- esac ;;
- s390x:SunOS:*:*)
- echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4H:SunOS:5.*:*)
- echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
- echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
- eval $set_cc_for_build
- SUN_ARCH="i386"
- # If there is a compiler, see if it is configured for 64-bit objects.
- # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
- # This test works for both compilers.
- if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
- if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
- (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
- grep IS_64BIT_ARCH >/dev/null
- then
- SUN_ARCH="x86_64"
- fi
- fi
- echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4*:SunOS:6*:*)
- # According to config.sub, this is the proper way to canonicalize
- # SunOS6. Hard to guess exactly what SunOS6 will be like, but
- # it's likely to be more like Solaris than SunOS4.
- echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4*:SunOS:*:*)
- case "`/usr/bin/arch -k`" in
- Series*|S4*)
- UNAME_RELEASE=`uname -v`
- ;;
- esac
- # Japanese Language versions have a version number like `4.1.3-JL'.
- echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
- exit ;;
- sun3*:SunOS:*:*)
- echo m68k-sun-sunos${UNAME_RELEASE}
- exit ;;
- sun*:*:4.2BSD:*)
- UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
- test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
- case "`/bin/arch`" in
- sun3)
- echo m68k-sun-sunos${UNAME_RELEASE}
- ;;
- sun4)
- echo sparc-sun-sunos${UNAME_RELEASE}
- ;;
- esac
- exit ;;
- aushp:SunOS:*:*)
- echo sparc-auspex-sunos${UNAME_RELEASE}
- exit ;;
- # The situation for MiNT is a little confusing. The machine name
- # can be virtually everything (everything which is not
- # "atarist" or "atariste" at least should have a processor
- # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
- # to the lowercase version "mint" (or "freemint"). Finally
- # the system name "TOS" denotes a system which is actually not
- # 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}
- exit ;;
- atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
- *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
- milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
- echo m68k-milan-mint${UNAME_RELEASE}
- exit ;;
- hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
- echo m68k-hades-mint${UNAME_RELEASE}
- exit ;;
- *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
- echo m68k-unknown-mint${UNAME_RELEASE}
- exit ;;
- m68k:machten:*:*)
- echo m68k-apple-machten${UNAME_RELEASE}
- exit ;;
- powerpc:machten:*:*)
- echo powerpc-apple-machten${UNAME_RELEASE}
- exit ;;
- RISC*:Mach:*:*)
- echo mips-dec-mach_bsd4.3
- exit ;;
- RISC*:ULTRIX:*:*)
- echo mips-dec-ultrix${UNAME_RELEASE}
- exit ;;
- VAX*:ULTRIX*:*:*)
- echo vax-dec-ultrix${UNAME_RELEASE}
- exit ;;
- 2020:CLIX:*:* | 2430:CLIX:*:*)
- echo clipper-intergraph-clix${UNAME_RELEASE}
- exit ;;
- mips:*:*:UMIPS | mips:*:*:RISCos)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
-#ifdef __cplusplus
-#include <stdio.h> /* for printf() prototype */
- int main (int argc, char *argv[]) {
-#else
- int main (argc, argv) int argc; char *argv[]; {
-#endif
- #if defined (host_mips) && defined (MIPSEB)
- #if defined (SYSTYPE_SYSV)
- printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
- #endif
- #if defined (SYSTYPE_SVR4)
- printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
- #endif
- #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
- printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
- #endif
- #endif
- exit (-1);
- }
-EOF
- $CC_FOR_BUILD -o $dummy $dummy.c &&
- dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
- SYSTEM_NAME=`$dummy $dummyarg` &&
- { echo "$SYSTEM_NAME"; exit; }
- echo mips-mips-riscos${UNAME_RELEASE}
- exit ;;
- Motorola:PowerMAX_OS:*:*)
- echo powerpc-motorola-powermax
- exit ;;
- Motorola:*:4.3:PL8-*)
- echo powerpc-harris-powermax
- exit ;;
- Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
- echo powerpc-harris-powermax
- exit ;;
- Night_Hawk:Power_UNIX:*:*)
- echo powerpc-harris-powerunix
- exit ;;
- m88k:CX/UX:7*:*)
- echo m88k-harris-cxux7
- exit ;;
- m88k:*:4*:R4*)
- echo m88k-motorola-sysv4
- exit ;;
- m88k:*:3*:R3*)
- echo m88k-motorola-sysv3
- exit ;;
- AViiON:dgux:*:*)
- # 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 ] || \
- [ ${TARGET_BINARY_INTERFACE}x = x ]
- then
- echo m88k-dg-dgux${UNAME_RELEASE}
- else
- echo m88k-dg-dguxbcs${UNAME_RELEASE}
- fi
- else
- echo i586-dg-dgux${UNAME_RELEASE}
- fi
- exit ;;
- M88*:DolphinOS:*:*) # DolphinOS (SVR3)
- echo m88k-dolphin-sysv3
- exit ;;
- M88*:*:R3*:*)
- # Delta 88k system running SVR3
- echo m88k-motorola-sysv3
- exit ;;
- XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
- echo m88k-tektronix-sysv3
- exit ;;
- Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
- echo m68k-tektronix-bsd
- exit ;;
- *:IRIX*:*:*)
- echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
- exit ;;
- ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
- echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
- exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
- i*86:AIX:*:*)
- echo i386-ibm-aix
- exit ;;
- ia64:AIX:*:*)
- if [ -x /usr/bin/oslevel ] ; then
- IBM_REV=`/usr/bin/oslevel`
- else
- IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
- fi
- echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
- exit ;;
- *:AIX:2:3)
- if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <sys/systemcfg.h>
-
- main()
- {
- if (!__power_pc())
- exit(1);
- puts("powerpc-ibm-aix3.2.5");
- exit(0);
- }
-EOF
- if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
- then
- echo "$SYSTEM_NAME"
- else
- echo rs6000-ibm-aix3.2.5
- fi
- elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
- echo rs6000-ibm-aix3.2.4
- else
- echo rs6000-ibm-aix3.2
- fi
- exit ;;
- *:AIX:*:[456])
- 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
- else
- IBM_ARCH=powerpc
- fi
- if [ -x /usr/bin/oslevel ] ; then
- IBM_REV=`/usr/bin/oslevel`
- else
- IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
- fi
- echo ${IBM_ARCH}-ibm-aix${IBM_REV}
- exit ;;
- *:AIX:*:*)
- echo rs6000-ibm-aix
- exit ;;
- ibmrt:4.4BSD:*|romp-ibm:BSD:*)
- echo romp-ibm-bsd4.4
- exit ;;
- ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
- echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
- exit ;; # report: romp-ibm BSD 4.3
- *:BOSX:*:*)
- echo rs6000-bull-bosx
- exit ;;
- DPX/2?00:B.O.S.:*:*)
- echo m68k-bull-sysv3
- exit ;;
- 9000/[34]??:4.3bsd:1.*:*)
- echo m68k-hp-bsd
- exit ;;
- hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
- echo m68k-hp-bsd4.4
- exit ;;
- 9000/[34678]??:HP-UX:*:*)
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
- case "${UNAME_MACHINE}" in
- 9000/31? ) HP_ARCH=m68000 ;;
- 9000/[34]?? ) HP_ARCH=m68k ;;
- 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" ;;
- '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
- esac ;;
- esac
- fi
- if [ "${HP_ARCH}" = "" ]; then
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
-
- #define _HPUX_SOURCE
- #include <stdlib.h>
- #include <unistd.h>
-
- 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);
- }
-EOF
- (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
- test -z "$HP_ARCH" && HP_ARCH=hppa
- fi ;;
- esac
- if [ ${HP_ARCH} = "hppa2.0w" ]
- then
- eval $set_cc_for_build
-
- # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
- # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
- # generating 64-bit code. GNU and HP use different nomenclature:
- #
- # $ CC_FOR_BUILD=cc ./config.guess
- # => hppa2.0w-hp-hpux11.23
- # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
- # => hppa64-hp-hpux11.23
-
- if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
- grep __LP64__ >/dev/null
- then
- HP_ARCH="hppa2.0w"
- else
- HP_ARCH="hppa64"
- fi
- fi
- echo ${HP_ARCH}-hp-hpux${HPUX_REV}
- exit ;;
- ia64:HP-UX:*:*)
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
- echo ia64-hp-hpux${HPUX_REV}
- exit ;;
- 3050*:HI-UX:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <unistd.h>
- int
- main ()
- {
- long cpu = sysconf (_SC_CPU_VERSION);
- /* The order matters, because CPU_IS_HP_MC68K erroneously returns
- true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
- results, however. */
- if (CPU_IS_PA_RISC (cpu))
- {
- switch (cpu)
- {
- case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
- case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
- case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
- default: puts ("hppa-hitachi-hiuxwe2"); break;
- }
- }
- else if (CPU_IS_HP_MC68K (cpu))
- puts ("m68k-hitachi-hiuxwe2");
- else puts ("unknown-hitachi-hiuxwe2");
- exit (0);
- }
-EOF
- $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
- { echo "$SYSTEM_NAME"; exit; }
- echo unknown-hitachi-hiuxwe2
- exit ;;
- 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
- echo hppa1.1-hp-bsd
- exit ;;
- 9000/8??:4.3bsd:*:*)
- echo hppa1.0-hp-bsd
- exit ;;
- *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
- echo hppa1.0-hp-mpeix
- exit ;;
- hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
- echo hppa1.1-hp-osf
- exit ;;
- hp8??:OSF1:*:*)
- echo hppa1.0-hp-osf
- exit ;;
- i*86:OSF1:*:*)
- if [ -x /usr/sbin/sysversion ] ; then
- echo ${UNAME_MACHINE}-unknown-osf1mk
- else
- echo ${UNAME_MACHINE}-unknown-osf1
- fi
- exit ;;
- parisc*:Lites*:*:*)
- echo hppa1.1-hp-lites
- exit ;;
- C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
- echo c1-convex-bsd
- exit ;;
- C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
- if getsysinfo -f scalar_acc
- then echo c32-convex-bsd
- else echo c2-convex-bsd
- fi
- exit ;;
- C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
- echo c34-convex-bsd
- exit ;;
- C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
- echo c38-convex-bsd
- exit ;;
- C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
- echo c4-convex-bsd
- exit ;;
- CRAY*Y-MP:*:*:*)
- echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*[A-Z]90:*:*:*)
- echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
- | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
- -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
- -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*TS:*:*:*)
- echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*T3E:*:*:*)
- echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*SV1:*:*:*)
- echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- *:UNICOS/mp:*:*)
- echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- 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 ;;
- 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}"
- exit ;;
- i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
- echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
- exit ;;
- sparc*:BSD/OS:*:*)
- echo sparc-unknown-bsdi${UNAME_RELEASE}
- exit ;;
- *:BSD/OS:*:*)
- echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
- exit ;;
- *:FreeBSD:*:*)
- case ${UNAME_MACHINE} in
- pc98)
- echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
- amd64)
- echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
- *)
- echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
- esac
- exit ;;
- i*:CYGWIN*:*)
- echo ${UNAME_MACHINE}-pc-cygwin
- exit ;;
- *:MINGW*:*)
- echo ${UNAME_MACHINE}-pc-mingw32
- exit ;;
- i*:windows32*:*)
- # uname -m includes "-pc" on this system.
- echo ${UNAME_MACHINE}-mingw32
- exit ;;
- i*:PW*:*)
- echo ${UNAME_MACHINE}-pc-pw32
- exit ;;
- *:Interix*:[3456]*)
- case ${UNAME_MACHINE} in
- x86)
- echo i586-pc-interix${UNAME_RELEASE}
- exit ;;
- EM64T | authenticamd | genuineintel)
- echo x86_64-unknown-interix${UNAME_RELEASE}
- exit ;;
- IA64)
- echo ia64-unknown-interix${UNAME_RELEASE}
- exit ;;
- esac ;;
- [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
- echo i${UNAME_MACHINE}-pc-mks
- exit ;;
- i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
- # How do we know it's Interix rather than the generic POSIX subsystem?
- # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
- # UNAME_MACHINE based on the output of uname instead of i386?
- echo i586-pc-interix
- exit ;;
- i*:UWIN*:*)
- echo ${UNAME_MACHINE}-pc-uwin
- exit ;;
- amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
- echo x86_64-unknown-cygwin
- exit ;;
- p*:CYGWIN*:*)
- echo powerpcle-unknown-cygwin
- exit ;;
- prep*:SunOS:5.*:*)
- echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- *:GNU:*:*)
- # the GNU system
- echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
- exit ;;
- *:GNU/*:*:*)
- # other systems with GNU libc and userland
- echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
- exit ;;
- i*86:Minix:*:*)
- echo ${UNAME_MACHINE}-pc-minix
- exit ;;
- arm*:Linux:*:*)
- eval $set_cc_for_build
- if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
- | grep -q __ARM_EABI__
- then
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- else
- echo ${UNAME_MACHINE}-unknown-linux-gnueabi
- fi
- exit ;;
- avr32*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- cris:Linux:*:*)
- echo cris-axis-linux-gnu
- exit ;;
- crisv32:Linux:*:*)
- echo crisv32-axis-linux-gnu
- exit ;;
- frv:Linux:*:*)
- echo frv-unknown-linux-gnu
- exit ;;
- ia64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- m32r*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- m68*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- mips:Linux:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #undef CPU
- #undef mips
- #undef mipsel
- #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
- CPU=mipsel
- #else
- #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
- CPU=mips
- #else
- CPU=
- #endif
- #endif
-EOF
- eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
- /^CPU/{
- s: ::g
- p
- }'`"
- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
- ;;
- mips64:Linux:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #undef CPU
- #undef mips64
- #undef mips64el
- #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
- CPU=mips64el
- #else
- #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
- CPU=mips64
- #else
- CPU=
- #endif
- #endif
-EOF
- eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
- /^CPU/{
- s: ::g
- p
- }'`"
- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
- ;;
- or32:Linux:*:*)
- echo or32-unknown-linux-gnu
- exit ;;
- ppc:Linux:*:*)
- echo powerpc-unknown-linux-gnu
- exit ;;
- ppc64:Linux:*:*)
- echo powerpc64-unknown-linux-gnu
- exit ;;
- alpha:Linux:*:*)
- case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
- EV5) UNAME_MACHINE=alphaev5 ;;
- EV56) UNAME_MACHINE=alphaev56 ;;
- PCA56) UNAME_MACHINE=alphapca56 ;;
- PCA57) UNAME_MACHINE=alphapca56 ;;
- EV6) UNAME_MACHINE=alphaev6 ;;
- EV67) UNAME_MACHINE=alphaev67 ;;
- EV68*) UNAME_MACHINE=alphaev68 ;;
- esac
- objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
- if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
- echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
- exit ;;
- padre:Linux:*:*)
- echo sparc-unknown-linux-gnu
- exit ;;
- parisc:Linux:*:* | hppa:Linux:*:*)
- # Look for CPU level
- case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
- PA7*) echo hppa1.1-unknown-linux-gnu ;;
- PA8*) echo hppa2.0-unknown-linux-gnu ;;
- *) echo hppa-unknown-linux-gnu ;;
- esac
- exit ;;
- parisc64:Linux:*:* | hppa64:Linux:*:*)
- echo hppa64-unknown-linux-gnu
- exit ;;
- s390:Linux:*:* | s390x:Linux:*:*)
- echo ${UNAME_MACHINE}-ibm-linux
- exit ;;
- sh64*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- sh*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- sparc:Linux:*:* | sparc64: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
- exit ;;
- xtensa*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- i*86:Linux:*:*)
- # The BFD linker knows what the default object file format is, so
- # first see if it will tell us. cd to the root directory to prevent
- # problems with other programs or directories called `ld' in the path.
- # Set LC_ALL=C to ensure ld outputs messages in English.
- ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
- | sed -ne '/supported targets:/!d
- s/[ ][ ]*/ /g
- s/.*supported targets: *//
- s/ .*//
- p'`
- case "$ld_supported_targets" in
- elf32-i386)
- TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
- ;;
- a.out-i386-linux)
- echo "${UNAME_MACHINE}-pc-linux-gnuaout"
- exit ;;
- "")
- # Either a pre-BFD a.out linker (linux-gnuoldld) or
- # one that does not give us useful --help.
- echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
- exit ;;
- esac
- # Determine whether the default compiler is a.out or elf
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <features.h>
- #ifdef __ELF__
- # ifdef __GLIBC__
- # if __GLIBC__ >= 2
- LIBC=gnu
- # else
- LIBC=gnulibc1
- # endif
- # else
- LIBC=gnulibc1
- # endif
- #else
- #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
- LIBC=gnu
- #else
- LIBC=gnuaout
- #endif
- #endif
- #ifdef __dietlibc__
- LIBC=dietlibc
- #endif
-EOF
- eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
- /^LIBC/{
- s: ::g
- p
- }'`"
- test x"${LIBC}" != x && {
- echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
- exit
- }
- test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
- ;;
- i*86:DYNIX/ptx:4*:*)
- # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
- # earlier versions are messed up and put the nodename in both
- # sysname and nodename.
- 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,
- # I just have to hope. -- rms.
- # Use sysv4.2uw... so that sysv4* matches it.
- echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
- exit ;;
- i*86:OS/2:*:*)
- # If we were able to find `uname', then EMX Unix compatibility
- # is probably installed.
- echo ${UNAME_MACHINE}-pc-os2-emx
- exit ;;
- i*86:XTS-300:*:STOP)
- echo ${UNAME_MACHINE}-unknown-stop
- exit ;;
- i*86:atheos:*:*)
- echo ${UNAME_MACHINE}-unknown-atheos
- exit ;;
- i*86:syllable:*:*)
- echo ${UNAME_MACHINE}-pc-syllable
- exit ;;
- i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
- echo i386-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- i*86:*DOS:*:*)
- echo ${UNAME_MACHINE}-pc-msdosdjgpp
- exit ;;
- i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
- UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
- if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
- echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
- else
- echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
- fi
- exit ;;
- i*86:*:5:[678]*)
- # UnixWare 7.x, OpenUNIX and OpenServer 6.
- case `/bin/uname -X | grep "^Machine"` in
- *486*) UNAME_MACHINE=i486 ;;
- *Pentium) UNAME_MACHINE=i586 ;;
- *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
- esac
- echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
- exit ;;
- i*86:*:3.2:*)
- if test -f /usr/options/cb.name; then
- UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
- echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
- elif /bin/uname -X 2>/dev/null >/dev/null ; then
- UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
- (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
- (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
- && UNAME_MACHINE=i586
- (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
- && UNAME_MACHINE=i686
- (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
- && UNAME_MACHINE=i686
- echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
- else
- echo ${UNAME_MACHINE}-pc-sysv32
- fi
- 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.
- # 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 ;;
- Intel:Mach:3*:*)
- echo i386-pc-mach3
- exit ;;
- paragon:*:*:*)
- echo i860-intel-osf1
- exit ;;
- i860:*:4.*:*) # i860-SVR4
- if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
- echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
- else # Add other i860-SVR4 vendors below as they are discovered.
- echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
- fi
- exit ;;
- mini*:CTIX:SYS*5:*)
- # "miniframe"
- echo m68010-convergent-sysv
- exit ;;
- mc68k:UNIX:SYSTEM5:3.51m)
- echo m68k-convergent-sysv
- exit ;;
- M680?0:D-NIX:5.3:*)
- echo m68k-diab-dnix
- exit ;;
- M68*:*:R3V[5678]*:*)
- test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
- 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
- OS_REL=''
- test -r /etc/.relid \
- && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
- /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; } ;;
- NCR*:*:4.2:* | MPRAS*:*:4.2:*)
- OS_REL='.3'
- test -r /etc/.relid \
- && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
- /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
- /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
- m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
- echo m68k-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- mc68030:UNIX_System_V:4.*:*)
- echo m68k-atari-sysv4
- exit ;;
- TSUNAMI:LynxOS:2.*:*)
- echo sparc-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- rs6000:LynxOS:2.*:*)
- echo rs6000-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
- echo powerpc-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- SM[BE]S:UNIX_SV:*:*)
- echo mips-dde-sysv${UNAME_RELEASE}
- exit ;;
- RM*:ReliantUNIX-*:*:*)
- echo mips-sni-sysv4
- exit ;;
- RM*:SINIX-*:*:*)
- echo mips-sni-sysv4
- exit ;;
- *:SINIX-*:*:*)
- if uname -p 2>/dev/null >/dev/null ; then
- UNAME_MACHINE=`(uname -p) 2>/dev/null`
- echo ${UNAME_MACHINE}-sni-sysv4
- else
- echo ns32k-sni-sysv
- fi
- exit ;;
- PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
- # says <Richard.M.Bartel@ccMail.Census.GOV>
- echo i586-unisys-sysv4
- exit ;;
- *:UNIX_System_V:4*:FTX*)
- # From Gerald Hewes <hewes@openmarket.com>.
- # How about differentiating between stratus architectures? -djm
- echo hppa1.1-stratus-sysv4
- exit ;;
- *:*:*:FTX*)
- # From seanf@swdc.stratus.com.
- echo i860-stratus-sysv4
- exit ;;
- i*86:VOS:*:*)
- # From Paul.Green@stratus.com.
- echo ${UNAME_MACHINE}-stratus-vos
- exit ;;
- *:VOS:*:*)
- # From Paul.Green@stratus.com.
- echo hppa1.1-stratus-vos
- exit ;;
- mc68*:A/UX:*:*)
- echo m68k-apple-aux${UNAME_RELEASE}
- exit ;;
- news*:NEWS-OS:6*:*)
- echo mips-sony-newsos6
- exit ;;
- R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
- if [ -d /usr/nec ]; then
- echo mips-nec-sysv${UNAME_RELEASE}
- else
- echo mips-unknown-sysv${UNAME_RELEASE}
- fi
- exit ;;
- BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
- echo powerpc-be-beos
- exit ;;
- BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
- echo powerpc-apple-beos
- exit ;;
- BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
- echo i586-pc-beos
- exit ;;
- BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
- echo i586-pc-haiku
- exit ;;
- SX-4:SUPER-UX:*:*)
- echo sx4-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-5:SUPER-UX:*:*)
- echo sx5-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-6:SUPER-UX:*:*)
- echo sx6-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-7:SUPER-UX:*:*)
- echo sx7-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-8:SUPER-UX:*:*)
- echo sx8-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-8R:SUPER-UX:*:*)
- echo sx8r-nec-superux${UNAME_RELEASE}
- exit ;;
- Power*:Rhapsody:*:*)
- echo powerpc-apple-rhapsody${UNAME_RELEASE}
- exit ;;
- *:Rhapsody:*:*)
- echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
- exit ;;
- *:Darwin:*:*)
- UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
- case $UNAME_PROCESSOR in
- unknown) UNAME_PROCESSOR=powerpc ;;
- esac
- echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
- exit ;;
- *:procnto*:*:* | *:QNX:[0123456789]*:*)
- UNAME_PROCESSOR=`uname -p`
- if test "$UNAME_PROCESSOR" = "x86"; then
- UNAME_PROCESSOR=i386
- UNAME_MACHINE=pc
- fi
- echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
- exit ;;
- *:QNX:*:4*)
- echo i386-pc-qnx
- exit ;;
- NSE-?:NONSTOP_KERNEL:*:*)
- echo nse-tandem-nsk${UNAME_RELEASE}
- exit ;;
- NSR-?:NONSTOP_KERNEL:*:*)
- echo nsr-tandem-nsk${UNAME_RELEASE}
- exit ;;
- *:NonStop-UX:*:*)
- echo mips-compaq-nonstopux
- exit ;;
- BS2000:POSIX*:*:*)
- echo bs2000-siemens-sysv
- exit ;;
- DS/*:UNIX_System_V:*:*)
- echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
- exit ;;
- *:Plan9:*:*)
- # "uname -m" is not consistent, so use $cputype instead. 386
- # is converted to i386 for consistency with other x86
- # operating systems.
- if test "$cputype" = "386"; then
- UNAME_MACHINE=i386
- else
- UNAME_MACHINE="$cputype"
- fi
- echo ${UNAME_MACHINE}-unknown-plan9
- exit ;;
- *:TOPS-10:*:*)
- echo pdp10-unknown-tops10
- exit ;;
- *:TENEX:*:*)
- echo pdp10-unknown-tenex
- exit ;;
- KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
- echo pdp10-dec-tops20
- exit ;;
- XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
- echo pdp10-xkl-tops20
- exit ;;
- *:TOPS-20:*:*)
- echo pdp10-unknown-tops20
- exit ;;
- *:ITS:*:*)
- echo pdp10-unknown-its
- exit ;;
- SEI:*:*:SEIUX)
- 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`
- case "${UNAME_MACHINE}" in
- A*) echo alpha-dec-vms ; exit ;;
- I*) echo ia64-dec-vms ; exit ;;
- V*) echo vax-dec-vms ; exit ;;
- esac ;;
- *:XENIX:*:SysV)
- echo i386-pc-xenix
- exit ;;
- i*86:skyos:*:*)
- echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
- exit ;;
- i*86:rdos:*:*)
- echo ${UNAME_MACHINE}-pc-rdos
- exit ;;
- i*86:AROS:*:*)
- echo ${UNAME_MACHINE}-pc-aros
- 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 <<EOF
-#ifdef _SEQUENT_
-# include <sys/types.h>
-# include <sys/utsname.h>
-#endif
-main ()
-{
-#if defined (sony)
-#if defined (MIPSEB)
- /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
- I don't know.... */
- printf ("mips-sony-bsd\n"); exit (0);
-#else
-#include <sys/param.h>
- printf ("m68k-sony-newsos%s\n",
-#ifdef NEWSOS4
- "4"
-#else
- ""
-#endif
- ); exit (0);
-#endif
-#endif
-
-#if defined (__arm) && defined (__acorn) && defined (__unix)
- printf ("arm-acorn-riscix\n"); exit (0);
-#endif
-
-#if defined (hp300) && !defined (hpux)
- printf ("m68k-hp-bsd\n"); exit (0);
-#endif
-
-#if defined (NeXT)
-#if !defined (__ARCHITECTURE__)
-#define __ARCHITECTURE__ "m68k"
-#endif
- int version;
- version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
- if (version < 4)
- printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
- else
- printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
- exit (0);
-#endif
-
-#if defined (MULTIMAX) || defined (n16)
-#if defined (UMAXV)
- printf ("ns32k-encore-sysv\n"); exit (0);
-#else
-#if defined (CMU)
- printf ("ns32k-encore-mach\n"); exit (0);
-#else
- printf ("ns32k-encore-bsd\n"); exit (0);
-#endif
-#endif
-#endif
-
-#if defined (__386BSD__)
- printf ("i386-pc-bsd\n"); exit (0);
-#endif
-
-#if defined (sequent)
-#if defined (i386)
- printf ("i386-sequent-dynix\n"); exit (0);
-#endif
-#if defined (ns32000)
- printf ("ns32k-sequent-dynix\n"); exit (0);
-#endif
-#endif
-
-#if defined (_SEQUENT_)
- struct utsname un;
-
- uname(&un);
-
- if (strncmp(un.version, "V2", 2) == 0) {
- printf ("i386-sequent-ptx2\n"); exit (0);
- }
- if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
- printf ("i386-sequent-ptx1\n"); exit (0);
- }
- printf ("i386-sequent-ptx\n"); exit (0);
-
-#endif
-
-#if defined (vax)
-# if !defined (ultrix)
-# include <sys/param.h>
-# if defined (BSD)
-# if BSD == 43
- printf ("vax-dec-bsd4.3\n"); exit (0);
-# else
-# if BSD == 199006
- printf ("vax-dec-bsd4.3reno\n"); exit (0);
-# else
- printf ("vax-dec-bsd\n"); exit (0);
-# endif
-# endif
-# else
- printf ("vax-dec-bsd\n"); exit (0);
-# endif
-# else
- printf ("vax-dec-ultrix\n"); exit (0);
-# endif
-#endif
-
-#if defined (alliant) && defined (i860)
- printf ("i860-alliant-bsd\n"); exit (0);
-#endif
-
- exit (1);
-}
-EOF
-
-$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
- { echo "$SYSTEM_NAME"; exit; }
-
-# Apollos put the system type in the environment.
-
-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
-
-# Convex versions that predate uname can use getsysinfo(1)
-
-if [ -x /usr/convex/getsysinfo ]
-then
- case `getsysinfo -f cpu_type` in
- c1*)
- echo c1-convex-bsd
- exit ;;
- c2*)
- if getsysinfo -f scalar_acc
- then echo c32-convex-bsd
- else echo c2-convex-bsd
- fi
- exit ;;
- c34*)
- echo c34-convex-bsd
- exit ;;
- c38*)
- echo c38-convex-bsd
- exit ;;
- c4*)
- echo c4-convex-bsd
- exit ;;
- esac
-fi
-
-cat >&2 <<EOF
-$0: unable to guess system type
-
-This script, last modified $timestamp, has failed to recognize
-the operating system you are using. It is advised that you
-download the most up to date version of the config scripts from
-
- http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
-and
- http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
-
-If the version you run ($0) is already up to date, please
-send the following data and any information you think might be
-pertinent to <config-patches@gnu.org> in order to provide the needed
-information to handle your system.
-
-config.guess timestamp = $timestamp
-
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
-/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
-
-hostinfo = `(hostinfo) 2>/dev/null`
-/bin/universe = `(/bin/universe) 2>/dev/null`
-/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
-/bin/arch = `(/bin/arch) 2>/dev/null`
-/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
-
-UNAME_MACHINE = ${UNAME_MACHINE}
-UNAME_RELEASE = ${UNAME_RELEASE}
-UNAME_SYSTEM = ${UNAME_SYSTEM}
-UNAME_VERSION = ${UNAME_VERSION}
-EOF
-
-exit 1
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
diff --git a/chromium/third_party/talloc/config.h.in b/chromium/third_party/talloc/config.h.in
deleted file mode 100644
index b81653e4151..00000000000
--- a/chromium/third_party/talloc/config.h.in
+++ /dev/null
@@ -1,803 +0,0 @@
-/* config.h.in. Generated from configure.ac by autoheader. */
-
-/* Define if building universal (internal helper macro) */
-#undef AC_APPLE_UNIVERSAL_BUILD
-
-/* Broken RedHat 7.2 system header files */
-#undef BROKEN_REDHAT_7_SYSTEM_HEADERS
-
-/* Broken RHEL5 sys/capability.h */
-#undef BROKEN_RHEL5_SYS_CAP_HEADER
-
-/* Whether strndup is broken */
-#undef BROKEN_STRNDUP
-
-/* Whether strnlen is broken */
-#undef BROKEN_STRNLEN
-
-/* Whether dlopen takes unsigned int flags */
-#undef DLOPEN_TAKES_UNSIGNED_FLAGS
-
-/* Define to 1 if you have the <acl/libacl.h> header file. */
-#undef HAVE_ACL_LIBACL_H
-
-/* Define to 1 if you have the `asprintf' function. */
-#undef HAVE_ASPRINTF
-
-/* Whether the bool type is available */
-#undef HAVE_BOOL
-
-/* Define to 1 if you have the `bzero' function. */
-#undef HAVE_BZERO
-
-/* Whether there is a C99 compliant vsnprintf */
-#undef HAVE_C99_VSNPRINTF
-
-/* Define to 1 if you have the `chown' function. */
-#undef HAVE_CHOWN
-
-/* Define to 1 if you have the `chroot' function. */
-#undef HAVE_CHROOT
-
-/* Define to 1 if you have the `chsize' function. */
-#undef HAVE_CHSIZE
-
-/* Whether or not we have comparison_fn_t */
-#undef HAVE_COMPARISON_FN_T
-
-/* Define to 1 if you have the <compat.h> header file. */
-#undef HAVE_COMPAT_H
-
-/* Whether the system has the crypt() function */
-#undef HAVE_CRYPT
-
-/* Define to 1 if you have the <crypt.h> header file. */
-#undef HAVE_CRYPT_H
-
-/* Define to 1 if you have the <ctype.h> header file. */
-#undef HAVE_CTYPE_H
-
-/* Define to 1 if you have the declaration of `asprintf', and to 0 if you
- don't. */
-#undef HAVE_DECL_ASPRINTF
-
-/* Define to 1 if you have the declaration of `snprintf', and to 0 if you
- don't. */
-#undef HAVE_DECL_SNPRINTF
-
-/* Define to 1 if you have the declaration of `vasprintf', and to 0 if you
- don't. */
-#undef HAVE_DECL_VASPRINTF
-
-/* Define to 1 if you have the declaration of `vsnprintf', and to 0 if you
- don't. */
-#undef HAVE_DECL_VSNPRINTF
-
-/* Define to 1 if you have the <direct.h> header file. */
-#undef HAVE_DIRECT_H
-
-/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
- */
-#undef HAVE_DIRENT_H
-
-/* Define to 1 if you have the `dirfd' function. */
-#undef HAVE_DIRFD
-
-/* Whether dirfd() is available */
-#undef HAVE_DIRFD_DECL
-
-/* Define to 1 if you have the `dlclose' function. */
-#undef HAVE_DLCLOSE
-
-/* Define to 1 if you have the `dlerror' function. */
-#undef HAVE_DLERROR
-
-/* Define to 1 if you have the <dlfcn.h> header file. */
-#undef HAVE_DLFCN_H
-
-/* Define to 1 if you have the `dlopen' function. */
-#undef HAVE_DLOPEN
-
-/* Define to 1 if you have the `dlsym' function. */
-#undef HAVE_DLSYM
-
-/* Define to 1 if you have the <dl.h> header file. */
-#undef HAVE_DL_H
-
-/* Define to 1 if you have the `dup2' function. */
-#undef HAVE_DUP2
-
-/* Whether environ() is available */
-#undef HAVE_ENVIRON_DECL
-
-/* Whether errno() is available */
-#undef HAVE_ERRNO_DECL
-
-/* Define to 1 if you have the <fcntl.h> header file. */
-#undef HAVE_FCNTL_H
-
-/* Define to 1 if you have the <fnmatch.h> header file. */
-#undef HAVE_FNMATCH_H
-
-/* Define to 1 if you have the `ftruncate' function. */
-#undef HAVE_FTRUNCATE
-
-/* Whether there is a __FUNCTION__ macro */
-#undef HAVE_FUNCTION_MACRO
-
-/* Define to 1 if you have the `getdents' function. */
-#undef HAVE_GETDENTS
-
-/* Define to 1 if you have the `getdirentries' function. */
-#undef HAVE_GETDIRENTRIES
-
-/* Define to 1 if you have the `getgrent_r' function. */
-#undef HAVE_GETGRENT_R
-
-/* Whether getgrent_r() is available */
-#undef HAVE_GETGRENT_R_DECL
-
-/* Define to 1 if you have the `getgrgid_r' function. */
-#undef HAVE_GETGRGID_R
-
-/* Define to 1 if you have the `getgrnam_r' function. */
-#undef HAVE_GETGRNAM_R
-
-/* Define to 1 if you have the `getgrouplist' function. */
-#undef HAVE_GETGROUPLIST
-
-/* Define to 1 if you have the `getpgrp' function. */
-#undef HAVE_GETPGRP
-
-/* Define to 1 if you have the `getpwent_r' function. */
-#undef HAVE_GETPWENT_R
-
-/* Whether getpwent_r() is available */
-#undef HAVE_GETPWENT_R_DECL
-
-/* Define to 1 if you have the `getpwnam_r' function. */
-#undef HAVE_GETPWNAM_R
-
-/* Define to 1 if you have the `getpwuid_r' function. */
-#undef HAVE_GETPWUID_R
-
-/* Define to 1 if you have the <grp.h> header file. */
-#undef HAVE_GRP_H
-
-/* Whether the compiler supports immediate structures */
-#undef HAVE_IMMEDIATE_STRUCTURES
-
-/* Define to 1 if you have the `initgroups' function. */
-#undef HAVE_INITGROUPS
-
-/* Define to 1 if the system has the type `intptr_t'. */
-#undef HAVE_INTPTR_T
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#undef HAVE_INTTYPES_H
-
-/* Define to 1 if you have the `isatty' function. */
-#undef HAVE_ISATTY
-
-/* Define to 1 if you have the <langinfo.h> header file. */
-#undef HAVE_LANGINFO_H
-
-/* Define to 1 if you have the `lchown' function. */
-#undef HAVE_LCHOWN
-
-/* Define to 1 if you have the <limits.h> header file. */
-#undef HAVE_LIMITS_H
-
-/* Define to 1 if you have the `link' function. */
-#undef HAVE_LINK
-
-/* Define to 1 if you have the <locale.h> header file. */
-#undef HAVE_LOCALE_H
-
-/* Define to 1 if the system has the type `long long'. */
-#undef HAVE_LONG_LONG
-
-/* Define to 1 if you have the `lstat' function. */
-#undef HAVE_LSTAT
-
-/* Define to 1 if you have the `memcpy' function. */
-#undef HAVE_MEMCPY
-
-/* Define to 1 if you have the `memmove' function. */
-#undef HAVE_MEMMOVE
-
-/* Define to 1 if you have the <memory.h> header file. */
-#undef HAVE_MEMORY_H
-
-/* Define to 1 if you have the `memset' function. */
-#undef HAVE_MEMSET
-
-/* Define if target mkdir supports mode option */
-#undef HAVE_MKDIR_MODE
-
-/* Define to 1 if you have the `mkdtemp' function. */
-#undef HAVE_MKDTEMP
-
-/* Define to 1 if you have the `mktime' function. */
-#undef HAVE_MKTIME
-
-/* Whether mmap works */
-#undef HAVE_MMAP
-
-/* Define to 1 if you have the <mntent.h> header file. */
-#undef HAVE_MNTENT_H
-
-/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
-#undef HAVE_NDIR_H
-
-/* Whether the open(2) accepts O_DIRECT */
-#undef HAVE_OPEN_O_DIRECT
-
-/* Define to 1 if you have the `pipe' function. */
-#undef HAVE_PIPE
-
-/* Define to 1 if you have the `pread' function. */
-#undef HAVE_PREAD
-
-/* Define to 1 if you have the `printf' function. */
-#undef HAVE_PRINTF
-
-/* Define to 1 if the system has the type `ptrdiff_t'. */
-#undef HAVE_PTRDIFF_T
-
-/* Define to 1 if you have the <pwd.h> header file. */
-#undef HAVE_PWD_H
-
-/* Define to 1 if you have the `pwrite' function. */
-#undef HAVE_PWRITE
-
-/* Define to 1 if you have the `rand' function. */
-#undef HAVE_RAND
-
-/* Define to 1 if you have the `random' function. */
-#undef HAVE_RANDOM
-
-/* Define to 1 if you have the `readlink' function. */
-#undef HAVE_READLINK
-
-/* Define to 1 if you have the `realpath' function. */
-#undef HAVE_REALPATH
-
-/* Define to 1 if you have the `rename' function. */
-#undef HAVE_RENAME
-
-/* Whether mkstemp is secure */
-#undef HAVE_SECURE_MKSTEMP
-
-/* Define to 1 if you have the `setbuffer' function. */
-#undef HAVE_SETBUFFER
-
-/* Define to 1 if you have the `setegid' function. */
-#undef HAVE_SETEGID
-
-/* Define to 1 if you have the `setenv' function. */
-#undef HAVE_SETENV
-
-/* Whether setenv() is available */
-#undef HAVE_SETENV_DECL
-
-/* Define to 1 if you have the `seteuid' function. */
-#undef HAVE_SETEUID
-
-/* Define to 1 if you have the <setjmp.h> header file. */
-#undef HAVE_SETJMP_H
-
-/* Define to 1 if you have the `setlinebuf' function. */
-#undef HAVE_SETLINEBUF
-
-/* Define to 1 if you have the `setresgid' function. */
-#undef HAVE_SETRESGID
-
-/* Whether setresgid() is available */
-#undef HAVE_SETRESGID_DECL
-
-/* Define to 1 if you have the `setresuid' function. */
-#undef HAVE_SETRESUID
-
-/* Whether setresuid() is available */
-#undef HAVE_SETRESUID_DECL
-
-/* Define to 1 if you have the <shadow.h> header file. */
-#undef HAVE_SHADOW_H
-
-/* Define to 1 if you have the `shl_findsym' function. */
-#undef HAVE_SHL_FINDSYM
-
-/* Define to 1 if you have the `shl_load' function. */
-#undef HAVE_SHL_LOAD
-
-/* Define to 1 if you have the `shl_unload' function. */
-#undef HAVE_SHL_UNLOAD
-
-/* Whether we have the atomic_t variable type */
-#undef HAVE_SIG_ATOMIC_T_TYPE
-
-/* Define to 1 if you have the `snprintf' function. */
-#undef HAVE_SNPRINTF
-
-/* Define to 1 if you have the `srand' function. */
-#undef HAVE_SRAND
-
-/* Define to 1 if you have the `srandom' function. */
-#undef HAVE_SRANDOM
-
-/* Define to 1 if you have the <standards.h> header file. */
-#undef HAVE_STANDARDS_H
-
-/* Define to 1 if you have the <stdarg.h> header file. */
-#undef HAVE_STDARG_H
-
-/* Define to 1 if you have the <stdbool.h> header file. */
-#undef HAVE_STDBOOL_H
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#undef HAVE_STDINT_H
-
-/* Define to 1 if you have the <stdio.h> header file. */
-#undef HAVE_STDIO_H
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#undef HAVE_STDLIB_H
-
-/* Define to 1 if you have the `strcasestr' function. */
-#undef HAVE_STRCASESTR
-
-/* Define to 1 if you have the `strdup' function. */
-#undef HAVE_STRDUP
-
-/* Define to 1 if you have the `strerror' function. */
-#undef HAVE_STRERROR
-
-/* Define to 1 if you have the `strftime' function. */
-#undef HAVE_STRFTIME
-
-/* Define to 1 if you have the <strings.h> header file. */
-#undef HAVE_STRINGS_H
-
-/* Define to 1 if you have the <string.h> header file. */
-#undef HAVE_STRING_H
-
-/* Define to 1 if you have the `strlcat' function. */
-#undef HAVE_STRLCAT
-
-/* Define to 1 if you have the `strlcpy' function. */
-#undef HAVE_STRLCPY
-
-/* Define to 1 if you have the `strndup' function. */
-#undef HAVE_STRNDUP
-
-/* Define to 1 if you have the `strnlen' function. */
-#undef HAVE_STRNLEN
-
-/* Define to 1 if you have the <stropts.h> header file. */
-#undef HAVE_STROPTS_H
-
-/* Define to 1 if you have the `strtok_r' function. */
-#undef HAVE_STRTOK_R
-
-/* Define to 1 if you have the `strtoll' function. */
-#undef HAVE_STRTOLL
-
-/* Define to 1 if you have the `strtoq' function. */
-#undef HAVE_STRTOQ
-
-/* Define to 1 if you have the `strtoull' function. */
-#undef HAVE_STRTOULL
-
-/* Define to 1 if you have the `strtouq' function. */
-#undef HAVE_STRTOUQ
-
-/* Define to 1 if `st_rdev' is member of `struct stat'. */
-#undef HAVE_STRUCT_STAT_ST_RDEV
-
-/* Define to 1 if your `struct stat' has `st_rdev'. Deprecated, use
- `HAVE_STRUCT_STAT_ST_RDEV' instead. */
-#undef HAVE_ST_RDEV
-
-/* Define to 1 if you have the `symlink' function. */
-#undef HAVE_SYMLINK
-
-/* Define to 1 if you have the <syslog.h> header file. */
-#undef HAVE_SYSLOG_H
-
-/* Define to 1 if you have the <sys/acl.h> header file. */
-#undef HAVE_SYS_ACL_H
-
-/* Define to 1 if you have the <sys/capability.h> header file. */
-#undef HAVE_SYS_CAPABILITY_H
-
-/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
- */
-#undef HAVE_SYS_DIR_H
-
-/* Define to 1 if you have the <sys/fcntl.h> header file. */
-#undef HAVE_SYS_FCNTL_H
-
-/* Define to 1 if you have the <sys/filio.h> header file. */
-#undef HAVE_SYS_FILIO_H
-
-/* Define to 1 if you have the <sys/filsys.h> header file. */
-#undef HAVE_SYS_FILSYS_H
-
-/* Define to 1 if you have the <sys/fs/s5param.h> header file. */
-#undef HAVE_SYS_FS_S5PARAM_H
-
-/* Define to 1 if you have the <sys/id.h> header file. */
-#undef HAVE_SYS_ID_H
-
-/* Define to 1 if you have the <sys/ioctl.h> header file. */
-#undef HAVE_SYS_IOCTL_H
-
-/* Define to 1 if you have the <sys/ipc.h> header file. */
-#undef HAVE_SYS_IPC_H
-
-/* Define to 1 if you have the <sys/mman.h> header file. */
-#undef HAVE_SYS_MMAN_H
-
-/* Define to 1 if you have the <sys/mode.h> header file. */
-#undef HAVE_SYS_MODE_H
-
-/* Define to 1 if you have the <sys/mount.h> header file. */
-#undef HAVE_SYS_MOUNT_H
-
-/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
- */
-#undef HAVE_SYS_NDIR_H
-
-/* Define to 1 if you have the <sys/param.h> header file. */
-#undef HAVE_SYS_PARAM_H
-
-/* Define to 1 if you have the <sys/priv.h> header file. */
-#undef HAVE_SYS_PRIV_H
-
-/* Define to 1 if you have the <sys/resource.h> header file. */
-#undef HAVE_SYS_RESOURCE_H
-
-/* Define to 1 if you have the <sys/security.h> header file. */
-#undef HAVE_SYS_SECURITY_H
-
-/* Define to 1 if you have the <sys/select.h> header file. */
-#undef HAVE_SYS_SELECT_H
-
-/* Define to 1 if you have the <sys/shm.h> header file. */
-#undef HAVE_SYS_SHM_H
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#undef HAVE_SYS_STAT_H
-
-/* Define to 1 if you have the <sys/syslog.h> header file. */
-#undef HAVE_SYS_SYSLOG_H
-
-/* Define to 1 if you have the <sys/termio.h> header file. */
-#undef HAVE_SYS_TERMIO_H
-
-/* Define to 1 if you have the <sys/time.h> header file. */
-#undef HAVE_SYS_TIME_H
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#undef HAVE_SYS_TYPES_H
-
-/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
-#undef HAVE_SYS_WAIT_H
-
-/* Define to 1 if you have the <termios.h> header file. */
-#undef HAVE_TERMIOS_H
-
-/* Define to 1 if you have the <termio.h> header file. */
-#undef HAVE_TERMIO_H
-
-/* Define to 1 if you have the `timegm' function. */
-#undef HAVE_TIMEGM
-
-/* Define to 1 if you have the <time.h> header file. */
-#undef HAVE_TIME_H
-
-/* Define to 1 if the system has the type `uintptr_t'. */
-#undef HAVE_UINTPTR_T
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#undef HAVE_UNISTD_H
-
-/* Define to 1 if you have the <unix.h> header file. */
-#undef HAVE_UNIX_H
-
-/* Define to 1 if you have the `unsetenv' function. */
-#undef HAVE_UNSETENV
-
-/* Define to 1 if you have the `usleep' function. */
-#undef HAVE_USLEEP
-
-/* Define to 1 if you have the `utime' function. */
-#undef HAVE_UTIME
-
-/* Define to 1 if you have the `utimes' function. */
-#undef HAVE_UTIMES
-
-/* Define to 1 if you have the <utime.h> header file. */
-#undef HAVE_UTIME_H
-
-/* Define to 1 if you have the <vararg.h> header file. */
-#undef HAVE_VARARG_H
-
-/* Define to 1 if you have the `vasprintf' function. */
-#undef HAVE_VASPRINTF
-
-/* Whether va_copy() is available */
-#undef HAVE_VA_COPY
-
-/* Whether the C compiler understands volatile */
-#undef HAVE_VOLATILE
-
-/* Define to 1 if you have the `vsnprintf' function. */
-#undef HAVE_VSNPRINTF
-
-/* Define to 1 if you have the `vsyslog' function. */
-#undef HAVE_VSYSLOG
-
-/* Define to 1 if you have the `wait4' function. */
-#undef HAVE_WAIT4
-
-/* Define to 1 if you have the `waitpid' function. */
-#undef HAVE_WAITPID
-
-/* Define to 1 if you have the <windows.h> header file. */
-#undef HAVE_WINDOWS_H
-
-/* Define to 1 if you have the <winsock2.h> header file. */
-#undef HAVE_WINSOCK2_H
-
-/* Define to 1 if you have the <ws2tcpip.h> header file. */
-#undef HAVE_WS2TCPIP_H
-
-/* Whether the _Bool type is available */
-#undef HAVE__Bool
-
-/* Whether the __VA_ARGS__ macro is available */
-#undef HAVE__VA_ARGS__MACRO
-
-/* Define to 1 if you have the `__strtoll' function. */
-#undef HAVE___STRTOLL
-
-/* Define to 1 if you have the `__strtoull' function. */
-#undef HAVE___STRTOULL
-
-/* Whether __va_copy() is available */
-#undef HAVE___VA_COPY
-
-/* Whether there is a __func__ macro */
-#undef HAVE_func_MACRO
-
-/* Whether MMAP is broken */
-#undef MMAP_BLACKLIST
-
-/* Define to the address where bug reports for this package should be sent. */
-#undef PACKAGE_BUGREPORT
-
-/* Define to the full name of this package. */
-#undef PACKAGE_NAME
-
-/* Define to the full name and version of this package. */
-#undef PACKAGE_STRING
-
-/* Define to the one symbol short name of this package. */
-#undef PACKAGE_TARNAME
-
-/* Define to the version of this package. */
-#undef PACKAGE_VERSION
-
-/* Whether getpass should be replaced */
-#undef REPLACE_GETPASS
-
-/* getpass returns <9 chars where getpassphrase returns <265 chars */
-#undef REPLACE_GETPASS_BY_GETPASSPHRASE
-
-/* replace readdir */
-#undef REPLACE_READDIR
-
-/* replace readdir using getdents() */
-#undef REPLACE_READDIR_GETDENTS
-
-/* replace readdir using getdirentries() */
-#undef REPLACE_READDIR_GETDIRENTRIES
-
-/* Whether strptime should be replaced */
-#undef REPLACE_STRPTIME
-
-/* Define as the return type of signal handlers (`int' or `void'). */
-#undef RETSIGTYPE
-
-/* Whether seekdir returns an int */
-#undef SEEKDIR_RETURNS_INT
-
-/* The size of `char', as computed by sizeof. */
-#undef SIZEOF_CHAR
-
-/* The size of `int', as computed by sizeof. */
-#undef SIZEOF_INT
-
-/* The size of `long', as computed by sizeof. */
-#undef SIZEOF_LONG
-
-/* The size of `long long', as computed by sizeof. */
-#undef SIZEOF_LONG_LONG
-
-/* The size of `off_t', as computed by sizeof. */
-#undef SIZEOF_OFF_T
-
-/* The size of `short', as computed by sizeof. */
-#undef SIZEOF_SHORT
-
-/* The size of `size_t', as computed by sizeof. */
-#undef SIZEOF_SIZE_T
-
-/* The size of `ssize_t', as computed by sizeof. */
-#undef SIZEOF_SSIZE_T
-
-/* The size of `void *', as computed by sizeof. */
-#undef SIZEOF_VOID_P
-
-/* getgrent_r irix (similar to solaris) function prototype */
-#undef SOLARIS_GETGRENT_R
-
-/* getpwent_r irix (similar to solaris) function prototype */
-#undef SOLARIS_GETPWENT_R
-
-/* Define to 1 if you have the ANSI C header files. */
-#undef STDC_HEADERS
-
-/* talloc major version */
-#undef TALLOC_BUILD_VERSION_MAJOR
-
-/* talloc minor version */
-#undef TALLOC_BUILD_VERSION_MINOR
-
-/* talloc release version */
-#undef TALLOC_BUILD_VERSION_RELEASE
-
-/* Whether telldir takes a const pointer */
-#undef TELLDIR_TAKES_CONST_DIR
-
-/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
-#undef TIME_WITH_SYS_TIME
-
-/* Enable extensions on AIX 3, Interix. */
-#ifndef _ALL_SOURCE
-# undef _ALL_SOURCE
-#endif
-/* Enable GNU extensions on systems that have them. */
-#ifndef _GNU_SOURCE
-# undef _GNU_SOURCE
-#endif
-/* Enable threading extensions on Solaris. */
-#ifndef _POSIX_PTHREAD_SEMANTICS
-# undef _POSIX_PTHREAD_SEMANTICS
-#endif
-/* Enable extensions on HP NonStop. */
-#ifndef _TANDEM_SOURCE
-# undef _TANDEM_SOURCE
-#endif
-/* Enable general extensions on Solaris. */
-#ifndef __EXTENSIONS__
-# undef __EXTENSIONS__
-#endif
-
-
-/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
- significant byte first (like Motorola and SPARC, unlike Intel). */
-#if defined AC_APPLE_UNIVERSAL_BUILD
-# if defined __BIG_ENDIAN__
-# define WORDS_BIGENDIAN 1
-# endif
-#else
-# ifndef WORDS_BIGENDIAN
-# undef WORDS_BIGENDIAN
-# endif
-#endif
-
-/* Number of bits in a file offset, on hosts where this is settable. */
-#undef _FILE_OFFSET_BITS
-
-/* Define for large files, on AIX-style hosts. */
-#undef _LARGE_FILES
-
-/* Define to 1 if on MINIX. */
-#undef _MINIX
-
-
-#ifndef _OSF_SOURCE
-# undef _OSF_SOURCE
-#endif
-
-
-/* Define to 2 if the system does not provide POSIX.1 features except with
- this defined. */
-#undef _POSIX_1_SOURCE
-
-/* Whether to enable POSIX support */
-#undef _POSIX_C_SOURCE
-
-/* Define to 1 if you need to in order for `stat' and other things to work. */
-#undef _POSIX_SOURCE
-
-/* Whether to enable System V compatibility */
-#undef _SYSV
-
-
-#ifndef _XOPEN_SOURCE
-# undef _XOPEN_SOURCE
-#endif
-
-
-
-#ifndef _XOPEN_SOURCE_EXTENDED
-# undef _XOPEN_SOURCE_EXTENDED
-#endif
-
-
-/* Define to `int' if <sys/types.h> doesn't define. */
-#undef gid_t
-
-/* Define to `__inline__' or `__inline' if that's what the C compiler
- calls it, or to nothing if 'inline' is not supported under any name. */
-#ifndef __cplusplus
-#undef inline
-#endif
-
-/* Define to `unsigned' if <sys/types.h> does not define. */
-#undef ino_t
-
-/* Define to `short' if <sys/types.h> does not define. */
-#undef int16_t
-
-/* Define to `long' if <sys/types.h> does not define. */
-#undef int32_t
-
-/* Define to `long long' if <sys/types.h> does not define. */
-#undef int64_t
-
-/* Define to `char' if <sys/types.h> does not define. */
-#undef int8_t
-
-/* Define to `off_t' if <sys/types.h> does not define. */
-#undef loff_t
-
-/* Define to `int' if <sys/types.h> does not define. */
-#undef mode_t
-
-/* Define to `long int' if <sys/types.h> does not define. */
-#undef off_t
-
-/* Define to `loff_t' if <sys/types.h> does not define. */
-#undef offset_t
-
-/* Define to `int' if <sys/types.h> does not define. */
-#undef pid_t
-
-/* Define to `unsigned int' if <sys/types.h> does not define. */
-#undef size_t
-
-/* Define to `int' if <sys/types.h> does not define. */
-#undef ssize_t
-
-/* Define to `int' if <sys/types.h> doesn't define. */
-#undef uid_t
-
-/* Define to `unsigned short' if <sys/types.h> does not define. */
-#undef uint16_t
-
-/* Define to `unsigned long' if <sys/types.h> does not define. */
-#undef uint32_t
-
-/* Define to `unsigned long long' if <sys/types.h> does not define. */
-#undef uint64_t
-
-/* Define to `unsigned char' if <sys/types.h> does not define. */
-#undef uint8_t
-
-/* Define to `unsigned int' if <sys/types.h> does not define. */
-#undef uint_t
diff --git a/chromium/third_party/talloc/config.sub b/chromium/third_party/talloc/config.sub
deleted file mode 100755
index a39437d0158..00000000000
--- a/chromium/third_party/talloc/config.sub
+++ /dev/null
@@ -1,1686 +0,0 @@
-#! /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
-# Free Software Foundation, Inc.
-
-timestamp='2009-04-17'
-
-# 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
-# (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.
-#
-# 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.
-
-
-# Please send patches to <config-patches@gnu.org>. Submit a context
-# diff and a properly formatted ChangeLog entry.
-#
-# Configuration subroutine to validate and canonicalize a configuration type.
-# Supply the specified configuration type as an argument.
-# If it is invalid, we print an error message on stderr and exit with code 1.
-# Otherwise, we print the canonical config type on stdout and succeed.
-
-# This file is supposed to be the same for all GNU packages
-# and recognize all the CPU types, system types and aliases
-# that are meaningful with *any* GNU software.
-# Each package is responsible for reporting which valid configurations
-# it does not support. The user should be able to distinguish
-# a failure to support a valid configuration from a meaningless
-# configuration.
-
-# The goal of this file is to map all the various variations of a given
-# machine specification into a single specification in the form:
-# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
-# or in some cases, the newer four-part form:
-# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
-# It is wrong to echo any other type of specification.
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION] CPU-MFR-OPSYS
- $0 [OPTION] ALIAS
-
-Canonicalize a configuration name.
-
-Operation modes:
- -h, --help print this help, then exit
- -t, --time-stamp print date of last modification, then exit
- -v, --version print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-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.
-
-This is free software; see the source for copying conditions. There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
- case $1 in
- --time-stamp | --time* | -t )
- echo "$timestamp" ; exit ;;
- --version | -v )
- echo "$version" ; exit ;;
- --help | --h* | -h )
- echo "$usage"; exit ;;
- -- ) # Stop option processing
- shift; break ;;
- - ) # Use stdin as input.
- break ;;
- -* )
- echo "$me: invalid option $1$help"
- exit 1 ;;
-
- *local*)
- # First pass through any local machine types.
- echo $1
- exit ;;
-
- * )
- break ;;
- esac
-done
-
-case $# in
- 0) echo "$me: missing argument$help" >&2
- exit 1;;
- 1) ;;
- *) echo "$me: too many arguments$help" >&2
- exit 1;;
-esac
-
-# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
-# 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* | \
- kopensolaris*-gnu* | \
- storm-chaos* | os2-emx* | rtmk-nova*)
- os=-$maybe_os
- basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
- ;;
- *)
- basic_machine=`echo $1 | sed 's/-[^-]*$//'`
- if [ $basic_machine != $1 ]
- then os=`echo $1 | sed 's/.*-/-/'`
- else os=; fi
- ;;
-esac
-
-### Let's recognize common machines as not being operating systems so
-### that things like config.sub decstation-3100 work. We also
-### recognize some manufacturers as not being operating systems, so we
-### can provide default operating systems below.
-case $os in
- -sun*os*)
- # Prevent following clause from handling this invalid input.
- ;;
- -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
- -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
- -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
- -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)
- os=
- basic_machine=$1
- ;;
- -sim | -cisco | -oki | -wec | -winbond)
- os=
- basic_machine=$1
- ;;
- -scout)
- ;;
- -wrs)
- os=-vxworks
- basic_machine=$1
- ;;
- -chorusos*)
- os=-chorusos
- basic_machine=$1
- ;;
- -chorusrdb)
- os=-chorusrdb
- basic_machine=$1
- ;;
- -hiux*)
- os=-hiuxwe2
- ;;
- -sco6)
- os=-sco5v6
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco5)
- os=-sco3.2v5
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco4)
- os=-sco3.2v4
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco3.2.[4-9]*)
- os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco3.2v[4-9]*)
- # Don't forget version if it is 3.2v4 or newer.
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco5v6*)
- # Don't forget version if it is 3.2v4 or newer.
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco*)
- os=-sco3.2v2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -udk*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -isc)
- os=-isc2.2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -clix*)
- basic_machine=clipper-intergraph
- ;;
- -isc*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -lynx*)
- os=-lynxos
- ;;
- -ptx*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
- ;;
- -windowsnt*)
- os=`echo $os | sed -e 's/windowsnt/winnt/'`
- ;;
- -psos*)
- os=-psos
- ;;
- -mint | -mint[0-9]*)
- basic_machine=m68k-atari
- os=-mint
- ;;
-esac
-
-# Decode aliases for certain CPU-COMPANY combinations.
-case $basic_machine in
- # Recognize the basic CPU types without company name.
- # Some are omitted here because they have special meanings below.
- 1750a | 580 \
- | a29k \
- | 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 \
- | bfin \
- | c4x | clipper \
- | d10v | d30v | dlx | dsp16xx \
- | fido | fr30 | frv \
- | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
- | i370 | i860 | i960 | ia64 \
- | ip2k | iq2000 \
- | lm32 \
- | m32c | m32r | m32rle | m68000 | m68k | m88k \
- | maxq | mb | microblaze | mcore | mep | metag \
- | mips | mipsbe | mipseb | mipsel | mipsle \
- | mips16 \
- | mips64 | mips64el \
- | mips64octeon | mips64octeonel \
- | mips64orion | mips64orionel \
- | mips64r5900 | mips64r5900el \
- | mips64vr | mips64vrel \
- | mips64vr4100 | mips64vr4100el \
- | mips64vr4300 | mips64vr4300el \
- | mips64vr5000 | mips64vr5000el \
- | mips64vr5900 | mips64vr5900el \
- | mipsisa32 | mipsisa32el \
- | mipsisa32r2 | mipsisa32r2el \
- | mipsisa64 | mipsisa64el \
- | mipsisa64r2 | mipsisa64r2el \
- | mipsisa64sb1 | mipsisa64sb1el \
- | mipsisa64sr71k | mipsisa64sr71kel \
- | mipstx39 | mipstx39el \
- | mn10200 | mn10300 \
- | moxie \
- | mt \
- | msp430 \
- | nios | nios2 \
- | ns16k | ns32k \
- | or32 \
- | pdp10 | pdp11 | pj | pjl \
- | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
- | pyramid \
- | 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 \
- | v850 | v850e \
- | we32k \
- | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
- | z8k | z80)
- basic_machine=$basic_machine-unknown
- ;;
- m6811 | m68hc11 | m6812 | m68hc12)
- # Motorola 68HC11/12.
- basic_machine=$basic_machine-unknown
- os=-none
- ;;
- m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
- ;;
- ms1)
- basic_machine=mt-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.
- i*86 | x86_64)
- basic_machine=$basic_machine-pc
- ;;
- # Object if more than one company name word.
- *-*-*)
- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
- exit 1
- ;;
- # Recognize the basic CPU types with company name.
- 580-* \
- | a29k-* \
- | 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-* \
- | bfin-* | bs2000-* \
- | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
- | 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-* \
- | i*86-* | i860-* | i960-* | ia64-* \
- | ip2k-* | iq2000-* \
- | lm32-* \
- | m32c-* | m32r-* | m32rle-* \
- | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
- | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
- | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
- | mips16-* \
- | mips64-* | mips64el-* \
- | mips64octeon-* | mips64octeonel-* \
- | mips64orion-* | mips64orionel-* \
- | mips64r5900-* | mips64r5900el-* \
- | mips64vr-* | mips64vrel-* \
- | mips64vr4100-* | mips64vr4100el-* \
- | mips64vr4300-* | mips64vr4300el-* \
- | mips64vr5000-* | mips64vr5000el-* \
- | mips64vr5900-* | mips64vr5900el-* \
- | mipsisa32-* | mipsisa32el-* \
- | mipsisa32r2-* | mipsisa32r2el-* \
- | mipsisa64-* | mipsisa64el-* \
- | mipsisa64r2-* | mipsisa64r2el-* \
- | mipsisa64sb1-* | mipsisa64sb1el-* \
- | mipsisa64sr71k-* | mipsisa64sr71kel-* \
- | mipstx39-* | mipstx39el-* \
- | mmix-* \
- | mt-* \
- | msp430-* \
- | nios-* | nios2-* \
- | none-* | np1-* | ns16k-* | ns32k-* \
- | orion-* \
- | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
- | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
- | pyramid-* \
- | romp-* | rs6000-* \
- | 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-* \
- | tron-* \
- | v850-* | v850e-* | vax-* \
- | we32k-* \
- | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
- | xstormy16-* | xtensa*-* \
- | ymp-* \
- | z8k-* | z80-*)
- ;;
- # Recognize the basic CPU types without company name, with glob match.
- xtensa*)
- basic_machine=$basic_machine-unknown
- ;;
- # Recognize the various machine names and aliases which stand
- # for a CPU type and a company and sometimes even an OS.
- 386bsd)
- basic_machine=i386-unknown
- os=-bsd
- ;;
- 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
- basic_machine=m68000-att
- ;;
- 3b*)
- basic_machine=we32k-att
- ;;
- a29khif)
- basic_machine=a29k-amd
- os=-udi
- ;;
- abacus)
- basic_machine=abacus-unknown
- ;;
- adobe68k)
- basic_machine=m68010-adobe
- os=-scout
- ;;
- alliant | fx80)
- basic_machine=fx80-alliant
- ;;
- altos | altos3068)
- basic_machine=m68k-altos
- ;;
- am29k)
- basic_machine=a29k-none
- os=-bsd
- ;;
- amd64)
- basic_machine=x86_64-pc
- ;;
- amd64-*)
- basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- amdahl)
- basic_machine=580-amdahl
- os=-sysv
- ;;
- amiga | amiga-*)
- basic_machine=m68k-unknown
- ;;
- amigaos | amigados)
- basic_machine=m68k-unknown
- os=-amigaos
- ;;
- amigaunix | amix)
- basic_machine=m68k-unknown
- os=-sysv4
- ;;
- apollo68)
- basic_machine=m68k-apollo
- os=-sysv
- ;;
- apollo68bsd)
- basic_machine=m68k-apollo
- os=-bsd
- ;;
- aros)
- basic_machine=i386-pc
- os=-aros
- ;;
- aux)
- basic_machine=m68k-apple
- os=-aux
- ;;
- balance)
- basic_machine=ns32k-sequent
- os=-dynix
- ;;
- blackfin)
- basic_machine=bfin-unknown
- os=-linux
- ;;
- blackfin-*)
- basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
- os=-linux
- ;;
- c90)
- basic_machine=c90-cray
- os=-unicos
- ;;
- cegcc)
- basic_machine=arm-unknown
- os=-cegcc
- ;;
- convex-c1)
- basic_machine=c1-convex
- os=-bsd
- ;;
- convex-c2)
- basic_machine=c2-convex
- os=-bsd
- ;;
- convex-c32)
- basic_machine=c32-convex
- os=-bsd
- ;;
- convex-c34)
- basic_machine=c34-convex
- os=-bsd
- ;;
- convex-c38)
- basic_machine=c38-convex
- os=-bsd
- ;;
- cray | j90)
- basic_machine=j90-cray
- os=-unicos
- ;;
- craynv)
- basic_machine=craynv-cray
- os=-unicosmp
- ;;
- cr16)
- basic_machine=cr16-unknown
- os=-elf
- ;;
- crds | unos)
- basic_machine=m68k-crds
- ;;
- crisv32 | crisv32-* | etraxfs*)
- basic_machine=crisv32-axis
- ;;
- cris | cris-* | etrax*)
- basic_machine=cris-axis
- ;;
- crx)
- basic_machine=crx-unknown
- os=-elf
- ;;
- da30 | da30-*)
- basic_machine=m68k-da30
- ;;
- decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
- basic_machine=mips-dec
- ;;
- decsystem10* | dec10*)
- basic_machine=pdp10-dec
- os=-tops10
- ;;
- decsystem20* | dec20*)
- basic_machine=pdp10-dec
- os=-tops20
- ;;
- delta | 3300 | motorola-3300 | motorola-delta \
- | 3300-motorola | delta-motorola)
- basic_machine=m68k-motorola
- ;;
- delta88)
- basic_machine=m88k-motorola
- os=-sysv3
- ;;
- dicos)
- basic_machine=i686-pc
- os=-dicos
- ;;
- djgpp)
- basic_machine=i586-pc
- os=-msdosdjgpp
- ;;
- dpx20 | dpx20-*)
- basic_machine=rs6000-bull
- os=-bosx
- ;;
- dpx2* | dpx2*-bull)
- basic_machine=m68k-bull
- os=-sysv3
- ;;
- ebmon29k)
- basic_machine=a29k-amd
- os=-ebmon
- ;;
- elxsi)
- basic_machine=elxsi-elxsi
- os=-bsd
- ;;
- encore | umax | mmax)
- basic_machine=ns32k-encore
- ;;
- es1800 | OSE68k | ose68k | ose | OSE)
- basic_machine=m68k-ericsson
- os=-ose
- ;;
- fx2800)
- basic_machine=i860-alliant
- ;;
- genix)
- basic_machine=ns32k-ns
- ;;
- gmicro)
- basic_machine=tron-gmicro
- os=-sysv
- ;;
- go32)
- basic_machine=i386-pc
- os=-go32
- ;;
- h3050r* | hiux*)
- basic_machine=hppa1.1-hitachi
- os=-hiuxwe2
- ;;
- h8300hms)
- basic_machine=h8300-hitachi
- os=-hms
- ;;
- h8300xray)
- basic_machine=h8300-hitachi
- os=-xray
- ;;
- h8500hms)
- basic_machine=h8500-hitachi
- os=-hms
- ;;
- harris)
- basic_machine=m88k-harris
- os=-sysv3
- ;;
- hp300-*)
- basic_machine=m68k-hp
- ;;
- hp300bsd)
- basic_machine=m68k-hp
- os=-bsd
- ;;
- hp300hpux)
- basic_machine=m68k-hp
- os=-hpux
- ;;
- hp3k9[0-9][0-9] | hp9[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hp9k2[0-9][0-9] | hp9k31[0-9])
- basic_machine=m68000-hp
- ;;
- hp9k3[2-9][0-9])
- basic_machine=m68k-hp
- ;;
- hp9k6[0-9][0-9] | hp6[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hp9k7[0-79][0-9] | hp7[0-79][0-9])
- basic_machine=hppa1.1-hp
- ;;
- hp9k78[0-9] | hp78[0-9])
- # FIXME: really hppa2.0-hp
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
- # FIXME: really hppa2.0-hp
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[0-9][13679] | hp8[0-9][13679])
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[0-9][0-9] | hp8[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hppa-next)
- os=-nextstep3
- ;;
- hppaosf)
- basic_machine=hppa1.1-hp
- os=-osf
- ;;
- hppro)
- basic_machine=hppa1.1-hp
- os=-proelf
- ;;
- 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
- ;;
- i*86v4*)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv4
- ;;
- i*86v)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv
- ;;
- i*86sol2)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-solaris2
- ;;
- i386mach)
- basic_machine=i386-mach
- os=-mach
- ;;
- i386-vsta | vsta)
- basic_machine=i386-unknown
- os=-vsta
- ;;
- iris | iris4d)
- basic_machine=mips-sgi
- case $os in
- -irix*)
- ;;
- *)
- os=-irix4
- ;;
- esac
- ;;
- isi68 | isi)
- basic_machine=m68k-isi
- os=-sysv
- ;;
- m68knommu)
- basic_machine=m68k-unknown
- os=-linux
- ;;
- m68knommu-*)
- basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
- os=-linux
- ;;
- m88k-omron*)
- basic_machine=m88k-omron
- ;;
- magnum | m3230)
- basic_machine=mips-mips
- os=-sysv
- ;;
- merlin)
- basic_machine=ns32k-utek
- os=-sysv
- ;;
- mingw32)
- basic_machine=i386-pc
- os=-mingw32
- ;;
- mingw32ce)
- basic_machine=arm-unknown
- os=-mingw32ce
- ;;
- miniframe)
- basic_machine=m68000-convergent
- ;;
- *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
- basic_machine=m68k-atari
- os=-mint
- ;;
- mips3*-*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
- ;;
- mips3*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
- ;;
- monitor)
- basic_machine=m68k-rom68k
- os=-coff
- ;;
- morphos)
- basic_machine=powerpc-unknown
- os=-morphos
- ;;
- msdos)
- basic_machine=i386-pc
- os=-msdos
- ;;
- ms1-*)
- basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
- ;;
- mvs)
- basic_machine=i370-ibm
- os=-mvs
- ;;
- ncr3000)
- basic_machine=i486-ncr
- os=-sysv4
- ;;
- netbsd386)
- basic_machine=i386-unknown
- os=-netbsd
- ;;
- netwinder)
- basic_machine=armv4l-rebel
- os=-linux
- ;;
- news | news700 | news800 | news900)
- basic_machine=m68k-sony
- os=-newsos
- ;;
- news1000)
- basic_machine=m68030-sony
- os=-newsos
- ;;
- news-3600 | risc-news)
- basic_machine=mips-sony
- os=-newsos
- ;;
- necv70)
- basic_machine=v70-nec
- os=-sysv
- ;;
- next | m*-next )
- basic_machine=m68k-next
- case $os in
- -nextstep* )
- ;;
- -ns2*)
- os=-nextstep2
- ;;
- *)
- os=-nextstep3
- ;;
- esac
- ;;
- nh3000)
- basic_machine=m68k-harris
- os=-cxux
- ;;
- nh[45]000)
- basic_machine=m88k-harris
- os=-cxux
- ;;
- nindy960)
- basic_machine=i960-intel
- os=-nindy
- ;;
- mon960)
- basic_machine=i960-intel
- os=-mon960
- ;;
- nonstopux)
- basic_machine=mips-compaq
- os=-nonstopux
- ;;
- np1)
- basic_machine=np1-gould
- ;;
- nsr-tandem)
- basic_machine=nsr-tandem
- ;;
- op50n-* | op60c-*)
- basic_machine=hppa1.1-oki
- os=-proelf
- ;;
- openrisc | openrisc-*)
- basic_machine=or32-unknown
- ;;
- os400)
- basic_machine=powerpc-ibm
- os=-os400
- ;;
- OSE68000 | ose68000)
- basic_machine=m68000-ericsson
- os=-ose
- ;;
- os68k)
- basic_machine=m68k-none
- os=-os68k
- ;;
- pa-hitachi)
- basic_machine=hppa1.1-hitachi
- os=-hiuxwe2
- ;;
- paragon)
- basic_machine=i860-intel
- os=-osf
- ;;
- parisc)
- basic_machine=hppa-unknown
- os=-linux
- ;;
- parisc-*)
- basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
- os=-linux
- ;;
- pbd)
- basic_machine=sparc-tti
- ;;
- pbb)
- basic_machine=m68k-tti
- ;;
- pc532 | pc532-*)
- basic_machine=ns32k-pc532
- ;;
- pc98)
- basic_machine=i386-pc
- ;;
- pc98-*)
- basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentium | p5 | k5 | k6 | nexgen | viac3)
- basic_machine=i586-pc
- ;;
- pentiumpro | p6 | 6x86 | athlon | athlon_*)
- basic_machine=i686-pc
- ;;
- pentiumii | pentium2 | pentiumiii | pentium3)
- basic_machine=i686-pc
- ;;
- pentium4)
- basic_machine=i786-pc
- ;;
- pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
- basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentiumpro-* | p6-* | 6x86-* | athlon-*)
- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentium4-*)
- basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pn)
- basic_machine=pn-gould
- ;;
- power) basic_machine=power-ibm
- ;;
- ppc) basic_machine=powerpc-unknown
- ;;
- ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppcle | powerpclittle | ppc-le | powerpc-little)
- basic_machine=powerpcle-unknown
- ;;
- ppcle-* | powerpclittle-*)
- basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppc64) basic_machine=powerpc64-unknown
- ;;
- ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppc64le | powerpc64little | ppc64-le | powerpc64-little)
- basic_machine=powerpc64le-unknown
- ;;
- ppc64le-* | powerpc64little-*)
- basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ps2)
- basic_machine=i386-ibm
- ;;
- pw32)
- basic_machine=i586-unknown
- os=-pw32
- ;;
- rdos)
- basic_machine=i386-pc
- os=-rdos
- ;;
- rom68k)
- basic_machine=m68k-rom68k
- os=-coff
- ;;
- rm[46]00)
- basic_machine=mips-siemens
- ;;
- rtpc | rtpc-*)
- basic_machine=romp-ibm
- ;;
- s390 | s390-*)
- basic_machine=s390-ibm
- ;;
- s390x | s390x-*)
- basic_machine=s390x-ibm
- ;;
- sa29200)
- basic_machine=a29k-amd
- os=-udi
- ;;
- sb1)
- basic_machine=mipsisa64sb1-unknown
- ;;
- sb1el)
- basic_machine=mipsisa64sb1el-unknown
- ;;
- sde)
- basic_machine=mipsisa32-sde
- os=-elf
- ;;
- sei)
- basic_machine=mips-sei
- os=-seiux
- ;;
- sequent)
- basic_machine=i386-sequent
- ;;
- sh)
- basic_machine=sh-hitachi
- os=-hms
- ;;
- sh5el)
- basic_machine=sh5le-unknown
- ;;
- sh64)
- basic_machine=sh64-unknown
- ;;
- sparclite-wrs | simso-wrs)
- basic_machine=sparclite-wrs
- os=-vxworks
- ;;
- sps7)
- basic_machine=m68k-bull
- os=-sysv2
- ;;
- spur)
- basic_machine=spur-unknown
- ;;
- st2000)
- basic_machine=m68k-tandem
- ;;
- stratus)
- basic_machine=i860-stratus
- os=-sysv4
- ;;
- sun2)
- basic_machine=m68000-sun
- ;;
- sun2os3)
- basic_machine=m68000-sun
- os=-sunos3
- ;;
- sun2os4)
- basic_machine=m68000-sun
- os=-sunos4
- ;;
- sun3os3)
- basic_machine=m68k-sun
- os=-sunos3
- ;;
- sun3os4)
- basic_machine=m68k-sun
- os=-sunos4
- ;;
- sun4os3)
- basic_machine=sparc-sun
- os=-sunos3
- ;;
- sun4os4)
- basic_machine=sparc-sun
- os=-sunos4
- ;;
- sun4sol2)
- basic_machine=sparc-sun
- os=-solaris2
- ;;
- sun3 | sun3-*)
- basic_machine=m68k-sun
- ;;
- sun4)
- basic_machine=sparc-sun
- ;;
- sun386 | sun386i | roadrunner)
- basic_machine=i386-sun
- ;;
- sv1)
- basic_machine=sv1-cray
- os=-unicos
- ;;
- symmetry)
- basic_machine=i386-sequent
- os=-dynix
- ;;
- t3e)
- basic_machine=alphaev5-cray
- os=-unicos
- ;;
- t90)
- 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
- os=-linux-gnu
- ;;
- tx39)
- basic_machine=mipstx39-unknown
- ;;
- tx39el)
- basic_machine=mipstx39el-unknown
- ;;
- toad1)
- basic_machine=pdp10-xkl
- os=-tops20
- ;;
- tower | tower-32)
- basic_machine=m68k-ncr
- ;;
- tpf)
- basic_machine=s390x-ibm
- os=-tpf
- ;;
- udi29k)
- basic_machine=a29k-amd
- os=-udi
- ;;
- ultra3)
- basic_machine=a29k-nyu
- os=-sym1
- ;;
- v810 | necv810)
- basic_machine=v810-nec
- os=-none
- ;;
- vaxv)
- basic_machine=vax-dec
- os=-sysv
- ;;
- vms)
- basic_machine=vax-dec
- os=-vms
- ;;
- vpp*|vx|vx-*)
- basic_machine=f301-fujitsu
- ;;
- vxworks960)
- basic_machine=i960-wrs
- os=-vxworks
- ;;
- vxworks68)
- basic_machine=m68k-wrs
- os=-vxworks
- ;;
- vxworks29k)
- basic_machine=a29k-wrs
- os=-vxworks
- ;;
- w65*)
- basic_machine=w65-wdc
- os=-none
- ;;
- w89k-*)
- basic_machine=hppa1.1-winbond
- os=-proelf
- ;;
- xbox)
- basic_machine=i686-pc
- os=-mingw32
- ;;
- xps | xps100)
- basic_machine=xps100-honeywell
- ;;
- ymp)
- basic_machine=ymp-cray
- os=-unicos
- ;;
- z8k-*-coff)
- basic_machine=z8k-unknown
- os=-sim
- ;;
- z80-*-coff)
- basic_machine=z80-unknown
- os=-sim
- ;;
- none)
- basic_machine=none-none
- os=-none
- ;;
-
-# Here we handle the default manufacturer of certain CPU types. It is in
-# some cases the only manufacturer, in others, it is the most popular.
- w89k)
- basic_machine=hppa1.1-winbond
- ;;
- op50n)
- basic_machine=hppa1.1-oki
- ;;
- op60c)
- basic_machine=hppa1.1-oki
- ;;
- romp)
- basic_machine=romp-ibm
- ;;
- mmix)
- basic_machine=mmix-knuth
- ;;
- rs6000)
- basic_machine=rs6000-ibm
- ;;
- vax)
- basic_machine=vax-dec
- ;;
- pdp10)
- # there are many clones, so DEC is not a safe bet
- basic_machine=pdp10-unknown
- ;;
- pdp11)
- basic_machine=pdp11-dec
- ;;
- we32k)
- basic_machine=we32k-att
- ;;
- sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
- basic_machine=sh-unknown
- ;;
- sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
- basic_machine=sparc-sun
- ;;
- cydra)
- basic_machine=cydra-cydrome
- ;;
- orion)
- basic_machine=orion-highlevel
- ;;
- orion105)
- basic_machine=clipper-highlevel
- ;;
- mac | mpw | mac-mpw)
- basic_machine=m68k-apple
- ;;
- pmac | pmac-mpw)
- basic_machine=powerpc-apple
- ;;
- *-unknown)
- # Make sure to match an already-canonicalized machine name.
- ;;
- *)
- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
- exit 1
- ;;
-esac
-
-# Here we canonicalize certain aliases for manufacturers.
-case $basic_machine in
- *-digital*)
- basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
- ;;
- *-commodore*)
- basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
- ;;
- *)
- ;;
-esac
-
-# Decode manufacturer-specific aliases for certain operating systems.
-
-if [ x"$os" != x"" ]
-then
-case $os in
- # First match some system type aliases
- # that might get confused with valid system types.
- # -solaris* is a basic system type, with this one exception.
- -solaris1 | -solaris1.*)
- os=`echo $os | sed -e 's|solaris1|sunos4|'`
- ;;
- -solaris)
- os=-solaris2
- ;;
- -svr4*)
- os=-sysv4
- ;;
- -unixware*)
- os=-sysv4.2uw
- ;;
- -gnu/linux*)
- os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
- ;;
- # First accept the basic system types.
- # The portable systems comes first.
- # Each alternative MUST END IN A *, to match a version number.
- # -sysv* is not here because it comes later, after sysvr4.
- -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
- | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
- | -hpux* | -unos* | -osf* | -luna* | -dgux* | -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* \
- | -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* \
- | -uxpv* | -beos* | -mpeix* | -udk* \
- | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
- | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
- | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
- | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
- | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
- | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
- | -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
- # Remember, each alternative MUST END IN *, to match a version number.
- ;;
- -qnx*)
- case $basic_machine in
- x86-* | i*86-*)
- ;;
- *)
- os=-nto$os
- ;;
- esac
- ;;
- -nto-qnx*)
- ;;
- -nto*)
- os=`echo $os | sed -e 's|nto|nto-qnx|'`
- ;;
- -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
- | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
- | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
- ;;
- -mac*)
- os=`echo $os | sed -e 's|mac|macos|'`
- ;;
- -linux-dietlibc)
- os=-linux-dietlibc
- ;;
- -linux*)
- os=`echo $os | sed -e 's|linux|linux-gnu|'`
- ;;
- -sunos5*)
- os=`echo $os | sed -e 's|sunos5|solaris2|'`
- ;;
- -sunos6*)
- os=`echo $os | sed -e 's|sunos6|solaris3|'`
- ;;
- -opened*)
- os=-openedition
- ;;
- -os400*)
- os=-os400
- ;;
- -wince*)
- os=-wince
- ;;
- -osfrose*)
- os=-osfrose
- ;;
- -osf*)
- os=-osf
- ;;
- -utek*)
- os=-bsd
- ;;
- -dynix*)
- os=-bsd
- ;;
- -acis*)
- os=-aos
- ;;
- -atheos*)
- os=-atheos
- ;;
- -syllable*)
- os=-syllable
- ;;
- -386bsd)
- os=-bsd
- ;;
- -ctix* | -uts*)
- os=-sysv
- ;;
- -nova*)
- os=-rtmk-nova
- ;;
- -ns2 )
- os=-nextstep2
- ;;
- -nsk*)
- os=-nsk
- ;;
- # Preserve the version number of sinix5.
- -sinix5.*)
- os=`echo $os | sed -e 's|sinix|sysv|'`
- ;;
- -sinix*)
- os=-sysv4
- ;;
- -tpf*)
- os=-tpf
- ;;
- -triton*)
- os=-sysv3
- ;;
- -oss*)
- os=-sysv3
- ;;
- -svr4)
- os=-sysv4
- ;;
- -svr3)
- os=-sysv3
- ;;
- -sysvr4)
- os=-sysv4
- ;;
- # This must come after -sysvr4.
- -sysv*)
- ;;
- -ose*)
- os=-ose
- ;;
- -es1800*)
- os=-ose
- ;;
- -xenix)
- os=-xenix
- ;;
- -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
- os=-mint
- ;;
- -aros*)
- os=-aros
- ;;
- -kaos*)
- os=-kaos
- ;;
- -zvmoe)
- os=-zvmoe
- ;;
- -dicos*)
- os=-dicos
- ;;
- -none)
- ;;
- *)
- # Get rid of the `-' at the beginning of $os.
- os=`echo $os | sed 's/[^-]*-//'`
- echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
- exit 1
- ;;
-esac
-else
-
-# Here we handle the default operating systems that come with various machines.
-# The value should be what the vendor currently ships out the door with their
-# machine or put another way, the most popular os provided with the machine.
-
-# Note that if you're going to try to match "-MANUFACTURER" here (say,
-# "-sun"), then you have to tell the case statement up towards the top
-# that MANUFACTURER isn't an operating system. Otherwise, code above
-# will signal an error saying that MANUFACTURER isn't an operating
-# system, and we'll never get to this point.
-
-case $basic_machine in
- score-*)
- os=-elf
- ;;
- spu-*)
- os=-elf
- ;;
- *-acorn)
- os=-riscix1.2
- ;;
- arm*-rebel)
- os=-linux
- ;;
- arm*-semi)
- os=-aout
- ;;
- c4x-* | tic4x-*)
- os=-coff
- ;;
- # This must come before the *-dec entry.
- pdp10-*)
- os=-tops20
- ;;
- pdp11-*)
- os=-none
- ;;
- *-dec | vax-*)
- os=-ultrix4.2
- ;;
- m68*-apollo)
- os=-domain
- ;;
- i386-sun)
- os=-sunos4.0.2
- ;;
- m68000-sun)
- os=-sunos3
- # This also exists in the configure program, but was not the
- # default.
- # os=-sunos4
- ;;
- m68*-cisco)
- os=-aout
- ;;
- mep-*)
- os=-elf
- ;;
- mips*-cisco)
- os=-elf
- ;;
- mips*-*)
- os=-elf
- ;;
- or32-*)
- os=-coff
- ;;
- *-tti) # must be before sparc entry or we get the wrong os.
- os=-sysv3
- ;;
- sparc-* | *-sun)
- os=-sunos4.1.1
- ;;
- *-be)
- os=-beos
- ;;
- *-haiku)
- os=-haiku
- ;;
- *-ibm)
- os=-aix
- ;;
- *-knuth)
- os=-mmixware
- ;;
- *-wec)
- os=-proelf
- ;;
- *-winbond)
- os=-proelf
- ;;
- *-oki)
- os=-proelf
- ;;
- *-hp)
- os=-hpux
- ;;
- *-hitachi)
- os=-hiux
- ;;
- i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
- os=-sysv
- ;;
- *-cbm)
- os=-amigaos
- ;;
- *-dg)
- os=-dgux
- ;;
- *-dolphin)
- os=-sysv3
- ;;
- m68k-ccur)
- os=-rtu
- ;;
- m88k-omron*)
- os=-luna
- ;;
- *-next )
- os=-nextstep
- ;;
- *-sequent)
- os=-ptx
- ;;
- *-crds)
- os=-unos
- ;;
- *-ns)
- os=-genix
- ;;
- i370-*)
- os=-mvs
- ;;
- *-next)
- os=-nextstep3
- ;;
- *-gould)
- os=-sysv
- ;;
- *-highlevel)
- os=-bsd
- ;;
- *-encore)
- os=-bsd
- ;;
- *-sgi)
- os=-irix
- ;;
- *-siemens)
- os=-sysv4
- ;;
- *-masscomp)
- os=-rtu
- ;;
- f30[01]-fujitsu | f700-fujitsu)
- os=-uxpv
- ;;
- *-rom68k)
- os=-coff
- ;;
- *-*bug)
- os=-coff
- ;;
- *-apple)
- os=-macos
- ;;
- *-atari*)
- os=-mint
- ;;
- *)
- os=-none
- ;;
-esac
-fi
-
-# Here we handle the case where we know the os, and the CPU type, but not the
-# manufacturer. We pick the logical manufacturer.
-vendor=unknown
-case $basic_machine in
- *-unknown)
- case $os in
- -riscix*)
- vendor=acorn
- ;;
- -sunos*)
- vendor=sun
- ;;
- -aix*)
- vendor=ibm
- ;;
- -beos*)
- vendor=be
- ;;
- -hpux*)
- vendor=hp
- ;;
- -mpeix*)
- vendor=hp
- ;;
- -hiux*)
- vendor=hitachi
- ;;
- -unos*)
- vendor=crds
- ;;
- -dgux*)
- vendor=dg
- ;;
- -luna*)
- vendor=omron
- ;;
- -genix*)
- vendor=ns
- ;;
- -mvs* | -opened*)
- vendor=ibm
- ;;
- -os400*)
- vendor=ibm
- ;;
- -ptx*)
- vendor=sequent
- ;;
- -tpf*)
- vendor=ibm
- ;;
- -vxsim* | -vxworks* | -windiss*)
- vendor=wrs
- ;;
- -aux*)
- vendor=apple
- ;;
- -hms*)
- vendor=hitachi
- ;;
- -mpw* | -macos*)
- vendor=apple
- ;;
- -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
- vendor=atari
- ;;
- -vos*)
- vendor=stratus
- ;;
- esac
- basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
- ;;
-esac
-
-echo $basic_machine$os
-exit
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
diff --git a/chromium/third_party/talloc/configure b/chromium/third_party/talloc/configure
deleted file mode 100755
index c038976e386..00000000000
--- a/chromium/third_party/talloc/configure
+++ /dev/null
@@ -1,23592 +0,0 @@
-#! /bin/sh
-# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.63 for talloc 2.0.1.
-#
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
-# This configure script is free software; the Free Software Foundation
-# gives unlimited permission to copy, distribute and modify it.
-## --------------------- ##
-## M4sh Initialization. ##
-## --------------------- ##
-
-# Be more Bourne compatible
-DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
- emulate sh
- NULLCMD=:
- # Pre-4.2 versions of Zsh do 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
-
-
-
-
-# PATH needs CR
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-as_nl='
-'
-export as_nl
-# Printing a long string crashes Solaris 7 /usr/bin/printf.
-as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
-if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
- as_echo='printf %s\n'
- as_echo_n='printf %s'
-else
- if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
- as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
- as_echo_n='/usr/ucb/echo -n'
- else
- as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
- as_echo_n_body='eval
- arg=$1;
- case $arg in
- *"$as_nl"*)
- expr "X$arg" : "X\\(.*\\)$as_nl";
- arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
- esac;
- expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
- '
- export as_echo_n_body
- as_echo_n='sh -c $as_echo_n_body as_echo'
- fi
- export as_echo_body
- as_echo='sh -c $as_echo_body as_echo'
-fi
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- PATH_SEPARATOR=:
- (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
- (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
- PATH_SEPARATOR=';'
- }
-fi
-
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
- as_unset=unset
-else
- as_unset=false
-fi
-
-
-# IFS
-# We need space, tab and new line, in precisely that order. Quoting is
-# there to prevent editors from complaining about space-tab.
-# (If _AS_PATH_WALK were called with IFS unset, it would disable word
-# splitting by setting IFS to empty value.)
-IFS=" "" $as_nl"
-
-# Find who we are. Look in the path if we contain no directory separator.
-case $0 in
- *[\\/]* ) as_myself=$0 ;;
- *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
-IFS=$as_save_IFS
-
- ;;
-esac
-# We did not find ourselves, most probably we were run as `sh COMMAND'
-# in which case we are not to be found in the path.
-if test "x$as_myself" = x; then
- as_myself=$0
-fi
-if test ! -f "$as_myself"; then
- $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
- { (exit 1); exit 1; }
-fi
-
-# Work around bugs in pre-3.0 UWIN ksh.
-for as_var in ENV MAIL MAILPATH
-do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
-done
-PS1='$ '
-PS2='> '
-PS4='+ '
-
-# NLS nuisances.
-LC_ALL=C
-export LC_ALL
-LANGUAGE=C
-export LANGUAGE
-
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1 &&
- test "X`expr 00001 : '.*\(...\)'`" = X001; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
- as_basename=basename
-else
- as_basename=false
-fi
-
-
-# Name of the executable.
-as_me=`$as_basename -- "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
- X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X/"$0" |
- sed '/^.*\/\([^/][^/]*\)\/*$/{
- s//\1/
- q
- }
- /^X\/\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\/\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
-
-# CDPATH.
-$as_unset CDPATH
-
-
-if test "x$CONFIG_SHELL" = x; then
- if (eval ":") 2>/dev/null; then
- as_have_required=yes
-else
- as_have_required=no
-fi
-
- if test $as_have_required = yes && (eval ":
-(as_func_return () {
- (exit \$1)
-}
-as_func_success () {
- as_func_return 0
-}
-as_func_failure () {
- as_func_return 1
-}
-as_func_ret_success () {
- return 0
-}
-as_func_ret_failure () {
- return 1
-}
-
-exitcode=0
-if as_func_success; then
- :
-else
- exitcode=1
- echo as_func_success failed.
-fi
-
-if as_func_failure; then
- exitcode=1
- echo as_func_failure succeeded.
-fi
-
-if as_func_ret_success; then
- :
-else
- exitcode=1
- echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
- exitcode=1
- echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
- :
-else
- exitcode=1
- echo positional parameters were not saved.
-fi
-
-test \$exitcode = 0) || { (exit 1); exit 1; }
-
-(
- as_lineno_1=\$LINENO
- as_lineno_2=\$LINENO
- test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
- test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
-") 2> /dev/null; then
- :
-else
- as_candidate_shells=
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- case $as_dir in
- /*)
- for as_base in sh bash ksh sh5; do
- as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
- done;;
- esac
-done
-IFS=$as_save_IFS
-
-
- for as_shell in $as_candidate_shells $SHELL; do
- # Try only shells that exist, to save several forks.
- if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
- { ("$as_shell") 2> /dev/null <<\_ASEOF
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
- emulate sh
- NULLCMD=:
- # Pre-4.2 versions of Zsh do 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
-
-
-:
-_ASEOF
-}; then
- CONFIG_SHELL=$as_shell
- as_have_required=yes
- if { "$as_shell" 2> /dev/null <<\_ASEOF
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
- emulate sh
- NULLCMD=:
- # Pre-4.2 versions of Zsh do 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
-
-
-:
-(as_func_return () {
- (exit $1)
-}
-as_func_success () {
- as_func_return 0
-}
-as_func_failure () {
- as_func_return 1
-}
-as_func_ret_success () {
- return 0
-}
-as_func_ret_failure () {
- return 1
-}
-
-exitcode=0
-if as_func_success; then
- :
-else
- exitcode=1
- echo as_func_success failed.
-fi
-
-if as_func_failure; then
- exitcode=1
- echo as_func_failure succeeded.
-fi
-
-if as_func_ret_success; then
- :
-else
- exitcode=1
- echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
- exitcode=1
- echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = "$1" ); then
- :
-else
- exitcode=1
- echo positional parameters were not saved.
-fi
-
-test $exitcode = 0) || { (exit 1); exit 1; }
-
-(
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
-
-_ASEOF
-}; then
- break
-fi
-
-fi
-
- done
-
- if test "x$CONFIG_SHELL" != x; then
- for as_var in BASH_ENV ENV
- do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
- done
- export CONFIG_SHELL
- exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
-fi
-
-
- if test $as_have_required = no; then
- echo This script requires a shell more modern than all the
- echo shells that I found on your system. Please install a
- echo modern shell, or manually run the script under such a
- echo shell if you do have one.
- { (exit 1); exit 1; }
-fi
-
-
-fi
-
-fi
-
-
-
-(eval "as_func_return () {
- (exit \$1)
-}
-as_func_success () {
- as_func_return 0
-}
-as_func_failure () {
- as_func_return 1
-}
-as_func_ret_success () {
- return 0
-}
-as_func_ret_failure () {
- return 1
-}
-
-exitcode=0
-if as_func_success; then
- :
-else
- exitcode=1
- echo as_func_success failed.
-fi
-
-if as_func_failure; then
- exitcode=1
- echo as_func_failure succeeded.
-fi
-
-if as_func_ret_success; then
- :
-else
- exitcode=1
- echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
- exitcode=1
- echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
- :
-else
- exitcode=1
- echo positional parameters were not saved.
-fi
-
-test \$exitcode = 0") || {
- echo No shell found that supports shell functions.
- echo Please tell bug-autoconf@gnu.org about your system,
- echo including any error possibly output before this message.
- echo This can help us improve future autoconf versions.
- echo Configuration will now proceed without shell functions.
-}
-
-
-
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
-
- # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
- # uniformly replaced by the line number. The first 'sed' inserts a
- # line-number line after each line using $LINENO; the second 'sed'
- # does the real work. The second script uses 'N' to pair each
- # line-number line with the line containing $LINENO, and appends
- # trailing '-' during substitution so that $LINENO is not a special
- # case at line end.
- # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
- # scripts with optimization help from Paolo Bonzini. Blame Lee
- # E. McMahon (1931-1989) for sed's syntax. :-)
- sed -n '
- p
- /[$]LINENO/=
- ' <$as_myself |
- sed '
- s/[$]LINENO.*/&-/
- t lineno
- b
- :lineno
- N
- :loop
- s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
- t loop
- s/-\n.*//
- ' >$as_me.lineno &&
- chmod +x "$as_me.lineno" ||
- { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
- { (exit 1); exit 1; }; }
-
- # 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).
- . "./$as_me.lineno"
- # Exit status is that of the last command.
- exit
-}
-
-
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
- as_dirname=dirname
-else
- as_dirname=false
-fi
-
-ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in
--n*)
- case `echo 'x\c'` in
- *c*) ECHO_T=' ';; # ECHO_T is single tab character.
- *) ECHO_C='\c';;
- esac;;
-*)
- ECHO_N='-n';;
-esac
-if expr a : '\(a\)' >/dev/null 2>&1 &&
- test "X`expr 00001 : '.*\(...\)'`" = X001; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-rm -f conf$$ conf$$.exe conf$$.file
-if test -d conf$$.dir; then
- rm -f conf$$.dir/conf$$.file
-else
- rm -f conf$$.dir
- mkdir conf$$.dir 2>/dev/null
-fi
-if (echo >conf$$.file) 2>/dev/null; then
- if ln -s conf$$.file conf$$ 2>/dev/null; then
- as_ln_s='ln -s'
- # ... 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'.
- ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
- as_ln_s='cp -p'
- 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'
-fi
-rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
-rmdir conf$$.dir 2>/dev/null
-
-if mkdir -p . 2>/dev/null; then
- as_mkdir_p=:
-else
- test -d ./-p && rmdir ./-p
- 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
-
-# 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'"
-
-# Sed expression to map a string onto a valid variable name.
-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-
-
-
-exec 7<&0 </dev/null 6>&1
-
-# Name of the host.
-# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
-# so uname gets run too.
-ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
-
-#
-# Initializations.
-#
-ac_default_prefix=/usr/local
-ac_clean_files=
-ac_config_libobj_dir=.
-LIBOBJS=
-cross_compiling=no
-subdirs=
-MFLAGS=
-MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
-
-# Identity of this package.
-PACKAGE_NAME='talloc'
-PACKAGE_TARNAME='talloc'
-PACKAGE_VERSION='2.0.1'
-PACKAGE_STRING='talloc 2.0.1'
-PACKAGE_BUGREPORT=''
-
-ac_unique_file="talloc.c"
-# Factoring default headers for most tests.
-ac_includes_default="\
-#include <stdio.h>
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-#ifdef STDC_HEADERS
-# include <stdlib.h>
-# include <stddef.h>
-#else
-# ifdef HAVE_STDLIB_H
-# include <stdlib.h>
-# endif
-#endif
-#ifdef HAVE_STRING_H
-# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
-# include <memory.h>
-# endif
-# include <string.h>
-#endif
-#ifdef HAVE_STRINGS_H
-# include <strings.h>
-#endif
-#ifdef HAVE_INTTYPES_H
-# include <inttypes.h>
-#endif
-#ifdef HAVE_STDINT_H
-# include <stdint.h>
-#endif
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif"
-
-ac_subst_vars='LTLIBOBJS
-sharedbuilddir
-DOC_TARGET
-XSLTPROC
-TALLOC_COMPAT1_MK
-EXPORTSFILE
-TALLOC_LIBS
-TALLOC_CFLAGS
-TALLOC_OBJ
-tallocdir
-SHLD_FLAGS
-LD_SHLIB_DISALLOW_UNDEF_FLAG
-LD_SHLIB_FLAGS
-SHLD
-LD_SHLIB_LINKER
-VERSIONSCRIPT
-SONAMEFLAG
-SHLIBEXT
-PICFLAG
-LIBDL
-LIBOBJS
-libreplace_cv_immediate_structures
-INSTALL_DATA
-INSTALL_SCRIPT
-INSTALL_PROGRAM
-EGREP
-GREP
-CPP
-OBJEXT
-EXEEXT
-ac_ct_CC
-CPPFLAGS
-LDFLAGS
-CFLAGS
-CC
-target_os
-target_vendor
-target_cpu
-target
-host_os
-host_vendor
-host_cpu
-host
-build_os
-build_vendor
-build_cpu
-build
-LIBREPLACEOBJ
-libreplacedir
-TALLOC_VERSION_RELEASE
-TALLOC_VERSION_MINOR
-TALLOC_VERSION_MAJOR
-TALLOC_VERSION
-target_alias
-host_alias
-build_alias
-LIBS
-ECHO_T
-ECHO_N
-ECHO_C
-DEFS
-mandir
-localedir
-libdir
-psdir
-pdfdir
-dvidir
-htmldir
-infodir
-docdir
-oldincludedir
-includedir
-localstatedir
-sharedstatedir
-sysconfdir
-datadir
-datarootdir
-libexecdir
-sbindir
-bindir
-program_transform_name
-prefix
-exec_prefix
-PACKAGE_BUGREPORT
-PACKAGE_STRING
-PACKAGE_VERSION
-PACKAGE_TARNAME
-PACKAGE_NAME
-PATH_SEPARATOR
-SHELL'
-ac_subst_files=''
-ac_user_opts='
-enable_option_checking
-enable_largefile
-enable_talloc_compat1
-with_shared_build_dir
-'
- ac_precious_vars='build_alias
-host_alias
-target_alias
-CC
-CFLAGS
-LDFLAGS
-LIBS
-CPPFLAGS
-CPP'
-
-
-# Initialize some variables set by options.
-ac_init_help=
-ac_init_version=false
-ac_unrecognized_opts=
-ac_unrecognized_sep=
-# The variables have the same names as the options, with
-# dashes changed to underlines.
-cache_file=/dev/null
-exec_prefix=NONE
-no_create=
-no_recursion=
-prefix=NONE
-program_prefix=NONE
-program_suffix=NONE
-program_transform_name=s,x,x,
-silent=
-site=
-srcdir=
-verbose=
-x_includes=NONE
-x_libraries=NONE
-
-# Installation directory options.
-# These are left unexpanded so users can "make install exec_prefix=/foo"
-# and all the variables that are supposed to be based on exec_prefix
-# by default will actually change.
-# Use braces instead of parens because sh, perl, etc. also accept them.
-# (The list follows the same order as the GNU Coding Standards.)
-bindir='${exec_prefix}/bin'
-sbindir='${exec_prefix}/sbin'
-libexecdir='${exec_prefix}/libexec'
-datarootdir='${prefix}/share'
-datadir='${datarootdir}'
-sysconfdir='${prefix}/etc'
-sharedstatedir='${prefix}/com'
-localstatedir='${prefix}/var'
-includedir='${prefix}/include'
-oldincludedir='/usr/include'
-docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
-infodir='${datarootdir}/info'
-htmldir='${docdir}'
-dvidir='${docdir}'
-pdfdir='${docdir}'
-psdir='${docdir}'
-libdir='${exec_prefix}/lib'
-localedir='${datarootdir}/locale'
-mandir='${datarootdir}/man'
-
-ac_prev=
-ac_dashdash=
-for ac_option
-do
- # If the previous option needs an argument, assign it.
- if test -n "$ac_prev"; then
- eval $ac_prev=\$ac_option
- ac_prev=
- continue
- fi
-
- case $ac_option in
- *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
- *) ac_optarg=yes ;;
- esac
-
- # Accept the important Cygnus configure options, so we can diagnose typos.
-
- case $ac_dashdash$ac_option in
- --)
- ac_dashdash=yes ;;
-
- -bindir | --bindir | --bindi | --bind | --bin | --bi)
- ac_prev=bindir ;;
- -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
- bindir=$ac_optarg ;;
-
- -build | --build | --buil | --bui | --bu)
- ac_prev=build_alias ;;
- -build=* | --build=* | --buil=* | --bui=* | --bu=*)
- build_alias=$ac_optarg ;;
-
- -cache-file | --cache-file | --cache-fil | --cache-fi \
- | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
- ac_prev=cache_file ;;
- -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
- | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
- cache_file=$ac_optarg ;;
-
- --config-cache | -C)
- cache_file=config.cache ;;
-
- -datadir | --datadir | --datadi | --datad)
- ac_prev=datadir ;;
- -datadir=* | --datadir=* | --datadi=* | --datad=*)
- datadir=$ac_optarg ;;
-
- -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
- | --dataroo | --dataro | --datar)
- ac_prev=datarootdir ;;
- -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
- | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
- datarootdir=$ac_optarg ;;
-
- -disable-* | --disable-*)
- 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_echo "$as_me: error: invalid feature name: $ac_useropt" >&2
- { (exit 1); exit 1; }; }
- ac_useropt_orig=$ac_useropt
- ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
- case $ac_user_opts in
- *"
-"enable_$ac_useropt"
-"*) ;;
- *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
- ac_unrecognized_sep=', ';;
- esac
- eval enable_$ac_useropt=no ;;
-
- -docdir | --docdir | --docdi | --doc | --do)
- ac_prev=docdir ;;
- -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
- docdir=$ac_optarg ;;
-
- -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
- ac_prev=dvidir ;;
- -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
- dvidir=$ac_optarg ;;
-
- -enable-* | --enable-*)
- 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_echo "$as_me: error: invalid feature name: $ac_useropt" >&2
- { (exit 1); exit 1; }; }
- ac_useropt_orig=$ac_useropt
- ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
- case $ac_user_opts in
- *"
-"enable_$ac_useropt"
-"*) ;;
- *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
- ac_unrecognized_sep=', ';;
- esac
- eval enable_$ac_useropt=\$ac_optarg ;;
-
- -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
- | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
- | --exec | --exe | --ex)
- ac_prev=exec_prefix ;;
- -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
- | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
- | --exec=* | --exe=* | --ex=*)
- exec_prefix=$ac_optarg ;;
-
- -gas | --gas | --ga | --g)
- # Obsolete; use --with-gas.
- with_gas=yes ;;
-
- -help | --help | --hel | --he | -h)
- ac_init_help=long ;;
- -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
- ac_init_help=recursive ;;
- -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
- ac_init_help=short ;;
-
- -host | --host | --hos | --ho)
- ac_prev=host_alias ;;
- -host=* | --host=* | --hos=* | --ho=*)
- host_alias=$ac_optarg ;;
-
- -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
- ac_prev=htmldir ;;
- -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
- | --ht=*)
- htmldir=$ac_optarg ;;
-
- -includedir | --includedir | --includedi | --included | --include \
- | --includ | --inclu | --incl | --inc)
- ac_prev=includedir ;;
- -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
- | --includ=* | --inclu=* | --incl=* | --inc=*)
- includedir=$ac_optarg ;;
-
- -infodir | --infodir | --infodi | --infod | --info | --inf)
- ac_prev=infodir ;;
- -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
- infodir=$ac_optarg ;;
-
- -libdir | --libdir | --libdi | --libd)
- ac_prev=libdir ;;
- -libdir=* | --libdir=* | --libdi=* | --libd=*)
- libdir=$ac_optarg ;;
-
- -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
- | --libexe | --libex | --libe)
- ac_prev=libexecdir ;;
- -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
- | --libexe=* | --libex=* | --libe=*)
- libexecdir=$ac_optarg ;;
-
- -localedir | --localedir | --localedi | --localed | --locale)
- ac_prev=localedir ;;
- -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
- localedir=$ac_optarg ;;
-
- -localstatedir | --localstatedir | --localstatedi | --localstated \
- | --localstate | --localstat | --localsta | --localst | --locals)
- ac_prev=localstatedir ;;
- -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
- | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
- localstatedir=$ac_optarg ;;
-
- -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
- ac_prev=mandir ;;
- -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
- mandir=$ac_optarg ;;
-
- -nfp | --nfp | --nf)
- # Obsolete; use --without-fp.
- with_fp=no ;;
-
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c | -n)
- no_create=yes ;;
-
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
- no_recursion=yes ;;
-
- -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
- | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
- | --oldin | --oldi | --old | --ol | --o)
- ac_prev=oldincludedir ;;
- -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
- | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
- | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
- oldincludedir=$ac_optarg ;;
-
- -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
- ac_prev=prefix ;;
- -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
- prefix=$ac_optarg ;;
-
- -program-prefix | --program-prefix | --program-prefi | --program-pref \
- | --program-pre | --program-pr | --program-p)
- ac_prev=program_prefix ;;
- -program-prefix=* | --program-prefix=* | --program-prefi=* \
- | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
- program_prefix=$ac_optarg ;;
-
- -program-suffix | --program-suffix | --program-suffi | --program-suff \
- | --program-suf | --program-su | --program-s)
- ac_prev=program_suffix ;;
- -program-suffix=* | --program-suffix=* | --program-suffi=* \
- | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
- program_suffix=$ac_optarg ;;
-
- -program-transform-name | --program-transform-name \
- | --program-transform-nam | --program-transform-na \
- | --program-transform-n | --program-transform- \
- | --program-transform | --program-transfor \
- | --program-transfo | --program-transf \
- | --program-trans | --program-tran \
- | --progr-tra | --program-tr | --program-t)
- ac_prev=program_transform_name ;;
- -program-transform-name=* | --program-transform-name=* \
- | --program-transform-nam=* | --program-transform-na=* \
- | --program-transform-n=* | --program-transform-=* \
- | --program-transform=* | --program-transfor=* \
- | --program-transfo=* | --program-transf=* \
- | --program-trans=* | --program-tran=* \
- | --progr-tra=* | --program-tr=* | --program-t=*)
- program_transform_name=$ac_optarg ;;
-
- -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
- ac_prev=pdfdir ;;
- -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
- pdfdir=$ac_optarg ;;
-
- -psdir | --psdir | --psdi | --psd | --ps)
- ac_prev=psdir ;;
- -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
- psdir=$ac_optarg ;;
-
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil)
- silent=yes ;;
-
- -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
- ac_prev=sbindir ;;
- -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
- | --sbi=* | --sb=*)
- sbindir=$ac_optarg ;;
-
- -sharedstatedir | --sharedstatedir | --sharedstatedi \
- | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
- | --sharedst | --shareds | --shared | --share | --shar \
- | --sha | --sh)
- ac_prev=sharedstatedir ;;
- -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
- | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
- | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
- | --sha=* | --sh=*)
- sharedstatedir=$ac_optarg ;;
-
- -site | --site | --sit)
- ac_prev=site ;;
- -site=* | --site=* | --sit=*)
- site=$ac_optarg ;;
-
- -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
- ac_prev=srcdir ;;
- -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
- srcdir=$ac_optarg ;;
-
- -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
- | --syscon | --sysco | --sysc | --sys | --sy)
- ac_prev=sysconfdir ;;
- -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
- | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
- sysconfdir=$ac_optarg ;;
-
- -target | --target | --targe | --targ | --tar | --ta | --t)
- ac_prev=target_alias ;;
- -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
- target_alias=$ac_optarg ;;
-
- -v | -verbose | --verbose | --verbos | --verbo | --verb)
- verbose=yes ;;
-
- -version | --version | --versio | --versi | --vers | -V)
- ac_init_version=: ;;
-
- -with-* | --with-*)
- 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_echo "$as_me: error: invalid package name: $ac_useropt" >&2
- { (exit 1); exit 1; }; }
- ac_useropt_orig=$ac_useropt
- ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
- case $ac_user_opts in
- *"
-"with_$ac_useropt"
-"*) ;;
- *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
- ac_unrecognized_sep=', ';;
- esac
- eval with_$ac_useropt=\$ac_optarg ;;
-
- -without-* | --without-*)
- 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_echo "$as_me: error: invalid package name: $ac_useropt" >&2
- { (exit 1); exit 1; }; }
- ac_useropt_orig=$ac_useropt
- ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
- case $ac_user_opts in
- *"
-"with_$ac_useropt"
-"*) ;;
- *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
- ac_unrecognized_sep=', ';;
- esac
- eval with_$ac_useropt=no ;;
-
- --x)
- # Obsolete; use --with-x.
- with_x=yes ;;
-
- -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
- | --x-incl | --x-inc | --x-in | --x-i)
- ac_prev=x_includes ;;
- -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
- | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
- x_includes=$ac_optarg ;;
-
- -x-libraries | --x-libraries | --x-librarie | --x-librari \
- | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
- ac_prev=x_libraries ;;
- -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
- | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
- x_libraries=$ac_optarg ;;
-
- -*) { $as_echo "$as_me: error: unrecognized option: $ac_option
-Try \`$0 --help' for more information." >&2
- { (exit 1); exit 1; }; }
- ;;
-
- *=*)
- ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
- # Reject names that are not valid shell variable names.
- expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
- { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2
- { (exit 1); exit 1; }; }
- eval $ac_envvar=\$ac_optarg
- export $ac_envvar ;;
-
- *)
- # FIXME: should be removed in autoconf 3.0.
- $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}
- ;;
-
- esac
-done
-
-if test -n "$ac_prev"; then
- ac_option=--`echo $ac_prev | sed 's/_/-/g'`
- { $as_echo "$as_me: error: missing argument to $ac_option" >&2
- { (exit 1); exit 1; }; }
-fi
-
-if test -n "$ac_unrecognized_opts"; then
- case $enable_option_checking in
- no) ;;
- fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2
- { (exit 1); exit 1; }; } ;;
- *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
- esac
-fi
-
-# Check all directory arguments for consistency.
-for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
- datadir sysconfdir sharedstatedir localstatedir includedir \
- oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
- libdir localedir mandir
-do
- eval ac_val=\$$ac_var
- # Remove trailing slashes.
- case $ac_val in
- */ )
- ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
- eval $ac_var=\$ac_val;;
- esac
- # Be sure to have absolute directory names.
- case $ac_val in
- [\\/$]* | ?:[\\/]* ) continue;;
- NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
- esac
- { $as_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
- { (exit 1); exit 1; }; }
-done
-
-# There might be people who depend on the old broken behavior: `$host'
-# used to hold the argument of --host etc.
-# FIXME: To remove some day.
-build=$build_alias
-host=$host_alias
-target=$target_alias
-
-# FIXME: To remove some day.
-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
-fi
-
-ac_tool_prefix=
-test -n "$host_alias" && ac_tool_prefix=$host_alias-
-
-test "$silent" = yes && exec 6>/dev/null
-
-
-ac_pwd=`pwd` && test -n "$ac_pwd" &&
-ac_ls_di=`ls -di .` &&
-ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
- { $as_echo "$as_me: error: working directory cannot be determined" >&2
- { (exit 1); exit 1; }; }
-test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
- { $as_echo "$as_me: error: pwd does not report name of working directory" >&2
- { (exit 1); exit 1; }; }
-
-
-# Find the source files, if location was not specified.
-if test -z "$srcdir"; then
- ac_srcdir_defaulted=yes
- # Try the directory containing this script, then the parent directory.
- ac_confdir=`$as_dirname -- "$as_myself" ||
-$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$as_myself" : 'X\(//\)[^/]' \| \
- X"$as_myself" : 'X\(//\)$' \| \
- X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$as_myself" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
- srcdir=$ac_confdir
- if test ! -r "$srcdir/$ac_unique_file"; then
- srcdir=..
- fi
-else
- ac_srcdir_defaulted=no
-fi
-if test ! -r "$srcdir/$ac_unique_file"; then
- test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
- { $as_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
- { (exit 1); exit 1; }; }
-fi
-ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
-ac_abs_confdir=`(
- cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2
- { (exit 1); exit 1; }; }
- pwd)`
-# When building in place, set srcdir=.
-if test "$ac_abs_confdir" = "$ac_pwd"; then
- srcdir=.
-fi
-# Remove unnecessary trailing slashes from srcdir.
-# Double slashes in file names in object file debugging info
-# mess up M-x gdb in Emacs.
-case $srcdir in
-*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
-esac
-for ac_var in $ac_precious_vars; do
- eval ac_env_${ac_var}_set=\${${ac_var}+set}
- eval ac_env_${ac_var}_value=\$${ac_var}
- eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
- eval ac_cv_env_${ac_var}_value=\$${ac_var}
-done
-
-#
-# Report the --help message.
-#
-if test "$ac_init_help" = "long"; then
- # 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 talloc 2.0.1 to adapt to many kinds of systems.
-
-Usage: $0 [OPTION]... [VAR=VALUE]...
-
-To assign environment variables (e.g., CC, CFLAGS...), specify them as
-VAR=VALUE. See below for descriptions of some of the useful variables.
-
-Defaults for the options are specified in brackets.
-
-Configuration:
- -h, --help display this help and exit
- --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
- --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
- --srcdir=DIR find the sources in DIR [configure dir or \`..']
-
-Installation directories:
- --prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
- --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [PREFIX]
-
-By default, \`make install' will install all the files in
-\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
-an installation prefix other than \`$ac_default_prefix' using \`--prefix',
-for instance \`--prefix=\$HOME'.
-
-For better control, use the options below.
-
-Fine tuning of the installation directories:
- --bindir=DIR user executables [EPREFIX/bin]
- --sbindir=DIR system admin executables [EPREFIX/sbin]
- --libexecdir=DIR program executables [EPREFIX/libexec]
- --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
- --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
- --localstatedir=DIR modifiable single-machine data [PREFIX/var]
- --libdir=DIR object code libraries [EPREFIX/lib]
- --includedir=DIR C header files [PREFIX/include]
- --oldincludedir=DIR C header files for non-gcc [/usr/include]
- --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
- --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
- --infodir=DIR info documentation [DATAROOTDIR/info]
- --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
- --mandir=DIR man documentation [DATAROOTDIR/man]
- --docdir=DIR documentation root [DATAROOTDIR/doc/talloc]
- --htmldir=DIR html documentation [DOCDIR]
- --dvidir=DIR dvi documentation [DOCDIR]
- --pdfdir=DIR pdf documentation [DOCDIR]
- --psdir=DIR ps documentation [DOCDIR]
-_ACEOF
-
- cat <<\_ACEOF
-
-System types:
- --build=BUILD configure for building on BUILD [guessed]
- --host=HOST cross-compile to build programs to run on HOST [BUILD]
- --target=TARGET configure for building compilers for TARGET [HOST]
-_ACEOF
-fi
-
-if test -n "$ac_init_help"; then
- case $ac_init_help in
- short | recursive ) echo "Configuration of talloc 2.0.1:";;
- esac
- cat <<\_ACEOF
-
-Optional Features:
- --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-largefile omit support for large files
- --enable-talloc-compat1 Build talloc 1.x.x compat library [default=no]
-
-Optional Packages:
- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --with-shared-build-dir=DIR
- temporary build directory where libraries are
- installed [$srcdir/sharedbuild]
-
-Some influential environment variables:
- CC C compiler command
- CFLAGS C compiler flags
- LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
- nonstandard directory <lib dir>
- LIBS libraries to pass to the linker, e.g. -l<library>
- CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
- you have headers in a nonstandard directory <include dir>
- CPP C preprocessor
-
-Use these variables to override the choices made by `configure' or to help
-it to find libraries and programs with nonstandard names/locations.
-
-_ACEOF
-ac_status=$?
-fi
-
-if test "$ac_init_help" = "recursive"; then
- # If there are subdirs, report their specific --help.
- for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
- test -d "$ac_dir" ||
- { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
- continue
- ac_builddir=.
-
-case "$ac_dir" in
-.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
-*)
- ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
- # A ".." for each directory in $ac_dir_suffix.
- ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
- case $ac_top_builddir_sub in
- "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
- *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
- esac ;;
-esac
-ac_abs_top_builddir=$ac_pwd
-ac_abs_builddir=$ac_pwd$ac_dir_suffix
-# for backward compatibility:
-ac_top_builddir=$ac_top_build_prefix
-
-case $srcdir in
- .) # We are building in place.
- ac_srcdir=.
- ac_top_srcdir=$ac_top_builddir_sub
- ac_abs_top_srcdir=$ac_pwd ;;
- [\\/]* | ?:[\\/]* ) # Absolute name.
- ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir
- ac_abs_top_srcdir=$srcdir ;;
- *) # Relative name.
- ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_build_prefix$srcdir
- ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
-esac
-ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
-
- cd "$ac_dir" || { ac_status=$?; continue; }
- # Check for guested configure.
- if test -f "$ac_srcdir/configure.gnu"; then
- echo &&
- $SHELL "$ac_srcdir/configure.gnu" --help=recursive
- elif test -f "$ac_srcdir/configure"; then
- echo &&
- $SHELL "$ac_srcdir/configure" --help=recursive
- else
- $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
- fi || ac_status=$?
- cd "$ac_pwd" || { ac_status=$?; break; }
- done
-fi
-
-test -n "$ac_init_help" && exit $ac_status
-if $ac_init_version; then
- cat <<\_ACEOF
-talloc configure 2.0.1
-generated by GNU Autoconf 2.63
-
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
-This configure script is free software; the Free Software Foundation
-gives unlimited permission to copy, distribute and modify it.
-_ACEOF
- exit
-fi
-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 talloc $as_me 2.0.1, which was
-generated by GNU Autoconf 2.63. Invocation command line was
-
- $ $0 $@
-
-_ACEOF
-exec 5>>config.log
-{
-cat <<_ASUNAME
-## --------- ##
-## Platform. ##
-## --------- ##
-
-hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
-/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
-
-/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
-/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
-/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
-/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
-/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
-/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
-
-_ASUNAME
-
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- $as_echo "PATH: $as_dir"
-done
-IFS=$as_save_IFS
-
-} >&5
-
-cat >&5 <<_ACEOF
-
-
-## ----------- ##
-## Core tests. ##
-## ----------- ##
-
-_ACEOF
-
-
-# Keep a trace of the command line.
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Strip out --silent because we don't want to record it for future runs.
-# Also quote any args containing shell meta-characters.
-# Make two passes to allow for proper duplicate-argument suppression.
-ac_configure_args=
-ac_configure_args0=
-ac_configure_args1=
-ac_must_keep_next=false
-for ac_pass in 1 2
-do
- for ac_arg
- do
- case $ac_arg in
- -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil)
- continue ;;
- *\'*)
- ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
- esac
- case $ac_pass in
- 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
- 2)
- ac_configure_args1="$ac_configure_args1 '$ac_arg'"
- if test $ac_must_keep_next = true; then
- ac_must_keep_next=false # Got value, back to normal.
- else
- case $ac_arg in
- *=* | --config-cache | -C | -disable-* | --disable-* \
- | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
- | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
- | -with-* | --with-* | -without-* | --without-* | --x)
- case "$ac_configure_args0 " in
- "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
- esac
- ;;
- -* ) ac_must_keep_next=true ;;
- esac
- fi
- ac_configure_args="$ac_configure_args '$ac_arg'"
- ;;
- esac
- done
-done
-$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
-$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
-
-# When interrupted or exit'd, cleanup temporary files, and complete
-# config.log. We remove comments because anyway the quotes in there
-# would cause problems or look ugly.
-# WARNING: Use '\'' to represent an apostrophe within the trap.
-# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
-trap 'exit_status=$?
- # Save into config.log some information that might help in debugging.
- {
- echo
-
- cat <<\_ASBOX
-## ---------------- ##
-## Cache variables. ##
-## ---------------- ##
-_ASBOX
- echo
- # The following way of writing the cache mishandles newlines in values,
-(
- for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
- eval ac_val=\$$ac_var
- case $ac_val in #(
- *${as_nl}*)
- case $ac_var in #(
- *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5
-$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
- esac
- case $ac_var in #(
- _ | IFS | as_nl) ;; #(
- BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
- *) $as_unset $ac_var ;;
- esac ;;
- esac
- done
- (set) 2>&1 |
- case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
- *${as_nl}ac_space=\ *)
- sed -n \
- "s/'\''/'\''\\\\'\'''\''/g;
- s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
- ;; #(
- *)
- sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
- ;;
- esac |
- sort
-)
- echo
-
- cat <<\_ASBOX
-## ----------------- ##
-## Output variables. ##
-## ----------------- ##
-_ASBOX
- echo
- for ac_var in $ac_subst_vars
- do
- eval ac_val=\$$ac_var
- case $ac_val in
- *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
- esac
- $as_echo "$ac_var='\''$ac_val'\''"
- done | sort
- echo
-
- if test -n "$ac_subst_files"; then
- cat <<\_ASBOX
-## ------------------- ##
-## File substitutions. ##
-## ------------------- ##
-_ASBOX
- echo
- for ac_var in $ac_subst_files
- do
- eval ac_val=\$$ac_var
- case $ac_val in
- *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
- esac
- $as_echo "$ac_var='\''$ac_val'\''"
- done | sort
- echo
- fi
-
- if test -s confdefs.h; then
- cat <<\_ASBOX
-## ----------- ##
-## confdefs.h. ##
-## ----------- ##
-_ASBOX
- echo
- cat confdefs.h
- echo
- fi
- test "$ac_signal" != 0 &&
- $as_echo "$as_me: caught signal $ac_signal"
- $as_echo "$as_me: exit $exit_status"
- } >&5
- rm -f core *.core core.conftest.* &&
- rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
- exit $exit_status
-' 0
-for ac_signal in 1 2 13 15; do
- trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
-done
-ac_signal=0
-
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -f -r conftest* confdefs.h
-
-# Predefined preprocessor variables.
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_NAME "$PACKAGE_NAME"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_VERSION "$PACKAGE_VERSION"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_STRING "$PACKAGE_STRING"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
-_ACEOF
-
-
-# Let the site file select an alternate cache file if it wants to.
-# Prefer an explicitly selected file to automatically selected ones.
-ac_site_file1=NONE
-ac_site_file2=NONE
-if test -n "$CONFIG_SITE"; then
- ac_site_file1=$CONFIG_SITE
-elif test "x$prefix" != xNONE; then
- ac_site_file1=$prefix/share/config.site
- ac_site_file2=$prefix/etc/config.site
-else
- ac_site_file1=$ac_default_prefix/share/config.site
- ac_site_file2=$ac_default_prefix/etc/config.site
-fi
-for ac_site_file in "$ac_site_file1" "$ac_site_file2"
-do
- test "x$ac_site_file" = xNONE && continue
- if test -r "$ac_site_file"; then
- { $as_echo "$as_me:$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"
- fi
-done
-
-if test -r "$cache_file"; then
- # Some versions of bash will fail to source /dev/null (special
- # files actually), so we avoid doing that.
- if test -f "$cache_file"; then
- { $as_echo "$as_me:$LINENO: loading cache $cache_file" >&5
-$as_echo "$as_me: loading cache $cache_file" >&6;}
- case $cache_file in
- [\\/]* | ?:[\\/]* ) . "$cache_file";;
- *) . "./$cache_file";;
- esac
- fi
-else
- { $as_echo "$as_me:$LINENO: creating cache $cache_file" >&5
-$as_echo "$as_me: creating cache $cache_file" >&6;}
- >$cache_file
-fi
-
-# Check that the precious variables saved in the cache have kept the same
-# value.
-ac_cache_corrupted=false
-for ac_var in $ac_precious_vars; do
- eval ac_old_set=\$ac_cv_env_${ac_var}_set
- eval ac_new_set=\$ac_env_${ac_var}_set
- eval ac_old_val=\$ac_cv_env_${ac_var}_value
- eval ac_new_val=\$ac_env_${ac_var}_value
- case $ac_old_set,$ac_new_set in
- set,)
- { $as_echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
-$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
- ac_cache_corrupted=: ;;
- ,set)
- { $as_echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
-$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
- ac_cache_corrupted=: ;;
- ,);;
- *)
- if test "x$ac_old_val" != "x$ac_new_val"; then
- # differences in whitespace do not lead to failure.
- ac_old_val_w=`echo x $ac_old_val`
- ac_new_val_w=`echo x $ac_new_val`
- if test "$ac_old_val_w" != "$ac_new_val_w"; then
- { $as_echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
-$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
- ac_cache_corrupted=:
- else
- { $as_echo "$as_me:$LINENO: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
-$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
- eval $ac_var=\$ac_old_val
- fi
- { $as_echo "$as_me:$LINENO: former value: \`$ac_old_val'" >&5
-$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}
- { $as_echo "$as_me:$LINENO: current value: \`$ac_new_val'" >&5
-$as_echo "$as_me: current value: \`$ac_new_val'" >&2;}
- fi;;
- esac
- # Pass precious variables to config.status.
- if test "$ac_new_set" = set; then
- case $ac_new_val in
- *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
- *) ac_arg=$ac_var=$ac_new_val ;;
- esac
- case " $ac_configure_args " in
- *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
- *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
- esac
- fi
-done
-if $ac_cache_corrupted; then
- { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
- { $as_echo "$as_me:$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_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
-$as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
- { (exit 1); exit 1; }; }
-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
-
-
-
-
-ac_config_headers="$ac_config_headers config.h"
-
-
-TALLOC_VERSION=${PACKAGE_VERSION}
-TALLOC_VERSION_MAJOR=`echo ${PACKAGE_VERSION} | cut -d '.' -f1`
-TALLOC_VERSION_MINOR=`echo ${PACKAGE_VERSION} | cut -d '.' -f2`
-TALLOC_VERSION_RELEASE=`echo ${PACKAGE_VERSION} | cut -d '.' -f3`
-
-
-
-
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define TALLOC_BUILD_VERSION_MAJOR ${TALLOC_VERSION_MAJOR}
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define TALLOC_BUILD_VERSION_MINOR ${TALLOC_VERSION_MINOR}
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define TALLOC_BUILD_VERSION_RELEASE ${TALLOC_VERSION_RELEASE}
-_ACEOF
-
-
-
-
-#LIBREPLACE_ALL_CHECKS: START"
-
-ac_aux_dir=
-for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
- 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_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5
-$as_echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-# These three variables are undocumented and unsupported,
-# and are intended to be withdrawn in a future Autoconf release.
-# They can cause serious problems if a builder's source tree is in a directory
-# whose full name contains unusual characters.
-ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
-ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
-ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
-
-
-
-echo "LIBREPLACE_LOCATION_CHECKS: START"
-
-libreplacedir=""
-libreplacepaths="$srcdir $srcdir/lib/replace $srcdir/libreplace $srcdir/../libreplace $srcdir/../replace $srcdir/../lib/replace $srcdir/../../../lib/replace"
-for d in $libreplacepaths; do
- if test -f "$d/replace.c"; then
- libreplacedir="$d"
-
- break;
- fi
-done
-if test x"$libreplacedir" = "x"; then
- { { $as_echo "$as_me:$LINENO: error: cannot find libreplace in $libreplacepaths" >&5
-$as_echo "$as_me: error: cannot find libreplace in $libreplacepaths" >&2;}
- { (exit 1); exit 1; }; }
-fi
-LIBREPLACEOBJ="$libreplacedir/replace.o"
-
-
-# Make sure we can run config.sub.
-$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
- { { $as_echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
-$as_echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
- { (exit 1); exit 1; }; }
-
-{ $as_echo "$as_me:$LINENO: checking build system type" >&5
-$as_echo_n "checking build system type... " >&6; }
-if test "${ac_cv_build+set}" = set; 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_echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
-$as_echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
- { (exit 1); exit 1; }; }
-ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
- { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
-$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
- { (exit 1); exit 1; }; }
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_build" >&5
-$as_echo "$ac_cv_build" >&6; }
-case $ac_cv_build in
-*-*-*) ;;
-*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
-$as_echo "$as_me: error: invalid value of canonical build" >&2;}
- { (exit 1); exit 1; }; };;
-esac
-build=$ac_cv_build
-ac_save_IFS=$IFS; IFS='-'
-set x $ac_cv_build
-shift
-build_cpu=$1
-build_vendor=$2
-shift; shift
-# Remember, the first character of IFS is used to create $*,
-# except with old shells:
-build_os=$*
-IFS=$ac_save_IFS
-case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
-
-
-{ $as_echo "$as_me:$LINENO: checking host system type" >&5
-$as_echo_n "checking host system type... " >&6; }
-if test "${ac_cv_host+set}" = set; 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_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
-$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_host" >&5
-$as_echo "$ac_cv_host" >&6; }
-case $ac_cv_host in
-*-*-*) ;;
-*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
-$as_echo "$as_me: error: invalid value of canonical host" >&2;}
- { (exit 1); exit 1; }; };;
-esac
-host=$ac_cv_host
-ac_save_IFS=$IFS; IFS='-'
-set x $ac_cv_host
-shift
-host_cpu=$1
-host_vendor=$2
-shift; shift
-# Remember, the first character of IFS is used to create $*,
-# except with old shells:
-host_os=$*
-IFS=$ac_save_IFS
-case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
-
-
-{ $as_echo "$as_me:$LINENO: checking target system type" >&5
-$as_echo_n "checking target system type... " >&6; }
-if test "${ac_cv_target+set}" = set; 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_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&5
-$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_target" >&5
-$as_echo "$ac_cv_target" >&6; }
-case $ac_cv_target in
-*-*-*) ;;
-*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical target" >&5
-$as_echo "$as_me: error: invalid value of canonical target" >&2;}
- { (exit 1); exit 1; }; };;
-esac
-target=$ac_cv_target
-ac_save_IFS=$IFS; IFS='-'
-set x $ac_cv_target
-shift
-target_cpu=$1
-target_vendor=$2
-shift; shift
-# Remember, the first character of IFS is used to create $*,
-# except with old shells:
-target_os=$*
-IFS=$ac_save_IFS
-case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac
-
-
-# The aliases save the names the user supplied, while $host etc.
-# will get canonicalized.
-test -n "$target_alias" &&
- test "$program_prefix$program_suffix$program_transform_name" = \
- NONENONEs,x,x, &&
- program_prefix=${target_alias}-
-
-echo "LIBREPLACE_LOCATION_CHECKS: END"
-
-
-
-echo "LIBREPLACE_CC_CHECKS: START"
-
-
-ac_cv_prog_cc_Ae=no
-
-savedCFLAGS=$CFLAGS
-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
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}gcc; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_prog_CC="${ac_tool_prefix}gcc"
- $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- { $as_echo "$as_me:$LINENO: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_CC"; then
- ac_ct_CC=$CC
- # Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-{ $as_echo "$as_me:$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
- $as_echo_n "(cached) " >&6
-else
- if test -n "$ac_ct_CC"; then
- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # 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 { 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_CC="gcc"
- $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
- { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-$as_echo "$ac_ct_CC" >&6; }
-else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
- if test "x$ac_ct_CC" = x; then
- CC=""
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:$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
- CC=$ac_ct_CC
- fi
-else
- CC="$ac_cv_prog_CC"
-fi
-
-if test -z "$CC"; then
- if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}cc; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_prog_CC="${ac_tool_prefix}cc"
- $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- { $as_echo "$as_me:$LINENO: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
- fi
-fi
-if test -z "$CC"; then
- # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- ac_prog_rejected=no
-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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
- fi
- ac_cv_prog_CC="cc"
- $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-IFS=$as_save_IFS
-
-if test $ac_prog_rejected = yes; then
- # We found a bogon in the path, so make sure we never use it.
- set dummy $ac_cv_prog_CC
- shift
- if test $# != 0; then
- # We chose a different compiler from the bogus one.
- # However, it has the same basename, so the bogon will be chosen
- # first if we set CC to just the basename; use the full file name.
- shift
- ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
- fi
-fi
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- { $as_echo "$as_me:$LINENO: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$CC"; then
- if test -n "$ac_tool_prefix"; then
- for ac_prog in cl.exe
- 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:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
- $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- { $as_echo "$as_me:$LINENO: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
- test -n "$CC" && break
- done
-fi
-if test -z "$CC"; then
- ac_ct_CC=$CC
- for ac_prog in cl.exe
-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:$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
- $as_echo_n "(cached) " >&6
-else
- if test -n "$ac_ct_CC"; then
- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # 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 { 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_CC="$ac_prog"
- $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
- { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-$as_echo "$ac_ct_CC" >&6; }
-else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
- test -n "$ac_ct_CC" && break
-done
-
- if test "x$ac_ct_CC" = x; then
- CC=""
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:$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
- CC=$ac_ct_CC
- fi
-fi
-
-fi
-
-
-test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }; }
-
-# Provide some information about the compiler.
-$as_echo "$as_me:$LINENO: checking for C compiler version" >&5
-set X $ac_compile
-ac_compiler=$2
-{ (ac_try="$ac_compiler --version >&5"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compiler --version >&5") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-{ (ac_try="$ac_compiler -v >&5"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compiler -v >&5") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-{ (ac_try="$ac_compiler -V >&5"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compiler -V >&5") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
-# Try to create an executable without -o first, disregard a.out.
-# It will help us diagnose broken compilers, and finding out an intuition
-# of exeext.
-{ $as_echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
-$as_echo_n "checking for C compiler default output file name... " >&6; }
-ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-
-# The possible output files:
-ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
-
-ac_rmfiles=
-for ac_file in $ac_files
-do
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
- * ) ac_rmfiles="$ac_rmfiles $ac_file";;
- esac
-done
-rm -f $ac_rmfiles
-
-if { (ac_try="$ac_link_default"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link_default") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
-# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
-# in a Makefile. We should not override ac_cv_exeext if it was cached,
-# so that the user can short-circuit this test for compilers unknown to
-# Autoconf.
-for ac_file in $ac_files ''
-do
- test -f "$ac_file" || continue
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
- ;;
- [ab].out )
- # We found the default executable, but exeext='' is most
- # certainly right.
- break;;
- *.* )
- if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
- then :; else
- ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
- fi
- # We set ac_cv_exeext here because the later test for it is not
- # safe: cross compilers may not add the suffix if given an `-o'
- # argument, so we may need to know it at that point already.
- # Even if this section looks crufty: it has the advantage of
- # actually working.
- break;;
- * )
- break;;
- esac
-done
-test "$ac_cv_exeext" = no && ac_cv_exeext=
-
-else
- ac_file=''
-fi
-
-{ $as_echo "$as_me:$LINENO: result: $ac_file" >&5
-$as_echo "$ac_file" >&6; }
-if test -z "$ac_file"; then
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: C compiler cannot create executables
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: C compiler cannot create executables
-See \`config.log' for more details." >&2;}
- { (exit 77); exit 77; }; }; }
-fi
-
-ac_exeext=$ac_cv_exeext
-
-# Check that the compiler produces executables we can run. If not, either
-# the compiler is broken, or we cross compile.
-{ $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5
-$as_echo_n "checking whether the C compiler works... " >&6; }
-# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
-# If not cross compiling, check that we can run a simple program.
-if test "$cross_compiling" != yes; then
- if { ac_try='./$ac_file'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- cross_compiling=no
- else
- if test "$cross_compiling" = maybe; then
- cross_compiling=yes
- else
- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }; }
- fi
- fi
-fi
-{ $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-
-rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
-ac_clean_files=$ac_clean_files_save
-# Check that the compiler produces executables we can run. If not, either
-# the compiler is broken, or we cross compile.
-{ $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
-$as_echo_n "checking whether we are cross compiling... " >&6; }
-{ $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5
-$as_echo "$cross_compiling" >&6; }
-
-{ $as_echo "$as_me:$LINENO: checking for suffix of executables" >&5
-$as_echo_n "checking for suffix of executables... " >&6; }
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- # If both `conftest.exe' and `conftest' are `present' (well, observable)
-# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
-# work properly (i.e., refer to `conftest.exe'), while it won't with
-# `rm'.
-for ac_file in conftest.exe conftest conftest.*; do
- test -f "$ac_file" || continue
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
- *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
- break;;
- * ) break;;
- esac
-done
-else
- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }; }
-fi
-
-rm -f conftest$ac_cv_exeext
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
-$as_echo "$ac_cv_exeext" >&6; }
-
-rm -f conftest.$ac_ext
-EXEEXT=$ac_cv_exeext
-ac_exeext=$EXEEXT
-{ $as_echo "$as_me:$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
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.o conftest.obj
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- for ac_file in conftest.o conftest.obj conftest.*; do
- test -f "$ac_file" || continue;
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
- *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
- break;;
- esac
-done
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }; }
-fi
-
-rm -f conftest.$ac_cv_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
-$as_echo "$ac_cv_objext" >&6; }
-OBJEXT=$ac_cv_objext
-ac_objext=$OBJEXT
-{ $as_echo "$as_me:$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
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-#ifndef __GNUC__
- choke me
-#endif
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_compiler_gnu=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_compiler_gnu=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_cv_c_compiler_gnu=$ac_compiler_gnu
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
-$as_echo "$ac_cv_c_compiler_gnu" >&6; }
-if test $ac_compiler_gnu = yes; then
- GCC=yes
-else
- GCC=
-fi
-ac_test_CFLAGS=${CFLAGS+set}
-ac_save_CFLAGS=$CFLAGS
-{ $as_echo "$as_me:$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
- $as_echo_n "(cached) " >&6
-else
- ac_save_c_werror_flag=$ac_c_werror_flag
- ac_c_werror_flag=yes
- ac_cv_prog_cc_g=no
- CFLAGS="-g"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_prog_cc_g=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- CFLAGS=""
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- :
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_c_werror_flag=$ac_save_c_werror_flag
- CFLAGS="-g"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_prog_cc_g=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- ac_c_werror_flag=$ac_save_c_werror_flag
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
-$as_echo "$ac_cv_prog_cc_g" >&6; }
-if test "$ac_test_CFLAGS" = set; then
- CFLAGS=$ac_save_CFLAGS
-elif test $ac_cv_prog_cc_g = yes; then
- if test "$GCC" = yes; then
- CFLAGS="-g -O2"
- else
- CFLAGS="-g"
- fi
-else
- if test "$GCC" = yes; then
- CFLAGS="-O2"
- else
- CFLAGS=
- fi
-fi
-{ $as_echo "$as_me:$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
- $as_echo_n "(cached) " >&6
-else
- ac_cv_prog_cc_c89=no
-ac_save_CC=$CC
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdarg.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-/* 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);
-static char *e (p, i)
- char **p;
- int i;
-{
- return p[i];
-}
-static char *f (char * (*g) (char **, int), char **p, ...)
-{
- char *s;
- va_list v;
- va_start (v,p);
- s = g (p, va_arg (v,int));
- va_end (v);
- return s;
-}
-
-/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
- function prototypes and stuff, but not '\xHH' hex character constants.
- These don't provoke an error unfortunately, instead are silently treated
- as 'x'. The following induces an error, until -std is added to get
- proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
- array size at least. It's necessary to write '\x00'==0 to get something
- that's true only with -std. */
-int osf4_cc_array ['\x00' == 0 ? 1 : -1];
-
-/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
- inside strings and character constants. */
-#define FOO(x) 'x'
-int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
-
-int test (int i, double x);
-struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};
-int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
-int argc;
-char **argv;
-int
-main ()
-{
-return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
- ;
- return 0;
-}
-_ACEOF
-for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
- -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
-do
- CC="$ac_save_CC $ac_arg"
- rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_prog_cc_c89=$ac_arg
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext
- test "x$ac_cv_prog_cc_c89" != "xno" && break
-done
-rm -f conftest.$ac_ext
-CC=$ac_save_CC
-
-fi
-# AC_CACHE_VAL
-case "x$ac_cv_prog_cc_c89" in
- x)
- { $as_echo "$as_me:$LINENO: result: none needed" >&5
-$as_echo "none needed" >&6; } ;;
- xno)
- { $as_echo "$as_me:$LINENO: result: unsupported" >&5
-$as_echo "unsupported" >&6; } ;;
- *)
- CC="$CC $ac_cv_prog_cc_c89"
- { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
-$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
-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
-
-CFLAGS=$savedCFLAGS
-
-if test x"$GCC" != x"yes" ; then
- { $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C99" >&5
-$as_echo_n "checking for $CC option to accept ISO C99... " >&6; }
-if test "${ac_cv_prog_cc_c99+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_cv_prog_cc_c99=no
-ac_save_CC=$CC
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include <stdio.h>
-
-// Check varargs macros. These examples are taken from C99 6.10.3.5.
-#define debug(...) fprintf (stderr, __VA_ARGS__)
-#define showlist(...) puts (#__VA_ARGS__)
-#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__))
-static void
-test_varargs_macros (void)
-{
- int x = 1234;
- int y = 5678;
- debug ("Flag");
- debug ("X = %d\n", x);
- showlist (The first, second, and third items.);
- report (x>y, "x is %d but y is %d", x, y);
-}
-
-// Check long long types.
-#define BIG64 18446744073709551615ull
-#define BIG32 4294967295ul
-#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0)
-#if !BIG_OK
- your preprocessor is broken;
-#endif
-#if BIG_OK
-#else
- your preprocessor is broken;
-#endif
-static long long int bignum = -9223372036854775807LL;
-static unsigned long long int ubignum = BIG64;
-
-struct incomplete_array
-{
- int datasize;
- double data[];
-};
-
-struct named_init {
- int number;
- const wchar_t *name;
- double average;
-};
-
-typedef const char *ccp;
-
-static inline int
-test_restrict (ccp restrict text)
-{
- // See if C++-style comments work.
- // Iterate through items via the restricted pointer.
- // Also check for declarations in for loops.
- for (unsigned int i = 0; *(text+i) != '\0'; ++i)
- continue;
- return 0;
-}
-
-// Check varargs and va_copy.
-static void
-test_varargs (const char *format, ...)
-{
- va_list args;
- va_start (args, format);
- va_list args_copy;
- va_copy (args_copy, args);
-
- const char *str;
- int number;
- float fnumber;
-
- while (*format)
- {
- switch (*format++)
- {
- case 's': // string
- str = va_arg (args_copy, const char *);
- break;
- case 'd': // int
- number = va_arg (args_copy, int);
- break;
- case 'f': // float
- fnumber = va_arg (args_copy, double);
- break;
- default:
- break;
- }
- }
- va_end (args_copy);
- va_end (args);
-}
-
-int
-main ()
-{
-
- // Check bool.
- _Bool success = false;
-
- // Check restrict.
- if (test_restrict ("String literal") == 0)
- success = true;
- char *restrict newvar = "Another string";
-
- // Check varargs.
- test_varargs ("s, d' f .", "string", 65, 34.234);
- test_varargs_macros ();
-
- // Check flexible array members.
- struct incomplete_array *ia =
- malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10));
- ia->datasize = 10;
- for (int i = 0; i < ia->datasize; ++i)
- ia->data[i] = i * 1.234;
-
- // Check named initializers.
- struct named_init ni = {
- .number = 34,
- .name = L"Test wide string",
- .average = 543.34343,
- };
-
- ni.number = 58;
-
- int dynamic_array[ni.number];
- dynamic_array[ni.number - 1] = 543;
-
- // work around unused variable warnings
- return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x'
- || dynamic_array[ni.number - 1] != 543);
-
- ;
- return 0;
-}
-_ACEOF
-for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -xc99=all -qlanglvl=extc99
-do
- CC="$ac_save_CC $ac_arg"
- rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_prog_cc_c99=$ac_arg
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext
- test "x$ac_cv_prog_cc_c99" != "xno" && break
-done
-rm -f conftest.$ac_ext
-CC=$ac_save_CC
-
-fi
-# AC_CACHE_VAL
-case "x$ac_cv_prog_cc_c99" in
- x)
- { $as_echo "$as_me:$LINENO: result: none needed" >&5
-$as_echo "none needed" >&6; } ;;
- xno)
- { $as_echo "$as_me:$LINENO: result: unsupported" >&5
-$as_echo "unsupported" >&6; } ;;
- *)
- CC="$CC $ac_cv_prog_cc_c99"
- { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c99" >&5
-$as_echo "$ac_cv_prog_cc_c99" >&6; } ;;
-esac
-
-
-
-fi
-
-if test x"$GCC" = x"yes" ; then
- { $as_echo "$as_me:$LINENO: checking for version of gcc" >&5
-$as_echo_n "checking for version of gcc... " >&6; }
- GCC_VERSION=`$CC -dumpversion`
- { $as_echo "$as_me:$LINENO: result: ${GCC_VERSION}" >&5
-$as_echo "${GCC_VERSION}" >&6; }
-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:$LINENO: checking how to run the C preprocessor" >&5
-$as_echo_n "checking how to run the C preprocessor... " >&6; }
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
- CPP=
-fi
-if test -z "$CPP"; then
- if test "${ac_cv_prog_CPP+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- # Double quotes because CPP needs to be expanded
- for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
- do
- ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
- # Use a header file that comes with gcc, so configuring glibc
- # with a fresh cross-compiler works.
- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- # <limits.h> exists even on freestanding compilers.
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp. "Syntax error" is here to catch this case.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
- Syntax error
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- :
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Broken: fails on valid input.
-continue
-fi
-
-rm -f conftest.err conftest.$ac_ext
-
- # OK, works on sane cases. Now check whether nonexistent headers
- # can be detected and how.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- # Broken: success on invalid input.
-continue
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-
-rm -f conftest.err conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
- break
-fi
-
- done
- ac_cv_prog_CPP=$CPP
-
-fi
- CPP=$ac_cv_prog_CPP
-else
- ac_cv_prog_CPP=$CPP
-fi
-{ $as_echo "$as_me:$LINENO: result: $CPP" >&5
-$as_echo "$CPP" >&6; }
-ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
- # Use a header file that comes with gcc, so configuring glibc
- # with a fresh cross-compiler works.
- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- # <limits.h> exists even on freestanding compilers.
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp. "Syntax error" is here to catch this case.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
- Syntax error
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- :
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Broken: fails on valid input.
-continue
-fi
-
-rm -f conftest.err conftest.$ac_ext
-
- # OK, works on sane cases. Now check whether nonexistent headers
- # can be detected and how.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- # Broken: success on invalid input.
-continue
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-
-rm -f conftest.err conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
- :
-else
- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }; }
-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:$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
- $as_echo_n "(cached) " >&6
-else
- if test -z "$GREP"; then
- ac_path_GREP_found=false
- # Loop through the user's path and test for each of PROGNAME-LIST
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- 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
-# 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
-*GNU*)
- ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
-*)
- ac_count=0
- $as_echo_n 0123456789 >"conftest.in"
- while :
- do
- cat "conftest.in" "conftest.in" >"conftest.tmp"
- mv "conftest.tmp" "conftest.in"
- cp "conftest.in" "conftest.nl"
- $as_echo 'GREP' >> "conftest.nl"
- "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
- diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
- ac_count=`expr $ac_count + 1`
- if test $ac_count -gt ${ac_path_GREP_max-0}; then
- # Best one so far, save it but keep looking for a better one
- ac_cv_path_GREP="$ac_path_GREP"
- ac_path_GREP_max=$ac_count
- fi
- # 10*(2^10) chars as input seems more than enough
- test $ac_count -gt 10 && break
- done
- rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
- $ac_path_GREP_found && break 3
- done
- done
-done
-IFS=$as_save_IFS
- if test -z "$ac_cv_path_GREP"; then
- { { $as_echo "$as_me:$LINENO: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-$as_echo "$as_me: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
- { (exit 1); exit 1; }; }
- fi
-else
- ac_cv_path_GREP=$GREP
-fi
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
-$as_echo "$ac_cv_path_GREP" >&6; }
- GREP="$ac_cv_path_GREP"
-
-
-{ $as_echo "$as_me:$LINENO: checking for egrep" >&5
-$as_echo_n "checking for egrep... " >&6; }
-if test "${ac_cv_path_EGREP+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
- then ac_cv_path_EGREP="$GREP -E"
- else
- if test -z "$EGREP"; then
- ac_path_EGREP_found=false
- # Loop through the user's path and test for each of PROGNAME-LIST
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- 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
-# 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
-*GNU*)
- ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
-*)
- ac_count=0
- $as_echo_n 0123456789 >"conftest.in"
- while :
- do
- cat "conftest.in" "conftest.in" >"conftest.tmp"
- mv "conftest.tmp" "conftest.in"
- cp "conftest.in" "conftest.nl"
- $as_echo 'EGREP' >> "conftest.nl"
- "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
- diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
- ac_count=`expr $ac_count + 1`
- if test $ac_count -gt ${ac_path_EGREP_max-0}; then
- # Best one so far, save it but keep looking for a better one
- ac_cv_path_EGREP="$ac_path_EGREP"
- ac_path_EGREP_max=$ac_count
- fi
- # 10*(2^10) chars as input seems more than enough
- test $ac_count -gt 10 && break
- done
- rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
- $ac_path_EGREP_found && break 3
- done
- done
-done
-IFS=$as_save_IFS
- if test -z "$ac_cv_path_EGREP"; then
- { { $as_echo "$as_me:$LINENO: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-$as_echo "$as_me: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
- { (exit 1); exit 1; }; }
- fi
-else
- ac_cv_path_EGREP=$EGREP
-fi
-
- fi
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
-$as_echo "$ac_cv_path_EGREP" >&6; }
- EGREP="$ac_cv_path_EGREP"
-
-
-{ $as_echo "$as_me:$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
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_header_stdc=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_header_stdc=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-if test $ac_cv_header_stdc = yes; then
- # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <string.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "memchr" >/dev/null 2>&1; then
- :
-else
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdlib.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "free" >/dev/null 2>&1; then
- :
-else
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
- if test "$cross_compiling" = yes; then
- :
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <ctype.h>
-#include <stdlib.h>
-#if ((' ' & 0x0FF) == 0x020)
-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#else
-# define ISLOWER(c) \
- (('a' <= (c) && (c) <= 'i') \
- || ('j' <= (c) && (c) <= 'r') \
- || ('s' <= (c) && (c) <= 'z'))
-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
-#endif
-
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int
-main ()
-{
- int i;
- for (i = 0; i < 256; i++)
- if (XOR (islower (i), ISLOWER (i))
- || toupper (i) != TOUPPER (i))
- return 2;
- return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- :
-else
- $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_header_stdc=no
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-fi
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
-$as_echo "$ac_cv_header_stdc" >&6; }
-if test $ac_cv_header_stdc = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define STDC_HEADERS 1
-_ACEOF
-
-fi
-
-# On IRIX 5.3, sys/types and inttypes.h are conflicting.
-
-
-
-
-
-
-
-
-
-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
- inttypes.h stdint.h unistd.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- eval "$as_ac_Header=yes"
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- eval "$as_ac_Header=no"
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-
- if test "${ac_cv_header_minix_config_h+set}" = set; then
- { $as_echo "$as_me:$LINENO: checking for minix/config.h" >&5
-$as_echo_n "checking for minix/config.h... " >&6; }
-if test "${ac_cv_header_minix_config_h+set}" = set; then
- $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5
-$as_echo "$ac_cv_header_minix_config_h" >&6; }
-else
- # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking minix/config.h usability" >&5
-$as_echo_n "checking minix/config.h usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <minix/config.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_header_compiler=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking minix/config.h presence" >&5
-$as_echo_n "checking minix/config.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <minix/config.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- ac_header_preproc=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: minix/config.h: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: minix/config.h: present but cannot be compiled" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: minix/config.h: check for missing prerequisite headers?" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: minix/config.h: see the Autoconf documentation" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: minix/config.h: section \"Present But Cannot Be Compiled\"" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: minix/config.h: proceeding with the preprocessor's result" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: minix/config.h: in the future, the compiler will take precedence" >&2;}
-
- ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for minix/config.h" >&5
-$as_echo_n "checking for minix/config.h... " >&6; }
-if test "${ac_cv_header_minix_config_h+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_cv_header_minix_config_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5
-$as_echo "$ac_cv_header_minix_config_h" >&6; }
-
-fi
-if test "x$ac_cv_header_minix_config_h" = x""yes; then
- MINIX=yes
-else
- MINIX=
-fi
-
-
- if test "$MINIX" = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define _POSIX_SOURCE 1
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define _POSIX_1_SOURCE 2
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define _MINIX 1
-_ACEOF
-
- fi
-
-
-
- { $as_echo "$as_me:$LINENO: checking whether it is safe to define __EXTENSIONS__" >&5
-$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; }
-if test "${ac_cv_safe_to_define___extensions__+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-# define __EXTENSIONS__ 1
- $ac_includes_default
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_safe_to_define___extensions__=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_safe_to_define___extensions__=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_safe_to_define___extensions__" >&5
-$as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
- test $ac_cv_safe_to_define___extensions__ = yes &&
- cat >>confdefs.h <<\_ACEOF
-#define __EXTENSIONS__ 1
-_ACEOF
-
- cat >>confdefs.h <<\_ACEOF
-#define _ALL_SOURCE 1
-_ACEOF
-
- cat >>confdefs.h <<\_ACEOF
-#define _GNU_SOURCE 1
-_ACEOF
-
- cat >>confdefs.h <<\_ACEOF
-#define _POSIX_PTHREAD_SEMANTICS 1
-_ACEOF
-
- cat >>confdefs.h <<\_ACEOF
-#define _TANDEM_SOURCE 1
-_ACEOF
-
-
-
- { $as_echo "$as_me:$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
- $as_echo_n "(cached) " >&6
-else
- ac_cv_c_bigendian=unknown
- # See if we're dealing with a universal compiler.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#ifndef __APPLE_CC__
- not a universal capable compiler
- #endif
- typedef int dummy;
-
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
-
- # Check for potential -arch flags. It is not universal unless
- # there are some -arch flags. Note that *ppc* also matches
- # ppc64. This check is also rather less than ideal.
- case "${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}" in #(
- *-arch*ppc*|*-arch*i386*|*-arch*x86_64*) ac_cv_c_bigendian=universal;;
- esac
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- if test $ac_cv_c_bigendian = unknown; then
- # See if sys/param.h defines the BYTE_ORDER macro.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <sys/types.h>
- #include <sys/param.h>
-
-int
-main ()
-{
-#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \
- && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \
- && LITTLE_ENDIAN)
- bogus endian macros
- #endif
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- # It does; now see whether it defined to BIG_ENDIAN or not.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <sys/types.h>
- #include <sys/param.h>
-
-int
-main ()
-{
-#if BYTE_ORDER != BIG_ENDIAN
- not big endian
- #endif
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_c_bigendian=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_c_bigendian=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- fi
- if test $ac_cv_c_bigendian = unknown; then
- # See if <limits.h> defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris).
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <limits.h>
-
-int
-main ()
-{
-#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN)
- bogus endian macros
- #endif
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- # It does; now see whether it defined to _BIG_ENDIAN or not.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <limits.h>
-
-int
-main ()
-{
-#ifndef _BIG_ENDIAN
- not big endian
- #endif
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_c_bigendian=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_c_bigendian=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- fi
- if test $ac_cv_c_bigendian = unknown; then
- # Compile a test program.
- if test "$cross_compiling" = yes; then
- # Try to guess by grepping values from an object file.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-short int ascii_mm[] =
- { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
- short int ascii_ii[] =
- { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
- int use_ascii (int i) {
- return ascii_mm[i] + ascii_ii[i];
- }
- short int ebcdic_ii[] =
- { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
- short int ebcdic_mm[] =
- { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
- int use_ebcdic (int i) {
- return ebcdic_mm[i] + ebcdic_ii[i];
- }
- extern int foo;
-
-int
-main ()
-{
-return use_ascii (foo) == use_ebcdic (foo);
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then
- ac_cv_c_bigendian=yes
- fi
- if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
- if test "$ac_cv_c_bigendian" = unknown; then
- ac_cv_c_bigendian=no
- else
- # finding both strings is unlikely to happen, but who knows?
- ac_cv_c_bigendian=unknown
- fi
- fi
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-
- /* Are we little or big endian? From Harbison&Steele. */
- union
- {
- long int l;
- char c[sizeof (long int)];
- } u;
- u.l = 1;
- return u.c[sizeof (long int) - 1] == 1;
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_c_bigendian=no
-else
- $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_c_bigendian=yes
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-
-
- fi
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5
-$as_echo "$ac_cv_c_bigendian" >&6; }
- case $ac_cv_c_bigendian in #(
- yes)
- cat >>confdefs.h <<\_ACEOF
-#define WORDS_BIGENDIAN 1
-_ACEOF
-;; #(
- no)
- ;; #(
- universal)
-
-cat >>confdefs.h <<\_ACEOF
-#define AC_APPLE_UNIVERSAL_BUILD 1
-_ACEOF
-
- ;; #(
- *)
- { { $as_echo "$as_me:$LINENO: error: unknown endianness
- presetting ac_cv_c_bigendian=no (or yes) will help" >&5
-$as_echo "$as_me: error: unknown endianness
- presetting ac_cv_c_bigendian=no (or yes) will help" >&2;}
- { (exit 1); exit 1; }; } ;;
- esac
-
-{ $as_echo "$as_me:$LINENO: checking for inline" >&5
-$as_echo_n "checking for inline... " >&6; }
-if test "${ac_cv_c_inline+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_cv_c_inline=no
-for ac_kw in inline __inline__ __inline; do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#ifndef __cplusplus
-typedef int foo_t;
-static $ac_kw foo_t static_foo () {return 0; }
-$ac_kw foo_t foo () {return 0; }
-#endif
-
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_c_inline=$ac_kw
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- test "$ac_cv_c_inline" != no && break
-done
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5
-$as_echo "$ac_cv_c_inline" >&6; }
-
-
-case $ac_cv_c_inline in
- inline | yes) ;;
- *)
- case $ac_cv_c_inline in
- no) ac_val=;;
- *) ac_val=$ac_cv_c_inline;;
- esac
- cat >>confdefs.h <<_ACEOF
-#ifndef __cplusplus
-#define inline $ac_val
-#endif
-_ACEOF
- ;;
-esac
-
-
-saved_CFLAGS="$CFLAGS";
-c99_init=no
-if test x"$c99_init" = x"no"; then
- { $as_echo "$as_me:$LINENO: checking for C99 designated initializers" >&5
-$as_echo_n "checking for C99 designated initializers... " >&6; }
- CFLAGS="$saved_CFLAGS";
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdio.h>
-int
-main ()
-{
- struct foo {int x;char y;};
- struct foo bar = { .y = 'X', .x = 1 };
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }; c99_init=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-if test x"$c99_init" = x"no"; then
- { $as_echo "$as_me:$LINENO: checking for C99 designated initializers with -AC99" >&5
-$as_echo_n "checking for C99 designated initializers with -AC99... " >&6; }
- CFLAGS="$saved_CFLAGS -AC99";
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdio.h>
-int
-main ()
-{
- struct foo {int x;char y;};
- struct foo bar = { .y = 'X', .x = 1 };
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }; c99_init=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-if test x"$c99_init" = x"no"; then
- { $as_echo "$as_me:$LINENO: checking for C99 designated initializers with -qlanglvl=extc99" >&5
-$as_echo_n "checking for C99 designated initializers with -qlanglvl=extc99... " >&6; }
- CFLAGS="$saved_CFLAGS -qlanglvl=extc99";
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdio.h>
-int
-main ()
-{
- struct foo {int x;char y;};
- struct foo bar = { .y = 'X', .x = 1 };
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }; c99_init=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-if test x"$c99_init" = x"no"; then
- { $as_echo "$as_me:$LINENO: checking for C99 designated initializers with -qlanglvl=stdc99" >&5
-$as_echo_n "checking for C99 designated initializers with -qlanglvl=stdc99... " >&6; }
- CFLAGS="$saved_CFLAGS -qlanglvl=stdc99";
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdio.h>
-int
-main ()
-{
- struct foo {int x;char y;};
- struct foo bar = { .y = 'X', .x = 1 };
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }; c99_init=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-if test x"$c99_init" = x"no"; then
- { $as_echo "$as_me:$LINENO: checking for C99 designated initializers with -c99" >&5
-$as_echo_n "checking for C99 designated initializers with -c99... " >&6; }
- CFLAGS="$saved_CFLAGS -c99"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdio.h>
-int
-main ()
-{
- struct foo {int x;char y;};
- struct foo bar = { .y = 'X', .x = 1 };
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }; c99_init=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-if test "`uname`" = "HP-UX"; then
- if test "$ac_cv_c_compiler_gnu" = no; then
- # special override for broken HP-UX compiler - I can't find a way to test
- # this properly (its a compiler bug)
- CFLAGS="$CFLAGS -AC99";
- c99_init=yes;
- fi
-fi
-
-if test x"$c99_init" = x"yes"; then
- saved_CFLAGS=""
-
-else
- CFLAGS="$saved_CFLAGS"
- saved_CFLAGS=""
- { $as_echo "$as_me:$LINENO: WARNING: c99 structure initializer are not supported" >&5
-$as_echo "$as_me: WARNING: c99 structure initializer are not supported" >&2;}
-fi
-
-
-# Find a good install program. We prefer a C program (faster),
-# so one script is as good as another. But avoid the broken or
-# incompatible versions:
-# SysV /etc/install, /usr/sbin/install
-# SunOS /usr/etc/install
-# IRIX /sbin/install
-# AIX /bin/install
-# AmigaOS /C/install, which installs bootblocks on floppy discs
-# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
-# AFS /usr/afsws/bin/install, which mishandles nonexistent args
-# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
-# OS/2's system install, which has a completely different semantic
-# ./install, which can be erroneously created by make from ./install.sh.
-# Reject install programs that cannot install multiple files.
-{ $as_echo "$as_me:$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
- $as_echo_n "(cached) " >&6
-else
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- # Account for people who put trailing slashes in PATH elements.
-case $as_dir/ in
- ./ | .// | /cC/* | \
- /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
- ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
- /usr/ucb/* ) ;;
- *)
- # OSF1 and SCO ODT 3.0 have their own names for install.
- # Don't use installbsd from OSF since it installs stuff as root
- # 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 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.
- :
- elif test $ac_prog = install &&
- grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
- # program-specific install script used by HP pwplus--don't use.
- :
- else
- rm -rf conftest.one conftest.two conftest.dir
- echo one > conftest.one
- echo two > conftest.two
- mkdir conftest.dir
- if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
- test -s conftest.one && test -s conftest.two &&
- test -s conftest.dir/conftest.one &&
- test -s conftest.dir/conftest.two
- then
- ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
- break 3
- fi
- fi
- fi
- done
- done
- ;;
-esac
-
-done
-IFS=$as_save_IFS
-
-rm -rf conftest.one conftest.two conftest.dir
-
-fi
- if test "${ac_cv_path_install+set}" = set; then
- INSTALL=$ac_cv_path_install
- else
- # As a last resort, use the slow shell script. Don't cache a
- # value for INSTALL within a source directory, because that will
- # break other packages using the cache if that directory is
- # removed, or if the value is a relative name.
- INSTALL=$ac_install_sh
- fi
-fi
-{ $as_echo "$as_me:$LINENO: result: $INSTALL" >&5
-$as_echo "$INSTALL" >&6; }
-
-# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
-# It thinks the first close brace ends the variable substitution.
-test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
-
-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
-
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-
-{ $as_echo "$as_me:$LINENO: checking for library containing strerror" >&5
-$as_echo_n "checking for library containing strerror... " >&6; }
-if test "${ac_cv_search_strerror+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_func_search_save_LIBS=$LIBS
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char strerror ();
-int
-main ()
-{
-return strerror ();
- ;
- return 0;
-}
-_ACEOF
-for ac_lib in '' cposix; do
- if test -z "$ac_lib"; then
- ac_res="none required"
- else
- ac_res=-l$ac_lib
- LIBS="-l$ac_lib $ac_func_search_save_LIBS"
- fi
- rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
- ac_cv_search_strerror=$ac_res
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext
- if test "${ac_cv_search_strerror+set}" = set; then
- break
-fi
-done
-if test "${ac_cv_search_strerror+set}" = set; then
- :
-else
- ac_cv_search_strerror=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_strerror" >&5
-$as_echo "$ac_cv_search_strerror" >&6; }
-ac_res=$ac_cv_search_strerror
-if test "$ac_res" != no; then
- test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-
-fi
-
-
-
-
-
- cat >>confdefs.h <<\EOF
-#ifndef _XOPEN_SOURCE_EXTENDED
-#define _XOPEN_SOURCE_EXTENDED 1
-#endif
-EOF
-
-
-# Check whether --enable-largefile was given.
-if test "${enable_largefile+set}" = set; then
- enableval=$enable_largefile;
-fi
-
-if test "$enable_largefile" != no; then
-
- { $as_echo "$as_me:$LINENO: checking for special C compiler options needed for large files" >&5
-$as_echo_n "checking for special C compiler options needed for large files... " >&6; }
-if test "${ac_cv_sys_largefile_CC+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_cv_sys_largefile_CC=no
- if test "$GCC" != yes; then
- ac_save_CC=$CC
- while :; do
- # IRIX 6.2 and later do not support large files by default,
- # so use the C compiler's -n32 option if that helps.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
- We can't simply define LARGE_OFF_T to be 9223372036854775807,
- since some C++ compilers masquerading as C compilers
- incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
- int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
- && LARGE_OFF_T % 2147483647 == 1)
- ? 1 : -1];
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
- rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- break
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext
- CC="$CC -n32"
- rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_sys_largefile_CC=' -n32'; break
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext
- break
- done
- CC=$ac_save_CC
- rm -f conftest.$ac_ext
- fi
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_CC" >&5
-$as_echo "$ac_cv_sys_largefile_CC" >&6; }
- if test "$ac_cv_sys_largefile_CC" != no; then
- CC=$CC$ac_cv_sys_largefile_CC
- fi
-
- { $as_echo "$as_me:$LINENO: checking for _FILE_OFFSET_BITS value needed for large files" >&5
-$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; }
-if test "${ac_cv_sys_file_offset_bits+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- while :; do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
- We can't simply define LARGE_OFF_T to be 9223372036854775807,
- since some C++ compilers masquerading as C compilers
- incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
- int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
- && LARGE_OFF_T % 2147483647 == 1)
- ? 1 : -1];
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_sys_file_offset_bits=no; break
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#define _FILE_OFFSET_BITS 64
-#include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
- We can't simply define LARGE_OFF_T to be 9223372036854775807,
- since some C++ compilers masquerading as C compilers
- incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
- int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
- && LARGE_OFF_T % 2147483647 == 1)
- ? 1 : -1];
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_sys_file_offset_bits=64; break
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- ac_cv_sys_file_offset_bits=unknown
- break
-done
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sys_file_offset_bits" >&5
-$as_echo "$ac_cv_sys_file_offset_bits" >&6; }
-case $ac_cv_sys_file_offset_bits in #(
- no | unknown) ;;
- *)
-cat >>confdefs.h <<_ACEOF
-#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
-_ACEOF
-;;
-esac
-rm -rf conftest*
- if test $ac_cv_sys_file_offset_bits = unknown; then
- { $as_echo "$as_me:$LINENO: checking for _LARGE_FILES value needed for large files" >&5
-$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; }
-if test "${ac_cv_sys_large_files+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- while :; do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
- We can't simply define LARGE_OFF_T to be 9223372036854775807,
- since some C++ compilers masquerading as C compilers
- incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
- int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
- && LARGE_OFF_T % 2147483647 == 1)
- ? 1 : -1];
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_sys_large_files=no; break
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#define _LARGE_FILES 1
-#include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
- We can't simply define LARGE_OFF_T to be 9223372036854775807,
- since some C++ compilers masquerading as C compilers
- incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
- int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
- && LARGE_OFF_T % 2147483647 == 1)
- ? 1 : -1];
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_sys_large_files=1; break
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- ac_cv_sys_large_files=unknown
- break
-done
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sys_large_files" >&5
-$as_echo "$ac_cv_sys_large_files" >&6; }
-case $ac_cv_sys_large_files in #(
- no | unknown) ;;
- *)
-cat >>confdefs.h <<_ACEOF
-#define _LARGE_FILES $ac_cv_sys_large_files
-_ACEOF
-;;
-esac
-rm -rf conftest*
- fi
-fi
-
-
-case "$host_os" in
- *irix6*) cat >> confdefs.h <<\EOF
-#include <standards.h>
-EOF
-
- ;;
- *hpux*)
- # mmap on HPUX is completely broken...
-
-cat >>confdefs.h <<\_ACEOF
-#define MMAP_BLACKLIST 1
-_ACEOF
-
- if test "`uname -r`" = "B.11.00" -o "`uname -r`" = "B.11.11"; then
- { $as_echo "$as_me:$LINENO: WARNING: Enabling HPUX 11.00/11.11 header bug workaround" >&5
-$as_echo "$as_me: WARNING: Enabling HPUX 11.00/11.11 header bug workaround" >&2;}
- CFLAGS="$CFLAGS -Dpread=pread64 -Dpwrite=pwrite64"
- fi
- if test "`uname -r`" = "B.11.23"; then
- { $as_echo "$as_me:$LINENO: WARNING: Enabling HPUX 11.23 machine/sys/getppdp.h bug workaround" >&5
-$as_echo "$as_me: WARNING: Enabling HPUX 11.23 machine/sys/getppdp.h bug workaround" >&2;}
- CFLAGS="$CFLAGS -D_MACHINE_SYS_GETPPDP_INCLUDED"
- fi
- ;;
- *aix*)
-
-cat >>confdefs.h <<\_ACEOF
-#define BROKEN_STRNDUP 1
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define BROKEN_STRNLEN 1
-_ACEOF
-
- if test "${GCC}" != "yes"; then
- ## for funky AIX compiler using strncpy()
- CFLAGS="$CFLAGS -D_LINUX_SOURCE_COMPAT -qmaxmem=32000"
- fi
- ;;
- *osf*)
- # this brings in socklen_t
-
-
-
-
- cat >>confdefs.h <<\EOF
-#ifndef _XOPEN_SOURCE
-#define _XOPEN_SOURCE 600
-#endif
-EOF
-
-
-
-
-
- cat >>confdefs.h <<\EOF
-#ifndef _OSF_SOURCE
-#define _OSF_SOURCE 1
-#endif
-EOF
-
- ;;
- #
- # VOS may need to have POSIX support and System V compatibility enabled.
- #
- *vos*)
- case "$CFLAGS" in
- *-D_POSIX_C_SOURCE*);;
- *)
- CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=200112L"
-
-cat >>confdefs.h <<\_ACEOF
-#define _POSIX_C_SOURCE 200112L
-_ACEOF
-
- ;;
- esac
- case "$CFLAGS" in
- *-D_SYSV*|*-D_SVID_SOURCE*);;
- *)
- CFLAGS="$CFLAGS -D_SYSV"
-
-cat >>confdefs.h <<\_ACEOF
-#define _SYSV 1
-_ACEOF
-
- ;;
- esac
- ;;
-esac
-
-
-
-
-for ac_header in standards.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
- # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_header_compiler=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- ac_header_preproc=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
- ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-# Solaris needs HAVE_LONG_LONG defined
-{ $as_echo "$as_me:$LINENO: checking for long long" >&5
-$as_echo_n "checking for long long... " >&6; }
-if test "${ac_cv_type_long_long+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_cv_type_long_long=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof (long long))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof ((long long)))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- :
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_type_long_long=yes
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5
-$as_echo "$ac_cv_type_long_long" >&6; }
-if test "x$ac_cv_type_long_long" = x""yes; then
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_LONG_LONG 1
-_ACEOF
-
-
-fi
-
-
-# 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:$LINENO: checking size of int" >&5
-$as_echo_n "checking size of int... " >&6; }
-if test "${ac_cv_sizeof_int+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test "$cross_compiling" = yes; then
- # Depending upon the size, compute the lo and hi bounds.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (int))) >= 0)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_lo=0 ac_mid=0
- while :; do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (int))) <= $ac_mid)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_hi=$ac_mid; break
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_lo=`expr $ac_mid + 1`
- if test $ac_lo -le $ac_mid; then
- ac_lo= ac_hi=
- break
- fi
- ac_mid=`expr 2 '*' $ac_mid + 1`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- done
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (int))) < 0)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_hi=-1 ac_mid=-1
- while :; do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (int))) >= $ac_mid)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_lo=$ac_mid; break
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_hi=`expr '(' $ac_mid ')' - 1`
- if test $ac_mid -le $ac_hi; then
- ac_lo= ac_hi=
- break
- fi
- ac_mid=`expr 2 '*' $ac_mid`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- done
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- 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
- ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (int))) <= $ac_mid)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_hi=$ac_mid
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_lo=`expr '(' $ac_mid ')' + 1`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_int=$ac_lo;;
-'') if test "$ac_cv_type_int" = yes; then
- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (int)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (int)
-See \`config.log' for more details." >&2;}
- { (exit 77); exit 77; }; }; }
- else
- ac_cv_sizeof_int=0
- fi ;;
-esac
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-static long int longval () { return (long int) (sizeof (int)); }
-static unsigned long int ulongval () { return (long int) (sizeof (int)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
-
- FILE *f = fopen ("conftest.val", "w");
- if (! f)
- return 1;
- if (((long int) (sizeof (int))) < 0)
- {
- long int i = longval ();
- if (i != ((long int) (sizeof (int))))
- return 1;
- fprintf (f, "%ld", i);
- }
- else
- {
- unsigned long int i = ulongval ();
- if (i != ((long int) (sizeof (int))))
- 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
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_sizeof_int=`cat conftest.val`
-else
- $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-if test "$ac_cv_type_int" = yes; then
- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (int)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (int)
-See \`config.log' for more details." >&2;}
- { (exit 77); exit 77; }; }; }
- else
- ac_cv_sizeof_int=0
- fi
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f conftest.val
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5
-$as_echo "$ac_cv_sizeof_int" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_INT $ac_cv_sizeof_int
-_ACEOF
-
-
-# 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:$LINENO: checking size of char" >&5
-$as_echo_n "checking size of char... " >&6; }
-if test "${ac_cv_sizeof_char+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test "$cross_compiling" = yes; then
- # Depending upon the size, compute the lo and hi bounds.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (char))) >= 0)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_lo=0 ac_mid=0
- while :; do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (char))) <= $ac_mid)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_hi=$ac_mid; break
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_lo=`expr $ac_mid + 1`
- if test $ac_lo -le $ac_mid; then
- ac_lo= ac_hi=
- break
- fi
- ac_mid=`expr 2 '*' $ac_mid + 1`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- done
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (char))) < 0)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_hi=-1 ac_mid=-1
- while :; do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (char))) >= $ac_mid)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_lo=$ac_mid; break
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_hi=`expr '(' $ac_mid ')' - 1`
- if test $ac_mid -le $ac_hi; then
- ac_lo= ac_hi=
- break
- fi
- ac_mid=`expr 2 '*' $ac_mid`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- done
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- 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
- ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (char))) <= $ac_mid)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_hi=$ac_mid
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_lo=`expr '(' $ac_mid ')' + 1`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_char=$ac_lo;;
-'') if test "$ac_cv_type_char" = yes; then
- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (char)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (char)
-See \`config.log' for more details." >&2;}
- { (exit 77); exit 77; }; }; }
- else
- ac_cv_sizeof_char=0
- fi ;;
-esac
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-static long int longval () { return (long int) (sizeof (char)); }
-static unsigned long int ulongval () { return (long int) (sizeof (char)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
-
- FILE *f = fopen ("conftest.val", "w");
- if (! f)
- return 1;
- if (((long int) (sizeof (char))) < 0)
- {
- long int i = longval ();
- if (i != ((long int) (sizeof (char))))
- return 1;
- fprintf (f, "%ld", i);
- }
- else
- {
- unsigned long int i = ulongval ();
- if (i != ((long int) (sizeof (char))))
- 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
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_sizeof_char=`cat conftest.val`
-else
- $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-if test "$ac_cv_type_char" = yes; then
- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (char)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (char)
-See \`config.log' for more details." >&2;}
- { (exit 77); exit 77; }; }; }
- else
- ac_cv_sizeof_char=0
- fi
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f conftest.val
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_char" >&5
-$as_echo "$ac_cv_sizeof_char" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_CHAR $ac_cv_sizeof_char
-_ACEOF
-
-
-# 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:$LINENO: checking size of short" >&5
-$as_echo_n "checking size of short... " >&6; }
-if test "${ac_cv_sizeof_short+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test "$cross_compiling" = yes; then
- # Depending upon the size, compute the lo and hi bounds.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (short))) >= 0)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_lo=0 ac_mid=0
- while :; do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (short))) <= $ac_mid)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_hi=$ac_mid; break
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_lo=`expr $ac_mid + 1`
- if test $ac_lo -le $ac_mid; then
- ac_lo= ac_hi=
- break
- fi
- ac_mid=`expr 2 '*' $ac_mid + 1`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- done
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (short))) < 0)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_hi=-1 ac_mid=-1
- while :; do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (short))) >= $ac_mid)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_lo=$ac_mid; break
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_hi=`expr '(' $ac_mid ')' - 1`
- if test $ac_mid -le $ac_hi; then
- ac_lo= ac_hi=
- break
- fi
- ac_mid=`expr 2 '*' $ac_mid`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- done
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- 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
- ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (short))) <= $ac_mid)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_hi=$ac_mid
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_lo=`expr '(' $ac_mid ')' + 1`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_short=$ac_lo;;
-'') if test "$ac_cv_type_short" = yes; then
- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (short)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (short)
-See \`config.log' for more details." >&2;}
- { (exit 77); exit 77; }; }; }
- else
- ac_cv_sizeof_short=0
- fi ;;
-esac
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-static long int longval () { return (long int) (sizeof (short)); }
-static unsigned long int ulongval () { return (long int) (sizeof (short)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
-
- FILE *f = fopen ("conftest.val", "w");
- if (! f)
- return 1;
- if (((long int) (sizeof (short))) < 0)
- {
- long int i = longval ();
- if (i != ((long int) (sizeof (short))))
- return 1;
- fprintf (f, "%ld", i);
- }
- else
- {
- unsigned long int i = ulongval ();
- if (i != ((long int) (sizeof (short))))
- 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
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_sizeof_short=`cat conftest.val`
-else
- $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-if test "$ac_cv_type_short" = yes; then
- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (short)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (short)
-See \`config.log' for more details." >&2;}
- { (exit 77); exit 77; }; }; }
- else
- ac_cv_sizeof_short=0
- fi
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f conftest.val
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_short" >&5
-$as_echo "$ac_cv_sizeof_short" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_SHORT $ac_cv_sizeof_short
-_ACEOF
-
-
-# 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:$LINENO: checking size of long" >&5
-$as_echo_n "checking size of long... " >&6; }
-if test "${ac_cv_sizeof_long+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test "$cross_compiling" = yes; then
- # Depending upon the size, compute the lo and hi bounds.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long))) >= 0)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_lo=0 ac_mid=0
- while :; do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long))) <= $ac_mid)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_hi=$ac_mid; break
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_lo=`expr $ac_mid + 1`
- if test $ac_lo -le $ac_mid; then
- ac_lo= ac_hi=
- break
- fi
- ac_mid=`expr 2 '*' $ac_mid + 1`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- done
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long))) < 0)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_hi=-1 ac_mid=-1
- while :; do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long))) >= $ac_mid)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_lo=$ac_mid; break
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_hi=`expr '(' $ac_mid ')' - 1`
- if test $ac_mid -le $ac_hi; then
- ac_lo= ac_hi=
- break
- fi
- ac_mid=`expr 2 '*' $ac_mid`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- done
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- 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
- ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long))) <= $ac_mid)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_hi=$ac_mid
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_lo=`expr '(' $ac_mid ')' + 1`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_long=$ac_lo;;
-'') if test "$ac_cv_type_long" = yes; then
- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (long)
-See \`config.log' for more details." >&2;}
- { (exit 77); exit 77; }; }; }
- else
- ac_cv_sizeof_long=0
- fi ;;
-esac
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-static long int longval () { return (long int) (sizeof (long)); }
-static unsigned long int ulongval () { return (long int) (sizeof (long)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
-
- FILE *f = fopen ("conftest.val", "w");
- if (! f)
- return 1;
- if (((long int) (sizeof (long))) < 0)
- {
- long int i = longval ();
- if (i != ((long int) (sizeof (long))))
- return 1;
- fprintf (f, "%ld", i);
- }
- else
- {
- unsigned long int i = ulongval ();
- if (i != ((long int) (sizeof (long))))
- 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
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_sizeof_long=`cat conftest.val`
-else
- $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-if test "$ac_cv_type_long" = yes; then
- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (long)
-See \`config.log' for more details." >&2;}
- { (exit 77); exit 77; }; }; }
- else
- ac_cv_sizeof_long=0
- fi
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f conftest.val
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5
-$as_echo "$ac_cv_sizeof_long" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_LONG $ac_cv_sizeof_long
-_ACEOF
-
-
-# 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:$LINENO: checking size of long long" >&5
-$as_echo_n "checking size of long long... " >&6; }
-if test "${ac_cv_sizeof_long_long+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test "$cross_compiling" = yes; then
- # Depending upon the size, compute the lo and hi bounds.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long long))) >= 0)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_lo=0 ac_mid=0
- while :; do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long long))) <= $ac_mid)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_hi=$ac_mid; break
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_lo=`expr $ac_mid + 1`
- if test $ac_lo -le $ac_mid; then
- ac_lo= ac_hi=
- break
- fi
- ac_mid=`expr 2 '*' $ac_mid + 1`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- done
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long long))) < 0)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_hi=-1 ac_mid=-1
- while :; do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long long))) >= $ac_mid)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_lo=$ac_mid; break
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_hi=`expr '(' $ac_mid ')' - 1`
- if test $ac_mid -le $ac_hi; then
- ac_lo= ac_hi=
- break
- fi
- ac_mid=`expr 2 '*' $ac_mid`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- done
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- 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
- ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long long))) <= $ac_mid)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_hi=$ac_mid
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_lo=`expr '(' $ac_mid ')' + 1`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_long_long=$ac_lo;;
-'') if test "$ac_cv_type_long_long" = yes; then
- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long long)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (long long)
-See \`config.log' for more details." >&2;}
- { (exit 77); exit 77; }; }; }
- else
- ac_cv_sizeof_long_long=0
- fi ;;
-esac
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-static long int longval () { return (long int) (sizeof (long long)); }
-static unsigned long int ulongval () { return (long int) (sizeof (long long)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
-
- FILE *f = fopen ("conftest.val", "w");
- if (! f)
- return 1;
- if (((long int) (sizeof (long long))) < 0)
- {
- long int i = longval ();
- if (i != ((long int) (sizeof (long long))))
- return 1;
- fprintf (f, "%ld", i);
- }
- else
- {
- unsigned long int i = ulongval ();
- if (i != ((long int) (sizeof (long long))))
- 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
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_sizeof_long_long=`cat conftest.val`
-else
- $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-if test "$ac_cv_type_long_long" = yes; then
- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long long)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (long long)
-See \`config.log' for more details." >&2;}
- { (exit 77); exit 77; }; }; }
- else
- ac_cv_sizeof_long_long=0
- fi
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f conftest.val
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_long" >&5
-$as_echo "$ac_cv_sizeof_long_long" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
-_ACEOF
-
-
-
-{ $as_echo "$as_me:$LINENO: checking for uint_t" >&5
-$as_echo_n "checking for uint_t... " >&6; }
-if test "${ac_cv_type_uint_t+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_cv_type_uint_t=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof (uint_t))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof ((uint_t)))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- :
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_type_uint_t=yes
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_uint_t" >&5
-$as_echo "$ac_cv_type_uint_t" >&6; }
-if test "x$ac_cv_type_uint_t" = x""yes; then
- :
-else
-
-cat >>confdefs.h <<_ACEOF
-#define uint_t unsigned int
-_ACEOF
-
-fi
-
-{ $as_echo "$as_me:$LINENO: checking for int8_t" >&5
-$as_echo_n "checking for int8_t... " >&6; }
-if test "${ac_cv_type_int8_t+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_cv_type_int8_t=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof (int8_t))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof ((int8_t)))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- :
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_type_int8_t=yes
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_int8_t" >&5
-$as_echo "$ac_cv_type_int8_t" >&6; }
-if test "x$ac_cv_type_int8_t" = x""yes; then
- :
-else
-
-cat >>confdefs.h <<_ACEOF
-#define int8_t char
-_ACEOF
-
-fi
-
-{ $as_echo "$as_me:$LINENO: checking for uint8_t" >&5
-$as_echo_n "checking for uint8_t... " >&6; }
-if test "${ac_cv_type_uint8_t+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_cv_type_uint8_t=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof (uint8_t))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof ((uint8_t)))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- :
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_type_uint8_t=yes
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_uint8_t" >&5
-$as_echo "$ac_cv_type_uint8_t" >&6; }
-if test "x$ac_cv_type_uint8_t" = x""yes; then
- :
-else
-
-cat >>confdefs.h <<_ACEOF
-#define uint8_t unsigned char
-_ACEOF
-
-fi
-
-{ $as_echo "$as_me:$LINENO: checking for int16_t" >&5
-$as_echo_n "checking for int16_t... " >&6; }
-if test "${ac_cv_type_int16_t+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_cv_type_int16_t=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof (int16_t))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof ((int16_t)))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- :
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_type_int16_t=yes
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_int16_t" >&5
-$as_echo "$ac_cv_type_int16_t" >&6; }
-if test "x$ac_cv_type_int16_t" = x""yes; then
- :
-else
-
-cat >>confdefs.h <<_ACEOF
-#define int16_t short
-_ACEOF
-
-fi
-
-{ $as_echo "$as_me:$LINENO: checking for uint16_t" >&5
-$as_echo_n "checking for uint16_t... " >&6; }
-if test "${ac_cv_type_uint16_t+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_cv_type_uint16_t=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof (uint16_t))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof ((uint16_t)))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- :
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_type_uint16_t=yes
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_uint16_t" >&5
-$as_echo "$ac_cv_type_uint16_t" >&6; }
-if test "x$ac_cv_type_uint16_t" = x""yes; then
- :
-else
-
-cat >>confdefs.h <<_ACEOF
-#define uint16_t unsigned short
-_ACEOF
-
-fi
-
-
-if test $ac_cv_sizeof_int -eq 4 ; then
-{ $as_echo "$as_me:$LINENO: checking for int32_t" >&5
-$as_echo_n "checking for int32_t... " >&6; }
-if test "${ac_cv_type_int32_t+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_cv_type_int32_t=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof (int32_t))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof ((int32_t)))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- :
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_type_int32_t=yes
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_int32_t" >&5
-$as_echo "$ac_cv_type_int32_t" >&6; }
-if test "x$ac_cv_type_int32_t" = x""yes; then
- :
-else
-
-cat >>confdefs.h <<_ACEOF
-#define int32_t int
-_ACEOF
-
-fi
-
-{ $as_echo "$as_me:$LINENO: checking for uint32_t" >&5
-$as_echo_n "checking for uint32_t... " >&6; }
-if test "${ac_cv_type_uint32_t+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_cv_type_uint32_t=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof (uint32_t))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof ((uint32_t)))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- :
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_type_uint32_t=yes
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_uint32_t" >&5
-$as_echo "$ac_cv_type_uint32_t" >&6; }
-if test "x$ac_cv_type_uint32_t" = x""yes; then
- :
-else
-
-cat >>confdefs.h <<_ACEOF
-#define uint32_t unsigned int
-_ACEOF
-
-fi
-
-elif test $ac_cv_size_long -eq 4 ; then
-{ $as_echo "$as_me:$LINENO: checking for int32_t" >&5
-$as_echo_n "checking for int32_t... " >&6; }
-if test "${ac_cv_type_int32_t+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_cv_type_int32_t=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof (int32_t))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof ((int32_t)))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- :
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_type_int32_t=yes
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_int32_t" >&5
-$as_echo "$ac_cv_type_int32_t" >&6; }
-if test "x$ac_cv_type_int32_t" = x""yes; then
- :
-else
-
-cat >>confdefs.h <<_ACEOF
-#define int32_t long
-_ACEOF
-
-fi
-
-{ $as_echo "$as_me:$LINENO: checking for uint32_t" >&5
-$as_echo_n "checking for uint32_t... " >&6; }
-if test "${ac_cv_type_uint32_t+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_cv_type_uint32_t=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof (uint32_t))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof ((uint32_t)))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- :
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_type_uint32_t=yes
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_uint32_t" >&5
-$as_echo "$ac_cv_type_uint32_t" >&6; }
-if test "x$ac_cv_type_uint32_t" = x""yes; then
- :
-else
-
-cat >>confdefs.h <<_ACEOF
-#define uint32_t unsigned long
-_ACEOF
-
-fi
-
-else
-{ { $as_echo "$as_me:$LINENO: error: LIBREPLACE no 32-bit type found" >&5
-$as_echo "$as_me: error: LIBREPLACE no 32-bit type found" >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-{ $as_echo "$as_me:$LINENO: checking for int64_t" >&5
-$as_echo_n "checking for int64_t... " >&6; }
-if test "${ac_cv_type_int64_t+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_cv_type_int64_t=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof (int64_t))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof ((int64_t)))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- :
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_type_int64_t=yes
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_int64_t" >&5
-$as_echo "$ac_cv_type_int64_t" >&6; }
-if test "x$ac_cv_type_int64_t" = x""yes; then
- :
-else
-
-cat >>confdefs.h <<_ACEOF
-#define int64_t long long
-_ACEOF
-
-fi
-
-{ $as_echo "$as_me:$LINENO: checking for uint64_t" >&5
-$as_echo_n "checking for uint64_t... " >&6; }
-if test "${ac_cv_type_uint64_t+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_cv_type_uint64_t=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof (uint64_t))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof ((uint64_t)))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- :
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_type_uint64_t=yes
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_uint64_t" >&5
-$as_echo "$ac_cv_type_uint64_t" >&6; }
-if test "x$ac_cv_type_uint64_t" = x""yes; then
- :
-else
-
-cat >>confdefs.h <<_ACEOF
-#define uint64_t unsigned long long
-_ACEOF
-
-fi
-
-
-{ $as_echo "$as_me:$LINENO: checking for size_t" >&5
-$as_echo_n "checking for size_t... " >&6; }
-if test "${ac_cv_type_size_t+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_cv_type_size_t=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof (size_t))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof ((size_t)))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- :
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_type_size_t=yes
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
-$as_echo "$ac_cv_type_size_t" >&6; }
-if test "x$ac_cv_type_size_t" = x""yes; then
- :
-else
-
-cat >>confdefs.h <<_ACEOF
-#define size_t unsigned int
-_ACEOF
-
-fi
-
-{ $as_echo "$as_me:$LINENO: checking for ssize_t" >&5
-$as_echo_n "checking for ssize_t... " >&6; }
-if test "${ac_cv_type_ssize_t+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_cv_type_ssize_t=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof (ssize_t))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof ((ssize_t)))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- :
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_type_ssize_t=yes
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_ssize_t" >&5
-$as_echo "$ac_cv_type_ssize_t" >&6; }
-if test "x$ac_cv_type_ssize_t" = x""yes; then
- :
-else
-
-cat >>confdefs.h <<_ACEOF
-#define ssize_t int
-_ACEOF
-
-fi
-
-
-# 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:$LINENO: checking size of off_t" >&5
-$as_echo_n "checking size of off_t... " >&6; }
-if test "${ac_cv_sizeof_off_t+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test "$cross_compiling" = yes; then
- # Depending upon the size, compute the lo and hi bounds.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (off_t))) >= 0)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_lo=0 ac_mid=0
- while :; do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (off_t))) <= $ac_mid)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_hi=$ac_mid; break
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_lo=`expr $ac_mid + 1`
- if test $ac_lo -le $ac_mid; then
- ac_lo= ac_hi=
- break
- fi
- ac_mid=`expr 2 '*' $ac_mid + 1`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- done
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (off_t))) < 0)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_hi=-1 ac_mid=-1
- while :; do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (off_t))) >= $ac_mid)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_lo=$ac_mid; break
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_hi=`expr '(' $ac_mid ')' - 1`
- if test $ac_mid -le $ac_hi; then
- ac_lo= ac_hi=
- break
- fi
- ac_mid=`expr 2 '*' $ac_mid`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- done
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- 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
- ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (off_t))) <= $ac_mid)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_hi=$ac_mid
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_lo=`expr '(' $ac_mid ')' + 1`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_off_t=$ac_lo;;
-'') if test "$ac_cv_type_off_t" = yes; then
- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (off_t)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (off_t)
-See \`config.log' for more details." >&2;}
- { (exit 77); exit 77; }; }; }
- else
- ac_cv_sizeof_off_t=0
- fi ;;
-esac
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-static long int longval () { return (long int) (sizeof (off_t)); }
-static unsigned long int ulongval () { return (long int) (sizeof (off_t)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
-
- FILE *f = fopen ("conftest.val", "w");
- if (! f)
- return 1;
- if (((long int) (sizeof (off_t))) < 0)
- {
- long int i = longval ();
- if (i != ((long int) (sizeof (off_t))))
- return 1;
- fprintf (f, "%ld", i);
- }
- else
- {
- unsigned long int i = ulongval ();
- if (i != ((long int) (sizeof (off_t))))
- 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
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_sizeof_off_t=`cat conftest.val`
-else
- $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-if test "$ac_cv_type_off_t" = yes; then
- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (off_t)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (off_t)
-See \`config.log' for more details." >&2;}
- { (exit 77); exit 77; }; }; }
- else
- ac_cv_sizeof_off_t=0
- fi
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f conftest.val
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_off_t" >&5
-$as_echo "$ac_cv_sizeof_off_t" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_OFF_T $ac_cv_sizeof_off_t
-_ACEOF
-
-
-# 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:$LINENO: checking size of size_t" >&5
-$as_echo_n "checking size of size_t... " >&6; }
-if test "${ac_cv_sizeof_size_t+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test "$cross_compiling" = yes; then
- # Depending upon the size, compute the lo and hi bounds.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) >= 0)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_lo=0 ac_mid=0
- while :; do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) <= $ac_mid)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_hi=$ac_mid; break
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_lo=`expr $ac_mid + 1`
- if test $ac_lo -le $ac_mid; then
- ac_lo= ac_hi=
- break
- fi
- ac_mid=`expr 2 '*' $ac_mid + 1`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- done
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) < 0)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_hi=-1 ac_mid=-1
- while :; do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) >= $ac_mid)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_lo=$ac_mid; break
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_hi=`expr '(' $ac_mid ')' - 1`
- if test $ac_mid -le $ac_hi; then
- ac_lo= ac_hi=
- break
- fi
- ac_mid=`expr 2 '*' $ac_mid`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- done
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- 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
- ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) <= $ac_mid)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_hi=$ac_mid
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_lo=`expr '(' $ac_mid ')' + 1`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_size_t=$ac_lo;;
-'') if test "$ac_cv_type_size_t" = yes; then
- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (size_t)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (size_t)
-See \`config.log' for more details." >&2;}
- { (exit 77); exit 77; }; }; }
- else
- ac_cv_sizeof_size_t=0
- fi ;;
-esac
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-static long int longval () { return (long int) (sizeof (size_t)); }
-static unsigned long int ulongval () { return (long int) (sizeof (size_t)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
-
- FILE *f = fopen ("conftest.val", "w");
- if (! f)
- return 1;
- if (((long int) (sizeof (size_t))) < 0)
- {
- long int i = longval ();
- if (i != ((long int) (sizeof (size_t))))
- return 1;
- fprintf (f, "%ld", i);
- }
- else
- {
- unsigned long int i = ulongval ();
- if (i != ((long int) (sizeof (size_t))))
- 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
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_sizeof_size_t=`cat conftest.val`
-else
- $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-if test "$ac_cv_type_size_t" = yes; then
- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (size_t)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (size_t)
-See \`config.log' for more details." >&2;}
- { (exit 77); exit 77; }; }; }
- else
- ac_cv_sizeof_size_t=0
- fi
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f conftest.val
-fi
-{ $as_echo "$as_me:$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
-
-
-# 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:$LINENO: checking size of ssize_t" >&5
-$as_echo_n "checking size of ssize_t... " >&6; }
-if test "${ac_cv_sizeof_ssize_t+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test "$cross_compiling" = yes; then
- # Depending upon the size, compute the lo and hi bounds.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (ssize_t))) >= 0)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_lo=0 ac_mid=0
- while :; do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (ssize_t))) <= $ac_mid)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_hi=$ac_mid; break
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_lo=`expr $ac_mid + 1`
- if test $ac_lo -le $ac_mid; then
- ac_lo= ac_hi=
- break
- fi
- ac_mid=`expr 2 '*' $ac_mid + 1`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- done
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (ssize_t))) < 0)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_hi=-1 ac_mid=-1
- while :; do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (ssize_t))) >= $ac_mid)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_lo=$ac_mid; break
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_hi=`expr '(' $ac_mid ')' - 1`
- if test $ac_mid -le $ac_hi; then
- ac_lo= ac_hi=
- break
- fi
- ac_mid=`expr 2 '*' $ac_mid`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- done
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- 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
- ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (ssize_t))) <= $ac_mid)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_hi=$ac_mid
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_lo=`expr '(' $ac_mid ')' + 1`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_ssize_t=$ac_lo;;
-'') if test "$ac_cv_type_ssize_t" = yes; then
- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (ssize_t)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (ssize_t)
-See \`config.log' for more details." >&2;}
- { (exit 77); exit 77; }; }; }
- else
- ac_cv_sizeof_ssize_t=0
- fi ;;
-esac
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-static long int longval () { return (long int) (sizeof (ssize_t)); }
-static unsigned long int ulongval () { return (long int) (sizeof (ssize_t)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
-
- FILE *f = fopen ("conftest.val", "w");
- if (! f)
- return 1;
- if (((long int) (sizeof (ssize_t))) < 0)
- {
- long int i = longval ();
- if (i != ((long int) (sizeof (ssize_t))))
- return 1;
- fprintf (f, "%ld", i);
- }
- else
- {
- unsigned long int i = ulongval ();
- if (i != ((long int) (sizeof (ssize_t))))
- 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
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_sizeof_ssize_t=`cat conftest.val`
-else
- $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-if test "$ac_cv_type_ssize_t" = yes; then
- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (ssize_t)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (ssize_t)
-See \`config.log' for more details." >&2;}
- { (exit 77); exit 77; }; }; }
- else
- ac_cv_sizeof_ssize_t=0
- fi
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f conftest.val
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_ssize_t" >&5
-$as_echo "$ac_cv_sizeof_ssize_t" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_SSIZE_T $ac_cv_sizeof_ssize_t
-_ACEOF
-
-
-
-{ $as_echo "$as_me:$LINENO: checking for intptr_t" >&5
-$as_echo_n "checking for intptr_t... " >&6; }
-if test "${ac_cv_type_intptr_t+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_cv_type_intptr_t=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof (intptr_t))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof ((intptr_t)))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- :
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_type_intptr_t=yes
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_intptr_t" >&5
-$as_echo "$ac_cv_type_intptr_t" >&6; }
-if test "x$ac_cv_type_intptr_t" = x""yes; then
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_INTPTR_T 1
-_ACEOF
-
-
-fi
-{ $as_echo "$as_me:$LINENO: checking for uintptr_t" >&5
-$as_echo_n "checking for uintptr_t... " >&6; }
-if test "${ac_cv_type_uintptr_t+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_cv_type_uintptr_t=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof (uintptr_t))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof ((uintptr_t)))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- :
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_type_uintptr_t=yes
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_uintptr_t" >&5
-$as_echo "$ac_cv_type_uintptr_t" >&6; }
-if test "x$ac_cv_type_uintptr_t" = x""yes; then
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_UINTPTR_T 1
-_ACEOF
-
-
-fi
-{ $as_echo "$as_me:$LINENO: checking for ptrdiff_t" >&5
-$as_echo_n "checking for ptrdiff_t... " >&6; }
-if test "${ac_cv_type_ptrdiff_t+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_cv_type_ptrdiff_t=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof (ptrdiff_t))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof ((ptrdiff_t)))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- :
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_type_ptrdiff_t=yes
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_ptrdiff_t" >&5
-$as_echo "$ac_cv_type_ptrdiff_t" >&6; }
-if test "x$ac_cv_type_ptrdiff_t" = x""yes; then
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_PTRDIFF_T 1
-_ACEOF
-
-
-fi
-
-
-if test x"$ac_cv_type_long_long" != x"yes";then
- { { $as_echo "$as_me:$LINENO: error: LIBREPLACE needs type 'long long'" >&5
-$as_echo "$as_me: error: LIBREPLACE needs type 'long long'" >&2;}
- { (exit 1); exit 1; }; }
-fi
-if test $ac_cv_sizeof_long_long -lt 8;then
- { { $as_echo "$as_me:$LINENO: error: LIBREPLACE needs sizeof(long long) >= 8" >&5
-$as_echo "$as_me: error: LIBREPLACE needs sizeof(long long) >= 8" >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-############################################
-# check if the compiler can do immediate structures
-
-{ $as_echo "$as_me:$LINENO: checking for immediate structures" >&5
-$as_echo_n "checking for immediate structures... " >&6; }
-if test "${libreplace_cv_immediate_structures+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
-
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
- #include <stdio.h>
-
-int
-main ()
-{
-
- typedef struct {unsigned x;} FOOBAR;
- #define X_FOOBAR(x) ((FOOBAR) { x })
- #define FOO_ONE X_FOOBAR(1)
- FOOBAR f = FOO_ONE;
- static const struct {
- FOOBAR y;
- } f2[] = {
- {FOO_ONE}
- };
- static const FOOBAR f3[] = {FOO_ONE};
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- libreplace_cv_immediate_structures=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- libreplace_cv_immediate_structures=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $libreplace_cv_immediate_structures" >&5
-$as_echo "$libreplace_cv_immediate_structures" >&6; }
-if test x"$libreplace_cv_immediate_structures" = x"yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_IMMEDIATE_STRUCTURES 1
-_ACEOF
-
-fi
-
-
-echo "LIBREPLACE_CC_CHECKS: END"
-
-
-
-echo "LIBREPLACE_BROKEN_CHECKS: START"
-
-libreplacedir=""
-libreplacepaths="$srcdir $srcdir/lib/replace $srcdir/libreplace $srcdir/../libreplace $srcdir/../replace $srcdir/../lib/replace $srcdir/../../../lib/replace"
-for d in $libreplacepaths; do
- if test -f "$d/replace.c"; then
- libreplacedir="$d"
-
- break;
- fi
-done
-if test x"$libreplacedir" = "x"; then
- { { $as_echo "$as_me:$LINENO: error: cannot find libreplace in $libreplacepaths" >&5
-$as_echo "$as_me: error: cannot find libreplace in $libreplacepaths" >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-LIBREPLACEOBJ="$libreplacedir/replace.o"
-
-
-LIBREPLACEOBJ="${LIBREPLACEOBJ} $libreplacedir/snprintf.o"
-
-{ $as_echo "$as_me:$LINENO: checking return type of signal handlers" >&5
-$as_echo_n "checking return type of signal handlers... " >&6; }
-if test "${ac_cv_type_signal+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <sys/types.h>
-#include <signal.h>
-
-int
-main ()
-{
-return *(signal (0, 0)) (0) == 1;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_type_signal=int
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_type_signal=void
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5
-$as_echo "$ac_cv_type_signal" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define RETSIGTYPE $ac_cv_type_signal
-_ACEOF
-
-
-{ $as_echo "$as_me:$LINENO: checking for uid_t in sys/types.h" >&5
-$as_echo_n "checking for uid_t in sys/types.h... " >&6; }
-if test "${ac_cv_type_uid_t+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <sys/types.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "uid_t" >/dev/null 2>&1; then
- ac_cv_type_uid_t=yes
-else
- ac_cv_type_uid_t=no
-fi
-rm -f conftest*
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_uid_t" >&5
-$as_echo "$ac_cv_type_uid_t" >&6; }
-if test $ac_cv_type_uid_t = no; then
-
-cat >>confdefs.h <<\_ACEOF
-#define uid_t int
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define gid_t int
-_ACEOF
-
-fi
-
-{ $as_echo "$as_me:$LINENO: checking for mode_t" >&5
-$as_echo_n "checking for mode_t... " >&6; }
-if test "${ac_cv_type_mode_t+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_cv_type_mode_t=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof (mode_t))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof ((mode_t)))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- :
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_type_mode_t=yes
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_mode_t" >&5
-$as_echo "$ac_cv_type_mode_t" >&6; }
-if test "x$ac_cv_type_mode_t" = x""yes; then
- :
-else
-
-cat >>confdefs.h <<_ACEOF
-#define mode_t int
-_ACEOF
-
-fi
-
-{ $as_echo "$as_me:$LINENO: checking for off_t" >&5
-$as_echo_n "checking for off_t... " >&6; }
-if test "${ac_cv_type_off_t+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_cv_type_off_t=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof (off_t))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof ((off_t)))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- :
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_type_off_t=yes
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5
-$as_echo "$ac_cv_type_off_t" >&6; }
-if test "x$ac_cv_type_off_t" = x""yes; then
- :
-else
-
-cat >>confdefs.h <<_ACEOF
-#define off_t long int
-_ACEOF
-
-fi
-
-{ $as_echo "$as_me:$LINENO: checking for size_t" >&5
-$as_echo_n "checking for size_t... " >&6; }
-if test "${ac_cv_type_size_t+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_cv_type_size_t=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof (size_t))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof ((size_t)))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- :
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_type_size_t=yes
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
-$as_echo "$ac_cv_type_size_t" >&6; }
-if test "x$ac_cv_type_size_t" = x""yes; then
- :
-else
-
-cat >>confdefs.h <<_ACEOF
-#define size_t unsigned int
-_ACEOF
-
-fi
-
-{ $as_echo "$as_me:$LINENO: checking for pid_t" >&5
-$as_echo_n "checking for pid_t... " >&6; }
-if test "${ac_cv_type_pid_t+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_cv_type_pid_t=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof (pid_t))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof ((pid_t)))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- :
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_type_pid_t=yes
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5
-$as_echo "$ac_cv_type_pid_t" >&6; }
-if test "x$ac_cv_type_pid_t" = x""yes; then
- :
-else
-
-cat >>confdefs.h <<_ACEOF
-#define pid_t int
-_ACEOF
-
-fi
-
-{ $as_echo "$as_me:$LINENO: checking for struct stat.st_rdev" >&5
-$as_echo_n "checking for struct stat.st_rdev... " >&6; }
-if test "${ac_cv_member_struct_stat_st_rdev+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static struct stat ac_aggr;
-if (ac_aggr.st_rdev)
-return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_member_struct_stat_st_rdev=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static struct stat ac_aggr;
-if (sizeof ac_aggr.st_rdev)
-return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_member_struct_stat_st_rdev=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_member_struct_stat_st_rdev=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_rdev" >&5
-$as_echo "$ac_cv_member_struct_stat_st_rdev" >&6; }
-if test "x$ac_cv_member_struct_stat_st_rdev" = x""yes; then
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_STRUCT_STAT_ST_RDEV 1
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_ST_RDEV 1
-_ACEOF
-
-fi
-
-
-{ $as_echo "$as_me:$LINENO: checking for ino_t" >&5
-$as_echo_n "checking for ino_t... " >&6; }
-if test "${ac_cv_type_ino_t+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_cv_type_ino_t=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof (ino_t))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof ((ino_t)))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- :
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_type_ino_t=yes
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_ino_t" >&5
-$as_echo "$ac_cv_type_ino_t" >&6; }
-if test "x$ac_cv_type_ino_t" = x""yes; then
- :
-else
-
-cat >>confdefs.h <<_ACEOF
-#define ino_t unsigned
-_ACEOF
-
-fi
-
-{ $as_echo "$as_me:$LINENO: checking for loff_t" >&5
-$as_echo_n "checking for loff_t... " >&6; }
-if test "${ac_cv_type_loff_t+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_cv_type_loff_t=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof (loff_t))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof ((loff_t)))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- :
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_type_loff_t=yes
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_loff_t" >&5
-$as_echo "$ac_cv_type_loff_t" >&6; }
-if test "x$ac_cv_type_loff_t" = x""yes; then
- :
-else
-
-cat >>confdefs.h <<_ACEOF
-#define loff_t off_t
-_ACEOF
-
-fi
-
-{ $as_echo "$as_me:$LINENO: checking for offset_t" >&5
-$as_echo_n "checking for offset_t... " >&6; }
-if test "${ac_cv_type_offset_t+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_cv_type_offset_t=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof (offset_t))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof ((offset_t)))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- :
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_type_offset_t=yes
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_offset_t" >&5
-$as_echo "$ac_cv_type_offset_t" >&6; }
-if test "x$ac_cv_type_offset_t" = x""yes; then
- :
-else
-
-cat >>confdefs.h <<_ACEOF
-#define offset_t loff_t
-_ACEOF
-
-fi
-
-
-{ $as_echo "$as_me:$LINENO: checking for working memcmp" >&5
-$as_echo_n "checking for working memcmp... " >&6; }
-if test "${ac_cv_func_memcmp_working+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test "$cross_compiling" = yes; then
- ac_cv_func_memcmp_working=no
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-
- /* Some versions of memcmp are not 8-bit clean. */
- char c0 = '\100', c1 = '\200', c2 = '\201';
- if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0)
- return 1;
-
- /* The Next x86 OpenStep bug shows up only when comparing 16 bytes
- or more and with at least one buffer not starting on a 4-byte boundary.
- William Lewis provided this test program. */
- {
- char foo[21];
- char bar[21];
- int i;
- for (i = 0; i < 4; i++)
- {
- char *a = foo + i;
- char *b = bar + i;
- strcpy (a, "--------01111111");
- strcpy (b, "--------10000000");
- if (memcmp (a, b, 16) >= 0)
- return 1;
- }
- return 0;
- }
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_func_memcmp_working=yes
-else
- $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_func_memcmp_working=no
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_memcmp_working" >&5
-$as_echo "$ac_cv_func_memcmp_working" >&6; }
-test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in
- *" memcmp.$ac_objext "* ) ;;
- *) LIBOBJS="$LIBOBJS memcmp.$ac_objext"
- ;;
-esac
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-for ac_func in pipe strftime srandom random srand rand usleep setbuffer lstat getpgrp utime utimes
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
- eval "$as_ac_var=yes"
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
-
-
-
-for ac_header in stdbool.h stdint.h sys/select.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
- # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_header_compiler=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- ac_header_preproc=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
- ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-
-for ac_header in setjmp.h utime.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
- # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_header_compiler=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- ac_header_preproc=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
- ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-if test "${ac_cv_header_stdint_h+set}" = set; then
- { $as_echo "$as_me:$LINENO: checking for stdint.h" >&5
-$as_echo_n "checking for stdint.h... " >&6; }
-if test "${ac_cv_header_stdint_h+set}" = set; then
- $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdint_h" >&5
-$as_echo "$ac_cv_header_stdint_h" >&6; }
-else
- # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking stdint.h usability" >&5
-$as_echo_n "checking stdint.h usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <stdint.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_header_compiler=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking stdint.h presence" >&5
-$as_echo_n "checking stdint.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdint.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- ac_header_preproc=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { $as_echo "$as_me:$LINENO: WARNING: stdint.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: stdint.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: stdint.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: stdint.h: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { $as_echo "$as_me:$LINENO: WARNING: stdint.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: stdint.h: present but cannot be compiled" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: stdint.h: check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: stdint.h: check for missing prerequisite headers?" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: stdint.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: stdint.h: see the Autoconf documentation" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: stdint.h: section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: stdint.h: section \"Present But Cannot Be Compiled\"" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: stdint.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: stdint.h: proceeding with the preprocessor's result" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: stdint.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: stdint.h: in the future, the compiler will take precedence" >&2;}
-
- ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for stdint.h" >&5
-$as_echo_n "checking for stdint.h... " >&6; }
-if test "${ac_cv_header_stdint_h+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_cv_header_stdint_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdint_h" >&5
-$as_echo "$ac_cv_header_stdint_h" >&6; }
-
-fi
-if test "x$ac_cv_header_stdint_h" = x""yes; then
- ac_config_commands="$ac_config_commands rm-stdint.h"
-
-else
- ac_config_commands="$ac_config_commands mk-stdint.h"
-
-
-fi
-
-
-
-if test "${ac_cv_header_stdbool_h+set}" = set; then
- { $as_echo "$as_me:$LINENO: checking for stdbool.h" >&5
-$as_echo_n "checking for stdbool.h... " >&6; }
-if test "${ac_cv_header_stdbool_h+set}" = set; then
- $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdbool_h" >&5
-$as_echo "$ac_cv_header_stdbool_h" >&6; }
-else
- # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking stdbool.h usability" >&5
-$as_echo_n "checking stdbool.h usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <stdbool.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_header_compiler=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking stdbool.h presence" >&5
-$as_echo_n "checking stdbool.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdbool.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- ac_header_preproc=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { $as_echo "$as_me:$LINENO: WARNING: stdbool.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: stdbool.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: stdbool.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: stdbool.h: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { $as_echo "$as_me:$LINENO: WARNING: stdbool.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: stdbool.h: present but cannot be compiled" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: stdbool.h: check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: stdbool.h: check for missing prerequisite headers?" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: stdbool.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: stdbool.h: see the Autoconf documentation" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: stdbool.h: section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: stdbool.h: section \"Present But Cannot Be Compiled\"" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: stdbool.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: stdbool.h: proceeding with the preprocessor's result" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: stdbool.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: stdbool.h: in the future, the compiler will take precedence" >&2;}
-
- ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for stdbool.h" >&5
-$as_echo_n "checking for stdbool.h... " >&6; }
-if test "${ac_cv_header_stdbool_h+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_cv_header_stdbool_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdbool_h" >&5
-$as_echo "$ac_cv_header_stdbool_h" >&6; }
-
-fi
-if test "x$ac_cv_header_stdbool_h" = x""yes; then
- ac_config_commands="$ac_config_commands rm-stdbool.h"
-
-else
- ac_config_commands="$ac_config_commands mk-stdbool.h"
-
-
-fi
-
-
-
-
-{ $as_echo "$as_me:$LINENO: checking for bool" >&5
-$as_echo_n "checking for bool... " >&6; }
-if test "${ac_cv_type_bool+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_cv_type_bool=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-$ac_includes_default
-#ifdef HAVE_STDBOOL_H
-#include <stdbool.h>
-#endif
-
-
-int
-main ()
-{
-if (sizeof (bool))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-$ac_includes_default
-#ifdef HAVE_STDBOOL_H
-#include <stdbool.h>
-#endif
-
-
-int
-main ()
-{
-if (sizeof ((bool)))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- :
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_type_bool=yes
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_bool" >&5
-$as_echo "$ac_cv_type_bool" >&6; }
-if test "x$ac_cv_type_bool" = x""yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_BOOL 1
-_ACEOF
-
-fi
-
-
-{ $as_echo "$as_me:$LINENO: checking for _Bool" >&5
-$as_echo_n "checking for _Bool... " >&6; }
-if test "${ac_cv_type__Bool+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_cv_type__Bool=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-$ac_includes_default
-#ifdef HAVE_STDBOOL_H
-#include <stdbool.h>
-#endif
-
-
-int
-main ()
-{
-if (sizeof (_Bool))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-$ac_includes_default
-#ifdef HAVE_STDBOOL_H
-#include <stdbool.h>
-#endif
-
-
-int
-main ()
-{
-if (sizeof ((_Bool)))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- :
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_type__Bool=yes
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type__Bool" >&5
-$as_echo "$ac_cv_type__Bool" >&6; }
-if test "x$ac_cv_type__Bool" = x""yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE__Bool 1
-_ACEOF
-
-fi
-
-
-{ $as_echo "$as_me:$LINENO: checking for working mmap" >&5
-$as_echo_n "checking for working mmap... " >&6; }
-if test "${libreplace_cv_HAVE_MMAP+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
-
-if test "$cross_compiling" = yes; then
- libreplace_cv_HAVE_MMAP=cross
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include "$libreplacedir/test/shared_mmap.c"
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- libreplace_cv_HAVE_MMAP=yes
-else
- $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-libreplace_cv_HAVE_MMAP=no
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $libreplace_cv_HAVE_MMAP" >&5
-$as_echo "$libreplace_cv_HAVE_MMAP" >&6; }
-if test x"$libreplace_cv_HAVE_MMAP" = x"yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_MMAP 1
-_ACEOF
-
-fi
-
-
-
-
-for ac_header in sys/syslog.h syslog.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
- # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_header_compiler=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- ac_header_preproc=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
- ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-
-for ac_header in sys/time.h time.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
- # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_header_compiler=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- ac_header_preproc=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
- ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-
-for ac_header in stdarg.h vararg.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
- # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_header_compiler=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- ac_header_preproc=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
- ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-
-for ac_header in sys/mount.h mntent.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
- # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_header_compiler=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- ac_header_preproc=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
- ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in stropts.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
- # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_header_compiler=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- ac_header_preproc=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
- ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in unix.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
- # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_header_compiler=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- ac_header_preproc=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
- ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-
-
-
-
-
-
-
-for ac_func in seteuid setresuid setegid setresgid chroot bzero strerror
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
- eval "$as_ac_var=yes"
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
-
-
-
-
-
-for ac_func in vsyslog setlinebuf mktime ftruncate chsize rename
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
- eval "$as_ac_var=yes"
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
-
-
-
-
-
-
-for ac_func in waitpid wait4 strlcpy strlcat initgroups memmove strdup
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
- eval "$as_ac_var=yes"
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
-
-
-
-
-
-
-for ac_func in pread pwrite strndup strcasestr strtok_r mkdtemp dup2
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
- eval "$as_ac_var=yes"
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
-
-
-
-
-
-
-for ac_func in isatty chown lchown link readlink symlink realpath
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
- eval "$as_ac_var=yes"
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
- { $as_echo "$as_me:$LINENO: checking for setresuid declaration" >&5
-$as_echo_n "checking for setresuid declaration... " >&6; }
-if test "${ac_cv_have_setresuid_decl+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
-
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <unistd.h>
-int
-main ()
-{
-int i = (int)setresuid
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_have_setresuid_decl=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_have_setresuid_decl=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_setresuid_decl" >&5
-$as_echo "$ac_cv_have_setresuid_decl" >&6; }
- if test x"$ac_cv_have_setresuid_decl" = x"yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SETRESUID_DECL 1
-_ACEOF
-
- fi
-
-
- { $as_echo "$as_me:$LINENO: checking for setresgid declaration" >&5
-$as_echo_n "checking for setresgid declaration... " >&6; }
-if test "${ac_cv_have_setresgid_decl+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
-
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <unistd.h>
-int
-main ()
-{
-int i = (int)setresgid
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_have_setresgid_decl=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_have_setresgid_decl=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_setresgid_decl" >&5
-$as_echo "$ac_cv_have_setresgid_decl" >&6; }
- if test x"$ac_cv_have_setresgid_decl" = x"yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SETRESGID_DECL 1
-_ACEOF
-
- fi
-
-
- { $as_echo "$as_me:$LINENO: checking for errno declaration" >&5
-$as_echo_n "checking for errno declaration... " >&6; }
-if test "${ac_cv_have_errno_decl+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
-
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <errno.h>
-int
-main ()
-{
-int i = (int)errno
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_have_errno_decl=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_have_errno_decl=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_errno_decl" >&5
-$as_echo "$ac_cv_have_errno_decl" >&6; }
- if test x"$ac_cv_have_errno_decl" = x"yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_ERRNO_DECL 1
-_ACEOF
-
- fi
-
-
-{ $as_echo "$as_me:$LINENO: checking for secure mkstemp" >&5
-$as_echo_n "checking for secure mkstemp... " >&6; }
-if test "${libreplace_cv_HAVE_SECURE_MKSTEMP+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
-
-if test "$cross_compiling" = yes; then
- libreplace_cv_HAVE_SECURE_MKSTEMP=cross
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-main() {
- struct stat st;
- char tpl[20]="/tmp/test.XXXXXX";
- int fd = mkstemp(tpl);
- if (fd == -1) exit(1);
- unlink(tpl);
- if (fstat(fd, &st) != 0) exit(1);
- if ((st.st_mode & 0777) != 0600) exit(1);
- exit(0);
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- libreplace_cv_HAVE_SECURE_MKSTEMP=yes
-else
- $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-libreplace_cv_HAVE_SECURE_MKSTEMP=no
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $libreplace_cv_HAVE_SECURE_MKSTEMP" >&5
-$as_echo "$libreplace_cv_HAVE_SECURE_MKSTEMP" >&6; }
-if test x"$libreplace_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SECURE_MKSTEMP 1
-_ACEOF
-
-fi
-
-
-
-for ac_header in stdio.h strings.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
- # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_header_compiler=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- ac_header_preproc=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
- ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-{ $as_echo "$as_me:$LINENO: checking whether snprintf is declared" >&5
-$as_echo_n "checking whether snprintf is declared... " >&6; }
-if test "${ac_cv_have_decl_snprintf+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-#ifndef snprintf
- (void) snprintf;
-#endif
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_have_decl_snprintf=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_have_decl_snprintf=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_snprintf" >&5
-$as_echo "$ac_cv_have_decl_snprintf" >&6; }
-if test "x$ac_cv_have_decl_snprintf" = x""yes; then
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_SNPRINTF 1
-_ACEOF
-
-
-else
- cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_SNPRINTF 0
-_ACEOF
-
-
-fi
-{ $as_echo "$as_me:$LINENO: checking whether vsnprintf is declared" >&5
-$as_echo_n "checking whether vsnprintf is declared... " >&6; }
-if test "${ac_cv_have_decl_vsnprintf+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-#ifndef vsnprintf
- (void) vsnprintf;
-#endif
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_have_decl_vsnprintf=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_have_decl_vsnprintf=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_vsnprintf" >&5
-$as_echo "$ac_cv_have_decl_vsnprintf" >&6; }
-if test "x$ac_cv_have_decl_vsnprintf" = x""yes; then
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_VSNPRINTF 1
-_ACEOF
-
-
-else
- cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_VSNPRINTF 0
-_ACEOF
-
-
-fi
-{ $as_echo "$as_me:$LINENO: checking whether asprintf is declared" >&5
-$as_echo_n "checking whether asprintf is declared... " >&6; }
-if test "${ac_cv_have_decl_asprintf+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-#ifndef asprintf
- (void) asprintf;
-#endif
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_have_decl_asprintf=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_have_decl_asprintf=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_asprintf" >&5
-$as_echo "$ac_cv_have_decl_asprintf" >&6; }
-if test "x$ac_cv_have_decl_asprintf" = x""yes; then
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_ASPRINTF 1
-_ACEOF
-
-
-else
- cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_ASPRINTF 0
-_ACEOF
-
-
-fi
-{ $as_echo "$as_me:$LINENO: checking whether vasprintf is declared" >&5
-$as_echo_n "checking whether vasprintf is declared... " >&6; }
-if test "${ac_cv_have_decl_vasprintf+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-#ifndef vasprintf
- (void) vasprintf;
-#endif
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_have_decl_vasprintf=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_have_decl_vasprintf=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_vasprintf" >&5
-$as_echo "$ac_cv_have_decl_vasprintf" >&6; }
-if test "x$ac_cv_have_decl_vasprintf" = x""yes; then
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_VASPRINTF 1
-_ACEOF
-
-
-else
- cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_VASPRINTF 0
-_ACEOF
-
-
-fi
-
-
-
-
-
-
-for ac_func in snprintf vsnprintf asprintf vasprintf
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
- eval "$as_ac_var=yes"
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
-{ $as_echo "$as_me:$LINENO: checking for C99 vsnprintf" >&5
-$as_echo_n "checking for C99 vsnprintf... " >&6; }
-if test "${libreplace_cv_HAVE_C99_VSNPRINTF+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
-
-if test "$cross_compiling" = yes; then
- libreplace_cv_HAVE_C99_VSNPRINTF=cross
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <stdlib.h>
-void foo(const char *format, ...) {
- va_list ap;
- int len;
- char buf[20];
- long long l = 1234567890;
- l *= 100;
-
- va_start(ap, format);
- len = vsnprintf(buf, 0, format, ap);
- va_end(ap);
- if (len != 5) exit(1);
-
- va_start(ap, format);
- len = vsnprintf(0, 0, format, ap);
- va_end(ap);
- if (len != 5) exit(2);
-
- if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(3);
-
- if (snprintf(buf, 20, "%lld", l) != 12 || strcmp(buf, "123456789000") != 0) exit(4);
- if (snprintf(buf, 20, "%zu", 123456789) != 9 || strcmp(buf, "123456789") != 0) exit(5);
- if (snprintf(buf, 20, "%2\$d %1\$d", 3, 4) != 3 || strcmp(buf, "4 3") != 0) exit(6);
- if (snprintf(buf, 20, "%s", 0) < 3) exit(7);
-
- exit(0);
-}
-main() { foo("hello"); }
-
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- libreplace_cv_HAVE_C99_VSNPRINTF=yes
-else
- $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-libreplace_cv_HAVE_C99_VSNPRINTF=no
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $libreplace_cv_HAVE_C99_VSNPRINTF" >&5
-$as_echo "$libreplace_cv_HAVE_C99_VSNPRINTF" >&6; }
-if test x"$libreplace_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_C99_VSNPRINTF 1
-_ACEOF
-
-fi
-
-
-{ $as_echo "$as_me:$LINENO: checking for va_copy" >&5
-$as_echo_n "checking for va_copy... " >&6; }
-if test "${libreplace_cv_HAVE_VA_COPY+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
-
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdarg.h>
-va_list ap1,ap2;
-int
-main ()
-{
-va_copy(ap1,ap2);
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
- libreplace_cv_HAVE_VA_COPY=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- libreplace_cv_HAVE_VA_COPY=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $libreplace_cv_HAVE_VA_COPY" >&5
-$as_echo "$libreplace_cv_HAVE_VA_COPY" >&6; }
-if test x"$libreplace_cv_HAVE_VA_COPY" = x"yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_VA_COPY 1
-_ACEOF
-
-fi
-
-if test x"$libreplace_cv_HAVE_VA_COPY" != x"yes"; then
-{ $as_echo "$as_me:$LINENO: checking for __va_copy" >&5
-$as_echo_n "checking for __va_copy... " >&6; }
-if test "${libreplace_cv_HAVE___VA_COPY+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
-
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdarg.h>
-va_list ap1,ap2;
-int
-main ()
-{
-__va_copy(ap1,ap2);
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
- libreplace_cv_HAVE___VA_COPY=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- libreplace_cv_HAVE___VA_COPY=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $libreplace_cv_HAVE___VA_COPY" >&5
-$as_echo "$libreplace_cv_HAVE___VA_COPY" >&6; }
-if test x"$libreplace_cv_HAVE___VA_COPY" = x"yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE___VA_COPY 1
-_ACEOF
-
-fi
-fi
-
-{ $as_echo "$as_me:$LINENO: checking for __FUNCTION__ macro" >&5
-$as_echo_n "checking for __FUNCTION__ macro... " >&6; }
-if test "${libreplace_cv_HAVE_FUNCTION_MACRO+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
-
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdio.h>
-int
-main ()
-{
-printf("%s\n", __FUNCTION__);
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- libreplace_cv_HAVE_FUNCTION_MACRO=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- libreplace_cv_HAVE_FUNCTION_MACRO=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $libreplace_cv_HAVE_FUNCTION_MACRO" >&5
-$as_echo "$libreplace_cv_HAVE_FUNCTION_MACRO" >&6; }
-if test x"$libreplace_cv_HAVE_FUNCTION_MACRO" = x"yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_FUNCTION_MACRO 1
-_ACEOF
-
-else
- { $as_echo "$as_me:$LINENO: checking for __func__ macro" >&5
-$as_echo_n "checking for __func__ macro... " >&6; }
-if test "${libreplace_cv_HAVE_func_MACRO+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
-
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdio.h>
-int
-main ()
-{
-printf("%s\n", __func__);
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- libreplace_cv_HAVE_func_MACRO=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- libreplace_cv_HAVE_func_MACRO=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $libreplace_cv_HAVE_func_MACRO" >&5
-$as_echo "$libreplace_cv_HAVE_func_MACRO" >&6; }
- if test x"$libreplace_cv_HAVE_func_MACRO" = x"yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_func_MACRO 1
-_ACEOF
-
- fi
-fi
-
-
-
-for ac_header in sys/param.h limits.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
- # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_header_compiler=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- ac_header_preproc=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
- ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-{ $as_echo "$as_me:$LINENO: checking for comparison_fn_t" >&5
-$as_echo_n "checking for comparison_fn_t... " >&6; }
-if test "${ac_cv_type_comparison_fn_t+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_cv_type_comparison_fn_t=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof (comparison_fn_t))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof ((comparison_fn_t)))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- :
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_type_comparison_fn_t=yes
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_comparison_fn_t" >&5
-$as_echo "$ac_cv_type_comparison_fn_t" >&6; }
-if test "x$ac_cv_type_comparison_fn_t" = x""yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_COMPARISON_FN_T 1
-_ACEOF
-
-fi
-
-
-
- { $as_echo "$as_me:$LINENO: checking for setenv declaration" >&5
-$as_echo_n "checking for setenv declaration... " >&6; }
-if test "${ac_cv_have_setenv_decl+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
-
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdlib.h>
-int
-main ()
-{
-int i = (int)setenv
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_have_setenv_decl=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_have_setenv_decl=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_setenv_decl" >&5
-$as_echo "$ac_cv_have_setenv_decl" >&6; }
- if test x"$ac_cv_have_setenv_decl" = x"yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SETENV_DECL 1
-_ACEOF
-
- fi
-
-
-
-for ac_func in setenv unsetenv
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
- eval "$as_ac_var=yes"
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
- { $as_echo "$as_me:$LINENO: checking for environ declaration" >&5
-$as_echo_n "checking for environ declaration... " >&6; }
-if test "${ac_cv_have_environ_decl+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
-
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <unistd.h>
-int
-main ()
-{
-int i = (int)environ
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_have_environ_decl=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_have_environ_decl=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_environ_decl" >&5
-$as_echo "$ac_cv_have_environ_decl" >&6; }
- if test x"$ac_cv_have_environ_decl" = x"yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_ENVIRON_DECL 1
-_ACEOF
-
- fi
-
-
-
-for ac_func in strnlen
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
- eval "$as_ac_var=yes"
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
-
-
-
-
-
-for ac_func in strtoull __strtoull strtouq strtoll __strtoll strtoq
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
- eval "$as_ac_var=yes"
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
-# this test disabled as we don't actually need __VA_ARGS__ yet
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-#define eprintf(...) fprintf(stderr, __VA_ARGS__)
-eprintf("bla", "bar");
-
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE__VA_ARGS__MACRO 1
-_ACEOF
-
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f conftest.err conftest.$ac_ext
-
-
-{ $as_echo "$as_me:$LINENO: checking for sig_atomic_t type" >&5
-$as_echo_n "checking for sig_atomic_t type... " >&6; }
-if test "${libreplace_cv_sig_atomic_t+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
-
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-#include <signal.h>
-int
-main ()
-{
-sig_atomic_t i = 0
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- libreplace_cv_sig_atomic_t=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- libreplace_cv_sig_atomic_t=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $libreplace_cv_sig_atomic_t" >&5
-$as_echo "$libreplace_cv_sig_atomic_t" >&6; }
-if test x"$libreplace_cv_sig_atomic_t" = x"yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SIG_ATOMIC_T_TYPE 1
-_ACEOF
-
-fi
-
-
-{ $as_echo "$as_me:$LINENO: checking for O_DIRECT flag to open(2)" >&5
-$as_echo_n "checking for O_DIRECT flag to open(2)... " >&6; }
-if test "${libreplace_cv_HAVE_OPEN_O_DIRECT+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
-
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-#include <unistd.h>
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-int
-main ()
-{
-int fd = open("/dev/null", O_DIRECT);
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- libreplace_cv_HAVE_OPEN_O_DIRECT=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- libreplace_cv_HAVE_OPEN_O_DIRECT=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $libreplace_cv_HAVE_OPEN_O_DIRECT" >&5
-$as_echo "$libreplace_cv_HAVE_OPEN_O_DIRECT" >&6; }
-if test x"$libreplace_cv_HAVE_OPEN_O_DIRECT" = x"yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_OPEN_O_DIRECT 1
-_ACEOF
-
-fi
-
-
-{ $as_echo "$as_me:$LINENO: checking that the C compiler understands volatile" >&5
-$as_echo_n "checking that the C compiler understands volatile... " >&6; }
-if test "${libreplace_cv_volatile+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
-
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <sys/types.h>
-int
-main ()
-{
-volatile int i = 0
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- libreplace_cv_volatile=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- libreplace_cv_volatile=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $libreplace_cv_volatile" >&5
-$as_echo "$libreplace_cv_volatile" >&6; }
-if test x"$libreplace_cv_volatile" = x"yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_VOLATILE 1
-_ACEOF
-
-fi
-
-# filesys
-
-
-
-
-
-ac_header_dirent=no
-for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
- as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5
-$as_echo_n "checking for $ac_hdr that defines DIR... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <sys/types.h>
-#include <$ac_hdr>
-
-int
-main ()
-{
-if ((DIR *) 0)
-return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- eval "$as_ac_Header=yes"
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- eval "$as_ac_Header=no"
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1
-_ACEOF
-
-ac_header_dirent=$ac_hdr; break
-fi
-
-done
-# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
-if test $ac_header_dirent = dirent.h; then
- { $as_echo "$as_me:$LINENO: checking for library containing opendir" >&5
-$as_echo_n "checking for library containing opendir... " >&6; }
-if test "${ac_cv_search_opendir+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_func_search_save_LIBS=$LIBS
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char opendir ();
-int
-main ()
-{
-return opendir ();
- ;
- return 0;
-}
-_ACEOF
-for ac_lib in '' dir; do
- if test -z "$ac_lib"; then
- ac_res="none required"
- else
- ac_res=-l$ac_lib
- LIBS="-l$ac_lib $ac_func_search_save_LIBS"
- fi
- rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
- ac_cv_search_opendir=$ac_res
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext
- if test "${ac_cv_search_opendir+set}" = set; then
- break
-fi
-done
-if test "${ac_cv_search_opendir+set}" = set; then
- :
-else
- ac_cv_search_opendir=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5
-$as_echo "$ac_cv_search_opendir" >&6; }
-ac_res=$ac_cv_search_opendir
-if test "$ac_res" != no; then
- test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-
-fi
-
-else
- { $as_echo "$as_me:$LINENO: checking for library containing opendir" >&5
-$as_echo_n "checking for library containing opendir... " >&6; }
-if test "${ac_cv_search_opendir+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_func_search_save_LIBS=$LIBS
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char opendir ();
-int
-main ()
-{
-return opendir ();
- ;
- return 0;
-}
-_ACEOF
-for ac_lib in '' x; do
- if test -z "$ac_lib"; then
- ac_res="none required"
- else
- ac_res=-l$ac_lib
- LIBS="-l$ac_lib $ac_func_search_save_LIBS"
- fi
- rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
- ac_cv_search_opendir=$ac_res
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext
- if test "${ac_cv_search_opendir+set}" = set; then
- break
-fi
-done
-if test "${ac_cv_search_opendir+set}" = set; then
- :
-else
- ac_cv_search_opendir=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5
-$as_echo "$ac_cv_search_opendir" >&6; }
-ac_res=$ac_cv_search_opendir
-if test "$ac_res" != no; then
- test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-
-fi
-
-fi
-
-
-
-
-
-
-
-
-
-for ac_header in fcntl.h sys/fcntl.h sys/resource.h sys/ioctl.h sys/mode.h sys/filio.h sys/fs/s5param.h sys/filsys.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
- # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_header_compiler=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- ac_header_preproc=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
- ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-
-for ac_header in sys/acl.h acl/libacl.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
- # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_header_compiler=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- ac_header_preproc=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
- ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-# select
-
-for ac_header in sys/select.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
- # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_header_compiler=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- ac_header_preproc=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
- ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-# time
-
-
-for ac_header in sys/time.h utime.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
- # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_header_compiler=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- ac_header_preproc=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
- ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-{ $as_echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
-$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; }
-if test "${ac_cv_header_time+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <sys/types.h>
-#include <sys/time.h>
-#include <time.h>
-
-int
-main ()
-{
-if ((struct tm *) 0)
-return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_header_time=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_header_time=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
-$as_echo "$ac_cv_header_time" >&6; }
-if test $ac_cv_header_time = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define TIME_WITH_SYS_TIME 1
-_ACEOF
-
-fi
-
-
-
-for ac_func in utime utimes
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
- eval "$as_ac_var=yes"
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
-# wait
-{ $as_echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5
-$as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; }
-if test "${ac_cv_header_sys_wait_h+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <sys/types.h>
-#include <sys/wait.h>
-#ifndef WEXITSTATUS
-# define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8)
-#endif
-#ifndef WIFEXITED
-# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
-#endif
-
-int
-main ()
-{
- int s;
- wait (&s);
- s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_header_sys_wait_h=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_header_sys_wait_h=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5
-$as_echo "$ac_cv_header_sys_wait_h" >&6; }
-if test $ac_cv_header_sys_wait_h = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SYS_WAIT_H 1
-_ACEOF
-
-fi
-
-
-# capability
-
-for ac_header in sys/capability.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
- # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_header_compiler=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- ac_header_preproc=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
- ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-case "$host_os" in
-*linux*)
-{ $as_echo "$as_me:$LINENO: checking for broken RedHat 7.2 system header files" >&5
-$as_echo_n "checking for broken RedHat 7.2 system header files... " >&6; }
-if test "${libreplace_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
-
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
- #ifdef HAVE_SYS_VFS_H
- #include <sys/vfs.h>
- #endif
- #ifdef HAVE_SYS_CAPABILITY_H
- #include <sys/capability.h>
- #endif
-
-int
-main ()
-{
-
- int i;
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- libreplace_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=no
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- libreplace_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=yes
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $libreplace_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS" >&5
-$as_echo "$libreplace_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS" >&6; }
-if test x"$libreplace_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS" = x"yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define BROKEN_REDHAT_7_SYSTEM_HEADERS 1
-_ACEOF
-
-fi
-
-{ $as_echo "$as_me:$LINENO: checking for broken RHEL5 sys/capability.h" >&5
-$as_echo_n "checking for broken RHEL5 sys/capability.h... " >&6; }
-if test "${libreplace_cv_BROKEN_RHEL5_SYS_CAP_HEADER+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
-
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
- #ifdef HAVE_SYS_CAPABILITY_H
- #include <sys/capability.h>
- #endif
- #include <linux/types.h>
-
-int
-main ()
-{
-
- __s8 i;
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- libreplace_cv_BROKEN_RHEL5_SYS_CAP_HEADER=no
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- libreplace_cv_BROKEN_RHEL5_SYS_CAP_HEADER=yes
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $libreplace_cv_BROKEN_RHEL5_SYS_CAP_HEADER" >&5
-$as_echo "$libreplace_cv_BROKEN_RHEL5_SYS_CAP_HEADER" >&6; }
-if test x"$libreplace_cv_BROKEN_RHEL5_SYS_CAP_HEADER" = x"yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define BROKEN_RHEL5_SYS_CAP_HEADER 1
-_ACEOF
-
-fi
-;;
-esac
-
-# passwd
-
-
-
-
-
-
-
-for ac_header in grp.h sys/id.h compat.h shadow.h sys/priv.h pwd.h sys/security.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
- # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_header_compiler=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- ac_header_preproc=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
- ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-
-
-for ac_func in getpwnam_r getpwuid_r getpwent_r
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
- eval "$as_ac_var=yes"
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
- { $as_echo "$as_me:$LINENO: checking for getpwent_r declaration" >&5
-$as_echo_n "checking for getpwent_r declaration... " >&6; }
-if test "${ac_cv_have_getpwent_r_decl+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
-
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
- #include <unistd.h>
- #include <pwd.h>
-
-int
-main ()
-{
-int i = (int)getpwent_r
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_have_getpwent_r_decl=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_have_getpwent_r_decl=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_getpwent_r_decl" >&5
-$as_echo "$ac_cv_have_getpwent_r_decl" >&6; }
- if test x"$ac_cv_have_getpwent_r_decl" = x"yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_GETPWENT_R_DECL 1
-_ACEOF
-
- fi
-
-{ $as_echo "$as_me:$LINENO: checking for prototype struct passwd *getpwent_r(struct passwd *src, char *buf, int buflen)" >&5
-$as_echo_n "checking for prototype struct passwd *getpwent_r(struct passwd *src, char *buf, int buflen)... " >&6; }
-if test "${ac_cv_c_prototype_struct_passwd_pgetpwent_r_struct_passwd_psrc__char_pbuf__int_buflen_+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
- $ac_includes_default
-
- #include <unistd.h>
- #include <pwd.h>
-
- struct passwd *getpwent_r(struct passwd *src, char *buf, int buflen)
- {
-
- #ifndef HAVE_GETPWENT_R_DECL
- #error missing getpwent_r prototype
- #endif
- return NULL;
-
- }
-
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
-
- ac_cv_c_prototype_struct_passwd_pgetpwent_r_struct_passwd_psrc__char_pbuf__int_buflen_=yes
-
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
- ac_cv_c_prototype_struct_passwd_pgetpwent_r_struct_passwd_psrc__char_pbuf__int_buflen_=no
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_prototype_struct_passwd_pgetpwent_r_struct_passwd_psrc__char_pbuf__int_buflen_" >&5
-$as_echo "$ac_cv_c_prototype_struct_passwd_pgetpwent_r_struct_passwd_psrc__char_pbuf__int_buflen_" >&6; }
-if test $ac_cv_c_prototype_struct_passwd_pgetpwent_r_struct_passwd_psrc__char_pbuf__int_buflen_ = yes; then
-
-
-cat >>confdefs.h <<\_ACEOF
-#define SOLARIS_GETPWENT_R 1
-_ACEOF
-
-
-fi
-
-
-{ $as_echo "$as_me:$LINENO: checking for prototype struct passwd *getpwent_r(struct passwd *src, char *buf, size_t buflen)" >&5
-$as_echo_n "checking for prototype struct passwd *getpwent_r(struct passwd *src, char *buf, size_t buflen)... " >&6; }
-if test "${ac_cv_c_prototype_struct_passwd_pgetpwent_r_struct_passwd_psrc__char_pbuf__size_t_buflen_+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
- $ac_includes_default
-
- #include <unistd.h>
- #include <pwd.h>
-
- struct passwd *getpwent_r(struct passwd *src, char *buf, size_t buflen)
- {
-
- #ifndef HAVE_GETPWENT_R_DECL
- #error missing getpwent_r prototype
- #endif
- return NULL;
-
- }
-
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
-
- ac_cv_c_prototype_struct_passwd_pgetpwent_r_struct_passwd_psrc__char_pbuf__size_t_buflen_=yes
-
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
- ac_cv_c_prototype_struct_passwd_pgetpwent_r_struct_passwd_psrc__char_pbuf__size_t_buflen_=no
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_prototype_struct_passwd_pgetpwent_r_struct_passwd_psrc__char_pbuf__size_t_buflen_" >&5
-$as_echo "$ac_cv_c_prototype_struct_passwd_pgetpwent_r_struct_passwd_psrc__char_pbuf__size_t_buflen_" >&6; }
-if test $ac_cv_c_prototype_struct_passwd_pgetpwent_r_struct_passwd_psrc__char_pbuf__size_t_buflen_ = yes; then
-
-
-cat >>confdefs.h <<\_ACEOF
-#define SOLARIS_GETPWENT_R 1
-_ACEOF
-
-
-fi
-
-
-
-
-
-for ac_func in getgrnam_r getgrgid_r getgrent_r
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
- eval "$as_ac_var=yes"
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
- { $as_echo "$as_me:$LINENO: checking for getgrent_r declaration" >&5
-$as_echo_n "checking for getgrent_r declaration... " >&6; }
-if test "${ac_cv_have_getgrent_r_decl+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
-
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
- #include <unistd.h>
- #include <grp.h>
-
-int
-main ()
-{
-int i = (int)getgrent_r
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_have_getgrent_r_decl=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_have_getgrent_r_decl=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_getgrent_r_decl" >&5
-$as_echo "$ac_cv_have_getgrent_r_decl" >&6; }
- if test x"$ac_cv_have_getgrent_r_decl" = x"yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_GETGRENT_R_DECL 1
-_ACEOF
-
- fi
-
-{ $as_echo "$as_me:$LINENO: checking for prototype struct group *getgrent_r(struct group *src, char *buf, int buflen)" >&5
-$as_echo_n "checking for prototype struct group *getgrent_r(struct group *src, char *buf, int buflen)... " >&6; }
-if test "${ac_cv_c_prototype_struct_group_pgetgrent_r_struct_group_psrc__char_pbuf__int_buflen_+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
- $ac_includes_default
-
- #include <unistd.h>
- #include <grp.h>
-
- struct group *getgrent_r(struct group *src, char *buf, int buflen)
- {
-
- #ifndef HAVE_GETGRENT_R_DECL
- #error missing getgrent_r prototype
- #endif
- return NULL;
-
- }
-
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
-
- ac_cv_c_prototype_struct_group_pgetgrent_r_struct_group_psrc__char_pbuf__int_buflen_=yes
-
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
- ac_cv_c_prototype_struct_group_pgetgrent_r_struct_group_psrc__char_pbuf__int_buflen_=no
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_prototype_struct_group_pgetgrent_r_struct_group_psrc__char_pbuf__int_buflen_" >&5
-$as_echo "$ac_cv_c_prototype_struct_group_pgetgrent_r_struct_group_psrc__char_pbuf__int_buflen_" >&6; }
-if test $ac_cv_c_prototype_struct_group_pgetgrent_r_struct_group_psrc__char_pbuf__int_buflen_ = yes; then
-
-
-cat >>confdefs.h <<\_ACEOF
-#define SOLARIS_GETGRENT_R 1
-_ACEOF
-
-
-fi
-
-
-
-{ $as_echo "$as_me:$LINENO: checking for prototype struct group *getgrent_r(struct group *src, char *buf, size_t buflen)" >&5
-$as_echo_n "checking for prototype struct group *getgrent_r(struct group *src, char *buf, size_t buflen)... " >&6; }
-if test "${ac_cv_c_prototype_struct_group_pgetgrent_r_struct_group_psrc__char_pbuf__size_t_buflen_+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
- $ac_includes_default
-
- #include <unistd.h>
- #include <grp.h>
-
- struct group *getgrent_r(struct group *src, char *buf, size_t buflen)
- {
-
- #ifndef HAVE_GETGRENT_R_DECL
- #error missing getgrent_r prototype
- #endif
- return NULL;
-
- }
-
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
-
- ac_cv_c_prototype_struct_group_pgetgrent_r_struct_group_psrc__char_pbuf__size_t_buflen_=yes
-
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
- ac_cv_c_prototype_struct_group_pgetgrent_r_struct_group_psrc__char_pbuf__size_t_buflen_=no
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_prototype_struct_group_pgetgrent_r_struct_group_psrc__char_pbuf__size_t_buflen_" >&5
-$as_echo "$ac_cv_c_prototype_struct_group_pgetgrent_r_struct_group_psrc__char_pbuf__size_t_buflen_" >&6; }
-if test $ac_cv_c_prototype_struct_group_pgetgrent_r_struct_group_psrc__char_pbuf__size_t_buflen_ = yes; then
-
-
-cat >>confdefs.h <<\_ACEOF
-#define SOLARIS_GETGRENT_R 1
-_ACEOF
-
-
-fi
-
-
-
-for ac_func in getgrouplist
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
- eval "$as_ac_var=yes"
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
-# locale
-
-
-
-for ac_header in ctype.h locale.h langinfo.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
- # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_header_compiler=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- ac_header_preproc=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
- ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-# glob
-
-for ac_header in fnmatch.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
- # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_header_compiler=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- ac_header_preproc=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
- ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-# shmem
-
-
-
-for ac_header in sys/ipc.h sys/mman.h sys/shm.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
- # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_header_compiler=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- ac_header_preproc=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
- ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-# terminal
-
-
-
-for ac_header in termios.h termio.h sys/termio.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
- # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_header_compiler=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- ac_header_preproc=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
- ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-
-save_LIBS="$LIBS"
-LIBS=""
-
-libreplace_cv_dlfcn=no
-{ $as_echo "$as_me:$LINENO: checking for library containing dlopen" >&5
-$as_echo_n "checking for library containing dlopen... " >&6; }
-if test "${ac_cv_search_dlopen+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_func_search_save_LIBS=$LIBS
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char dlopen ();
-int
-main ()
-{
-return dlopen ();
- ;
- return 0;
-}
-_ACEOF
-for ac_lib in '' dl; do
- if test -z "$ac_lib"; then
- ac_res="none required"
- else
- ac_res=-l$ac_lib
- LIBS="-l$ac_lib $ac_func_search_save_LIBS"
- fi
- rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
- ac_cv_search_dlopen=$ac_res
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext
- if test "${ac_cv_search_dlopen+set}" = set; then
- break
-fi
-done
-if test "${ac_cv_search_dlopen+set}" = set; then
- :
-else
- ac_cv_search_dlopen=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_dlopen" >&5
-$as_echo "$ac_cv_search_dlopen" >&6; }
-ac_res=$ac_cv_search_dlopen
-if test "$ac_res" != no; then
- test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-
-fi
-
-
-
-for ac_header in dlfcn.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
- # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_header_compiler=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- ac_header_preproc=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
- ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-
-
-
-for ac_func in dlopen dlsym dlerror dlclose
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
- eval "$as_ac_var=yes"
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-else
- libreplace_cv_dlfcn=yes
-fi
-done
-
-
-libreplace_cv_shl=no
-{ $as_echo "$as_me:$LINENO: checking for library containing shl_load" >&5
-$as_echo_n "checking for library containing shl_load... " >&6; }
-if test "${ac_cv_search_shl_load+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_func_search_save_LIBS=$LIBS
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char shl_load ();
-int
-main ()
-{
-return shl_load ();
- ;
- return 0;
-}
-_ACEOF
-for ac_lib in '' sl; do
- if test -z "$ac_lib"; then
- ac_res="none required"
- else
- ac_res=-l$ac_lib
- LIBS="-l$ac_lib $ac_func_search_save_LIBS"
- fi
- rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
- ac_cv_search_shl_load=$ac_res
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext
- if test "${ac_cv_search_shl_load+set}" = set; then
- break
-fi
-done
-if test "${ac_cv_search_shl_load+set}" = set; then
- :
-else
- ac_cv_search_shl_load=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_shl_load" >&5
-$as_echo "$ac_cv_search_shl_load" >&6; }
-ac_res=$ac_cv_search_shl_load
-if test "$ac_res" != no; then
- test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-
-fi
-
-
-for ac_header in dl.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
- # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_header_compiler=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- ac_header_preproc=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
- ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-
-
-for ac_func in shl_load shl_unload shl_findsym
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
- eval "$as_ac_var=yes"
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-else
- libreplace_cv_shl=yes
-fi
-done
-
-
-{ $as_echo "$as_me:$LINENO: checking for prototype void *dlopen(const char* filename, unsigned int flags)" >&5
-$as_echo_n "checking for prototype void *dlopen(const char* filename, unsigned int flags)... " >&6; }
-if test "${ac_cv_c_prototype_void_pdlopen_const_charp_filename__unsigned_int_flags_+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
- $ac_includes_default
-
- #include <dlfcn.h>
-
- void *dlopen(const char* filename, unsigned int flags)
- {
-
- return 0;
-
- }
-
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
-
- ac_cv_c_prototype_void_pdlopen_const_charp_filename__unsigned_int_flags_=yes
-
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
- ac_cv_c_prototype_void_pdlopen_const_charp_filename__unsigned_int_flags_=no
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_prototype_void_pdlopen_const_charp_filename__unsigned_int_flags_" >&5
-$as_echo "$ac_cv_c_prototype_void_pdlopen_const_charp_filename__unsigned_int_flags_" >&6; }
-if test $ac_cv_c_prototype_void_pdlopen_const_charp_filename__unsigned_int_flags_ = yes; then
-
-
-cat >>confdefs.h <<\_ACEOF
-#define DLOPEN_TAKES_UNSIGNED_FLAGS 1
-_ACEOF
-
-
-fi
-
-
-
-if test x"${libreplace_cv_dlfcn}" = x"yes";then
- LIBREPLACEOBJ="${LIBREPLACEOBJ} $libreplacedir/dlfcn.o"
-fi
-
-LIBDL="$LIBS"
-
-LIBS="$save_LIBS"
-
-{ $as_echo "$as_me:$LINENO: checking for getpass" >&5
-$as_echo_n "checking for getpass... " >&6; }
-if test "${ac_cv_func_getpass+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define getpass to an innocuous variant, in case <limits.h> declares getpass.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define getpass innocuous_getpass
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char getpass (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef getpass
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char getpass ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined __stub_getpass || defined __stub___getpass
-choke me
-#endif
-
-int
-main ()
-{
-return getpass ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
- ac_cv_func_getpass=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_func_getpass=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_getpass" >&5
-$as_echo "$ac_cv_func_getpass" >&6; }
-if test "x$ac_cv_func_getpass" = x""yes; then
- libreplace_cv_HAVE_GETPASS=yes
-fi
-
-{ $as_echo "$as_me:$LINENO: checking for getpassphrase" >&5
-$as_echo_n "checking for getpassphrase... " >&6; }
-if test "${ac_cv_func_getpassphrase+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define getpassphrase to an innocuous variant, in case <limits.h> declares getpassphrase.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define getpassphrase innocuous_getpassphrase
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char getpassphrase (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef getpassphrase
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char getpassphrase ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined __stub_getpassphrase || defined __stub___getpassphrase
-choke me
-#endif
-
-int
-main ()
-{
-return getpassphrase ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
- ac_cv_func_getpassphrase=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_func_getpassphrase=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_getpassphrase" >&5
-$as_echo "$ac_cv_func_getpassphrase" >&6; }
-if test "x$ac_cv_func_getpassphrase" = x""yes; then
- libreplace_cv_HAVE_GETPASSPHRASE=yes
-fi
-
-if test x"$libreplace_cv_HAVE_GETPASS" = x"yes" -a x"$libreplace_cv_HAVE_GETPASSPHRASE" = x"yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define REPLACE_GETPASS_BY_GETPASSPHRASE 1
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define REPLACE_GETPASS 1
-_ACEOF
-
- LIBREPLACEOBJ="${LIBREPLACEOBJ} $libreplacedir/getpass.o"
-else
-
-{ $as_echo "$as_me:$LINENO: checking whether getpass should be replaced" >&5
-$as_echo_n "checking whether getpass should be replaced... " >&6; }
-if test "${libreplace_cv_REPLACE_GETPASS+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
-
-SAVE_CPPFLAGS="$CPPFLAGS"
-CPPFLAGS="$CPPFLAGS -I$libreplacedir/"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-#include "confdefs.h"
-#define NO_CONFIG_H
-#include "$libreplacedir/getpass.c"
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- libreplace_cv_REPLACE_GETPASS=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- libreplace_cv_REPLACE_GETPASS=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-CPPFLAGS="$SAVE_CPPFLAGS"
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $libreplace_cv_REPLACE_GETPASS" >&5
-$as_echo "$libreplace_cv_REPLACE_GETPASS" >&6; }
-if test x"$libreplace_cv_REPLACE_GETPASS" = x"yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define REPLACE_GETPASS 1
-_ACEOF
-
- LIBREPLACEOBJ="${LIBREPLACEOBJ} $libreplacedir/getpass.o"
-fi
-
-fi
-
-{ $as_echo "$as_me:$LINENO: checking whether strptime is available and works" >&5
-$as_echo_n "checking whether strptime is available and works... " >&6; }
-if test "${libreplace_cv_STRPTIME_OK+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
-
- if test "$cross_compiling" = yes; then
- libreplace_cv_STRPTIME_OK="assuming not"
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
- #define LIBREPLACE_CONFIGURE_TEST_STRPTIME
- #include "$libreplacedir/test/strptime.c"
-
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- libreplace_cv_STRPTIME_OK=yes
-else
- $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-libreplace_cv_STRPTIME_OK=no
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $libreplace_cv_STRPTIME_OK" >&5
-$as_echo "$libreplace_cv_STRPTIME_OK" >&6; }
-if test x"$libreplace_cv_STRPTIME_OK" != x"yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define REPLACE_STRPTIME 1
-_ACEOF
-
- LIBREPLACEOBJ="${LIBREPLACEOBJ} $libreplacedir/strptime.o"
-fi
-
-
-
-
-
-for ac_header in direct.h windows.h winsock2.h ws2tcpip.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
- # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_header_compiler=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- ac_header_preproc=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
- ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-#######################################
-# Check for mkdir mode
-{ $as_echo "$as_me:$LINENO: checking whether mkdir supports mode" >&5
-$as_echo_n "checking whether mkdir supports mode... " >&6; }
-if test "${libreplace_cv_mkdir_has_mode+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
- #include <stdio.h>
- #ifdef HAVE_DIRECT_H
- #include <direct.h>
- #endif
-int
-main ()
-{
-
- mkdir("foo",0777);
- return 0;
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- libreplace_cv_mkdir_has_mode="yes"
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- libreplace_cv_mkdir_has_mode="no"
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $libreplace_cv_mkdir_has_mode" >&5
-$as_echo "$libreplace_cv_mkdir_has_mode" >&6; }
-
-if test "$libreplace_cv_mkdir_has_mode" = "yes"
-then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_MKDIR_MODE 1
-_ACEOF
-
-fi
-
-
-for ac_func in timegm
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
- eval "$as_ac_var=yes"
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-else
- LIBREPLACEOBJ="${LIBREPLACEOBJ} $libreplacedir/timegm.o"
-fi
-done
-
-
-{ $as_echo "$as_me:$LINENO: checking for broken readdir" >&5
-$as_echo_n "checking for broken readdir... " >&6; }
-if test "${libreplace_cv_READDIR_NEEDED+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
-
- if test "$cross_compiling" = yes; then
- libreplace_cv_READDIR_NEEDED="assuming not"
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-#define test_readdir_os2_delete main
-#include "$libreplacedir/test/os2_delete.c"
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- libreplace_cv_READDIR_NEEDED=no
-else
- $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-libreplace_cv_READDIR_NEEDED=yes
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $libreplace_cv_READDIR_NEEDED" >&5
-$as_echo "$libreplace_cv_READDIR_NEEDED" >&6; }
-
-
-for ac_func in dirfd
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
- eval "$as_ac_var=yes"
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
- { $as_echo "$as_me:$LINENO: checking for dirfd declaration" >&5
-$as_echo_n "checking for dirfd declaration... " >&6; }
-if test "${ac_cv_have_dirfd_decl+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
-
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <dirent.h>
-int
-main ()
-{
-int i = (int)dirfd
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_have_dirfd_decl=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_have_dirfd_decl=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_dirfd_decl" >&5
-$as_echo "$ac_cv_have_dirfd_decl" >&6; }
- if test x"$ac_cv_have_dirfd_decl" = x"yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_DIRFD_DECL 1
-_ACEOF
-
- fi
-
-
-#
-# try to replace with getdirentries() if needed
-#
-if test x"$libreplace_cv_READDIR_NEEDED" = x"yes"; then
-
-for ac_func in getdirentries
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
- eval "$as_ac_var=yes"
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-{ $as_echo "$as_me:$LINENO: checking for prototype long telldir(const DIR *dir)" >&5
-$as_echo_n "checking for prototype long telldir(const DIR *dir)... " >&6; }
-if test "${ac_cv_c_prototype_long_telldir_const_DIR_pdir_+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
- $ac_includes_default
-
- #include <dirent.h>
-
- long telldir(const DIR *dir)
- {
-
- return 0;
-
- }
-
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
-
- ac_cv_c_prototype_long_telldir_const_DIR_pdir_=yes
-
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
- ac_cv_c_prototype_long_telldir_const_DIR_pdir_=no
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_prototype_long_telldir_const_DIR_pdir_" >&5
-$as_echo "$ac_cv_c_prototype_long_telldir_const_DIR_pdir_" >&6; }
-if test $ac_cv_c_prototype_long_telldir_const_DIR_pdir_ = yes; then
-
-
-cat >>confdefs.h <<\_ACEOF
-#define TELLDIR_TAKES_CONST_DIR 1
-_ACEOF
-
-
-fi
-
-
-
-{ $as_echo "$as_me:$LINENO: checking for prototype int seekdir(DIR *dir, long ofs)" >&5
-$as_echo_n "checking for prototype int seekdir(DIR *dir, long ofs)... " >&6; }
-if test "${ac_cv_c_prototype_int_seekdir_DIR_pdir__long_ofs_+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
- $ac_includes_default
-
- #include <dirent.h>
-
- int seekdir(DIR *dir, long ofs)
- {
-
- return 0;
-
- }
-
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
-
- ac_cv_c_prototype_int_seekdir_DIR_pdir__long_ofs_=yes
-
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
- ac_cv_c_prototype_int_seekdir_DIR_pdir__long_ofs_=no
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_prototype_int_seekdir_DIR_pdir__long_ofs_" >&5
-$as_echo "$ac_cv_c_prototype_int_seekdir_DIR_pdir__long_ofs_" >&6; }
-if test $ac_cv_c_prototype_int_seekdir_DIR_pdir__long_ofs_ = yes; then
-
-
-cat >>confdefs.h <<\_ACEOF
-#define SEEKDIR_RETURNS_INT 1
-_ACEOF
-
-
-fi
-
-
-{ $as_echo "$as_me:$LINENO: checking for replacing readdir using getdirentries()" >&5
-$as_echo_n "checking for replacing readdir using getdirentries()... " >&6; }
-if test "${libreplace_cv_READDIR_GETDIRENTRIES+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
-
- if test "$cross_compiling" = yes; then
- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }; }
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-#define _LIBREPLACE_REPLACE_H
-#include "$libreplacedir/repdir_getdirentries.c"
-#define test_readdir_os2_delete main
-#include "$libreplacedir/test/os2_delete.c"
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- libreplace_cv_READDIR_GETDIRENTRIES=yes
-else
- $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-libreplace_cv_READDIR_GETDIRENTRIES=no
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $libreplace_cv_READDIR_GETDIRENTRIES" >&5
-$as_echo "$libreplace_cv_READDIR_GETDIRENTRIES" >&6; }
-fi
-if test x"$libreplace_cv_READDIR_GETDIRENTRIES" = x"yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define REPLACE_READDIR 1
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define REPLACE_READDIR_GETDIRENTRIES 1
-_ACEOF
-
- LIBREPLACEOBJ="${LIBREPLACEOBJ} $libreplacedir/repdir_getdirentries.o"
- libreplace_cv_READDIR_NEEDED=no
-fi
-
-#
-# try to replace with getdents() if needed
-#
-if test x"$libreplace_cv_READDIR_NEEDED" = x"yes"; then
-
-for ac_func in getdents
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
- eval "$as_ac_var=yes"
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-{ $as_echo "$as_me:$LINENO: checking for replacing readdir using getdents()" >&5
-$as_echo_n "checking for replacing readdir using getdents()... " >&6; }
-if test "${libreplace_cv_READDIR_GETDENTS+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
-
- if test "$cross_compiling" = yes; then
- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }; }
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-#define _LIBREPLACE_REPLACE_H
-#error _donot_use_getdents_replacement_anymore
-#include "$libreplacedir/repdir_getdents.c"
-#define test_readdir_os2_delete main
-#include "$libreplacedir/test/os2_delete.c"
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- libreplace_cv_READDIR_GETDENTS=yes
-else
- $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-libreplace_cv_READDIR_GETDENTS=no
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $libreplace_cv_READDIR_GETDENTS" >&5
-$as_echo "$libreplace_cv_READDIR_GETDENTS" >&6; }
-fi
-if test x"$libreplace_cv_READDIR_GETDENTS" = x"yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define REPLACE_READDIR 1
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define REPLACE_READDIR_GETDENTS 1
-_ACEOF
-
- LIBREPLACEOBJ="${LIBREPLACEOBJ} $libreplacedir/repdir_getdents.o"
- libreplace_cv_READDIR_NEEDED=no
-fi
-
-{ $as_echo "$as_me:$LINENO: checking a usable readdir()" >&5
-$as_echo_n "checking a usable readdir()... " >&6; }
-if test x"$libreplace_cv_READDIR_NEEDED" = x"yes"; then
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
- { $as_echo "$as_me:$LINENO: WARNING: the provided readdir() is broken" >&5
-$as_echo "$as_me: WARNING: the provided readdir() is broken" >&2;}
-else
- { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-fi
-
-###############################################
-# test for where we get crypt() from
-
-for ac_header in crypt.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
- # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_header_compiler=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- ac_header_preproc=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
- ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-{ $as_echo "$as_me:$LINENO: checking for library containing crypt" >&5
-$as_echo_n "checking for library containing crypt... " >&6; }
-if test "${ac_cv_search_ext_crypt+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
-
-ac_func_search_ext_save_LIBS=$LIBS
-ac_cv_search_ext_crypt=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char crypt ();
-int
-main ()
-{
-return crypt ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
- ac_cv_search_ext_crypt="none required"
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-if test "$ac_cv_search_ext_crypt" = no; then
- for ac_lib in crypt; do
- LIBS="-l$ac_lib $CRYPT_LIBS $ac_func_search_save_ext_LIBS"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char crypt ();
-int
-main ()
-{
-return crypt ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
- ac_cv_search_ext_crypt="-l$ac_lib"
-break
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
- done
-fi
-LIBS=$ac_func_search_ext_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_ext_crypt" >&5
-$as_echo "$ac_cv_search_ext_crypt" >&6; }
-if test "$ac_cv_search_ext_crypt" != no; then
- test "$ac_cv_search_ext_crypt" = "none required" || CRYPT_LIBS="$ac_cv_search_ext_crypt $CRYPT_LIBS"
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_CRYPT 1
-_ACEOF
-
-else
- LIBREPLACEOBJ="${LIBREPLACEOBJ} $libreplacedir/crypt.o"
-fi
-
-
-
-
-
-
-for ac_func in printf memset memcpy
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
- eval "$as_ac_var=yes"
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-else
- { { $as_echo "$as_me:$LINENO: error: Required function not found" >&5
-$as_echo "$as_me: error: Required function not found" >&2;}
- { (exit 1); exit 1; }; }
-fi
-done
-
-
-echo "LIBREPLACE_BROKEN_CHECKS: END"
-
-
-#LIBREPLACE_ALL_CHECKS: END"
-
-CFLAGS="$CFLAGS -I$libreplacedir"
-
-
-
-case "$host_os" in
- *linux*|*gnu*)
- PICFLAG="-fPIC"
- ;;
- *solaris*)
- if test "${GCC}" = "yes"; then
- PICFLAG="-fPIC"
- else
- PICFLAG="-KPIC"
- fi
- ;;
- *sunos*)
- PICFLAG="-KPIC" # Is this correct for SunOS
- ;;
- *netbsd* | *freebsd* | *dragonfly* )
- PICFLAG="-fPIC -DPIC"
- ;;
- *openbsd*)
- PICFLAG="-fPIC"
- ;;
- *irix*)
- if test "${GCC}" = "yes"; then
- PICFLAG="-fPIC"
- else
- PICFLAG="-KPIC"
- fi
- ;;
- *aix*)
- # as AIX code is always position independent...
- PICFLAG="-O2"
- ;;
- *hpux*)
- if test "${GCC}" = "yes"; then
- PICFLAG="-fPIC"
- elif test "$host_cpu" = "ia64"; then
- PICFLAG="+z"
- elif test $ac_cv_prog_cc_Ae = yes; then
- PICFLAG="+z +ESnolit"
- fi
- ;;
- *osf*)
- PICFLAG="-fPIC"
- ;;
- *unixware*)
- PICFLAG="-KPIC"
- ;;
- *darwin*)
- PICFLAG="-fno-common"
- ;;
-esac
-
-
-
- SHLIBEXT="so"
- case "$host_os" in
- *hpux*)
- if test "$host_cpu" = "ia64"; then
- SHLIBEXT="so"
- else
- SHLIBEXT="sl"
- fi
- ;;
- *darwin*)
- SHLIBEXT="dylib"
- ;;
- esac
-
-
-
-
- SONAMEFLAG=""
- case "$host_os" in
- *linux*|*gnu*|*qnx*)
- SONAMEFLAG="-Wl,-soname="
- ;;
- *solaris*)
- SONAMEFLAG="-h "
- if test "${GCC}" = "yes"; then
- SONAMEFLAG="-Wl,-soname="
- fi
- ;;
- *sunos*)
- SONAMEFLAG="-Wl,-h,"
- ;;
- *netbsd* | *freebsd* | *dragonfly* )
- SONAMEFLAG="-Wl,-soname,"
- ;;
- *openbsd*)
- SONAMEFLAG="-Wl,-soname,"
- ;;
- *irix*)
- SONAMEFLAG="-Wl,-soname,"
- ;;
- *hpux*)
- SONAMEFLAG="-Wl,+h,"
- ;;
- *osf*)
- SONAMEFLAG="-Wl,-soname,"
- ;;
- *unixware*)
- SONAMEFLAG="-Wl,-soname,"
- ;;
- *darwin*)
- SONAMEFLAG="#"
- ;;
- *aix*)
- # Not supported
- SONAMEFLAG="#"
- ;;
- esac
-
-
-
- VERSIONSCRIPT=""
- case "$host_os" in
- *linux*|*gnu*)
- VERSIONSCRIPT="-Wl,--version-script"
- ;;
- *solaris*)
- if test "${GCC}" = "yes"; then
- VERSIONSCRIPT="-Wl,--version-script"
- fi
- ;;
- esac
-
-
- LD_SHLIB_LINKER="${CC}"
-
- case "$host_os" in
- *irix*)
- LD_SHLIB_LINKER="${PROG_LD}"
- ;;
- esac
-
-
-
-
-
- SHLD="$LD_SHLIB_LINKER"
-
-
-
- LD_SHLIB_FLAGS="-shared"
-
- case "$host_os" in
- *linux*|*gnu*)
- LD_SHLIB_FLAGS="-shared -Wl,-Bsymbolic"
- ;;
- *solaris*)
- LD_SHLIB_FLAGS="-G"
- if test "${GCC}" = "no"; then
- ## ${CFLAGS} added for building 64-bit shared
- ## libs using Sun's Compiler
- LD_SHLIB_FLAGS="-G \${CFLAGS}"
- fi
- ;;
- *sunos*)
- LD_SHLIB_FLAGS="-G"
- ;;
- *irix*)
- LD_SHLIB_FLAGS="-shared"
- ;;
- *aix*)
- LD_SHLIB_FLAGS="-Wl,-G,-bexpall,-bbigtoc"
- ;;
- *hpux*)
- if test "${GCC}" = "yes"; then
- LD_SHLIB_FLAGS="-shared"
- else
- LD_SHLIB_FLAGS="-b"
- fi
- ;;
- *osf*)
- LD_SHLIB_FLAGS="-shared"
- ;;
- *darwin*)
- LD_SHLIB_FLAGS="-dynamiclib -Wl,-search_paths_first"
- ;;
- esac
-
-
-
-
- LD_SHLIB_DISALLOW_UNDEF_FLAG=""
-
- #
- # TODO: enforce error not only warnings
- #
- # NOTE: -Wl,--no-allow-shlib-undefined isn't what we want...
- # as it bails out on broken system libraries
- #
- case "$host_os" in
- *osf*)
- LD_SHLIB_DISALLOW_UNDEF_FLAG="-warning_unresolved"
- ;;
- *darwin*)
- LD_SHLIB_DISALLOW_UNDEF_FLAG="-undefined error"
- ;;
- esac
-
-
-
-
-
-
- SHLD_FLAGS="$LD_SHLIB_FLAGS $LD_SHLIB_DISALLOW_UNDEF_FLAG"
-
-
-
-tallocdir=""
-tallocpaths=". lib/talloc talloc ../talloc ../lib/talloc"
-for d in $tallocpaths; do
- if test -f "$srcdir/$d/talloc.c"; then
- tallocdir="$d"
-
- break;
- fi
-done
-if test x"$tallocdir" = "x"; then
- { { $as_echo "$as_me:$LINENO: error: cannot find talloc source in $tallocpaths" >&5
-$as_echo "$as_me: error: cannot find talloc source in $tallocpaths" >&2;}
- { (exit 1); exit 1; }; }
-fi
-TALLOC_OBJ="talloc.o"
-
-
-TALLOC_CFLAGS="-I$srcdir/$tallocdir"
-
-
-TALLOC_LIBS=""
-
-
-# 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:$LINENO: checking size of size_t" >&5
-$as_echo_n "checking size of size_t... " >&6; }
-if test "${ac_cv_sizeof_size_t+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test "$cross_compiling" = yes; then
- # Depending upon the size, compute the lo and hi bounds.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) >= 0)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_lo=0 ac_mid=0
- while :; do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) <= $ac_mid)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_hi=$ac_mid; break
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_lo=`expr $ac_mid + 1`
- if test $ac_lo -le $ac_mid; then
- ac_lo= ac_hi=
- break
- fi
- ac_mid=`expr 2 '*' $ac_mid + 1`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- done
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) < 0)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_hi=-1 ac_mid=-1
- while :; do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) >= $ac_mid)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_lo=$ac_mid; break
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_hi=`expr '(' $ac_mid ')' - 1`
- if test $ac_mid -le $ac_hi; then
- ac_lo= ac_hi=
- break
- fi
- ac_mid=`expr 2 '*' $ac_mid`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- done
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- 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
- ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) <= $ac_mid)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_hi=$ac_mid
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_lo=`expr '(' $ac_mid ')' + 1`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_size_t=$ac_lo;;
-'') if test "$ac_cv_type_size_t" = yes; then
- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (size_t)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (size_t)
-See \`config.log' for more details." >&2;}
- { (exit 77); exit 77; }; }; }
- else
- ac_cv_sizeof_size_t=0
- fi ;;
-esac
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-static long int longval () { return (long int) (sizeof (size_t)); }
-static unsigned long int ulongval () { return (long int) (sizeof (size_t)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
-
- FILE *f = fopen ("conftest.val", "w");
- if (! f)
- return 1;
- if (((long int) (sizeof (size_t))) < 0)
- {
- long int i = longval ();
- if (i != ((long int) (sizeof (size_t))))
- return 1;
- fprintf (f, "%ld", i);
- }
- else
- {
- unsigned long int i = ulongval ();
- if (i != ((long int) (sizeof (size_t))))
- 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
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_sizeof_size_t=`cat conftest.val`
-else
- $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-if test "$ac_cv_type_size_t" = yes; then
- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (size_t)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (size_t)
-See \`config.log' for more details." >&2;}
- { (exit 77); exit 77; }; }; }
- else
- ac_cv_sizeof_size_t=0
- fi
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f conftest.val
-fi
-{ $as_echo "$as_me:$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
-
-
-# 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:$LINENO: checking size of void *" >&5
-$as_echo_n "checking size of void *... " >&6; }
-if test "${ac_cv_sizeof_void_p+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test "$cross_compiling" = yes; then
- # Depending upon the size, compute the lo and hi bounds.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (void *))) >= 0)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_lo=0 ac_mid=0
- while :; do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (void *))) <= $ac_mid)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_hi=$ac_mid; break
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_lo=`expr $ac_mid + 1`
- if test $ac_lo -le $ac_mid; then
- ac_lo= ac_hi=
- break
- fi
- ac_mid=`expr 2 '*' $ac_mid + 1`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- done
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (void *))) < 0)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_hi=-1 ac_mid=-1
- while :; do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (void *))) >= $ac_mid)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_lo=$ac_mid; break
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_hi=`expr '(' $ac_mid ')' - 1`
- if test $ac_mid -le $ac_hi; then
- ac_lo= ac_hi=
- break
- fi
- ac_mid=`expr 2 '*' $ac_mid`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- done
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- 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
- ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (void *))) <= $ac_mid)];
-test_array [0] = 0
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_hi=$ac_mid
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_lo=`expr '(' $ac_mid ')' + 1`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_void_p=$ac_lo;;
-'') if test "$ac_cv_type_void_p" = yes; then
- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (void *)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (void *)
-See \`config.log' for more details." >&2;}
- { (exit 77); exit 77; }; }; }
- else
- ac_cv_sizeof_void_p=0
- fi ;;
-esac
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-static long int longval () { return (long int) (sizeof (void *)); }
-static unsigned long int ulongval () { return (long int) (sizeof (void *)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
-
- FILE *f = fopen ("conftest.val", "w");
- if (! f)
- return 1;
- if (((long int) (sizeof (void *))) < 0)
- {
- long int i = longval ();
- if (i != ((long int) (sizeof (void *))))
- return 1;
- fprintf (f, "%ld", i);
- }
- else
- {
- unsigned long int i = ulongval ();
- if (i != ((long int) (sizeof (void *))))
- 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
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_sizeof_void_p=`cat conftest.val`
-else
- $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-if test "$ac_cv_type_void_p" = yes; then
- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (void *)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (void *)
-See \`config.log' for more details." >&2;}
- { (exit 77); exit 77; }; }; }
- else
- ac_cv_sizeof_void_p=0
- fi
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f conftest.val
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_void_p" >&5
-$as_echo "$ac_cv_sizeof_void_p" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_VOID_P $ac_cv_sizeof_void_p
-_ACEOF
-
-
-
-if test $ac_cv_sizeof_size_t -lt $ac_cv_sizeof_void_p; then
- { $as_echo "$as_me:$LINENO: WARNING: size_t cannot represent the amount of used memory of a process" >&5
-$as_echo "$as_me: WARNING: size_t cannot represent the amount of used memory of a process" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: please report this to <samba-technical@samba.org>" >&5
-$as_echo "$as_me: WARNING: please report this to <samba-technical@samba.org>" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: sizeof(size_t) = $ac_cv_sizeof_size_t" >&5
-$as_echo "$as_me: WARNING: sizeof(size_t) = $ac_cv_sizeof_size_t" >&2;}
- { $as_echo "$as_me:$LINENO: WARNING: sizeof(void *) = $ac_cv_sizeof_void_p" >&5
-$as_echo "$as_me: WARNING: sizeof(void *) = $ac_cv_sizeof_void_p" >&2;}
- { { $as_echo "$as_me:$LINENO: error: sizeof(size_t) < sizeof(void *)" >&5
-$as_echo "$as_me: error: sizeof(size_t) < sizeof(void *)" >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-if test x"$VERSIONSCRIPT" != "x"; then
- EXPORTSFILE=talloc.exports
-
-fi
-
-TALLOC_COMPAT1_MK=""
-
-
-# Check whether --enable-talloc-compat1 was given.
-if test "${enable_talloc_compat1+set}" = set; then
- enableval=$enable_talloc_compat1; enable_talloc_compat1=$enableval
-else
- enable_talloc_compat1=no
-
-fi
-
-
-if test "x$enable_talloc_compat1" = x"yes"; then
- TALLOC_COMPAT1_MK='include $(tallocdir)/compat/talloc_compat1.mk'
-fi
-
-
-
-# Extract the first word of "xsltproc", so it can be a program name with args.
-set dummy xsltproc; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_XSLTPROC+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- case $XSLTPROC in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_XSLTPROC="$XSLTPROC" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_path_XSLTPROC="$as_dir/$ac_word$ac_exec_ext"
- $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-IFS=$as_save_IFS
-
- ;;
-esac
-fi
-XSLTPROC=$ac_cv_path_XSLTPROC
-if test -n "$XSLTPROC"; then
- { $as_echo "$as_me:$LINENO: result: $XSLTPROC" >&5
-$as_echo "$XSLTPROC" >&6; }
-else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-DOC_TARGET=""
-if test -n "$XSLTPROC"; then
- DOC_TARGET=doc
-fi
-
-
-
-
-
-
-# Check whether --with-shared-build-dir was given.
-if test "${with_shared_build_dir+set}" = set; then
- withval=$with_shared_build_dir;
-fi
-
-
- sharedbuilddir="$srcdir/sharedbuild"
- if test x"$with_shared_build_dir" != x; then
- sharedbuilddir=$with_shared_build_dir
- CFLAGS="$CFLAGS -I$with_shared_build_dir/include"
- LDFLAGS="$LDFLAGS -L$with_shared_build_dir/lib"
- fi
-
-
-
-ac_config_files="$ac_config_files Makefile talloc.pc"
-
-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
-# scripts and configure runs, see configure's option --config-cache.
-# It is not useful on other systems. If it contains results you don't
-# want to keep, you may remove or edit it.
-#
-# config.status only pays attention to the cache file if you give it
-# the --recheck option to rerun configure.
-#
-# `ac_cv_env_foo' variables (set or unset) will be overridden when
-# loading this file, other *unset* `ac_cv_foo' will be assigned the
-# following values.
-
-_ACEOF
-
-# The following way of writing the cache mishandles newlines in values,
-# but we know of no workaround that is simple, portable, and efficient.
-# So, we kill variables containing newlines.
-# Ultrix sh set writes to stderr and can't be redirected directly,
-# and sets the high bit in the cache file unless we assign to the vars.
-(
- for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
- eval ac_val=\$$ac_var
- case $ac_val in #(
- *${as_nl}*)
- case $ac_var in #(
- *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5
-$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
- esac
- case $ac_var in #(
- _ | IFS | as_nl) ;; #(
- BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
- *) $as_unset $ac_var ;;
- esac ;;
- esac
- done
-
- (set) 2>&1 |
- case $as_nl`(ac_space=' '; set) 2>&1` in #(
- *${as_nl}ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote
- # substitution turns \\\\ into \\, and sed turns \\ into \).
- sed -n \
- "s/'/'\\\\''/g;
- s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
- ;; #(
- *)
- # `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
- ;;
- esac |
- sort
-) |
- sed '
- /^ac_cv_env_/b end
- t clear
- :clear
- s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
- t end
- s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
- :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" &&
- { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5
-$as_echo "$as_me: updating cache $cache_file" >&6;}
- cat confcache >$cache_file
- else
- { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
-$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
- fi
-fi
-rm -f confcache
-
-test "x$prefix" = xNONE && prefix=$ac_default_prefix
-# Let make expand exec_prefix.
-test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-
-DEFS=-DHAVE_CONFIG_H
-
-ac_libobjs=
-ac_ltlibobjs=
-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$//'
- ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
- # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
- # will be set to the directory where LIBOBJS objects are built.
- ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
- ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
-done
-LIBOBJS=$ac_libobjs
-
-LTLIBOBJS=$ac_ltlibobjs
-
-
-
-
-: ${CONFIG_STATUS=./config.status}
-ac_write_fail=0
-ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
-$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
-cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-#! $SHELL
-# Generated by $as_me.
-# Run this file to recreate the current configuration.
-# Compiler output produced by configure, useful for debugging
-# configure, is in config.log if it exists.
-
-debug=false
-ac_cs_recheck=false
-ac_cs_silent=false
-SHELL=\${CONFIG_SHELL-$SHELL}
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-## --------------------- ##
-## M4sh Initialization. ##
-## --------------------- ##
-
-# Be more Bourne compatible
-DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
- emulate sh
- NULLCMD=:
- # Pre-4.2 versions of Zsh do 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
-
-
-
-
-# PATH needs CR
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-as_nl='
-'
-export as_nl
-# Printing a long string crashes Solaris 7 /usr/bin/printf.
-as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
-if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
- as_echo='printf %s\n'
- as_echo_n='printf %s'
-else
- if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
- as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
- as_echo_n='/usr/ucb/echo -n'
- else
- as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
- as_echo_n_body='eval
- arg=$1;
- case $arg in
- *"$as_nl"*)
- expr "X$arg" : "X\\(.*\\)$as_nl";
- arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
- esac;
- expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
- '
- export as_echo_n_body
- as_echo_n='sh -c $as_echo_n_body as_echo'
- fi
- export as_echo_body
- as_echo='sh -c $as_echo_body as_echo'
-fi
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- PATH_SEPARATOR=:
- (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
- (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
- PATH_SEPARATOR=';'
- }
-fi
-
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
- as_unset=unset
-else
- as_unset=false
-fi
-
-
-# IFS
-# We need space, tab and new line, in precisely that order. Quoting is
-# there to prevent editors from complaining about space-tab.
-# (If _AS_PATH_WALK were called with IFS unset, it would disable word
-# splitting by setting IFS to empty value.)
-IFS=" "" $as_nl"
-
-# Find who we are. Look in the path if we contain no directory separator.
-case $0 in
- *[\\/]* ) as_myself=$0 ;;
- *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
-IFS=$as_save_IFS
-
- ;;
-esac
-# We did not find ourselves, most probably we were run as `sh COMMAND'
-# in which case we are not to be found in the path.
-if test "x$as_myself" = x; then
- as_myself=$0
-fi
-if test ! -f "$as_myself"; then
- $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
- { (exit 1); exit 1; }
-fi
-
-# Work around bugs in pre-3.0 UWIN ksh.
-for as_var in ENV MAIL MAILPATH
-do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
-done
-PS1='$ '
-PS2='> '
-PS4='+ '
-
-# NLS nuisances.
-LC_ALL=C
-export LC_ALL
-LANGUAGE=C
-export LANGUAGE
-
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1 &&
- test "X`expr 00001 : '.*\(...\)'`" = X001; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
- as_basename=basename
-else
- as_basename=false
-fi
-
-
-# Name of the executable.
-as_me=`$as_basename -- "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
- X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X/"$0" |
- sed '/^.*\/\([^/][^/]*\)\/*$/{
- s//\1/
- q
- }
- /^X\/\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\/\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
-
-# CDPATH.
-$as_unset CDPATH
-
-
-
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
-
- # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
- # uniformly replaced by the line number. The first 'sed' inserts a
- # line-number line after each line using $LINENO; the second 'sed'
- # does the real work. The second script uses 'N' to pair each
- # line-number line with the line containing $LINENO, and appends
- # trailing '-' during substitution so that $LINENO is not a special
- # case at line end.
- # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
- # scripts with optimization help from Paolo Bonzini. Blame Lee
- # E. McMahon (1931-1989) for sed's syntax. :-)
- sed -n '
- p
- /[$]LINENO/=
- ' <$as_myself |
- sed '
- s/[$]LINENO.*/&-/
- t lineno
- b
- :lineno
- N
- :loop
- s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
- t loop
- s/-\n.*//
- ' >$as_me.lineno &&
- chmod +x "$as_me.lineno" ||
- { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
- { (exit 1); exit 1; }; }
-
- # 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).
- . "./$as_me.lineno"
- # Exit status is that of the last command.
- exit
-}
-
-
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
- as_dirname=dirname
-else
- as_dirname=false
-fi
-
-ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in
--n*)
- case `echo 'x\c'` in
- *c*) ECHO_T=' ';; # ECHO_T is single tab character.
- *) ECHO_C='\c';;
- esac;;
-*)
- ECHO_N='-n';;
-esac
-if expr a : '\(a\)' >/dev/null 2>&1 &&
- test "X`expr 00001 : '.*\(...\)'`" = X001; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-rm -f conf$$ conf$$.exe conf$$.file
-if test -d conf$$.dir; then
- rm -f conf$$.dir/conf$$.file
-else
- rm -f conf$$.dir
- mkdir conf$$.dir 2>/dev/null
-fi
-if (echo >conf$$.file) 2>/dev/null; then
- if ln -s conf$$.file conf$$ 2>/dev/null; then
- as_ln_s='ln -s'
- # ... 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'.
- ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
- as_ln_s='cp -p'
- 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'
-fi
-rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
-rmdir conf$$.dir 2>/dev/null
-
-if mkdir -p . 2>/dev/null; then
- as_mkdir_p=:
-else
- test -d ./-p && rmdir ./-p
- 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
-
-# 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'"
-
-# Sed expression to map a string onto a valid variable name.
-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-
-
-exec 6>&1
-
-# Save the log message, to keep $[0] and so on meaningful, and to
-# report actual input values of CONFIG_FILES etc. instead of their
-# values after options handling.
-ac_log="
-This file was extended by talloc $as_me 2.0.1, which was
-generated by GNU Autoconf 2.63. Invocation command line was
-
- CONFIG_FILES = $CONFIG_FILES
- CONFIG_HEADERS = $CONFIG_HEADERS
- CONFIG_LINKS = $CONFIG_LINKS
- CONFIG_COMMANDS = $CONFIG_COMMANDS
- $ $0 $@
-
-on `(hostname || uname -n) 2>/dev/null | sed 1q`
-"
-
-_ACEOF
-
-case $ac_config_files in *"
-"*) set x $ac_config_files; shift; ac_config_files=$*;;
-esac
-
-case $ac_config_headers in *"
-"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
-esac
-
-
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-# Files that config.status was made for.
-config_files="$ac_config_files"
-config_headers="$ac_config_headers"
-config_commands="$ac_config_commands"
-
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-ac_cs_usage="\
-\`$as_me' instantiates files from templates according to the
-current configuration.
-
-Usage: $0 [OPTION]... [FILE]...
-
- -h, --help print this help, then exit
- -V, --version print version number and configuration settings, then exit
- -q, --quiet, --silent
- do not print progress messages
- -d, --debug don't remove temporary files
- --recheck update $as_me by reconfiguring in the same conditions
- --file=FILE[:TEMPLATE]
- instantiate the configuration file FILE
- --header=FILE[:TEMPLATE]
- instantiate the configuration header FILE
-
-Configuration files:
-$config_files
-
-Configuration headers:
-$config_headers
-
-Configuration commands:
-$config_commands
-
-Report bugs to <bug-autoconf@gnu.org>."
-
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-ac_cs_version="\\
-talloc config.status 2.0.1
-configured by $0, generated by GNU Autoconf 2.63,
- with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
-
-Copyright (C) 2008 Free Software Foundation, Inc.
-This config.status script is free software; the Free Software Foundation
-gives unlimited permission to copy, distribute and modify it."
-
-ac_pwd='$ac_pwd'
-srcdir='$srcdir'
-INSTALL='$INSTALL'
-test -n "\$AWK" || AWK=awk
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-# The default lists apply if the user does not specify any file.
-ac_need_defaults=:
-while test $# != 0
-do
- case $1 in
- --*=*)
- ac_option=`expr "X$1" : 'X\([^=]*\)='`
- ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
- ac_shift=:
- ;;
- *)
- ac_option=$1
- ac_optarg=$2
- ac_shift=shift
- ;;
- esac
-
- case $ac_option in
- # Handling of the options.
- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- ac_cs_recheck=: ;;
- --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
- $as_echo "$ac_cs_version"; exit ;;
- --debug | --debu | --deb | --de | --d | -d )
- debug=: ;;
- --file | --fil | --fi | --f )
- $ac_shift
- case $ac_optarg in
- *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
- esac
- CONFIG_FILES="$CONFIG_FILES '$ac_optarg'"
- ac_need_defaults=false;;
- --header | --heade | --head | --hea )
- $ac_shift
- case $ac_optarg in
- *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
- esac
- CONFIG_HEADERS="$CONFIG_HEADERS '$ac_optarg'"
- ac_need_defaults=false;;
- --he | --h)
- # Conflict between --help and --header
- { $as_echo "$as_me: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&2
- { (exit 1); exit 1; }; };;
- --help | --hel | -h )
- $as_echo "$ac_cs_usage"; exit ;;
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil | --si | --s)
- ac_cs_silent=: ;;
-
- # This is an error.
- -*) { $as_echo "$as_me: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&2
- { (exit 1); exit 1; }; } ;;
-
- *) ac_config_targets="$ac_config_targets $1"
- ac_need_defaults=false ;;
-
- esac
- shift
-done
-
-ac_configure_extra_args=
-
-if $ac_cs_silent; then
- exec 6>/dev/null
- ac_configure_extra_args="$ac_configure_extra_args --silent"
-fi
-
-_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
- shift
- \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
- CONFIG_SHELL='$SHELL'
- export CONFIG_SHELL
- exec "\$@"
-fi
-
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-exec 5>>config.log
-{
- echo
- sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
-## Running $as_me. ##
-_ASBOX
- $as_echo "$ac_log"
-} >&5
-
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-#
-# INIT-COMMANDS
-#
-libreplacedir=$libreplacedir
-libreplacedir=$libreplacedir
-libreplacedir=$libreplacedir
-libreplacedir=$libreplacedir
-
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-
-# Handling of arguments.
-for ac_config_target in $ac_config_targets
-do
- case $ac_config_target in
- "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
- "rm-stdint.h") CONFIG_COMMANDS="$CONFIG_COMMANDS rm-stdint.h" ;;
- "mk-stdint.h") CONFIG_COMMANDS="$CONFIG_COMMANDS mk-stdint.h" ;;
- "rm-stdbool.h") CONFIG_COMMANDS="$CONFIG_COMMANDS rm-stdbool.h" ;;
- "mk-stdbool.h") CONFIG_COMMANDS="$CONFIG_COMMANDS mk-stdbool.h" ;;
- "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
- "talloc.pc") CONFIG_FILES="$CONFIG_FILES talloc.pc" ;;
-
- *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
-$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
- { (exit 1); exit 1; }; };;
- esac
-done
-
-
-# If the user did not use the arguments to specify the items to instantiate,
-# then the envvar interface is used. Set only those that are not.
-# We use the long form for the default assignment because of an extremely
-# bizarre bug on SunOS 4.1.3.
-if $ac_need_defaults; then
- test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
- test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
- test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
-fi
-
-# Have a temporary directory for convenience. Make it in the build tree
-# simply because there is no reason against having it here, and in addition,
-# creating and moving files from /tmp can sometimes cause problems.
-# Hook for its removal unless debugging.
-# Note that there is a small window in which the directory will not be cleaned:
-# after its creation but before its name has been assigned to `$tmp'.
-$debug ||
-{
- tmp=
- trap 'exit_status=$?
- { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
-' 0
- trap '{ (exit 1); exit 1; }' 1 2 13 15
-}
-# Create a (secure) tmp directory for tmp files.
-
-{
- tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
- test -n "$tmp" && test -d "$tmp"
-} ||
-{
- tmp=./conf$$-$RANDOM
- (umask 077 && mkdir "$tmp")
-} ||
-{
- $as_echo "$as_me: cannot create a temporary directory in ." >&2
- { (exit 1); exit 1; }
-}
-
-# Set up the scripts for CONFIG_FILES section.
-# No need to generate them if there are no CONFIG_FILES.
-# This happens for instance with `./config.status config.h'.
-if test -n "$CONFIG_FILES"; then
-
-
-ac_cr=' '
-ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
-if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
- ac_cs_awk_cr='\\r'
-else
- ac_cs_awk_cr=$ac_cr
-fi
-
-echo 'BEGIN {' >"$tmp/subs1.awk" &&
-_ACEOF
-
-
-{
- echo "cat >conf$$subs.awk <<_ACEOF" &&
- echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
- echo "_ACEOF"
-} >conf$$subs.sh ||
- { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
- { (exit 1); exit 1; }; }
-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_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
- { (exit 1); exit 1; }; }
-
- 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_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
- { (exit 1); exit 1; }; }
- else
- ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
- fi
-done
-rm -f conf$$subs.sh
-
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&
-_ACEOF
-sed -n '
-h
-s/^/S["/; s/!.*/"]=/
-p
-g
-s/^[^!]*!//
-:repl
-t repl
-s/'"$ac_delim"'$//
-t delim
-:nl
-h
-s/\(.\{148\}\).*/\1/
-t more1
-s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
-p
-n
-b repl
-:more1
-s/["\\]/\\&/g; s/^/"/; s/$/"\\/
-p
-g
-s/.\{148\}//
-t nl
-:delim
-h
-s/\(.\{148\}\).*/\1/
-t more2
-s/["\\]/\\&/g; s/^/"/; s/$/"/
-p
-b
-:more2
-s/["\\]/\\&/g; s/^/"/; s/$/"\\/
-p
-g
-s/.\{148\}//
-t delim
-' <conf$$subs.awk | sed '
-/^[^""]/{
- N
- s/\n//
-}
-' >>$CONFIG_STATUS || ac_write_fail=1
-rm -f conf$$subs.awk
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-_ACAWK
-cat >>"\$tmp/subs1.awk" <<_ACAWK &&
- for (key in S) S_is_set[key] = 1
- FS = ""
-
-}
-{
- line = $ 0
- nfields = split(line, field, "@")
- substed = 0
- len = length(field[1])
- for (i = 2; i < nfields; i++) {
- key = field[i]
- keylen = length(key)
- if (S_is_set[key]) {
- value = S[key]
- line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
- len += length(value) + length(field[++i])
- substed = 1
- } else
- len += 1 + keylen
- }
-
- print line
-}
-
-_ACAWK
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
- sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
-else
- cat
-fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
- || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5
-$as_echo "$as_me: error: could not setup config files machinery" >&2;}
- { (exit 1); exit 1; }; }
-_ACEOF
-
-# VPATH may cause trouble with some makes, so we remove $(srcdir),
-# ${srcdir} and @srcdir@ 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/
-s/:*$//
-s/^[^=]*=[ ]*$//
-}'
-fi
-
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-fi # test -n "$CONFIG_FILES"
-
-# Set up the scripts for CONFIG_HEADERS section.
-# 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 ||
-BEGIN {
-_ACEOF
-
-# Transform confdefs.h into an awk script `defines.awk', embedded as
-# here-document in config.status, that substitutes the proper values into
-# config.h.in to produce config.h.
-
-# Create a delimiter string that does not exist in confdefs.h, to ease
-# 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
- break
- elif $ac_last_try; then
- { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_HEADERS" >&5
-$as_echo "$as_me: error: could not make $CONFIG_HEADERS" >&2;}
- { (exit 1); exit 1; }; }
- else
- ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
- fi
-done
-
-# For the awk script, D is an array of macro values keyed by name,
-# likewise P contains macro parameters if any. Preserve backslash
-# newline sequences.
-
-ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
-sed -n '
-s/.\{148\}/&'"$ac_delim"'/g
-t rset
-:rset
-s/^[ ]*#[ ]*define[ ][ ]*/ /
-t def
-d
-:def
-s/\\$//
-t bsnl
-s/["\\]/\\&/g
-s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
-D["\1"]=" \3"/p
-s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p
-d
-:bsnl
-s/["\\]/\\&/g
-s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
-D["\1"]=" \3\\\\\\n"\\/p
-t cont
-s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
-t cont
-d
-:cont
-n
-s/.\{148\}/&'"$ac_delim"'/g
-t clear
-:clear
-s/\\$//
-t bsnlc
-s/["\\]/\\&/g; s/^/"/; s/$/"/p
-d
-:bsnlc
-s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
-b cont
-' <confdefs.h | sed '
-s/'"$ac_delim"'/"\\\
-"/g' >>$CONFIG_STATUS || ac_write_fail=1
-
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
- for (key in D) D_is_set[key] = 1
- FS = ""
-}
-/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
- line = \$ 0
- split(line, arg, " ")
- if (arg[1] == "#") {
- defundef = arg[2]
- mac1 = arg[3]
- } else {
- defundef = substr(arg[1], 2)
- mac1 = arg[2]
- }
- split(mac1, mac2, "(") #)
- macro = mac2[1]
- prefix = substr(line, 1, index(line, defundef) - 1)
- if (D_is_set[macro]) {
- # Preserve the white space surrounding the "#".
- print prefix "define", macro P[macro] D[macro]
- next
- } else {
- # Replace #undef with comments. This is necessary, for example,
- # in the case of _POSIX_SOURCE, which is predefined and required
- # on some systems where configure will not decide to define it.
- if (defundef == "undef") {
- print "/*", prefix defundef, macro, "*/"
- next
- }
- }
-}
-{ print }
-_ACAWK
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
- { { $as_echo "$as_me:$LINENO: error: could not setup config headers machinery" >&5
-$as_echo "$as_me: error: could not setup config headers machinery" >&2;}
- { (exit 1); exit 1; }; }
-fi # test -n "$CONFIG_HEADERS"
-
-
-eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS"
-shift
-for ac_tag
-do
- case $ac_tag in
- :[FHLC]) ac_mode=$ac_tag; continue;;
- esac
- case $ac_mode$ac_tag in
- :[FHL]*:*);;
- :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5
-$as_echo "$as_me: error: invalid tag $ac_tag" >&2;}
- { (exit 1); exit 1; }; };;
- :[FH]-) ac_tag=-:-;;
- :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
- esac
- ac_save_IFS=$IFS
- IFS=:
- set x $ac_tag
- IFS=$ac_save_IFS
- shift
- ac_file=$1
- shift
-
- case $ac_mode in
- :L) ac_source=$1;;
- :[FH])
- ac_file_inputs=
- for ac_f
- do
- case $ac_f in
- -) ac_f="$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 `:'.
- test -f "$ac_f" ||
- case $ac_f in
- [\\/$]*) false;;
- *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
- esac ||
- { { $as_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
-$as_echo "$as_me: error: cannot find input file: $ac_f" >&2;}
- { (exit 1); exit 1; }; };;
- esac
- case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
- ac_file_inputs="$ac_file_inputs '$ac_f'"
- done
-
- # Let's still pretend it is `configure' which instantiates (i.e., don't
- # use $as_me), people would be surprised to read:
- # /* config.h. Generated by config.status. */
- configure_input='Generated from '`
- $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
- `' by configure.'
- if test x"$ac_file" != x-; then
- configure_input="$ac_file. $configure_input"
- { $as_echo "$as_me:$LINENO: creating $ac_file" >&5
-$as_echo "$as_me: creating $ac_file" >&6;}
- fi
- # Neutralize special characters interpreted by sed in replacement strings.
- case $configure_input in #(
- *\&* | *\|* | *\\* )
- ac_sed_conf_input=`$as_echo "$configure_input" |
- sed 's/[\\\\&|]/\\\\&/g'`;; #(
- *) ac_sed_conf_input=$configure_input;;
- esac
-
- case $ac_tag in
- *:-:* | *:-) cat >"$tmp/stdin" \
- || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
- { (exit 1); exit 1; }; } ;;
- esac
- ;;
- esac
-
- ac_dir=`$as_dirname -- "$ac_file" ||
-$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$ac_file" : 'X\(//\)[^/]' \| \
- X"$ac_file" : 'X\(//\)$' \| \
- X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$ac_file" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
- { as_dir="$ac_dir"
- case $as_dir in #(
- -*) as_dir=./$as_dir;;
- esac
- test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
- as_dirs=
- while :; do
- case $as_dir in #(
- *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
- *) as_qdir=$as_dir;;
- esac
- as_dirs="'$as_qdir' $as_dirs"
- as_dir=`$as_dirname -- "$as_dir" ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$as_dir" : 'X\(//\)[^/]' \| \
- X"$as_dir" : 'X\(//\)$' \| \
- X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$as_dir" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
- test -d "$as_dir" && break
- done
- test -z "$as_dirs" || eval "mkdir $as_dirs"
- } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
-$as_echo "$as_me: error: cannot create directory $as_dir" >&2;}
- { (exit 1); exit 1; }; }; }
- ac_builddir=.
-
-case "$ac_dir" in
-.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
-*)
- ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
- # A ".." for each directory in $ac_dir_suffix.
- ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
- case $ac_top_builddir_sub in
- "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
- *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
- esac ;;
-esac
-ac_abs_top_builddir=$ac_pwd
-ac_abs_builddir=$ac_pwd$ac_dir_suffix
-# for backward compatibility:
-ac_top_builddir=$ac_top_build_prefix
-
-case $srcdir in
- .) # We are building in place.
- ac_srcdir=.
- ac_top_srcdir=$ac_top_builddir_sub
- ac_abs_top_srcdir=$ac_pwd ;;
- [\\/]* | ?:[\\/]* ) # Absolute name.
- ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir
- ac_abs_top_srcdir=$srcdir ;;
- *) # Relative name.
- ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_build_prefix$srcdir
- ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
-esac
-ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
-
-
- case $ac_mode in
- :F)
- #
- # CONFIG_FILE
- #
-
- case $INSTALL in
- [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
- *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
- esac
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-# If the template does not know about datarootdir, expand it.
-# FIXME: This hack should be removed a few years after 2.60.
-ac_datarootdir_hack=; ac_datarootdir_seen=
-
-ac_sed_dataroot='
-/datarootdir/ {
- p
- q
-}
-/@datadir@/p
-/@docdir@/p
-/@infodir@/p
-/@localedir@/p
-/@mandir@/p
-'
-case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
-*datarootdir*) ac_datarootdir_seen=yes;;
-*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
- { $as_echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
-$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
- ac_datarootdir_hack='
- s&@datadir@&$datadir&g
- s&@docdir@&$docdir&g
- s&@infodir@&$infodir&g
- s&@localedir@&$localedir&g
- s&@mandir@&$mandir&g
- s&\\\${datarootdir}&$datarootdir&g' ;;
-esac
-_ACEOF
-
-# Neutralize VPATH when `$srcdir' = `.'.
-# Shell code in configure.ac might set extrasub.
-# FIXME: do we really want to maintain this feature?
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-ac_sed_extra="$ac_vpsub
-$extrasub
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-:t
-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-s|@configure_input@|$ac_sed_conf_input|;t t
-s&@top_builddir@&$ac_top_builddir_sub&;t t
-s&@top_build_prefix@&$ac_top_build_prefix&;t t
-s&@srcdir@&$ac_srcdir&;t t
-s&@abs_srcdir@&$ac_abs_srcdir&;t t
-s&@top_srcdir@&$ac_top_srcdir&;t t
-s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
-s&@builddir@&$ac_builddir&;t t
-s&@abs_builddir@&$ac_abs_builddir&;t t
-s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
-s&@INSTALL@&$ac_INSTALL&;t t
-$ac_datarootdir_hack
-"
-eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
- || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
- { (exit 1); exit 1; }; }
-
-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"; } &&
- { $as_echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-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"
- case $ac_file in
- -) cat "$tmp/out" && rm -f "$tmp/out";;
- *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
- esac \
- || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
- { (exit 1); exit 1; }; }
- ;;
- :H)
- #
- # CONFIG_HEADER
- #
- if test x"$ac_file" != x-; then
- {
- $as_echo "/* $configure_input */" \
- && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
- } >"$tmp/config.h" \
- || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
- { (exit 1); exit 1; }; }
- if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
- { $as_echo "$as_me:$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_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
- { (exit 1); exit 1; }; }
- fi
- else
- $as_echo "/* $configure_input */" \
- && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
- || { { $as_echo "$as_me:$LINENO: error: could not create -" >&5
-$as_echo "$as_me: error: could not create -" >&2;}
- { (exit 1); exit 1; }; }
- fi
- ;;
-
- :C) { $as_echo "$as_me:$LINENO: executing $ac_file commands" >&5
-$as_echo "$as_me: executing $ac_file commands" >&6;}
- ;;
- esac
-
-
- case $ac_file$ac_mode in
- "rm-stdint.h":C) rm -f $libreplacedir/stdint.h ;;
- "mk-stdint.h":C) echo "#include \"replace.h\"" > $libreplacedir/stdint.h ;;
- "rm-stdbool.h":C) rm -f $libreplacedir/stdbool.h ;;
- "mk-stdbool.h":C) echo "#include \"replace.h\"" > $libreplacedir/stdbool.h ;;
-
- esac
-done # for ac_tag
-
-
-{ (exit 0); exit 0; }
-_ACEOF
-chmod +x $CONFIG_STATUS
-ac_clean_files=$ac_clean_files_save
-
-test $ac_write_fail = 0 ||
- { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5
-$as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;}
- { (exit 1); exit 1; }; }
-
-
-# configure is writing to config.log, and then calls config.status.
-# config.status does its own redirection, appending to config.log.
-# Unfortunately, on DOS this fails, as config.log is still kept open
-# by configure, so config.status won't be able to write to it; its
-# output is simply discarded. So we exec the FD to /dev/null,
-# effectively closing config.log, so it can be properly (re)opened and
-# appended to by config.status. When coming back to configure, we
-# need to make the FD available again.
-if test "$no_create" != yes; then
- ac_cs_success=:
- ac_config_status_args=
- test "$silent" = yes &&
- ac_config_status_args="$ac_config_status_args --quiet"
- exec 5>/dev/null
- $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
- 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 || { (exit 1); exit 1; }
-fi
-if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
- { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
-$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
-fi
-
diff --git a/chromium/third_party/talloc/configure.ac b/chromium/third_party/talloc/configure.ac
deleted file mode 100644
index c1b1d2e4a12..00000000000
--- a/chromium/third_party/talloc/configure.ac
+++ /dev/null
@@ -1,49 +0,0 @@
-AC_PREREQ(2.50)
-AC_INIT(talloc, 2.0.1)
-AC_CONFIG_SRCDIR([talloc.c])
-AC_SUBST(datarootdir)
-AC_CONFIG_HEADER(config.h)
-
-TALLOC_VERSION=${PACKAGE_VERSION}
-TALLOC_VERSION_MAJOR=`echo ${PACKAGE_VERSION} | cut -d '.' -f1`
-TALLOC_VERSION_MINOR=`echo ${PACKAGE_VERSION} | cut -d '.' -f2`
-TALLOC_VERSION_RELEASE=`echo ${PACKAGE_VERSION} | cut -d '.' -f3`
-
-AC_SUBST(TALLOC_VERSION)
-AC_SUBST(TALLOC_VERSION_MAJOR)
-AC_SUBST(TALLOC_VERSION_MINOR)
-AC_SUBST(TALLOC_VERSION_RELEASE)
-
-AC_DEFINE_UNQUOTED(TALLOC_BUILD_VERSION_MAJOR,
- [${TALLOC_VERSION_MAJOR}],
- [talloc major version])
-AC_DEFINE_UNQUOTED(TALLOC_BUILD_VERSION_MINOR,
- [${TALLOC_VERSION_MINOR}],
- [talloc minor version])
-AC_DEFINE_UNQUOTED(TALLOC_BUILD_VERSION_RELEASE,
- [${TALLOC_VERSION_RELEASE}],
- [talloc release version])
-
-AC_LIBREPLACE_ALL_CHECKS
-
-AC_LD_PICFLAG
-AC_LD_SHLIBEXT
-AC_LD_SONAMEFLAG
-AC_LD_VERSIONSCRIPT
-AC_LIBREPLACE_SHLD
-AC_LIBREPLACE_SHLD_FLAGS
-
-m4_include(libtalloc.m4)
-m4_include(compat/talloc_compat1.m4)
-
-AC_PATH_PROG(XSLTPROC,xsltproc)
-DOC_TARGET=""
-if test -n "$XSLTPROC"; then
- DOC_TARGET=doc
-fi
-AC_SUBST(DOC_TARGET)
-
-m4_include(build_macros.m4)
-BUILD_WITH_SHARED_BUILD_DIR
-
-AC_OUTPUT(Makefile talloc.pc)
diff --git a/chromium/third_party/talloc/install-sh b/chromium/third_party/talloc/install-sh
deleted file mode 100755
index 58719246f04..00000000000
--- a/chromium/third_party/talloc/install-sh
+++ /dev/null
@@ -1,238 +0,0 @@
-#! /bin/sh
-#
-# install - install a program, script, or datafile
-# This comes from X11R5.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch.
-#
-
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
-
-
-# put in absolute paths if you don't have them in your path; or use env. 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}"
-
-transformbasename=""
-transform_arg=""
-instcmd="$mvprog"
-chmodcmd="$chmodprog 0755"
-chowncmd=""
-chgrpcmd=""
-stripcmd=""
-rmcmd="$rmprog -f"
-mvcmd="$mvprog"
-src=""
-dst=""
-dir_arg=""
-
-while [ x"$1" != x ]; do
- case $1 in
- -c) instcmd="$cpprog"
- shift
- continue;;
-
- -d) dir_arg=true
- shift
- continue;;
-
- -m) chmodcmd="$chmodprog $2"
- shift
- shift
- continue;;
-
- -o) chowncmd="$chownprog $2"
- shift
- shift
- continue;;
-
- -g) chgrpcmd="$chgrpprog $2"
- shift
- shift
- continue;;
-
- -s) stripcmd="$stripprog"
- shift
- continue;;
-
- -t=*) transformarg=`echo $1 | sed 's/-t=//'`
- shift
- continue;;
-
- -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
- shift
- continue;;
-
- *) if [ x"$src" = x ]
- then
- src=$1
- else
- # this colon is to work around a 386BSD /bin/sh bug
- :
- dst=$1
- fi
- shift
- continue;;
- esac
-done
-
-if [ x"$src" = x ]
-then
- echo "install: no input file specified"
- exit 1
-else
- true
-fi
-
-if [ x"$dir_arg" != x ]; then
- dst=$src
- src=""
-
- if [ -d $dst ]; then
- instcmd=:
- else
- instcmd=mkdir
- fi
-else
-
-# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad
-# if $src (and thus $dsttmp) contains '*'.
-
- if [ -f $src -o -d $src ]
- then
- true
- else
- echo "install: $src does not exist"
- exit 1
- fi
-
- if [ x"$dst" = x ]
- then
- echo "install: no destination specified"
- exit 1
- else
- true
- fi
-
-# If destination is a directory, append the input filename; if your system
-# does not like double slashes in filenames, you may need to add some logic
-
- if [ -d $dst ]
- then
- dst="$dst"/`basename $src`
- else
- true
- fi
-fi
-
-## this sed command emulates the dirname command
-dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
-
-# Make sure that the destination directory exists.
-# this part is taken from Noah Friedman's mkinstalldirs script
-
-# Skip lots of stat calls in the usual case.
-if [ ! -d "$dstdir" ]; then
-defaultIFS='
-'
-IFS="${IFS-${defaultIFS}}"
-
-oIFS="${IFS}"
-# Some sh's can't handle IFS=/ for some reason.
-IFS='%'
-set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
-IFS="${oIFS}"
-
-pathcomp=''
-
-while [ $# -ne 0 ] ; do
- pathcomp="${pathcomp}${1}"
- shift
-
- if [ ! -d "${pathcomp}" ] ;
- then
- $mkdirprog "${pathcomp}"
- else
- true
- fi
-
- pathcomp="${pathcomp}/"
-done
-fi
-
-if [ x"$dir_arg" != x ]
-then
- $doit $instcmd $dst &&
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
-else
-
-# If we're going to rename the final executable, determine the name now.
-
- if [ x"$transformarg" = x ]
- then
- dstfile=`basename $dst`
- else
- dstfile=`basename $dst $transformbasename |
- sed $transformarg`$transformbasename
- fi
-
-# don't allow the sed command to completely eliminate the filename
-
- if [ x"$dstfile" = x ]
- then
- dstfile=`basename $dst`
- else
- true
- fi
-
-# Make a temp file name in the proper directory.
-
- dsttmp=$dstdir/#inst.$$#
-
-# Move or copy the file name to the temp name
-
- $doit $instcmd $src $dsttmp &&
-
- trap "rm -f ${dsttmp}" 0 &&
-
-# and set any options; do chmod last to preserve setuid bits
-
-# If any of these fail, we abort the whole thing. If we want to
-# ignore errors from any of these, just make sure not to ignore
-# errors from the above "$doit $instcmd $src $dsttmp" command.
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
-
-# Now rename the file to the real destination.
-
- $doit $rmcmd -f $dstdir/$dstfile &&
- $doit $mvcmd $dsttmp $dstdir/$dstfile
-
-fi &&
-
-
-exit 0
diff --git a/chromium/third_party/talloc/libreplace/.checker_innocent b/chromium/third_party/talloc/libreplace/.checker_innocent
deleted file mode 100644
index e6191765409..00000000000
--- a/chromium/third_party/talloc/libreplace/.checker_innocent
+++ /dev/null
@@ -1,4 +0,0 @@
->>>MISTAKE21_create_files_6a9e68ada99a97cb
->>>MISTAKE21_os2_delete_9b2bfa7f38711d09
->>>MISTAKE21_os2_delete_2fcc29aaa99a97cb
->>>SECURITY2_os2_delete_9b2bfa7f1c9396ca
diff --git a/chromium/third_party/talloc/libreplace/Makefile.in b/chromium/third_party/talloc/libreplace/Makefile.in
deleted file mode 100644
index 65f8125efde..00000000000
--- a/chromium/third_party/talloc/libreplace/Makefile.in
+++ /dev/null
@@ -1,70 +0,0 @@
-#!gmake
-#
-CC = @CC@
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-bindir = @bindir@
-includedir = @includedir@
-libdir = @libdir@
-VPATH = @libreplacedir@
-srcdir = @srcdir@
-builddir = @builddir@
-sharedbuilddir = @sharedbuilddir@
-INSTALLCMD = @INSTALL@
-LIBS = @LIBS@
-
-.PHONY: test all showflags install installcheck clean distclean realdistclean
-
-CFLAGS=-I. @CFLAGS@
-LDFLAGS=@LDFLAGS@
-
-OBJS = @LIBREPLACEOBJ@
-
-all: showflags libreplace.a testsuite
-
-showflags:
- @echo 'libreplace will be compiled with flags:'
- @echo ' CC = $(CC)'
- @echo ' CFLAGS = $(CFLAGS)'
- @echo ' LDFLAGS= $(LDFLAGS)'
- @echo ' LIBS = $(LIBS)'
-
-install: all
- ${INSTALLCMD} -d $(libdir)
- ${INSTALLCMD} -m 644 libreplace.a $(libdir)
-
-shared-build: all
- ${INSTALLCMD} -d $(sharedbuilddir)/include
- ${INSTALLCMD} -m 644 replace.h $(sharedbuilddir)/include
- ${INSTALLCMD} -d $(sharedbuilddir)/lib
- ${INSTALLCMD} -m 644 libreplace.a $(sharedbuilddir)/lib
-
-libreplace.a: $(OBJS)
- ar -rcsv $@ $(OBJS)
-
-test: all
- ./testsuite
-
-installcheck: install test
-
-TEST_OBJS = test/main.o test/testsuite.o test/os2_delete.o test/strptime.o test/getifaddrs.o
-
-testsuite: libreplace.a $(TEST_OBJS)
- $(CC) -o testsuite $(TEST_OBJS) -L. -lreplace $(LDFLAGS) $(LIBS)
-
-.c.o:
- @echo Compiling $*.c
- @mkdir -p `dirname $@`
- @$(CC) $(CFLAGS) -c $< -o $@
-
-clean:
- rm -f *.o test/*.o *.a testsuite
- rm -f testfile.dat
-
-distclean: clean
- rm -f *~ */*~
- rm -f config.log config.status config.h config.cache
- rm -f Makefile
-
-realdistclean: distclean
- rm -f configure config.h.in
diff --git a/chromium/third_party/talloc/libreplace/README b/chromium/third_party/talloc/libreplace/README
deleted file mode 100644
index 26383bc89a2..00000000000
--- a/chromium/third_party/talloc/libreplace/README
+++ /dev/null
@@ -1,124 +0,0 @@
-This subsystem ensures that we can always use a certain core set of
-functions and types, that are either provided by the OS or by replacement
-functions / definitions in this subsystem. The aim is to try to stick
-to POSIX functions in here as much as possible. Convenience functions
-that are available on no platform at all belong in other subsystems
-(such as LIBUTIL).
-
-The following functions are guaranteed:
-
-ftruncate
-strlcpy
-strlcat
-mktime
-rename
-initgroups
-memmove
-strdup
-setlinebuf
-vsyslog
-timegm
-setenv
-unsetenv
-strndup
-strnlen
-waitpid
-seteuid
-setegid
-asprintf
-snprintf
-vasprintf
-vsnprintf
-opendir
-readdir
-telldir
-seekdir
-closedir
-dlopen
-dlclose
-dlsym
-dlerror
-chroot
-bzero
-strerror
-errno
-mkdtemp
-mkstemp (a secure one!)
-pread
-pwrite
-chown
-lchown
-getpass
-readline (the library)
-inet_ntoa
-inet_ntop
-inet_pton
-inet_aton
-strtoll
-strtoull
-socketpair
-strptime
-getaddrinfo
-freeaddrinfo
-getnameinfo
-gai_strerror
-getifaddrs
-freeifaddrs
-utime
-utimes
-dup2
-link
-readlink
-symlink
-realpath
-
-Types:
-bool
-socklen_t
-uint_t
-uint{8,16,32,64}_t
-int{8,16,32,64}_t
-intptr_t
-sig_atomic_t
-
-Constants:
-PATH_NAME_MAX
-UINT{16,32,64}_MAX
-INT32_MAX
-RTLD_LAZY
-HOST_NAME_MAX
-UINT16_MAX
-UINT32_MAX
-UINT64_MAX
-CHAR_BIT
-
-Macros:
-va_copy
-__FUNCTION__
-__FILE__
-__LINE__
-__LINESTR__
-__location__
-__STRING
-__STRINGSTRING
-MIN
-MAX
-QSORT_CAST
-ZERO_STRUCT
-ZERO_STRUCTP
-ZERO_STRUCTPN
-ZERO_ARRAY
-ARRAY_SIZE
-PTR_DIFF
-
-Headers:
-stdint.h
-stdbool.h
-
-Optional C keywords:
-volatile
-
-Prerequisites:
-memset (for bzero)
-syslog (for vsyslog)
-mktemp (for mkstemp and mkdtemp)
diff --git a/chromium/third_party/talloc/libreplace/aclocal.m4 b/chromium/third_party/talloc/libreplace/aclocal.m4
deleted file mode 100644
index 5605e476bab..00000000000
--- a/chromium/third_party/talloc/libreplace/aclocal.m4
+++ /dev/null
@@ -1 +0,0 @@
-m4_include(libreplace.m4)
diff --git a/chromium/third_party/talloc/libreplace/autoconf-2.60.m4 b/chromium/third_party/talloc/libreplace/autoconf-2.60.m4
deleted file mode 100644
index 2d5dbc16610..00000000000
--- a/chromium/third_party/talloc/libreplace/autoconf-2.60.m4
+++ /dev/null
@@ -1,212 +0,0 @@
-# AC_GNU_SOURCE
-# --------------
-AC_DEFUN([AC_GNU_SOURCE],
-[AH_VERBATIM([_GNU_SOURCE],
-[/* Enable GNU extensions on systems that have them. */
-#ifndef _GNU_SOURCE
-# undef _GNU_SOURCE
-#endif])dnl
-AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
-AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
-AC_DEFINE([_GNU_SOURCE])
-])
-
-# _AC_C_STD_TRY(STANDARD, TEST-PROLOGUE, TEST-BODY, OPTION-LIST,
-# ACTION-IF-AVAILABLE, ACTION-IF-UNAVAILABLE)
-# --------------------------------------------------------------
-# Check whether the C compiler accepts features of STANDARD (e.g `c89', `c99')
-# by trying to compile a program of TEST-PROLOGUE and TEST-BODY. If this fails,
-# try again with each compiler option in the space-separated OPTION-LIST; if one
-# helps, append it to CC. If eventually successful, run ACTION-IF-AVAILABLE,
-# else ACTION-IF-UNAVAILABLE.
-AC_DEFUN([_AC_C_STD_TRY],
-[AC_MSG_CHECKING([for $CC option to accept ISO ]m4_translit($1, [c], [C]))
-AC_CACHE_VAL(ac_cv_prog_cc_$1,
-[ac_cv_prog_cc_$1=no
-ac_save_CC=$CC
-AC_LANG_CONFTEST([AC_LANG_PROGRAM([$2], [$3])])
-for ac_arg in '' $4
-do
- CC="$ac_save_CC $ac_arg"
- _AC_COMPILE_IFELSE([], [ac_cv_prog_cc_$1=$ac_arg])
- test "x$ac_cv_prog_cc_$1" != "xno" && break
-done
-rm -f conftest.$ac_ext
-CC=$ac_save_CC
-])# AC_CACHE_VAL
-case "x$ac_cv_prog_cc_$1" in
- x)
- AC_MSG_RESULT([none needed]) ;;
- xno)
- AC_MSG_RESULT([unsupported]) ;;
- *)
- CC="$CC $ac_cv_prog_cc_$1"
- AC_MSG_RESULT([$ac_cv_prog_cc_$1]) ;;
-esac
-AS_IF([test "x$ac_cv_prog_cc_$1" != xno], [$5], [$6])
-])# _AC_C_STD_TRY
-
-# _AC_PROG_CC_C99 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE])
-# ----------------------------------------------------------------
-# If the C compiler is not in ISO C99 mode by default, try to add an
-# option to output variable CC to make it so. This macro tries
-# various options that select ISO C99 on some system or another. It
-# considers the compiler to be in ISO C99 mode if it handles mixed
-# code and declarations, _Bool, inline and restrict.
-AC_DEFUN([_AC_PROG_CC_C99],
-[_AC_C_STD_TRY([c99],
-[[#include <stdarg.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include <stdio.h>
-
-struct incomplete_array
-{
- int datasize;
- double data[];
-};
-
-struct named_init {
- int number;
- const wchar_t *name;
- double average;
-};
-
-typedef const char *ccp;
-
-static inline int
-test_restrict(ccp restrict text)
-{
- // See if C++-style comments work.
- // Iterate through items via the restricted pointer.
- // Also check for declarations in for loops.
- for (unsigned int i = 0; *(text+i) != '\0'; ++i)
- continue;
- return 0;
-}
-
-// Check varargs and va_copy work.
-static void
-test_varargs(const char *format, ...)
-{
- va_list args;
- va_start(args, format);
- va_list args_copy;
- va_copy(args_copy, args);
-
- const char *str;
- int number;
- float fnumber;
-
- while (*format)
- {
- switch (*format++)
- {
- case 's': // string
- str = va_arg(args_copy, const char *);
- break;
- case 'd': // int
- number = va_arg(args_copy, int);
- break;
- case 'f': // float
- fnumber = (float) va_arg(args_copy, double);
- break;
- default:
- break;
- }
- }
- va_end(args_copy);
- va_end(args);
-}
-]],
-[[
- // Check bool and long long datatypes.
- _Bool success = false;
- long long int bignum = -1234567890LL;
- unsigned long long int ubignum = 1234567890uLL;
-
- // Check restrict.
- if (test_restrict("String literal") != 0)
- success = true;
- char *restrict newvar = "Another string";
-
- // Check varargs.
- test_varargs("s, d' f .", "string", 65, 34.234);
-
- // Check incomplete arrays work.
- struct incomplete_array *ia =
- malloc(sizeof(struct incomplete_array) + (sizeof(double) * 10));
- ia->datasize = 10;
- for (int i = 0; i < ia->datasize; ++i)
- ia->data[i] = (double) i * 1.234;
-
- // Check named initialisers.
- struct named_init ni = {
- .number = 34,
- .name = L"Test wide string",
- .average = 543.34343,
- };
-
- ni.number = 58;
-
- int dynamic_array[ni.number];
- dynamic_array[43] = 543;
-
- // work around unused variable warnings
- return bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x';
-]],
-dnl Try
-dnl GCC -std=gnu99 (unused restrictive modes: -std=c99 -std=iso9899:1999)
-dnl AIX -qlanglvl=extc99 (unused restrictive mode: -qlanglvl=stdc99)
-dnl Intel ICC -c99
-dnl IRIX -c99
-dnl Solaris (unused because it causes the compiler to assume C99 semantics for
-dnl library functions, and this is invalid before Solaris 10: -xc99)
-dnl Tru64 -c99
-dnl with extended modes being tried first.
-[[-std=gnu99 -c99 -qlanglvl=extc99]], [$1], [$2])[]dnl
-])# _AC_PROG_CC_C99
-
-# AC_PROG_CC_C99
-# --------------
-AC_DEFUN([AC_PROG_CC_C99],
-[ AC_REQUIRE([AC_PROG_CC])dnl
- _AC_PROG_CC_C99
-])
-
-# AC_USE_SYSTEM_EXTENSIONS
-# ------------------------
-# Enable extensions on systems that normally disable them,
-# typically due to standards-conformance issues.
-m4_ifndef([AC_USE_SYSTEM_EXTENSIONS],[
-AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
-[
- AC_BEFORE([$0], [AC_COMPILE_IFELSE])
- AC_BEFORE([$0], [AC_RUN_IFELSE])
-
- AC_REQUIRE([AC_GNU_SOURCE])
- AC_REQUIRE([AC_AIX])
- AC_REQUIRE([AC_MINIX])
-
- AH_VERBATIM([__EXTENSIONS__],
-[/* Enable extensions on Solaris. */
-#ifndef __EXTENSIONS__
-# undef __EXTENSIONS__
-#endif
-#ifndef _POSIX_PTHREAD_SEMANTICS
-# undef _POSIX_PTHREAD_SEMANTICS
-#endif])
- AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
- [ac_cv_safe_to_define___extensions__],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([
-# define __EXTENSIONS__ 1
- AC_INCLUDES_DEFAULT])],
- [ac_cv_safe_to_define___extensions__=yes],
- [ac_cv_safe_to_define___extensions__=no])])
- test $ac_cv_safe_to_define___extensions__ = yes &&
- AC_DEFINE([__EXTENSIONS__])
- AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
-])
-])
diff --git a/chromium/third_party/talloc/libreplace/autogen.sh b/chromium/third_party/talloc/libreplace/autogen.sh
deleted file mode 100755
index d46a4279f30..00000000000
--- a/chromium/third_party/talloc/libreplace/autogen.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh
-
-rm -rf autom4te.cache
-rm -f configure config.h.in
-
-autoheader || exit 1
-autoconf || exit 1
-
-rm -rf autom4te.cache
-
-echo "Now run ./configure and then make."
-exit 0
-
diff --git a/chromium/third_party/talloc/libreplace/build_macros.m4 b/chromium/third_party/talloc/libreplace/build_macros.m4
deleted file mode 100644
index c036668cd14..00000000000
--- a/chromium/third_party/talloc/libreplace/build_macros.m4
+++ /dev/null
@@ -1,14 +0,0 @@
-AC_DEFUN(BUILD_WITH_SHARED_BUILD_DIR,
- [ AC_ARG_WITH([shared-build-dir],
- [AC_HELP_STRING([--with-shared-build-dir=DIR],
- [temporary build directory where libraries are installed [$srcdir/sharedbuild]])])
-
- sharedbuilddir="$srcdir/sharedbuild"
- if test x"$with_shared_build_dir" != x; then
- sharedbuilddir=$with_shared_build_dir
- CFLAGS="$CFLAGS -I$with_shared_build_dir/include"
- LDFLAGS="$LDFLAGS -L$with_shared_build_dir/lib"
- fi
- AC_SUBST(sharedbuilddir)
- ])
-
diff --git a/chromium/third_party/talloc/libreplace/config.guess b/chromium/third_party/talloc/libreplace/config.guess
deleted file mode 100755
index da833146088..00000000000
--- a/chromium/third_party/talloc/libreplace/config.guess
+++ /dev/null
@@ -1,1561 +0,0 @@
-#! /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
-# Free Software Foundation, Inc.
-
-timestamp='2009-04-27'
-
-# 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.
-#
-# 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 <per@bothner.com>.
-# Please send patches to <config-patches@gnu.org>. Submit a context
-# diff and a properly formatted ChangeLog entry.
-#
-# 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.
-#
-# The plan is that this can be called by configure scripts if you
-# don't specify an explicit build system type.
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION]
-
-Output the configuration name of the system \`$me' is run on.
-
-Operation modes:
- -h, --help print this help, then exit
- -t, --time-stamp print date of last modification, then exit
- -v, --version print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-version="\
-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.
-
-This is free software; see the source for copying conditions. There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
- case $1 in
- --time-stamp | --time* | -t )
- echo "$timestamp" ; exit ;;
- --version | -v )
- echo "$version" ; exit ;;
- --help | --h* | -h )
- echo "$usage"; exit ;;
- -- ) # Stop option processing
- shift; break ;;
- - ) # Use stdin as input.
- break ;;
- -* )
- echo "$me: invalid option $1$help" >&2
- exit 1 ;;
- * )
- break ;;
- esac
-done
-
-if test $# != 0; then
- echo "$me: too many arguments$help" >&2
- exit 1
-fi
-
-trap 'exit 1' 1 2 15
-
-# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
-# compiler to aid in system detection is discouraged as it requires
-# temporary files to be created and, as you can see below, it is a
-# headache to deal with in a portable fashion.
-
-# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
-# use `HOST_CC' if defined, but it is deprecated.
-
-# Portable tmp directory creation inspired by the Autoconf team.
-
-set_cc_for_build='
-trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
-trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
-: ${TMPDIR=/tmp} ;
- { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
- { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
- { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
- { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
-dummy=$tmp/dummy ;
-tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
-case $CC_FOR_BUILD,$HOST_CC,$CC in
- ,,) echo "int x;" > $dummy.c ;
- for c in cc gcc c89 c99 ; do
- if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
- CC_FOR_BUILD="$c"; break ;
- fi ;
- done ;
- if test x"$CC_FOR_BUILD" = x ; then
- CC_FOR_BUILD=no_compiler_found ;
- fi
- ;;
- ,,*) CC_FOR_BUILD=$CC ;;
- ,*,*) CC_FOR_BUILD=$HOST_CC ;;
-esac ; set_cc_for_build= ;'
-
-# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
-# (ghazi@noc.rutgers.edu 1994-08-24)
-if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
- PATH=$PATH:/.attbin ; export PATH
-fi
-
-UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
-UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
-UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
-UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
-
-# Note: order is significant - the case branches are not exclusive.
-
-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*,
- # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
- # switched to ELF, *-*-netbsd* would select the old
- # object file format. This provides both forward
- # compatibility and a consistent mechanism for selecting the
- # object file format.
- #
- # Note: NetBSD doesn't particularly care about the vendor
- # portion of the name. We always set it to "unknown".
- sysctl="sysctl -n hw.machine_arch"
- UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
- /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
- case "${UNAME_MACHINE_ARCH}" in
- armeb) machine=armeb-unknown ;;
- arm*) machine=arm-unknown ;;
- sh3el) machine=shl-unknown ;;
- sh3eb) machine=sh-unknown ;;
- sh5el) machine=sh5le-unknown ;;
- *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
- esac
- # The Operating System including object format, if it has switched
- # to ELF recently, or will in the future.
- case "${UNAME_MACHINE_ARCH}" in
- arm*|i386|m68k|ns32k|sh3*|sparc|vax)
- eval $set_cc_for_build
- if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
- | grep __ELF__ >/dev/null
- then
- # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
- # Return netbsd for either. FIX?
- os=netbsd
- else
- os=netbsdelf
- fi
- ;;
- *)
- os=netbsd
- ;;
- esac
- # The OS release
- # Debian GNU/NetBSD machines have a different userland, and
- # thus, need a distinct triplet. However, they do not need
- # kernel version information, so it can be replaced with a
- # suitable tag, in the style of linux-gnu.
- case "${UNAME_VERSION}" in
- Debian*)
- release='-gnu'
- ;;
- *)
- release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
- ;;
- esac
- # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
- # contains redundant information, the shorter form:
- # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
- echo "${machine}-${os}${release}"
- exit ;;
- *:OpenBSD:*:*)
- UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
- echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
- exit ;;
- *:ekkoBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
- exit ;;
- *:SolidBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
- exit ;;
- macppc:MirBSD:*:*)
- echo powerpc-unknown-mirbsd${UNAME_RELEASE}
- exit ;;
- *:MirBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
- exit ;;
- alpha:OSF1:*:*)
- case $UNAME_RELEASE in
- *4.0)
- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
- ;;
- *5.*)
- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
- ;;
- esac
- # According to Compaq, /usr/sbin/psrinfo has been available on
- # OSF/1 and Tru64 systems produced since 1995. I hope that
- # covers most systems running today. This code pipes the CPU
- # types through head -n 1, so we only detect the type of CPU 0.
- ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
- case "$ALPHA_CPU_TYPE" in
- "EV4 (21064)")
- UNAME_MACHINE="alpha" ;;
- "EV4.5 (21064)")
- UNAME_MACHINE="alpha" ;;
- "LCA4 (21066/21068)")
- UNAME_MACHINE="alpha" ;;
- "EV5 (21164)")
- UNAME_MACHINE="alphaev5" ;;
- "EV5.6 (21164A)")
- UNAME_MACHINE="alphaev56" ;;
- "EV5.6 (21164PC)")
- UNAME_MACHINE="alphapca56" ;;
- "EV5.7 (21164PC)")
- UNAME_MACHINE="alphapca57" ;;
- "EV6 (21264)")
- UNAME_MACHINE="alphaev6" ;;
- "EV6.7 (21264A)")
- UNAME_MACHINE="alphaev67" ;;
- "EV6.8CB (21264C)")
- UNAME_MACHINE="alphaev68" ;;
- "EV6.8AL (21264B)")
- UNAME_MACHINE="alphaev68" ;;
- "EV6.8CX (21264D)")
- UNAME_MACHINE="alphaev68" ;;
- "EV6.9A (21264/EV69A)")
- UNAME_MACHINE="alphaev69" ;;
- "EV7 (21364)")
- UNAME_MACHINE="alphaev7" ;;
- "EV7.9 (21364A)")
- UNAME_MACHINE="alphaev79" ;;
- esac
- # A Pn.n version is a patched version.
- # A Vn.n version is a released version.
- # A Tn.n version is a released field test version.
- # 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 ;;
- 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
- # of the specific Alpha model?
- echo alpha-pc-interix
- exit ;;
- 21064:Windows_NT:50:3)
- echo alpha-dec-winnt3.5
- exit ;;
- Amiga*:UNIX_System_V:4.0:*)
- echo m68k-unknown-sysv4
- exit ;;
- *:[Aa]miga[Oo][Ss]:*:*)
- echo ${UNAME_MACHINE}-unknown-amigaos
- exit ;;
- *:[Mm]orph[Oo][Ss]:*:*)
- echo ${UNAME_MACHINE}-unknown-morphos
- exit ;;
- *:OS/390:*:*)
- echo i370-ibm-openedition
- exit ;;
- *:z/VM:*:*)
- echo s390-ibm-zvmoe
- exit ;;
- *: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:*:*)
- echo arm-unknown-riscos
- exit ;;
- SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
- echo hppa1.1-hitachi-hiuxmpp
- exit ;;
- Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
- # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
- if test "`(/bin/universe) 2>/dev/null`" = att ; then
- echo pyramid-pyramid-sysv3
- else
- echo pyramid-pyramid-bsd
- fi
- exit ;;
- NILE*:*:*:dcosx)
- echo pyramid-pyramid-svr4
- exit ;;
- DRS?6000:unix:4.0:6*)
- echo sparc-icl-nx6
- exit ;;
- DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
- case `/usr/bin/uname -p` in
- sparc) echo sparc-icl-nx7; exit ;;
- esac ;;
- s390x:SunOS:*:*)
- echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4H:SunOS:5.*:*)
- echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
- echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
- eval $set_cc_for_build
- SUN_ARCH="i386"
- # If there is a compiler, see if it is configured for 64-bit objects.
- # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
- # This test works for both compilers.
- if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
- if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
- (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
- grep IS_64BIT_ARCH >/dev/null
- then
- SUN_ARCH="x86_64"
- fi
- fi
- echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4*:SunOS:6*:*)
- # According to config.sub, this is the proper way to canonicalize
- # SunOS6. Hard to guess exactly what SunOS6 will be like, but
- # it's likely to be more like Solaris than SunOS4.
- echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4*:SunOS:*:*)
- case "`/usr/bin/arch -k`" in
- Series*|S4*)
- UNAME_RELEASE=`uname -v`
- ;;
- esac
- # Japanese Language versions have a version number like `4.1.3-JL'.
- echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
- exit ;;
- sun3*:SunOS:*:*)
- echo m68k-sun-sunos${UNAME_RELEASE}
- exit ;;
- sun*:*:4.2BSD:*)
- UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
- test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
- case "`/bin/arch`" in
- sun3)
- echo m68k-sun-sunos${UNAME_RELEASE}
- ;;
- sun4)
- echo sparc-sun-sunos${UNAME_RELEASE}
- ;;
- esac
- exit ;;
- aushp:SunOS:*:*)
- echo sparc-auspex-sunos${UNAME_RELEASE}
- exit ;;
- # The situation for MiNT is a little confusing. The machine name
- # can be virtually everything (everything which is not
- # "atarist" or "atariste" at least should have a processor
- # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
- # to the lowercase version "mint" (or "freemint"). Finally
- # the system name "TOS" denotes a system which is actually not
- # 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}
- exit ;;
- atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
- *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
- milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
- echo m68k-milan-mint${UNAME_RELEASE}
- exit ;;
- hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
- echo m68k-hades-mint${UNAME_RELEASE}
- exit ;;
- *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
- echo m68k-unknown-mint${UNAME_RELEASE}
- exit ;;
- m68k:machten:*:*)
- echo m68k-apple-machten${UNAME_RELEASE}
- exit ;;
- powerpc:machten:*:*)
- echo powerpc-apple-machten${UNAME_RELEASE}
- exit ;;
- RISC*:Mach:*:*)
- echo mips-dec-mach_bsd4.3
- exit ;;
- RISC*:ULTRIX:*:*)
- echo mips-dec-ultrix${UNAME_RELEASE}
- exit ;;
- VAX*:ULTRIX*:*:*)
- echo vax-dec-ultrix${UNAME_RELEASE}
- exit ;;
- 2020:CLIX:*:* | 2430:CLIX:*:*)
- echo clipper-intergraph-clix${UNAME_RELEASE}
- exit ;;
- mips:*:*:UMIPS | mips:*:*:RISCos)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
-#ifdef __cplusplus
-#include <stdio.h> /* for printf() prototype */
- int main (int argc, char *argv[]) {
-#else
- int main (argc, argv) int argc; char *argv[]; {
-#endif
- #if defined (host_mips) && defined (MIPSEB)
- #if defined (SYSTYPE_SYSV)
- printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
- #endif
- #if defined (SYSTYPE_SVR4)
- printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
- #endif
- #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
- printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
- #endif
- #endif
- exit (-1);
- }
-EOF
- $CC_FOR_BUILD -o $dummy $dummy.c &&
- dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
- SYSTEM_NAME=`$dummy $dummyarg` &&
- { echo "$SYSTEM_NAME"; exit; }
- echo mips-mips-riscos${UNAME_RELEASE}
- exit ;;
- Motorola:PowerMAX_OS:*:*)
- echo powerpc-motorola-powermax
- exit ;;
- Motorola:*:4.3:PL8-*)
- echo powerpc-harris-powermax
- exit ;;
- Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
- echo powerpc-harris-powermax
- exit ;;
- Night_Hawk:Power_UNIX:*:*)
- echo powerpc-harris-powerunix
- exit ;;
- m88k:CX/UX:7*:*)
- echo m88k-harris-cxux7
- exit ;;
- m88k:*:4*:R4*)
- echo m88k-motorola-sysv4
- exit ;;
- m88k:*:3*:R3*)
- echo m88k-motorola-sysv3
- exit ;;
- AViiON:dgux:*:*)
- # 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 ] || \
- [ ${TARGET_BINARY_INTERFACE}x = x ]
- then
- echo m88k-dg-dgux${UNAME_RELEASE}
- else
- echo m88k-dg-dguxbcs${UNAME_RELEASE}
- fi
- else
- echo i586-dg-dgux${UNAME_RELEASE}
- fi
- exit ;;
- M88*:DolphinOS:*:*) # DolphinOS (SVR3)
- echo m88k-dolphin-sysv3
- exit ;;
- M88*:*:R3*:*)
- # Delta 88k system running SVR3
- echo m88k-motorola-sysv3
- exit ;;
- XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
- echo m88k-tektronix-sysv3
- exit ;;
- Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
- echo m68k-tektronix-bsd
- exit ;;
- *:IRIX*:*:*)
- echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
- exit ;;
- ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
- echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
- exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
- i*86:AIX:*:*)
- echo i386-ibm-aix
- exit ;;
- ia64:AIX:*:*)
- if [ -x /usr/bin/oslevel ] ; then
- IBM_REV=`/usr/bin/oslevel`
- else
- IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
- fi
- echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
- exit ;;
- *:AIX:2:3)
- if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <sys/systemcfg.h>
-
- main()
- {
- if (!__power_pc())
- exit(1);
- puts("powerpc-ibm-aix3.2.5");
- exit(0);
- }
-EOF
- if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
- then
- echo "$SYSTEM_NAME"
- else
- echo rs6000-ibm-aix3.2.5
- fi
- elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
- echo rs6000-ibm-aix3.2.4
- else
- echo rs6000-ibm-aix3.2
- fi
- exit ;;
- *:AIX:*:[456])
- 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
- else
- IBM_ARCH=powerpc
- fi
- if [ -x /usr/bin/oslevel ] ; then
- IBM_REV=`/usr/bin/oslevel`
- else
- IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
- fi
- echo ${IBM_ARCH}-ibm-aix${IBM_REV}
- exit ;;
- *:AIX:*:*)
- echo rs6000-ibm-aix
- exit ;;
- ibmrt:4.4BSD:*|romp-ibm:BSD:*)
- echo romp-ibm-bsd4.4
- exit ;;
- ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
- echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
- exit ;; # report: romp-ibm BSD 4.3
- *:BOSX:*:*)
- echo rs6000-bull-bosx
- exit ;;
- DPX/2?00:B.O.S.:*:*)
- echo m68k-bull-sysv3
- exit ;;
- 9000/[34]??:4.3bsd:1.*:*)
- echo m68k-hp-bsd
- exit ;;
- hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
- echo m68k-hp-bsd4.4
- exit ;;
- 9000/[34678]??:HP-UX:*:*)
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
- case "${UNAME_MACHINE}" in
- 9000/31? ) HP_ARCH=m68000 ;;
- 9000/[34]?? ) HP_ARCH=m68k ;;
- 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" ;;
- '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
- esac ;;
- esac
- fi
- if [ "${HP_ARCH}" = "" ]; then
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
-
- #define _HPUX_SOURCE
- #include <stdlib.h>
- #include <unistd.h>
-
- 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);
- }
-EOF
- (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
- test -z "$HP_ARCH" && HP_ARCH=hppa
- fi ;;
- esac
- if [ ${HP_ARCH} = "hppa2.0w" ]
- then
- eval $set_cc_for_build
-
- # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
- # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
- # generating 64-bit code. GNU and HP use different nomenclature:
- #
- # $ CC_FOR_BUILD=cc ./config.guess
- # => hppa2.0w-hp-hpux11.23
- # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
- # => hppa64-hp-hpux11.23
-
- if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
- grep __LP64__ >/dev/null
- then
- HP_ARCH="hppa2.0w"
- else
- HP_ARCH="hppa64"
- fi
- fi
- echo ${HP_ARCH}-hp-hpux${HPUX_REV}
- exit ;;
- ia64:HP-UX:*:*)
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
- echo ia64-hp-hpux${HPUX_REV}
- exit ;;
- 3050*:HI-UX:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <unistd.h>
- int
- main ()
- {
- long cpu = sysconf (_SC_CPU_VERSION);
- /* The order matters, because CPU_IS_HP_MC68K erroneously returns
- true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
- results, however. */
- if (CPU_IS_PA_RISC (cpu))
- {
- switch (cpu)
- {
- case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
- case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
- case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
- default: puts ("hppa-hitachi-hiuxwe2"); break;
- }
- }
- else if (CPU_IS_HP_MC68K (cpu))
- puts ("m68k-hitachi-hiuxwe2");
- else puts ("unknown-hitachi-hiuxwe2");
- exit (0);
- }
-EOF
- $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
- { echo "$SYSTEM_NAME"; exit; }
- echo unknown-hitachi-hiuxwe2
- exit ;;
- 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
- echo hppa1.1-hp-bsd
- exit ;;
- 9000/8??:4.3bsd:*:*)
- echo hppa1.0-hp-bsd
- exit ;;
- *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
- echo hppa1.0-hp-mpeix
- exit ;;
- hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
- echo hppa1.1-hp-osf
- exit ;;
- hp8??:OSF1:*:*)
- echo hppa1.0-hp-osf
- exit ;;
- i*86:OSF1:*:*)
- if [ -x /usr/sbin/sysversion ] ; then
- echo ${UNAME_MACHINE}-unknown-osf1mk
- else
- echo ${UNAME_MACHINE}-unknown-osf1
- fi
- exit ;;
- parisc*:Lites*:*:*)
- echo hppa1.1-hp-lites
- exit ;;
- C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
- echo c1-convex-bsd
- exit ;;
- C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
- if getsysinfo -f scalar_acc
- then echo c32-convex-bsd
- else echo c2-convex-bsd
- fi
- exit ;;
- C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
- echo c34-convex-bsd
- exit ;;
- C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
- echo c38-convex-bsd
- exit ;;
- C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
- echo c4-convex-bsd
- exit ;;
- CRAY*Y-MP:*:*:*)
- echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*[A-Z]90:*:*:*)
- echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
- | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
- -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
- -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*TS:*:*:*)
- echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*T3E:*:*:*)
- echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*SV1:*:*:*)
- echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- *:UNICOS/mp:*:*)
- echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- 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 ;;
- 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}"
- exit ;;
- i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
- echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
- exit ;;
- sparc*:BSD/OS:*:*)
- echo sparc-unknown-bsdi${UNAME_RELEASE}
- exit ;;
- *:BSD/OS:*:*)
- echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
- exit ;;
- *:FreeBSD:*:*)
- case ${UNAME_MACHINE} in
- pc98)
- echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
- amd64)
- echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
- *)
- echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
- esac
- exit ;;
- i*:CYGWIN*:*)
- echo ${UNAME_MACHINE}-pc-cygwin
- exit ;;
- *:MINGW*:*)
- echo ${UNAME_MACHINE}-pc-mingw32
- exit ;;
- i*:windows32*:*)
- # uname -m includes "-pc" on this system.
- echo ${UNAME_MACHINE}-mingw32
- exit ;;
- i*:PW*:*)
- echo ${UNAME_MACHINE}-pc-pw32
- exit ;;
- *:Interix*:[3456]*)
- case ${UNAME_MACHINE} in
- x86)
- echo i586-pc-interix${UNAME_RELEASE}
- exit ;;
- EM64T | authenticamd | genuineintel)
- echo x86_64-unknown-interix${UNAME_RELEASE}
- exit ;;
- IA64)
- echo ia64-unknown-interix${UNAME_RELEASE}
- exit ;;
- esac ;;
- [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
- echo i${UNAME_MACHINE}-pc-mks
- exit ;;
- i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
- # How do we know it's Interix rather than the generic POSIX subsystem?
- # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
- # UNAME_MACHINE based on the output of uname instead of i386?
- echo i586-pc-interix
- exit ;;
- i*:UWIN*:*)
- echo ${UNAME_MACHINE}-pc-uwin
- exit ;;
- amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
- echo x86_64-unknown-cygwin
- exit ;;
- p*:CYGWIN*:*)
- echo powerpcle-unknown-cygwin
- exit ;;
- prep*:SunOS:5.*:*)
- echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- *:GNU:*:*)
- # the GNU system
- echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
- exit ;;
- *:GNU/*:*:*)
- # other systems with GNU libc and userland
- echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
- exit ;;
- i*86:Minix:*:*)
- echo ${UNAME_MACHINE}-pc-minix
- exit ;;
- arm*:Linux:*:*)
- eval $set_cc_for_build
- if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
- | grep -q __ARM_EABI__
- then
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- else
- echo ${UNAME_MACHINE}-unknown-linux-gnueabi
- fi
- exit ;;
- avr32*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- cris:Linux:*:*)
- echo cris-axis-linux-gnu
- exit ;;
- crisv32:Linux:*:*)
- echo crisv32-axis-linux-gnu
- exit ;;
- frv:Linux:*:*)
- echo frv-unknown-linux-gnu
- exit ;;
- ia64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- m32r*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- m68*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- mips:Linux:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #undef CPU
- #undef mips
- #undef mipsel
- #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
- CPU=mipsel
- #else
- #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
- CPU=mips
- #else
- CPU=
- #endif
- #endif
-EOF
- eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
- /^CPU/{
- s: ::g
- p
- }'`"
- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
- ;;
- mips64:Linux:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #undef CPU
- #undef mips64
- #undef mips64el
- #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
- CPU=mips64el
- #else
- #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
- CPU=mips64
- #else
- CPU=
- #endif
- #endif
-EOF
- eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
- /^CPU/{
- s: ::g
- p
- }'`"
- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
- ;;
- or32:Linux:*:*)
- echo or32-unknown-linux-gnu
- exit ;;
- ppc:Linux:*:*)
- echo powerpc-unknown-linux-gnu
- exit ;;
- ppc64:Linux:*:*)
- echo powerpc64-unknown-linux-gnu
- exit ;;
- alpha:Linux:*:*)
- case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
- EV5) UNAME_MACHINE=alphaev5 ;;
- EV56) UNAME_MACHINE=alphaev56 ;;
- PCA56) UNAME_MACHINE=alphapca56 ;;
- PCA57) UNAME_MACHINE=alphapca56 ;;
- EV6) UNAME_MACHINE=alphaev6 ;;
- EV67) UNAME_MACHINE=alphaev67 ;;
- EV68*) UNAME_MACHINE=alphaev68 ;;
- esac
- objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
- if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
- echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
- exit ;;
- padre:Linux:*:*)
- echo sparc-unknown-linux-gnu
- exit ;;
- parisc:Linux:*:* | hppa:Linux:*:*)
- # Look for CPU level
- case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
- PA7*) echo hppa1.1-unknown-linux-gnu ;;
- PA8*) echo hppa2.0-unknown-linux-gnu ;;
- *) echo hppa-unknown-linux-gnu ;;
- esac
- exit ;;
- parisc64:Linux:*:* | hppa64:Linux:*:*)
- echo hppa64-unknown-linux-gnu
- exit ;;
- s390:Linux:*:* | s390x:Linux:*:*)
- echo ${UNAME_MACHINE}-ibm-linux
- exit ;;
- sh64*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- sh*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- sparc:Linux:*:* | sparc64: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
- exit ;;
- xtensa*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- i*86:Linux:*:*)
- # The BFD linker knows what the default object file format is, so
- # first see if it will tell us. cd to the root directory to prevent
- # problems with other programs or directories called `ld' in the path.
- # Set LC_ALL=C to ensure ld outputs messages in English.
- ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
- | sed -ne '/supported targets:/!d
- s/[ ][ ]*/ /g
- s/.*supported targets: *//
- s/ .*//
- p'`
- case "$ld_supported_targets" in
- elf32-i386)
- TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
- ;;
- a.out-i386-linux)
- echo "${UNAME_MACHINE}-pc-linux-gnuaout"
- exit ;;
- "")
- # Either a pre-BFD a.out linker (linux-gnuoldld) or
- # one that does not give us useful --help.
- echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
- exit ;;
- esac
- # Determine whether the default compiler is a.out or elf
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <features.h>
- #ifdef __ELF__
- # ifdef __GLIBC__
- # if __GLIBC__ >= 2
- LIBC=gnu
- # else
- LIBC=gnulibc1
- # endif
- # else
- LIBC=gnulibc1
- # endif
- #else
- #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
- LIBC=gnu
- #else
- LIBC=gnuaout
- #endif
- #endif
- #ifdef __dietlibc__
- LIBC=dietlibc
- #endif
-EOF
- eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
- /^LIBC/{
- s: ::g
- p
- }'`"
- test x"${LIBC}" != x && {
- echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
- exit
- }
- test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
- ;;
- i*86:DYNIX/ptx:4*:*)
- # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
- # earlier versions are messed up and put the nodename in both
- # sysname and nodename.
- 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,
- # I just have to hope. -- rms.
- # Use sysv4.2uw... so that sysv4* matches it.
- echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
- exit ;;
- i*86:OS/2:*:*)
- # If we were able to find `uname', then EMX Unix compatibility
- # is probably installed.
- echo ${UNAME_MACHINE}-pc-os2-emx
- exit ;;
- i*86:XTS-300:*:STOP)
- echo ${UNAME_MACHINE}-unknown-stop
- exit ;;
- i*86:atheos:*:*)
- echo ${UNAME_MACHINE}-unknown-atheos
- exit ;;
- i*86:syllable:*:*)
- echo ${UNAME_MACHINE}-pc-syllable
- exit ;;
- i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
- echo i386-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- i*86:*DOS:*:*)
- echo ${UNAME_MACHINE}-pc-msdosdjgpp
- exit ;;
- i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
- UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
- if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
- echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
- else
- echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
- fi
- exit ;;
- i*86:*:5:[678]*)
- # UnixWare 7.x, OpenUNIX and OpenServer 6.
- case `/bin/uname -X | grep "^Machine"` in
- *486*) UNAME_MACHINE=i486 ;;
- *Pentium) UNAME_MACHINE=i586 ;;
- *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
- esac
- echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
- exit ;;
- i*86:*:3.2:*)
- if test -f /usr/options/cb.name; then
- UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
- echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
- elif /bin/uname -X 2>/dev/null >/dev/null ; then
- UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
- (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
- (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
- && UNAME_MACHINE=i586
- (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
- && UNAME_MACHINE=i686
- (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
- && UNAME_MACHINE=i686
- echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
- else
- echo ${UNAME_MACHINE}-pc-sysv32
- fi
- 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.
- # 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 ;;
- Intel:Mach:3*:*)
- echo i386-pc-mach3
- exit ;;
- paragon:*:*:*)
- echo i860-intel-osf1
- exit ;;
- i860:*:4.*:*) # i860-SVR4
- if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
- echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
- else # Add other i860-SVR4 vendors below as they are discovered.
- echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
- fi
- exit ;;
- mini*:CTIX:SYS*5:*)
- # "miniframe"
- echo m68010-convergent-sysv
- exit ;;
- mc68k:UNIX:SYSTEM5:3.51m)
- echo m68k-convergent-sysv
- exit ;;
- M680?0:D-NIX:5.3:*)
- echo m68k-diab-dnix
- exit ;;
- M68*:*:R3V[5678]*:*)
- test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
- 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
- OS_REL=''
- test -r /etc/.relid \
- && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
- /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; } ;;
- NCR*:*:4.2:* | MPRAS*:*:4.2:*)
- OS_REL='.3'
- test -r /etc/.relid \
- && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
- /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
- /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
- m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
- echo m68k-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- mc68030:UNIX_System_V:4.*:*)
- echo m68k-atari-sysv4
- exit ;;
- TSUNAMI:LynxOS:2.*:*)
- echo sparc-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- rs6000:LynxOS:2.*:*)
- echo rs6000-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
- echo powerpc-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- SM[BE]S:UNIX_SV:*:*)
- echo mips-dde-sysv${UNAME_RELEASE}
- exit ;;
- RM*:ReliantUNIX-*:*:*)
- echo mips-sni-sysv4
- exit ;;
- RM*:SINIX-*:*:*)
- echo mips-sni-sysv4
- exit ;;
- *:SINIX-*:*:*)
- if uname -p 2>/dev/null >/dev/null ; then
- UNAME_MACHINE=`(uname -p) 2>/dev/null`
- echo ${UNAME_MACHINE}-sni-sysv4
- else
- echo ns32k-sni-sysv
- fi
- exit ;;
- PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
- # says <Richard.M.Bartel@ccMail.Census.GOV>
- echo i586-unisys-sysv4
- exit ;;
- *:UNIX_System_V:4*:FTX*)
- # From Gerald Hewes <hewes@openmarket.com>.
- # How about differentiating between stratus architectures? -djm
- echo hppa1.1-stratus-sysv4
- exit ;;
- *:*:*:FTX*)
- # From seanf@swdc.stratus.com.
- echo i860-stratus-sysv4
- exit ;;
- i*86:VOS:*:*)
- # From Paul.Green@stratus.com.
- echo ${UNAME_MACHINE}-stratus-vos
- exit ;;
- *:VOS:*:*)
- # From Paul.Green@stratus.com.
- echo hppa1.1-stratus-vos
- exit ;;
- mc68*:A/UX:*:*)
- echo m68k-apple-aux${UNAME_RELEASE}
- exit ;;
- news*:NEWS-OS:6*:*)
- echo mips-sony-newsos6
- exit ;;
- R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
- if [ -d /usr/nec ]; then
- echo mips-nec-sysv${UNAME_RELEASE}
- else
- echo mips-unknown-sysv${UNAME_RELEASE}
- fi
- exit ;;
- BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
- echo powerpc-be-beos
- exit ;;
- BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
- echo powerpc-apple-beos
- exit ;;
- BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
- echo i586-pc-beos
- exit ;;
- BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
- echo i586-pc-haiku
- exit ;;
- SX-4:SUPER-UX:*:*)
- echo sx4-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-5:SUPER-UX:*:*)
- echo sx5-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-6:SUPER-UX:*:*)
- echo sx6-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-7:SUPER-UX:*:*)
- echo sx7-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-8:SUPER-UX:*:*)
- echo sx8-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-8R:SUPER-UX:*:*)
- echo sx8r-nec-superux${UNAME_RELEASE}
- exit ;;
- Power*:Rhapsody:*:*)
- echo powerpc-apple-rhapsody${UNAME_RELEASE}
- exit ;;
- *:Rhapsody:*:*)
- echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
- exit ;;
- *:Darwin:*:*)
- UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
- case $UNAME_PROCESSOR in
- unknown) UNAME_PROCESSOR=powerpc ;;
- esac
- echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
- exit ;;
- *:procnto*:*:* | *:QNX:[0123456789]*:*)
- UNAME_PROCESSOR=`uname -p`
- if test "$UNAME_PROCESSOR" = "x86"; then
- UNAME_PROCESSOR=i386
- UNAME_MACHINE=pc
- fi
- echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
- exit ;;
- *:QNX:*:4*)
- echo i386-pc-qnx
- exit ;;
- NSE-?:NONSTOP_KERNEL:*:*)
- echo nse-tandem-nsk${UNAME_RELEASE}
- exit ;;
- NSR-?:NONSTOP_KERNEL:*:*)
- echo nsr-tandem-nsk${UNAME_RELEASE}
- exit ;;
- *:NonStop-UX:*:*)
- echo mips-compaq-nonstopux
- exit ;;
- BS2000:POSIX*:*:*)
- echo bs2000-siemens-sysv
- exit ;;
- DS/*:UNIX_System_V:*:*)
- echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
- exit ;;
- *:Plan9:*:*)
- # "uname -m" is not consistent, so use $cputype instead. 386
- # is converted to i386 for consistency with other x86
- # operating systems.
- if test "$cputype" = "386"; then
- UNAME_MACHINE=i386
- else
- UNAME_MACHINE="$cputype"
- fi
- echo ${UNAME_MACHINE}-unknown-plan9
- exit ;;
- *:TOPS-10:*:*)
- echo pdp10-unknown-tops10
- exit ;;
- *:TENEX:*:*)
- echo pdp10-unknown-tenex
- exit ;;
- KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
- echo pdp10-dec-tops20
- exit ;;
- XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
- echo pdp10-xkl-tops20
- exit ;;
- *:TOPS-20:*:*)
- echo pdp10-unknown-tops20
- exit ;;
- *:ITS:*:*)
- echo pdp10-unknown-its
- exit ;;
- SEI:*:*:SEIUX)
- 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`
- case "${UNAME_MACHINE}" in
- A*) echo alpha-dec-vms ; exit ;;
- I*) echo ia64-dec-vms ; exit ;;
- V*) echo vax-dec-vms ; exit ;;
- esac ;;
- *:XENIX:*:SysV)
- echo i386-pc-xenix
- exit ;;
- i*86:skyos:*:*)
- echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
- exit ;;
- i*86:rdos:*:*)
- echo ${UNAME_MACHINE}-pc-rdos
- exit ;;
- i*86:AROS:*:*)
- echo ${UNAME_MACHINE}-pc-aros
- 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 <<EOF
-#ifdef _SEQUENT_
-# include <sys/types.h>
-# include <sys/utsname.h>
-#endif
-main ()
-{
-#if defined (sony)
-#if defined (MIPSEB)
- /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
- I don't know.... */
- printf ("mips-sony-bsd\n"); exit (0);
-#else
-#include <sys/param.h>
- printf ("m68k-sony-newsos%s\n",
-#ifdef NEWSOS4
- "4"
-#else
- ""
-#endif
- ); exit (0);
-#endif
-#endif
-
-#if defined (__arm) && defined (__acorn) && defined (__unix)
- printf ("arm-acorn-riscix\n"); exit (0);
-#endif
-
-#if defined (hp300) && !defined (hpux)
- printf ("m68k-hp-bsd\n"); exit (0);
-#endif
-
-#if defined (NeXT)
-#if !defined (__ARCHITECTURE__)
-#define __ARCHITECTURE__ "m68k"
-#endif
- int version;
- version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
- if (version < 4)
- printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
- else
- printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
- exit (0);
-#endif
-
-#if defined (MULTIMAX) || defined (n16)
-#if defined (UMAXV)
- printf ("ns32k-encore-sysv\n"); exit (0);
-#else
-#if defined (CMU)
- printf ("ns32k-encore-mach\n"); exit (0);
-#else
- printf ("ns32k-encore-bsd\n"); exit (0);
-#endif
-#endif
-#endif
-
-#if defined (__386BSD__)
- printf ("i386-pc-bsd\n"); exit (0);
-#endif
-
-#if defined (sequent)
-#if defined (i386)
- printf ("i386-sequent-dynix\n"); exit (0);
-#endif
-#if defined (ns32000)
- printf ("ns32k-sequent-dynix\n"); exit (0);
-#endif
-#endif
-
-#if defined (_SEQUENT_)
- struct utsname un;
-
- uname(&un);
-
- if (strncmp(un.version, "V2", 2) == 0) {
- printf ("i386-sequent-ptx2\n"); exit (0);
- }
- if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
- printf ("i386-sequent-ptx1\n"); exit (0);
- }
- printf ("i386-sequent-ptx\n"); exit (0);
-
-#endif
-
-#if defined (vax)
-# if !defined (ultrix)
-# include <sys/param.h>
-# if defined (BSD)
-# if BSD == 43
- printf ("vax-dec-bsd4.3\n"); exit (0);
-# else
-# if BSD == 199006
- printf ("vax-dec-bsd4.3reno\n"); exit (0);
-# else
- printf ("vax-dec-bsd\n"); exit (0);
-# endif
-# endif
-# else
- printf ("vax-dec-bsd\n"); exit (0);
-# endif
-# else
- printf ("vax-dec-ultrix\n"); exit (0);
-# endif
-#endif
-
-#if defined (alliant) && defined (i860)
- printf ("i860-alliant-bsd\n"); exit (0);
-#endif
-
- exit (1);
-}
-EOF
-
-$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
- { echo "$SYSTEM_NAME"; exit; }
-
-# Apollos put the system type in the environment.
-
-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
-
-# Convex versions that predate uname can use getsysinfo(1)
-
-if [ -x /usr/convex/getsysinfo ]
-then
- case `getsysinfo -f cpu_type` in
- c1*)
- echo c1-convex-bsd
- exit ;;
- c2*)
- if getsysinfo -f scalar_acc
- then echo c32-convex-bsd
- else echo c2-convex-bsd
- fi
- exit ;;
- c34*)
- echo c34-convex-bsd
- exit ;;
- c38*)
- echo c38-convex-bsd
- exit ;;
- c4*)
- echo c4-convex-bsd
- exit ;;
- esac
-fi
-
-cat >&2 <<EOF
-$0: unable to guess system type
-
-This script, last modified $timestamp, has failed to recognize
-the operating system you are using. It is advised that you
-download the most up to date version of the config scripts from
-
- http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
-and
- http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
-
-If the version you run ($0) is already up to date, please
-send the following data and any information you think might be
-pertinent to <config-patches@gnu.org> in order to provide the needed
-information to handle your system.
-
-config.guess timestamp = $timestamp
-
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
-/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
-
-hostinfo = `(hostinfo) 2>/dev/null`
-/bin/universe = `(/bin/universe) 2>/dev/null`
-/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
-/bin/arch = `(/bin/arch) 2>/dev/null`
-/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
-
-UNAME_MACHINE = ${UNAME_MACHINE}
-UNAME_RELEASE = ${UNAME_RELEASE}
-UNAME_SYSTEM = ${UNAME_SYSTEM}
-UNAME_VERSION = ${UNAME_VERSION}
-EOF
-
-exit 1
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
diff --git a/chromium/third_party/talloc/libreplace/config.sub b/chromium/third_party/talloc/libreplace/config.sub
deleted file mode 100755
index a39437d0158..00000000000
--- a/chromium/third_party/talloc/libreplace/config.sub
+++ /dev/null
@@ -1,1686 +0,0 @@
-#! /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
-# Free Software Foundation, Inc.
-
-timestamp='2009-04-17'
-
-# 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
-# (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.
-#
-# 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.
-
-
-# Please send patches to <config-patches@gnu.org>. Submit a context
-# diff and a properly formatted ChangeLog entry.
-#
-# Configuration subroutine to validate and canonicalize a configuration type.
-# Supply the specified configuration type as an argument.
-# If it is invalid, we print an error message on stderr and exit with code 1.
-# Otherwise, we print the canonical config type on stdout and succeed.
-
-# This file is supposed to be the same for all GNU packages
-# and recognize all the CPU types, system types and aliases
-# that are meaningful with *any* GNU software.
-# Each package is responsible for reporting which valid configurations
-# it does not support. The user should be able to distinguish
-# a failure to support a valid configuration from a meaningless
-# configuration.
-
-# The goal of this file is to map all the various variations of a given
-# machine specification into a single specification in the form:
-# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
-# or in some cases, the newer four-part form:
-# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
-# It is wrong to echo any other type of specification.
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION] CPU-MFR-OPSYS
- $0 [OPTION] ALIAS
-
-Canonicalize a configuration name.
-
-Operation modes:
- -h, --help print this help, then exit
- -t, --time-stamp print date of last modification, then exit
- -v, --version print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-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.
-
-This is free software; see the source for copying conditions. There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
- case $1 in
- --time-stamp | --time* | -t )
- echo "$timestamp" ; exit ;;
- --version | -v )
- echo "$version" ; exit ;;
- --help | --h* | -h )
- echo "$usage"; exit ;;
- -- ) # Stop option processing
- shift; break ;;
- - ) # Use stdin as input.
- break ;;
- -* )
- echo "$me: invalid option $1$help"
- exit 1 ;;
-
- *local*)
- # First pass through any local machine types.
- echo $1
- exit ;;
-
- * )
- break ;;
- esac
-done
-
-case $# in
- 0) echo "$me: missing argument$help" >&2
- exit 1;;
- 1) ;;
- *) echo "$me: too many arguments$help" >&2
- exit 1;;
-esac
-
-# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
-# 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* | \
- kopensolaris*-gnu* | \
- storm-chaos* | os2-emx* | rtmk-nova*)
- os=-$maybe_os
- basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
- ;;
- *)
- basic_machine=`echo $1 | sed 's/-[^-]*$//'`
- if [ $basic_machine != $1 ]
- then os=`echo $1 | sed 's/.*-/-/'`
- else os=; fi
- ;;
-esac
-
-### Let's recognize common machines as not being operating systems so
-### that things like config.sub decstation-3100 work. We also
-### recognize some manufacturers as not being operating systems, so we
-### can provide default operating systems below.
-case $os in
- -sun*os*)
- # Prevent following clause from handling this invalid input.
- ;;
- -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
- -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
- -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
- -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)
- os=
- basic_machine=$1
- ;;
- -sim | -cisco | -oki | -wec | -winbond)
- os=
- basic_machine=$1
- ;;
- -scout)
- ;;
- -wrs)
- os=-vxworks
- basic_machine=$1
- ;;
- -chorusos*)
- os=-chorusos
- basic_machine=$1
- ;;
- -chorusrdb)
- os=-chorusrdb
- basic_machine=$1
- ;;
- -hiux*)
- os=-hiuxwe2
- ;;
- -sco6)
- os=-sco5v6
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco5)
- os=-sco3.2v5
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco4)
- os=-sco3.2v4
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco3.2.[4-9]*)
- os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco3.2v[4-9]*)
- # Don't forget version if it is 3.2v4 or newer.
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco5v6*)
- # Don't forget version if it is 3.2v4 or newer.
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco*)
- os=-sco3.2v2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -udk*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -isc)
- os=-isc2.2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -clix*)
- basic_machine=clipper-intergraph
- ;;
- -isc*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -lynx*)
- os=-lynxos
- ;;
- -ptx*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
- ;;
- -windowsnt*)
- os=`echo $os | sed -e 's/windowsnt/winnt/'`
- ;;
- -psos*)
- os=-psos
- ;;
- -mint | -mint[0-9]*)
- basic_machine=m68k-atari
- os=-mint
- ;;
-esac
-
-# Decode aliases for certain CPU-COMPANY combinations.
-case $basic_machine in
- # Recognize the basic CPU types without company name.
- # Some are omitted here because they have special meanings below.
- 1750a | 580 \
- | a29k \
- | 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 \
- | bfin \
- | c4x | clipper \
- | d10v | d30v | dlx | dsp16xx \
- | fido | fr30 | frv \
- | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
- | i370 | i860 | i960 | ia64 \
- | ip2k | iq2000 \
- | lm32 \
- | m32c | m32r | m32rle | m68000 | m68k | m88k \
- | maxq | mb | microblaze | mcore | mep | metag \
- | mips | mipsbe | mipseb | mipsel | mipsle \
- | mips16 \
- | mips64 | mips64el \
- | mips64octeon | mips64octeonel \
- | mips64orion | mips64orionel \
- | mips64r5900 | mips64r5900el \
- | mips64vr | mips64vrel \
- | mips64vr4100 | mips64vr4100el \
- | mips64vr4300 | mips64vr4300el \
- | mips64vr5000 | mips64vr5000el \
- | mips64vr5900 | mips64vr5900el \
- | mipsisa32 | mipsisa32el \
- | mipsisa32r2 | mipsisa32r2el \
- | mipsisa64 | mipsisa64el \
- | mipsisa64r2 | mipsisa64r2el \
- | mipsisa64sb1 | mipsisa64sb1el \
- | mipsisa64sr71k | mipsisa64sr71kel \
- | mipstx39 | mipstx39el \
- | mn10200 | mn10300 \
- | moxie \
- | mt \
- | msp430 \
- | nios | nios2 \
- | ns16k | ns32k \
- | or32 \
- | pdp10 | pdp11 | pj | pjl \
- | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
- | pyramid \
- | 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 \
- | v850 | v850e \
- | we32k \
- | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
- | z8k | z80)
- basic_machine=$basic_machine-unknown
- ;;
- m6811 | m68hc11 | m6812 | m68hc12)
- # Motorola 68HC11/12.
- basic_machine=$basic_machine-unknown
- os=-none
- ;;
- m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
- ;;
- ms1)
- basic_machine=mt-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.
- i*86 | x86_64)
- basic_machine=$basic_machine-pc
- ;;
- # Object if more than one company name word.
- *-*-*)
- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
- exit 1
- ;;
- # Recognize the basic CPU types with company name.
- 580-* \
- | a29k-* \
- | 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-* \
- | bfin-* | bs2000-* \
- | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
- | 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-* \
- | i*86-* | i860-* | i960-* | ia64-* \
- | ip2k-* | iq2000-* \
- | lm32-* \
- | m32c-* | m32r-* | m32rle-* \
- | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
- | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
- | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
- | mips16-* \
- | mips64-* | mips64el-* \
- | mips64octeon-* | mips64octeonel-* \
- | mips64orion-* | mips64orionel-* \
- | mips64r5900-* | mips64r5900el-* \
- | mips64vr-* | mips64vrel-* \
- | mips64vr4100-* | mips64vr4100el-* \
- | mips64vr4300-* | mips64vr4300el-* \
- | mips64vr5000-* | mips64vr5000el-* \
- | mips64vr5900-* | mips64vr5900el-* \
- | mipsisa32-* | mipsisa32el-* \
- | mipsisa32r2-* | mipsisa32r2el-* \
- | mipsisa64-* | mipsisa64el-* \
- | mipsisa64r2-* | mipsisa64r2el-* \
- | mipsisa64sb1-* | mipsisa64sb1el-* \
- | mipsisa64sr71k-* | mipsisa64sr71kel-* \
- | mipstx39-* | mipstx39el-* \
- | mmix-* \
- | mt-* \
- | msp430-* \
- | nios-* | nios2-* \
- | none-* | np1-* | ns16k-* | ns32k-* \
- | orion-* \
- | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
- | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
- | pyramid-* \
- | romp-* | rs6000-* \
- | 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-* \
- | tron-* \
- | v850-* | v850e-* | vax-* \
- | we32k-* \
- | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
- | xstormy16-* | xtensa*-* \
- | ymp-* \
- | z8k-* | z80-*)
- ;;
- # Recognize the basic CPU types without company name, with glob match.
- xtensa*)
- basic_machine=$basic_machine-unknown
- ;;
- # Recognize the various machine names and aliases which stand
- # for a CPU type and a company and sometimes even an OS.
- 386bsd)
- basic_machine=i386-unknown
- os=-bsd
- ;;
- 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
- basic_machine=m68000-att
- ;;
- 3b*)
- basic_machine=we32k-att
- ;;
- a29khif)
- basic_machine=a29k-amd
- os=-udi
- ;;
- abacus)
- basic_machine=abacus-unknown
- ;;
- adobe68k)
- basic_machine=m68010-adobe
- os=-scout
- ;;
- alliant | fx80)
- basic_machine=fx80-alliant
- ;;
- altos | altos3068)
- basic_machine=m68k-altos
- ;;
- am29k)
- basic_machine=a29k-none
- os=-bsd
- ;;
- amd64)
- basic_machine=x86_64-pc
- ;;
- amd64-*)
- basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- amdahl)
- basic_machine=580-amdahl
- os=-sysv
- ;;
- amiga | amiga-*)
- basic_machine=m68k-unknown
- ;;
- amigaos | amigados)
- basic_machine=m68k-unknown
- os=-amigaos
- ;;
- amigaunix | amix)
- basic_machine=m68k-unknown
- os=-sysv4
- ;;
- apollo68)
- basic_machine=m68k-apollo
- os=-sysv
- ;;
- apollo68bsd)
- basic_machine=m68k-apollo
- os=-bsd
- ;;
- aros)
- basic_machine=i386-pc
- os=-aros
- ;;
- aux)
- basic_machine=m68k-apple
- os=-aux
- ;;
- balance)
- basic_machine=ns32k-sequent
- os=-dynix
- ;;
- blackfin)
- basic_machine=bfin-unknown
- os=-linux
- ;;
- blackfin-*)
- basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
- os=-linux
- ;;
- c90)
- basic_machine=c90-cray
- os=-unicos
- ;;
- cegcc)
- basic_machine=arm-unknown
- os=-cegcc
- ;;
- convex-c1)
- basic_machine=c1-convex
- os=-bsd
- ;;
- convex-c2)
- basic_machine=c2-convex
- os=-bsd
- ;;
- convex-c32)
- basic_machine=c32-convex
- os=-bsd
- ;;
- convex-c34)
- basic_machine=c34-convex
- os=-bsd
- ;;
- convex-c38)
- basic_machine=c38-convex
- os=-bsd
- ;;
- cray | j90)
- basic_machine=j90-cray
- os=-unicos
- ;;
- craynv)
- basic_machine=craynv-cray
- os=-unicosmp
- ;;
- cr16)
- basic_machine=cr16-unknown
- os=-elf
- ;;
- crds | unos)
- basic_machine=m68k-crds
- ;;
- crisv32 | crisv32-* | etraxfs*)
- basic_machine=crisv32-axis
- ;;
- cris | cris-* | etrax*)
- basic_machine=cris-axis
- ;;
- crx)
- basic_machine=crx-unknown
- os=-elf
- ;;
- da30 | da30-*)
- basic_machine=m68k-da30
- ;;
- decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
- basic_machine=mips-dec
- ;;
- decsystem10* | dec10*)
- basic_machine=pdp10-dec
- os=-tops10
- ;;
- decsystem20* | dec20*)
- basic_machine=pdp10-dec
- os=-tops20
- ;;
- delta | 3300 | motorola-3300 | motorola-delta \
- | 3300-motorola | delta-motorola)
- basic_machine=m68k-motorola
- ;;
- delta88)
- basic_machine=m88k-motorola
- os=-sysv3
- ;;
- dicos)
- basic_machine=i686-pc
- os=-dicos
- ;;
- djgpp)
- basic_machine=i586-pc
- os=-msdosdjgpp
- ;;
- dpx20 | dpx20-*)
- basic_machine=rs6000-bull
- os=-bosx
- ;;
- dpx2* | dpx2*-bull)
- basic_machine=m68k-bull
- os=-sysv3
- ;;
- ebmon29k)
- basic_machine=a29k-amd
- os=-ebmon
- ;;
- elxsi)
- basic_machine=elxsi-elxsi
- os=-bsd
- ;;
- encore | umax | mmax)
- basic_machine=ns32k-encore
- ;;
- es1800 | OSE68k | ose68k | ose | OSE)
- basic_machine=m68k-ericsson
- os=-ose
- ;;
- fx2800)
- basic_machine=i860-alliant
- ;;
- genix)
- basic_machine=ns32k-ns
- ;;
- gmicro)
- basic_machine=tron-gmicro
- os=-sysv
- ;;
- go32)
- basic_machine=i386-pc
- os=-go32
- ;;
- h3050r* | hiux*)
- basic_machine=hppa1.1-hitachi
- os=-hiuxwe2
- ;;
- h8300hms)
- basic_machine=h8300-hitachi
- os=-hms
- ;;
- h8300xray)
- basic_machine=h8300-hitachi
- os=-xray
- ;;
- h8500hms)
- basic_machine=h8500-hitachi
- os=-hms
- ;;
- harris)
- basic_machine=m88k-harris
- os=-sysv3
- ;;
- hp300-*)
- basic_machine=m68k-hp
- ;;
- hp300bsd)
- basic_machine=m68k-hp
- os=-bsd
- ;;
- hp300hpux)
- basic_machine=m68k-hp
- os=-hpux
- ;;
- hp3k9[0-9][0-9] | hp9[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hp9k2[0-9][0-9] | hp9k31[0-9])
- basic_machine=m68000-hp
- ;;
- hp9k3[2-9][0-9])
- basic_machine=m68k-hp
- ;;
- hp9k6[0-9][0-9] | hp6[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hp9k7[0-79][0-9] | hp7[0-79][0-9])
- basic_machine=hppa1.1-hp
- ;;
- hp9k78[0-9] | hp78[0-9])
- # FIXME: really hppa2.0-hp
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
- # FIXME: really hppa2.0-hp
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[0-9][13679] | hp8[0-9][13679])
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[0-9][0-9] | hp8[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hppa-next)
- os=-nextstep3
- ;;
- hppaosf)
- basic_machine=hppa1.1-hp
- os=-osf
- ;;
- hppro)
- basic_machine=hppa1.1-hp
- os=-proelf
- ;;
- 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
- ;;
- i*86v4*)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv4
- ;;
- i*86v)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv
- ;;
- i*86sol2)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-solaris2
- ;;
- i386mach)
- basic_machine=i386-mach
- os=-mach
- ;;
- i386-vsta | vsta)
- basic_machine=i386-unknown
- os=-vsta
- ;;
- iris | iris4d)
- basic_machine=mips-sgi
- case $os in
- -irix*)
- ;;
- *)
- os=-irix4
- ;;
- esac
- ;;
- isi68 | isi)
- basic_machine=m68k-isi
- os=-sysv
- ;;
- m68knommu)
- basic_machine=m68k-unknown
- os=-linux
- ;;
- m68knommu-*)
- basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
- os=-linux
- ;;
- m88k-omron*)
- basic_machine=m88k-omron
- ;;
- magnum | m3230)
- basic_machine=mips-mips
- os=-sysv
- ;;
- merlin)
- basic_machine=ns32k-utek
- os=-sysv
- ;;
- mingw32)
- basic_machine=i386-pc
- os=-mingw32
- ;;
- mingw32ce)
- basic_machine=arm-unknown
- os=-mingw32ce
- ;;
- miniframe)
- basic_machine=m68000-convergent
- ;;
- *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
- basic_machine=m68k-atari
- os=-mint
- ;;
- mips3*-*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
- ;;
- mips3*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
- ;;
- monitor)
- basic_machine=m68k-rom68k
- os=-coff
- ;;
- morphos)
- basic_machine=powerpc-unknown
- os=-morphos
- ;;
- msdos)
- basic_machine=i386-pc
- os=-msdos
- ;;
- ms1-*)
- basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
- ;;
- mvs)
- basic_machine=i370-ibm
- os=-mvs
- ;;
- ncr3000)
- basic_machine=i486-ncr
- os=-sysv4
- ;;
- netbsd386)
- basic_machine=i386-unknown
- os=-netbsd
- ;;
- netwinder)
- basic_machine=armv4l-rebel
- os=-linux
- ;;
- news | news700 | news800 | news900)
- basic_machine=m68k-sony
- os=-newsos
- ;;
- news1000)
- basic_machine=m68030-sony
- os=-newsos
- ;;
- news-3600 | risc-news)
- basic_machine=mips-sony
- os=-newsos
- ;;
- necv70)
- basic_machine=v70-nec
- os=-sysv
- ;;
- next | m*-next )
- basic_machine=m68k-next
- case $os in
- -nextstep* )
- ;;
- -ns2*)
- os=-nextstep2
- ;;
- *)
- os=-nextstep3
- ;;
- esac
- ;;
- nh3000)
- basic_machine=m68k-harris
- os=-cxux
- ;;
- nh[45]000)
- basic_machine=m88k-harris
- os=-cxux
- ;;
- nindy960)
- basic_machine=i960-intel
- os=-nindy
- ;;
- mon960)
- basic_machine=i960-intel
- os=-mon960
- ;;
- nonstopux)
- basic_machine=mips-compaq
- os=-nonstopux
- ;;
- np1)
- basic_machine=np1-gould
- ;;
- nsr-tandem)
- basic_machine=nsr-tandem
- ;;
- op50n-* | op60c-*)
- basic_machine=hppa1.1-oki
- os=-proelf
- ;;
- openrisc | openrisc-*)
- basic_machine=or32-unknown
- ;;
- os400)
- basic_machine=powerpc-ibm
- os=-os400
- ;;
- OSE68000 | ose68000)
- basic_machine=m68000-ericsson
- os=-ose
- ;;
- os68k)
- basic_machine=m68k-none
- os=-os68k
- ;;
- pa-hitachi)
- basic_machine=hppa1.1-hitachi
- os=-hiuxwe2
- ;;
- paragon)
- basic_machine=i860-intel
- os=-osf
- ;;
- parisc)
- basic_machine=hppa-unknown
- os=-linux
- ;;
- parisc-*)
- basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
- os=-linux
- ;;
- pbd)
- basic_machine=sparc-tti
- ;;
- pbb)
- basic_machine=m68k-tti
- ;;
- pc532 | pc532-*)
- basic_machine=ns32k-pc532
- ;;
- pc98)
- basic_machine=i386-pc
- ;;
- pc98-*)
- basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentium | p5 | k5 | k6 | nexgen | viac3)
- basic_machine=i586-pc
- ;;
- pentiumpro | p6 | 6x86 | athlon | athlon_*)
- basic_machine=i686-pc
- ;;
- pentiumii | pentium2 | pentiumiii | pentium3)
- basic_machine=i686-pc
- ;;
- pentium4)
- basic_machine=i786-pc
- ;;
- pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
- basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentiumpro-* | p6-* | 6x86-* | athlon-*)
- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentium4-*)
- basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pn)
- basic_machine=pn-gould
- ;;
- power) basic_machine=power-ibm
- ;;
- ppc) basic_machine=powerpc-unknown
- ;;
- ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppcle | powerpclittle | ppc-le | powerpc-little)
- basic_machine=powerpcle-unknown
- ;;
- ppcle-* | powerpclittle-*)
- basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppc64) basic_machine=powerpc64-unknown
- ;;
- ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppc64le | powerpc64little | ppc64-le | powerpc64-little)
- basic_machine=powerpc64le-unknown
- ;;
- ppc64le-* | powerpc64little-*)
- basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ps2)
- basic_machine=i386-ibm
- ;;
- pw32)
- basic_machine=i586-unknown
- os=-pw32
- ;;
- rdos)
- basic_machine=i386-pc
- os=-rdos
- ;;
- rom68k)
- basic_machine=m68k-rom68k
- os=-coff
- ;;
- rm[46]00)
- basic_machine=mips-siemens
- ;;
- rtpc | rtpc-*)
- basic_machine=romp-ibm
- ;;
- s390 | s390-*)
- basic_machine=s390-ibm
- ;;
- s390x | s390x-*)
- basic_machine=s390x-ibm
- ;;
- sa29200)
- basic_machine=a29k-amd
- os=-udi
- ;;
- sb1)
- basic_machine=mipsisa64sb1-unknown
- ;;
- sb1el)
- basic_machine=mipsisa64sb1el-unknown
- ;;
- sde)
- basic_machine=mipsisa32-sde
- os=-elf
- ;;
- sei)
- basic_machine=mips-sei
- os=-seiux
- ;;
- sequent)
- basic_machine=i386-sequent
- ;;
- sh)
- basic_machine=sh-hitachi
- os=-hms
- ;;
- sh5el)
- basic_machine=sh5le-unknown
- ;;
- sh64)
- basic_machine=sh64-unknown
- ;;
- sparclite-wrs | simso-wrs)
- basic_machine=sparclite-wrs
- os=-vxworks
- ;;
- sps7)
- basic_machine=m68k-bull
- os=-sysv2
- ;;
- spur)
- basic_machine=spur-unknown
- ;;
- st2000)
- basic_machine=m68k-tandem
- ;;
- stratus)
- basic_machine=i860-stratus
- os=-sysv4
- ;;
- sun2)
- basic_machine=m68000-sun
- ;;
- sun2os3)
- basic_machine=m68000-sun
- os=-sunos3
- ;;
- sun2os4)
- basic_machine=m68000-sun
- os=-sunos4
- ;;
- sun3os3)
- basic_machine=m68k-sun
- os=-sunos3
- ;;
- sun3os4)
- basic_machine=m68k-sun
- os=-sunos4
- ;;
- sun4os3)
- basic_machine=sparc-sun
- os=-sunos3
- ;;
- sun4os4)
- basic_machine=sparc-sun
- os=-sunos4
- ;;
- sun4sol2)
- basic_machine=sparc-sun
- os=-solaris2
- ;;
- sun3 | sun3-*)
- basic_machine=m68k-sun
- ;;
- sun4)
- basic_machine=sparc-sun
- ;;
- sun386 | sun386i | roadrunner)
- basic_machine=i386-sun
- ;;
- sv1)
- basic_machine=sv1-cray
- os=-unicos
- ;;
- symmetry)
- basic_machine=i386-sequent
- os=-dynix
- ;;
- t3e)
- basic_machine=alphaev5-cray
- os=-unicos
- ;;
- t90)
- 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
- os=-linux-gnu
- ;;
- tx39)
- basic_machine=mipstx39-unknown
- ;;
- tx39el)
- basic_machine=mipstx39el-unknown
- ;;
- toad1)
- basic_machine=pdp10-xkl
- os=-tops20
- ;;
- tower | tower-32)
- basic_machine=m68k-ncr
- ;;
- tpf)
- basic_machine=s390x-ibm
- os=-tpf
- ;;
- udi29k)
- basic_machine=a29k-amd
- os=-udi
- ;;
- ultra3)
- basic_machine=a29k-nyu
- os=-sym1
- ;;
- v810 | necv810)
- basic_machine=v810-nec
- os=-none
- ;;
- vaxv)
- basic_machine=vax-dec
- os=-sysv
- ;;
- vms)
- basic_machine=vax-dec
- os=-vms
- ;;
- vpp*|vx|vx-*)
- basic_machine=f301-fujitsu
- ;;
- vxworks960)
- basic_machine=i960-wrs
- os=-vxworks
- ;;
- vxworks68)
- basic_machine=m68k-wrs
- os=-vxworks
- ;;
- vxworks29k)
- basic_machine=a29k-wrs
- os=-vxworks
- ;;
- w65*)
- basic_machine=w65-wdc
- os=-none
- ;;
- w89k-*)
- basic_machine=hppa1.1-winbond
- os=-proelf
- ;;
- xbox)
- basic_machine=i686-pc
- os=-mingw32
- ;;
- xps | xps100)
- basic_machine=xps100-honeywell
- ;;
- ymp)
- basic_machine=ymp-cray
- os=-unicos
- ;;
- z8k-*-coff)
- basic_machine=z8k-unknown
- os=-sim
- ;;
- z80-*-coff)
- basic_machine=z80-unknown
- os=-sim
- ;;
- none)
- basic_machine=none-none
- os=-none
- ;;
-
-# Here we handle the default manufacturer of certain CPU types. It is in
-# some cases the only manufacturer, in others, it is the most popular.
- w89k)
- basic_machine=hppa1.1-winbond
- ;;
- op50n)
- basic_machine=hppa1.1-oki
- ;;
- op60c)
- basic_machine=hppa1.1-oki
- ;;
- romp)
- basic_machine=romp-ibm
- ;;
- mmix)
- basic_machine=mmix-knuth
- ;;
- rs6000)
- basic_machine=rs6000-ibm
- ;;
- vax)
- basic_machine=vax-dec
- ;;
- pdp10)
- # there are many clones, so DEC is not a safe bet
- basic_machine=pdp10-unknown
- ;;
- pdp11)
- basic_machine=pdp11-dec
- ;;
- we32k)
- basic_machine=we32k-att
- ;;
- sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
- basic_machine=sh-unknown
- ;;
- sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
- basic_machine=sparc-sun
- ;;
- cydra)
- basic_machine=cydra-cydrome
- ;;
- orion)
- basic_machine=orion-highlevel
- ;;
- orion105)
- basic_machine=clipper-highlevel
- ;;
- mac | mpw | mac-mpw)
- basic_machine=m68k-apple
- ;;
- pmac | pmac-mpw)
- basic_machine=powerpc-apple
- ;;
- *-unknown)
- # Make sure to match an already-canonicalized machine name.
- ;;
- *)
- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
- exit 1
- ;;
-esac
-
-# Here we canonicalize certain aliases for manufacturers.
-case $basic_machine in
- *-digital*)
- basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
- ;;
- *-commodore*)
- basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
- ;;
- *)
- ;;
-esac
-
-# Decode manufacturer-specific aliases for certain operating systems.
-
-if [ x"$os" != x"" ]
-then
-case $os in
- # First match some system type aliases
- # that might get confused with valid system types.
- # -solaris* is a basic system type, with this one exception.
- -solaris1 | -solaris1.*)
- os=`echo $os | sed -e 's|solaris1|sunos4|'`
- ;;
- -solaris)
- os=-solaris2
- ;;
- -svr4*)
- os=-sysv4
- ;;
- -unixware*)
- os=-sysv4.2uw
- ;;
- -gnu/linux*)
- os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
- ;;
- # First accept the basic system types.
- # The portable systems comes first.
- # Each alternative MUST END IN A *, to match a version number.
- # -sysv* is not here because it comes later, after sysvr4.
- -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
- | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
- | -hpux* | -unos* | -osf* | -luna* | -dgux* | -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* \
- | -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* \
- | -uxpv* | -beos* | -mpeix* | -udk* \
- | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
- | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
- | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
- | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
- | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
- | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
- | -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
- # Remember, each alternative MUST END IN *, to match a version number.
- ;;
- -qnx*)
- case $basic_machine in
- x86-* | i*86-*)
- ;;
- *)
- os=-nto$os
- ;;
- esac
- ;;
- -nto-qnx*)
- ;;
- -nto*)
- os=`echo $os | sed -e 's|nto|nto-qnx|'`
- ;;
- -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
- | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
- | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
- ;;
- -mac*)
- os=`echo $os | sed -e 's|mac|macos|'`
- ;;
- -linux-dietlibc)
- os=-linux-dietlibc
- ;;
- -linux*)
- os=`echo $os | sed -e 's|linux|linux-gnu|'`
- ;;
- -sunos5*)
- os=`echo $os | sed -e 's|sunos5|solaris2|'`
- ;;
- -sunos6*)
- os=`echo $os | sed -e 's|sunos6|solaris3|'`
- ;;
- -opened*)
- os=-openedition
- ;;
- -os400*)
- os=-os400
- ;;
- -wince*)
- os=-wince
- ;;
- -osfrose*)
- os=-osfrose
- ;;
- -osf*)
- os=-osf
- ;;
- -utek*)
- os=-bsd
- ;;
- -dynix*)
- os=-bsd
- ;;
- -acis*)
- os=-aos
- ;;
- -atheos*)
- os=-atheos
- ;;
- -syllable*)
- os=-syllable
- ;;
- -386bsd)
- os=-bsd
- ;;
- -ctix* | -uts*)
- os=-sysv
- ;;
- -nova*)
- os=-rtmk-nova
- ;;
- -ns2 )
- os=-nextstep2
- ;;
- -nsk*)
- os=-nsk
- ;;
- # Preserve the version number of sinix5.
- -sinix5.*)
- os=`echo $os | sed -e 's|sinix|sysv|'`
- ;;
- -sinix*)
- os=-sysv4
- ;;
- -tpf*)
- os=-tpf
- ;;
- -triton*)
- os=-sysv3
- ;;
- -oss*)
- os=-sysv3
- ;;
- -svr4)
- os=-sysv4
- ;;
- -svr3)
- os=-sysv3
- ;;
- -sysvr4)
- os=-sysv4
- ;;
- # This must come after -sysvr4.
- -sysv*)
- ;;
- -ose*)
- os=-ose
- ;;
- -es1800*)
- os=-ose
- ;;
- -xenix)
- os=-xenix
- ;;
- -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
- os=-mint
- ;;
- -aros*)
- os=-aros
- ;;
- -kaos*)
- os=-kaos
- ;;
- -zvmoe)
- os=-zvmoe
- ;;
- -dicos*)
- os=-dicos
- ;;
- -none)
- ;;
- *)
- # Get rid of the `-' at the beginning of $os.
- os=`echo $os | sed 's/[^-]*-//'`
- echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
- exit 1
- ;;
-esac
-else
-
-# Here we handle the default operating systems that come with various machines.
-# The value should be what the vendor currently ships out the door with their
-# machine or put another way, the most popular os provided with the machine.
-
-# Note that if you're going to try to match "-MANUFACTURER" here (say,
-# "-sun"), then you have to tell the case statement up towards the top
-# that MANUFACTURER isn't an operating system. Otherwise, code above
-# will signal an error saying that MANUFACTURER isn't an operating
-# system, and we'll never get to this point.
-
-case $basic_machine in
- score-*)
- os=-elf
- ;;
- spu-*)
- os=-elf
- ;;
- *-acorn)
- os=-riscix1.2
- ;;
- arm*-rebel)
- os=-linux
- ;;
- arm*-semi)
- os=-aout
- ;;
- c4x-* | tic4x-*)
- os=-coff
- ;;
- # This must come before the *-dec entry.
- pdp10-*)
- os=-tops20
- ;;
- pdp11-*)
- os=-none
- ;;
- *-dec | vax-*)
- os=-ultrix4.2
- ;;
- m68*-apollo)
- os=-domain
- ;;
- i386-sun)
- os=-sunos4.0.2
- ;;
- m68000-sun)
- os=-sunos3
- # This also exists in the configure program, but was not the
- # default.
- # os=-sunos4
- ;;
- m68*-cisco)
- os=-aout
- ;;
- mep-*)
- os=-elf
- ;;
- mips*-cisco)
- os=-elf
- ;;
- mips*-*)
- os=-elf
- ;;
- or32-*)
- os=-coff
- ;;
- *-tti) # must be before sparc entry or we get the wrong os.
- os=-sysv3
- ;;
- sparc-* | *-sun)
- os=-sunos4.1.1
- ;;
- *-be)
- os=-beos
- ;;
- *-haiku)
- os=-haiku
- ;;
- *-ibm)
- os=-aix
- ;;
- *-knuth)
- os=-mmixware
- ;;
- *-wec)
- os=-proelf
- ;;
- *-winbond)
- os=-proelf
- ;;
- *-oki)
- os=-proelf
- ;;
- *-hp)
- os=-hpux
- ;;
- *-hitachi)
- os=-hiux
- ;;
- i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
- os=-sysv
- ;;
- *-cbm)
- os=-amigaos
- ;;
- *-dg)
- os=-dgux
- ;;
- *-dolphin)
- os=-sysv3
- ;;
- m68k-ccur)
- os=-rtu
- ;;
- m88k-omron*)
- os=-luna
- ;;
- *-next )
- os=-nextstep
- ;;
- *-sequent)
- os=-ptx
- ;;
- *-crds)
- os=-unos
- ;;
- *-ns)
- os=-genix
- ;;
- i370-*)
- os=-mvs
- ;;
- *-next)
- os=-nextstep3
- ;;
- *-gould)
- os=-sysv
- ;;
- *-highlevel)
- os=-bsd
- ;;
- *-encore)
- os=-bsd
- ;;
- *-sgi)
- os=-irix
- ;;
- *-siemens)
- os=-sysv4
- ;;
- *-masscomp)
- os=-rtu
- ;;
- f30[01]-fujitsu | f700-fujitsu)
- os=-uxpv
- ;;
- *-rom68k)
- os=-coff
- ;;
- *-*bug)
- os=-coff
- ;;
- *-apple)
- os=-macos
- ;;
- *-atari*)
- os=-mint
- ;;
- *)
- os=-none
- ;;
-esac
-fi
-
-# Here we handle the case where we know the os, and the CPU type, but not the
-# manufacturer. We pick the logical manufacturer.
-vendor=unknown
-case $basic_machine in
- *-unknown)
- case $os in
- -riscix*)
- vendor=acorn
- ;;
- -sunos*)
- vendor=sun
- ;;
- -aix*)
- vendor=ibm
- ;;
- -beos*)
- vendor=be
- ;;
- -hpux*)
- vendor=hp
- ;;
- -mpeix*)
- vendor=hp
- ;;
- -hiux*)
- vendor=hitachi
- ;;
- -unos*)
- vendor=crds
- ;;
- -dgux*)
- vendor=dg
- ;;
- -luna*)
- vendor=omron
- ;;
- -genix*)
- vendor=ns
- ;;
- -mvs* | -opened*)
- vendor=ibm
- ;;
- -os400*)
- vendor=ibm
- ;;
- -ptx*)
- vendor=sequent
- ;;
- -tpf*)
- vendor=ibm
- ;;
- -vxsim* | -vxworks* | -windiss*)
- vendor=wrs
- ;;
- -aux*)
- vendor=apple
- ;;
- -hms*)
- vendor=hitachi
- ;;
- -mpw* | -macos*)
- vendor=apple
- ;;
- -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
- vendor=atari
- ;;
- -vos*)
- vendor=stratus
- ;;
- esac
- basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
- ;;
-esac
-
-echo $basic_machine$os
-exit
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
diff --git a/chromium/third_party/talloc/libreplace/configure.ac b/chromium/third_party/talloc/libreplace/configure.ac
deleted file mode 100644
index 0361825a022..00000000000
--- a/chromium/third_party/talloc/libreplace/configure.ac
+++ /dev/null
@@ -1,33 +0,0 @@
-AC_PREREQ(2.50)
-AC_INIT(replace.c)
-AC_CONFIG_SRCDIR([replace.c])
-AC_CONFIG_HEADER(config.h)
-
-CFLAGS="$CFLAGS -I$srcdir"
-
-AC_LIBREPLACE_ALL_CHECKS
-AC_LIBREPLACE_NETWORK_CHECKS
-
-if test "$ac_cv_prog_gcc" = yes; then
- CFLAGS="$CFLAGS -Wall"
- CFLAGS="$CFLAGS -W"
- CFLAGS="$CFLAGS -Wshadow"
- CFLAGS="$CFLAGS -Wstrict-prototypes"
- CFLAGS="$CFLAGS -Wpointer-arith"
- CFLAGS="$CFLAGS -Wcast-qual"
- CFLAGS="$CFLAGS -Wcast-align"
- CFLAGS="$CFLAGS -Wwrite-strings"
- CFLAGS="$CFLAGS -Werror-implicit-function-declaration"
- CFLAGS="$CFLAGS -Wformat=2"
- CFLAGS="$CFLAGS -Wno-format-y2k"
-fi
-
-m4_include(build_macros.m4)
-BUILD_WITH_SHARED_BUILD_DIR
-
-LIBS="${LIBREPLACE_NETWORK_LIBS}"
-AC_SUBST(LIBS)
-
-AC_SUBST(LDFLAGS)
-
-AC_OUTPUT(Makefile)
diff --git a/chromium/third_party/talloc/libreplace/crypt.c b/chromium/third_party/talloc/libreplace/crypt.c
deleted file mode 100644
index 22341ce511d..00000000000
--- a/chromium/third_party/talloc/libreplace/crypt.c
+++ /dev/null
@@ -1,770 +0,0 @@
-/*
- This bit of code was derived from the UFC-crypt package which
- carries the following copyright
-
- Modified for use by Samba by Andrew Tridgell, October 1994
-
- Note that this routine is only faster on some machines. Under Linux 1.1.51
- libc 4.5.26 I actually found this routine to be slightly slower.
-
- Under SunOS I found a huge speedup by using these routines
- (a factor of 20 or so)
-
- Warning: I've had a report from Steve Kennedy <steve@gbnet.org>
- that this crypt routine may sometimes get the wrong answer. Only
- use UFC_CRYT if you really need it.
-
-*/
-
-#include "replace.h"
-
-#ifndef HAVE_CRYPT
-
-/*
- * UFC-crypt: ultra fast crypt(3) implementation
- *
- * Copyright (C) 1991-1998, Free Software Foundation, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, see <http://www.gnu.org/licenses/>.
- *
- * @(#)crypt_util.c 2.31 02/08/92
- *
- * Support routines
- *
- */
-
-
-#ifndef long32
-#define long32 int32
-#endif
-
-#ifndef long64
-#define long64 int64
-#endif
-
-#ifndef ufc_long
-#define ufc_long unsigned
-#endif
-
-#ifndef _UFC_64_
-#define _UFC_32_
-#endif
-
-/*
- * Permutation done once on the 56 bit
- * key derived from the original 8 byte ASCII key.
- */
-static int pc1[56] = {
- 57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18,
- 10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60, 52, 44, 36,
- 63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22,
- 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 28, 20, 12, 4
-};
-
-/*
- * How much to rotate each 28 bit half of the pc1 permutated
- * 56 bit key before using pc2 to give the i' key
- */
-static int rots[16] = {
- 1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1
-};
-
-/*
- * Permutation giving the key
- * of the i' DES round
- */
-static int pc2[48] = {
- 14, 17, 11, 24, 1, 5, 3, 28, 15, 6, 21, 10,
- 23, 19, 12, 4, 26, 8, 16, 7, 27, 20, 13, 2,
- 41, 52, 31, 37, 47, 55, 30, 40, 51, 45, 33, 48,
- 44, 49, 39, 56, 34, 53, 46, 42, 50, 36, 29, 32
-};
-
-/*
- * The E expansion table which selects
- * bits from the 32 bit intermediate result.
- */
-static int esel[48] = {
- 32, 1, 2, 3, 4, 5, 4, 5, 6, 7, 8, 9,
- 8, 9, 10, 11, 12, 13, 12, 13, 14, 15, 16, 17,
- 16, 17, 18, 19, 20, 21, 20, 21, 22, 23, 24, 25,
- 24, 25, 26, 27, 28, 29, 28, 29, 30, 31, 32, 1
-};
-static int e_inverse[64];
-
-/*
- * Permutation done on the
- * result of sbox lookups
- */
-static int perm32[32] = {
- 16, 7, 20, 21, 29, 12, 28, 17, 1, 15, 23, 26, 5, 18, 31, 10,
- 2, 8, 24, 14, 32, 27, 3, 9, 19, 13, 30, 6, 22, 11, 4, 25
-};
-
-/*
- * The sboxes
- */
-static int sbox[8][4][16]= {
- { { 14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7 },
- { 0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8 },
- { 4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0 },
- { 15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13 }
- },
-
- { { 15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10 },
- { 3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5 },
- { 0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15 },
- { 13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9 }
- },
-
- { { 10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8 },
- { 13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1 },
- { 13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7 },
- { 1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12 }
- },
-
- { { 7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15 },
- { 13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9 },
- { 10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4 },
- { 3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14 }
- },
-
- { { 2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9 },
- { 14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6 },
- { 4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14 },
- { 11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3 }
- },
-
- { { 12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11 },
- { 10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8 },
- { 9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6 },
- { 4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13 }
- },
-
- { { 4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1 },
- { 13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6 },
- { 1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2 },
- { 6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12 }
- },
-
- { { 13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7 },
- { 1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2 },
- { 7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8 },
- { 2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11 }
- }
-};
-
-/*
- * This is the final
- * permutation matrix
- */
-static int final_perm[64] = {
- 40, 8, 48, 16, 56, 24, 64, 32, 39, 7, 47, 15, 55, 23, 63, 31,
- 38, 6, 46, 14, 54, 22, 62, 30, 37, 5, 45, 13, 53, 21, 61, 29,
- 36, 4, 44, 12, 52, 20, 60, 28, 35, 3, 43, 11, 51, 19, 59, 27,
- 34, 2, 42, 10, 50, 18, 58, 26, 33, 1, 41, 9, 49, 17, 57, 25
-};
-
-/*
- * The 16 DES keys in BITMASK format
- */
-#ifdef _UFC_32_
-long32 _ufc_keytab[16][2];
-#endif
-
-#ifdef _UFC_64_
-long64 _ufc_keytab[16];
-#endif
-
-
-#define ascii_to_bin(c) ((c)>='a'?(c-59):(c)>='A'?((c)-53):(c)-'.')
-#define bin_to_ascii(c) ((c)>=38?((c)-38+'a'):(c)>=12?((c)-12+'A'):(c)+'.')
-
-/* Macro to set a bit (0..23) */
-#define BITMASK(i) ( (1<<(11-(i)%12+3)) << ((i)<12?16:0) )
-
-/*
- * sb arrays:
- *
- * Workhorses of the inner loop of the DES implementation.
- * They do sbox lookup, shifting of this value, 32 bit
- * permutation and E permutation for the next round.
- *
- * Kept in 'BITMASK' format.
- */
-
-#ifdef _UFC_32_
-long32 _ufc_sb0[8192], _ufc_sb1[8192], _ufc_sb2[8192], _ufc_sb3[8192];
-static long32 *sb[4] = {_ufc_sb0, _ufc_sb1, _ufc_sb2, _ufc_sb3};
-#endif
-
-#ifdef _UFC_64_
-long64 _ufc_sb0[4096], _ufc_sb1[4096], _ufc_sb2[4096], _ufc_sb3[4096];
-static long64 *sb[4] = {_ufc_sb0, _ufc_sb1, _ufc_sb2, _ufc_sb3};
-#endif
-
-/*
- * eperm32tab: do 32 bit permutation and E selection
- *
- * The first index is the byte number in the 32 bit value to be permuted
- * - second - is the value of this byte
- * - third - selects the two 32 bit values
- *
- * The table is used and generated internally in init_des to speed it up
- */
-static ufc_long eperm32tab[4][256][2];
-
-/*
- * do_pc1: permform pc1 permutation in the key schedule generation.
- *
- * The first index is the byte number in the 8 byte ASCII key
- * - second - - the two 28 bits halfs of the result
- * - third - selects the 7 bits actually used of each byte
- *
- * The result is kept with 28 bit per 32 bit with the 4 most significant
- * bits zero.
- */
-static ufc_long do_pc1[8][2][128];
-
-/*
- * do_pc2: permform pc2 permutation in the key schedule generation.
- *
- * The first index is the septet number in the two 28 bit intermediate values
- * - second - - - septet values
- *
- * Knowledge of the structure of the pc2 permutation is used.
- *
- * The result is kept with 28 bit per 32 bit with the 4 most significant
- * bits zero.
- */
-static ufc_long do_pc2[8][128];
-
-/*
- * efp: undo an extra e selection and do final
- * permutation giving the DES result.
- *
- * Invoked 6 bit a time on two 48 bit values
- * giving two 32 bit longs.
- */
-static ufc_long efp[16][64][2];
-
-static unsigned char bytemask[8] = {
- 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01
-};
-
-static ufc_long longmask[32] = {
- 0x80000000, 0x40000000, 0x20000000, 0x10000000,
- 0x08000000, 0x04000000, 0x02000000, 0x01000000,
- 0x00800000, 0x00400000, 0x00200000, 0x00100000,
- 0x00080000, 0x00040000, 0x00020000, 0x00010000,
- 0x00008000, 0x00004000, 0x00002000, 0x00001000,
- 0x00000800, 0x00000400, 0x00000200, 0x00000100,
- 0x00000080, 0x00000040, 0x00000020, 0x00000010,
- 0x00000008, 0x00000004, 0x00000002, 0x00000001
-};
-
-
-/*
- * Silly rewrite of 'bzero'. I do so
- * because some machines don't have
- * bzero and some don't have memset.
- */
-
-static void clearmem(char *start, int cnt)
- { while(cnt--)
- *start++ = '\0';
- }
-
-static int initialized = 0;
-
-/* lookup a 6 bit value in sbox */
-
-#define s_lookup(i,s) sbox[(i)][(((s)>>4) & 0x2)|((s) & 0x1)][((s)>>1) & 0xf];
-
-/*
- * Initialize unit - may be invoked directly
- * by fcrypt users.
- */
-
-static void ufc_init_des(void)
- { int comes_from_bit;
- int bit, sg;
- ufc_long j;
- ufc_long mask1, mask2;
-
- /*
- * Create the do_pc1 table used
- * to affect pc1 permutation
- * when generating keys
- */
- for(bit = 0; bit < 56; bit++) {
- comes_from_bit = pc1[bit] - 1;
- mask1 = bytemask[comes_from_bit % 8 + 1];
- mask2 = longmask[bit % 28 + 4];
- for(j = 0; j < 128; j++) {
- if(j & mask1)
- do_pc1[comes_from_bit / 8][bit / 28][j] |= mask2;
- }
- }
-
- /*
- * Create the do_pc2 table used
- * to affect pc2 permutation when
- * generating keys
- */
- for(bit = 0; bit < 48; bit++) {
- comes_from_bit = pc2[bit] - 1;
- mask1 = bytemask[comes_from_bit % 7 + 1];
- mask2 = BITMASK(bit % 24);
- for(j = 0; j < 128; j++) {
- if(j & mask1)
- do_pc2[comes_from_bit / 7][j] |= mask2;
- }
- }
-
- /*
- * Now generate the table used to do combined
- * 32 bit permutation and e expansion
- *
- * We use it because we have to permute 16384 32 bit
- * longs into 48 bit in order to initialize sb.
- *
- * Looping 48 rounds per permutation becomes
- * just too slow...
- *
- */
-
- clearmem((char*)eperm32tab, sizeof(eperm32tab));
-
- for(bit = 0; bit < 48; bit++) {
- ufc_long inner_mask1,comes_from;
-
- comes_from = perm32[esel[bit]-1]-1;
- inner_mask1 = bytemask[comes_from % 8];
-
- for(j = 256; j--;) {
- if(j & inner_mask1)
- eperm32tab[comes_from / 8][j][bit / 24] |= BITMASK(bit % 24);
- }
- }
-
- /*
- * Create the sb tables:
- *
- * For each 12 bit segment of an 48 bit intermediate
- * result, the sb table precomputes the two 4 bit
- * values of the sbox lookups done with the two 6
- * bit halves, shifts them to their proper place,
- * sends them through perm32 and finally E expands
- * them so that they are ready for the next
- * DES round.
- *
- */
- for(sg = 0; sg < 4; sg++) {
- int j1, j2;
- int s1, s2;
-
- for(j1 = 0; j1 < 64; j1++) {
- s1 = s_lookup(2 * sg, j1);
- for(j2 = 0; j2 < 64; j2++) {
- ufc_long to_permute, inx;
-
- s2 = s_lookup(2 * sg + 1, j2);
- to_permute = ((s1 << 4) | s2) << (24 - 8 * sg);
-
-#ifdef _UFC_32_
- inx = ((j1 << 6) | j2) << 1;
- sb[sg][inx ] = eperm32tab[0][(to_permute >> 24) & 0xff][0];
- sb[sg][inx+1] = eperm32tab[0][(to_permute >> 24) & 0xff][1];
- sb[sg][inx ] |= eperm32tab[1][(to_permute >> 16) & 0xff][0];
- sb[sg][inx+1] |= eperm32tab[1][(to_permute >> 16) & 0xff][1];
- sb[sg][inx ] |= eperm32tab[2][(to_permute >> 8) & 0xff][0];
- sb[sg][inx+1] |= eperm32tab[2][(to_permute >> 8) & 0xff][1];
- sb[sg][inx ] |= eperm32tab[3][(to_permute) & 0xff][0];
- sb[sg][inx+1] |= eperm32tab[3][(to_permute) & 0xff][1];
-#endif
-#ifdef _UFC_64_
- inx = ((j1 << 6) | j2);
- sb[sg][inx] =
- ((long64)eperm32tab[0][(to_permute >> 24) & 0xff][0] << 32) |
- (long64)eperm32tab[0][(to_permute >> 24) & 0xff][1];
- sb[sg][inx] |=
- ((long64)eperm32tab[1][(to_permute >> 16) & 0xff][0] << 32) |
- (long64)eperm32tab[1][(to_permute >> 16) & 0xff][1];
- sb[sg][inx] |=
- ((long64)eperm32tab[2][(to_permute >> 8) & 0xff][0] << 32) |
- (long64)eperm32tab[2][(to_permute >> 8) & 0xff][1];
- sb[sg][inx] |=
- ((long64)eperm32tab[3][(to_permute) & 0xff][0] << 32) |
- (long64)eperm32tab[3][(to_permute) & 0xff][1];
-#endif
- }
- }
- }
-
- /*
- * Create an inverse matrix for esel telling
- * where to plug out bits if undoing it
- */
- for(bit=48; bit--;) {
- e_inverse[esel[bit] - 1 ] = bit;
- e_inverse[esel[bit] - 1 + 32] = bit + 48;
- }
-
- /*
- * create efp: the matrix used to
- * undo the E expansion and effect final permutation
- */
- clearmem((char*)efp, sizeof efp);
- for(bit = 0; bit < 64; bit++) {
- int o_bit, o_long;
- ufc_long word_value, inner_mask1, inner_mask2;
- int comes_from_f_bit, comes_from_e_bit;
- int comes_from_word, bit_within_word;
-
- /* See where bit i belongs in the two 32 bit long's */
- o_long = bit / 32; /* 0..1 */
- o_bit = bit % 32; /* 0..31 */
-
- /*
- * And find a bit in the e permutated value setting this bit.
- *
- * Note: the e selection may have selected the same bit several
- * times. By the initialization of e_inverse, we only look
- * for one specific instance.
- */
- comes_from_f_bit = final_perm[bit] - 1; /* 0..63 */
- comes_from_e_bit = e_inverse[comes_from_f_bit]; /* 0..95 */
- comes_from_word = comes_from_e_bit / 6; /* 0..15 */
- bit_within_word = comes_from_e_bit % 6; /* 0..5 */
-
- inner_mask1 = longmask[bit_within_word + 26];
- inner_mask2 = longmask[o_bit];
-
- for(word_value = 64; word_value--;) {
- if(word_value & inner_mask1)
- efp[comes_from_word][word_value][o_long] |= inner_mask2;
- }
- }
- initialized++;
- }
-
-/*
- * Process the elements of the sb table permuting the
- * bits swapped in the expansion by the current salt.
- */
-
-#ifdef _UFC_32_
-static void shuffle_sb(long32 *k, ufc_long saltbits)
- { ufc_long j;
- long32 x;
- for(j=4096; j--;) {
- x = (k[0] ^ k[1]) & (long32)saltbits;
- *k++ ^= x;
- *k++ ^= x;
- }
- }
-#endif
-
-#ifdef _UFC_64_
-static void shuffle_sb(long64 *k, ufc_long saltbits)
- { ufc_long j;
- long64 x;
- for(j=4096; j--;) {
- x = ((*k >> 32) ^ *k) & (long64)saltbits;
- *k++ ^= (x << 32) | x;
- }
- }
-#endif
-
-/*
- * Setup the unit for a new salt
- * Hopefully we'll not see a new salt in each crypt call.
- */
-
-static unsigned char current_salt[3] = "&&"; /* invalid value */
-static ufc_long current_saltbits = 0;
-static int direction = 0;
-
-static void setup_salt(const char *s1)
- { ufc_long i, j, saltbits;
- const unsigned char *s2 = (const unsigned char *)s1;
-
- if(!initialized)
- ufc_init_des();
-
- if(s2[0] == current_salt[0] && s2[1] == current_salt[1])
- return;
- current_salt[0] = s2[0]; current_salt[1] = s2[1];
-
- /*
- * This is the only crypt change to DES:
- * entries are swapped in the expansion table
- * according to the bits set in the salt.
- */
- saltbits = 0;
- for(i = 0; i < 2; i++) {
- long c=ascii_to_bin(s2[i]);
- if(c < 0 || c > 63)
- c = 0;
- for(j = 0; j < 6; j++) {
- if((c >> j) & 0x1)
- saltbits |= BITMASK(6 * i + j);
- }
- }
-
- /*
- * Permute the sb table values
- * to reflect the changed e
- * selection table
- */
- shuffle_sb(_ufc_sb0, current_saltbits ^ saltbits);
- shuffle_sb(_ufc_sb1, current_saltbits ^ saltbits);
- shuffle_sb(_ufc_sb2, current_saltbits ^ saltbits);
- shuffle_sb(_ufc_sb3, current_saltbits ^ saltbits);
-
- current_saltbits = saltbits;
- }
-
-static void ufc_mk_keytab(char *key)
- { ufc_long v1, v2, *k1;
- int i;
-#ifdef _UFC_32_
- long32 v, *k2 = &_ufc_keytab[0][0];
-#endif
-#ifdef _UFC_64_
- long64 v, *k2 = &_ufc_keytab[0];
-#endif
-
- v1 = v2 = 0; k1 = &do_pc1[0][0][0];
- for(i = 8; i--;) {
- v1 |= k1[*key & 0x7f]; k1 += 128;
- v2 |= k1[*key++ & 0x7f]; k1 += 128;
- }
-
- for(i = 0; i < 16; i++) {
- k1 = &do_pc2[0][0];
-
- v1 = (v1 << rots[i]) | (v1 >> (28 - rots[i]));
- v = k1[(v1 >> 21) & 0x7f]; k1 += 128;
- v |= k1[(v1 >> 14) & 0x7f]; k1 += 128;
- v |= k1[(v1 >> 7) & 0x7f]; k1 += 128;
- v |= k1[(v1 ) & 0x7f]; k1 += 128;
-
-#ifdef _UFC_32_
- *k2++ = v;
- v = 0;
-#endif
-#ifdef _UFC_64_
- v <<= 32;
-#endif
-
- v2 = (v2 << rots[i]) | (v2 >> (28 - rots[i]));
- v |= k1[(v2 >> 21) & 0x7f]; k1 += 128;
- v |= k1[(v2 >> 14) & 0x7f]; k1 += 128;
- v |= k1[(v2 >> 7) & 0x7f]; k1 += 128;
- v |= k1[(v2 ) & 0x7f];
-
- *k2++ = v;
- }
-
- direction = 0;
- }
-
-/*
- * Undo an extra E selection and do final permutations
- */
-
-ufc_long *_ufc_dofinalperm(ufc_long l1, ufc_long l2, ufc_long r1, ufc_long r2)
- { ufc_long v1, v2, x;
- static ufc_long ary[2];
-
- x = (l1 ^ l2) & current_saltbits; l1 ^= x; l2 ^= x;
- x = (r1 ^ r2) & current_saltbits; r1 ^= x; r2 ^= x;
-
- v1=v2=0; l1 >>= 3; l2 >>= 3; r1 >>= 3; r2 >>= 3;
-
- v1 |= efp[15][ r2 & 0x3f][0]; v2 |= efp[15][ r2 & 0x3f][1];
- v1 |= efp[14][(r2 >>= 6) & 0x3f][0]; v2 |= efp[14][ r2 & 0x3f][1];
- v1 |= efp[13][(r2 >>= 10) & 0x3f][0]; v2 |= efp[13][ r2 & 0x3f][1];
- v1 |= efp[12][(r2 >>= 6) & 0x3f][0]; v2 |= efp[12][ r2 & 0x3f][1];
-
- v1 |= efp[11][ r1 & 0x3f][0]; v2 |= efp[11][ r1 & 0x3f][1];
- v1 |= efp[10][(r1 >>= 6) & 0x3f][0]; v2 |= efp[10][ r1 & 0x3f][1];
- v1 |= efp[ 9][(r1 >>= 10) & 0x3f][0]; v2 |= efp[ 9][ r1 & 0x3f][1];
- v1 |= efp[ 8][(r1 >>= 6) & 0x3f][0]; v2 |= efp[ 8][ r1 & 0x3f][1];
-
- v1 |= efp[ 7][ l2 & 0x3f][0]; v2 |= efp[ 7][ l2 & 0x3f][1];
- v1 |= efp[ 6][(l2 >>= 6) & 0x3f][0]; v2 |= efp[ 6][ l2 & 0x3f][1];
- v1 |= efp[ 5][(l2 >>= 10) & 0x3f][0]; v2 |= efp[ 5][ l2 & 0x3f][1];
- v1 |= efp[ 4][(l2 >>= 6) & 0x3f][0]; v2 |= efp[ 4][ l2 & 0x3f][1];
-
- v1 |= efp[ 3][ l1 & 0x3f][0]; v2 |= efp[ 3][ l1 & 0x3f][1];
- v1 |= efp[ 2][(l1 >>= 6) & 0x3f][0]; v2 |= efp[ 2][ l1 & 0x3f][1];
- v1 |= efp[ 1][(l1 >>= 10) & 0x3f][0]; v2 |= efp[ 1][ l1 & 0x3f][1];
- v1 |= efp[ 0][(l1 >>= 6) & 0x3f][0]; v2 |= efp[ 0][ l1 & 0x3f][1];
-
- ary[0] = v1; ary[1] = v2;
- return ary;
- }
-
-/*
- * crypt only: convert from 64 bit to 11 bit ASCII
- * prefixing with the salt
- */
-
-static char *output_conversion(ufc_long v1, ufc_long v2, const char *salt)
- { static char outbuf[14];
- int i, s;
-
- outbuf[0] = salt[0];
- outbuf[1] = salt[1] ? salt[1] : salt[0];
-
- for(i = 0; i < 5; i++)
- outbuf[i + 2] = bin_to_ascii((v1 >> (26 - 6 * i)) & 0x3f);
-
- s = (v2 & 0xf) << 2;
- v2 = (v2 >> 2) | ((v1 & 0x3) << 30);
-
- for(i = 5; i < 10; i++)
- outbuf[i + 2] = bin_to_ascii((v2 >> (56 - 6 * i)) & 0x3f);
-
- outbuf[12] = bin_to_ascii(s);
- outbuf[13] = 0;
-
- return outbuf;
- }
-
-/*
- * UNIX crypt function
- */
-
-static ufc_long *_ufc_doit(ufc_long , ufc_long, ufc_long, ufc_long, ufc_long);
-
-char *ufc_crypt(const char *key,const char *salt)
- { ufc_long *s;
- char ktab[9];
-
- /*
- * Hack DES tables according to salt
- */
- setup_salt(salt);
-
- /*
- * Setup key schedule
- */
- clearmem(ktab, sizeof ktab);
- StrnCpy(ktab, key, 8);
- ufc_mk_keytab(ktab);
-
- /*
- * Go for the 25 DES encryptions
- */
- s = _ufc_doit((ufc_long)0, (ufc_long)0,
- (ufc_long)0, (ufc_long)0, (ufc_long)25);
-
- /*
- * And convert back to 6 bit ASCII
- */
- return output_conversion(s[0], s[1], salt);
- }
-
-
-#ifdef _UFC_32_
-
-/*
- * 32 bit version
- */
-
-extern long32 _ufc_keytab[16][2];
-extern long32 _ufc_sb0[], _ufc_sb1[], _ufc_sb2[], _ufc_sb3[];
-
-#define SBA(sb, v) (*(long32*)((char*)(sb)+(v)))
-
-static ufc_long *_ufc_doit(ufc_long l1, ufc_long l2, ufc_long r1, ufc_long r2, ufc_long itr)
- { int i;
- long32 s, *k;
-
- while(itr--) {
- k = &_ufc_keytab[0][0];
- for(i=8; i--; ) {
- s = *k++ ^ r1;
- l1 ^= SBA(_ufc_sb1, s & 0xffff); l2 ^= SBA(_ufc_sb1, (s & 0xffff)+4);
- l1 ^= SBA(_ufc_sb0, s >>= 16); l2 ^= SBA(_ufc_sb0, (s) +4);
- s = *k++ ^ r2;
- l1 ^= SBA(_ufc_sb3, s & 0xffff); l2 ^= SBA(_ufc_sb3, (s & 0xffff)+4);
- l1 ^= SBA(_ufc_sb2, s >>= 16); l2 ^= SBA(_ufc_sb2, (s) +4);
-
- s = *k++ ^ l1;
- r1 ^= SBA(_ufc_sb1, s & 0xffff); r2 ^= SBA(_ufc_sb1, (s & 0xffff)+4);
- r1 ^= SBA(_ufc_sb0, s >>= 16); r2 ^= SBA(_ufc_sb0, (s) +4);
- s = *k++ ^ l2;
- r1 ^= SBA(_ufc_sb3, s & 0xffff); r2 ^= SBA(_ufc_sb3, (s & 0xffff)+4);
- r1 ^= SBA(_ufc_sb2, s >>= 16); r2 ^= SBA(_ufc_sb2, (s) +4);
- }
- s=l1; l1=r1; r1=s; s=l2; l2=r2; r2=s;
- }
- return _ufc_dofinalperm(l1, l2, r1, r2);
- }
-
-#endif
-
-#ifdef _UFC_64_
-
-/*
- * 64 bit version
- */
-
-extern long64 _ufc_keytab[16];
-extern long64 _ufc_sb0[], _ufc_sb1[], _ufc_sb2[], _ufc_sb3[];
-
-#define SBA(sb, v) (*(long64*)((char*)(sb)+(v)))
-
-static ufc_long *_ufc_doit(ufc_long l1, ufc_long l2, ufc_long r1, ufc_long r2, ufc_long itr)
- { int i;
- long64 l, r, s, *k;
-
- l = (((long64)l1) << 32) | ((long64)l2);
- r = (((long64)r1) << 32) | ((long64)r2);
-
- while(itr--) {
- k = &_ufc_keytab[0];
- for(i=8; i--; ) {
- s = *k++ ^ r;
- l ^= SBA(_ufc_sb3, (s >> 0) & 0xffff);
- l ^= SBA(_ufc_sb2, (s >> 16) & 0xffff);
- l ^= SBA(_ufc_sb1, (s >> 32) & 0xffff);
- l ^= SBA(_ufc_sb0, (s >> 48) & 0xffff);
-
- s = *k++ ^ l;
- r ^= SBA(_ufc_sb3, (s >> 0) & 0xffff);
- r ^= SBA(_ufc_sb2, (s >> 16) & 0xffff);
- r ^= SBA(_ufc_sb1, (s >> 32) & 0xffff);
- r ^= SBA(_ufc_sb0, (s >> 48) & 0xffff);
- }
- s=l; l=r; r=s;
- }
-
- l1 = l >> 32; l2 = l & 0xffffffff;
- r1 = r >> 32; r2 = r & 0xffffffff;
- return _ufc_dofinalperm(l1, l2, r1, r2);
- }
-
-#endif
-
-
-#else
- int ufc_dummy_procedure(void);
- int ufc_dummy_procedure(void) {return 0;}
-#endif
diff --git a/chromium/third_party/talloc/libreplace/crypt.m4 b/chromium/third_party/talloc/libreplace/crypt.m4
deleted file mode 100644
index fae2a586857..00000000000
--- a/chromium/third_party/talloc/libreplace/crypt.m4
+++ /dev/null
@@ -1,6 +0,0 @@
-###############################################
-# test for where we get crypt() from
-AC_CHECK_HEADERS(crypt.h)
-AC_SEARCH_LIBS_EXT(crypt, [crypt], CRYPT_LIBS,
- [ AC_DEFINE(HAVE_CRYPT,1,[Whether the system has the crypt() function]) ],
- [ LIBREPLACEOBJ="${LIBREPLACEOBJ} $libreplacedir/crypt.o" ])
diff --git a/chromium/third_party/talloc/libreplace/dlfcn.c b/chromium/third_party/talloc/libreplace/dlfcn.c
deleted file mode 100644
index 88431ed576d..00000000000
--- a/chromium/third_party/talloc/libreplace/dlfcn.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- Samba system utilities
- Copyright (C) Andrew Tridgell 1992-1998
- Copyright (C) Jeremy Allison 1998-2002
- Copyright (C) Jelmer Vernooij 2006
-
- ** NOTE! The following LGPL license applies to the replace
- ** library. This does NOT imply that all of Samba is released
- ** under the LGPL
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "replace.h"
-#ifdef HAVE_DL_H
-#include <dl.h>
-#endif
-
-#ifndef HAVE_DLOPEN
-#ifdef DLOPEN_TAKES_UNSIGNED_FLAGS
-void *rep_dlopen(const char *name, unsigned int flags)
-#else
-void *rep_dlopen(const char *name, int flags)
-#endif
-{
-#ifdef HAVE_SHL_LOAD
- if (name == NULL)
- return PROG_HANDLE;
- return (void *)shl_load(name, flags, 0);
-#else
- return NULL;
-#endif
-}
-#endif
-
-#ifndef HAVE_DLSYM
-void *rep_dlsym(void *handle, const char *symbol)
-{
-#ifdef HAVE_SHL_FINDSYM
- void *sym_addr;
- if (!shl_findsym((shl_t *)&handle, symbol, TYPE_UNDEFINED, &sym_addr))
- return sym_addr;
-#endif
- return NULL;
-}
-#endif
-
-#ifndef HAVE_DLERROR
-char *rep_dlerror(void)
-{
- return "dynamic loading of objects not supported on this platform";
-}
-#endif
-
-#ifndef HAVE_DLCLOSE
-int rep_dlclose(void *handle)
-{
-#ifdef HAVE_SHL_CLOSE
- return shl_unload((shl_t)handle);
-#else
- return 0;
-#endif
-}
-#endif
diff --git a/chromium/third_party/talloc/libreplace/dlfcn.m4 b/chromium/third_party/talloc/libreplace/dlfcn.m4
deleted file mode 100644
index 722e0246b79..00000000000
--- a/chromium/third_party/talloc/libreplace/dlfcn.m4
+++ /dev/null
@@ -1,31 +0,0 @@
-dnl dummies provided by dlfcn.c if not available
-save_LIBS="$LIBS"
-LIBS=""
-
-libreplace_cv_dlfcn=no
-AC_SEARCH_LIBS(dlopen, dl)
-
-AC_CHECK_HEADERS(dlfcn.h)
-AC_CHECK_FUNCS([dlopen dlsym dlerror dlclose],[],[libreplace_cv_dlfcn=yes])
-
-libreplace_cv_shl=no
-AC_SEARCH_LIBS(shl_load, sl)
-AC_CHECK_HEADERS(dl.h)
-AC_CHECK_FUNCS([shl_load shl_unload shl_findsym],[],[libreplace_cv_shl=yes])
-
-AC_VERIFY_C_PROTOTYPE([void *dlopen(const char* filename, unsigned int flags)],
- [
- return 0;
- ],[
- AC_DEFINE(DLOPEN_TAKES_UNSIGNED_FLAGS, 1, [Whether dlopen takes unsigned int flags])
- ],[],[
- #include <dlfcn.h>
- ])
-
-if test x"${libreplace_cv_dlfcn}" = x"yes";then
- LIBREPLACEOBJ="${LIBREPLACEOBJ} $libreplacedir/dlfcn.o"
-fi
-
-LIBDL="$LIBS"
-AC_SUBST(LIBDL)
-LIBS="$save_LIBS"
diff --git a/chromium/third_party/talloc/libreplace/getaddrinfo.c b/chromium/third_party/talloc/libreplace/getaddrinfo.c
deleted file mode 100644
index c5cd52be93c..00000000000
--- a/chromium/third_party/talloc/libreplace/getaddrinfo.c
+++ /dev/null
@@ -1,497 +0,0 @@
-/*
-PostgreSQL Database Management System
-(formerly known as Postgres, then as Postgres95)
-
-Portions Copyright (c) 1996-2005, The PostgreSQL Global Development Group
-
-Portions Copyright (c) 1994, The Regents of the University of California
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose, without fee, and without a written agreement
-is hereby granted, provided that the above copyright notice and this paragraph
-and the following two paragraphs appear in all copies.
-
-IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
-DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
-LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
-EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
-THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
-INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
-ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS
-TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-
-*/
-
-/*-------------------------------------------------------------------------
- *
- * getaddrinfo.c
- * Support getaddrinfo() on platforms that don't have it.
- *
- * We also supply getnameinfo() here, assuming that the platform will have
- * it if and only if it has getaddrinfo(). If this proves false on some
- * platform, we'll need to split this file and provide a separate configure
- * test for getnameinfo().
- *
- * Copyright (c) 2003-2007, PostgreSQL Global Development Group
- *
- * Copyright (C) 2007 Jeremy Allison.
- * Modified to return multiple IPv4 addresses for Samba.
- *
- *-------------------------------------------------------------------------
- */
-
-#include "replace.h"
-#include "system/network.h"
-
-#ifndef SMB_MALLOC
-#define SMB_MALLOC(s) malloc(s)
-#endif
-
-#ifndef SMB_STRDUP
-#define SMB_STRDUP(s) strdup(s)
-#endif
-
-static int check_hostent_err(struct hostent *hp)
-{
- if (!hp) {
- switch (h_errno) {
- case HOST_NOT_FOUND:
- case NO_DATA:
- return EAI_NONAME;
- case TRY_AGAIN:
- return EAI_AGAIN;
- case NO_RECOVERY:
- default:
- return EAI_FAIL;
- }
- }
- if (!hp->h_name || hp->h_addrtype != AF_INET) {
- return EAI_FAIL;
- }
- return 0;
-}
-
-static char *canon_name_from_hostent(struct hostent *hp,
- int *perr)
-{
- char *ret = NULL;
-
- *perr = check_hostent_err(hp);
- if (*perr) {
- return NULL;
- }
- ret = SMB_STRDUP(hp->h_name);
- if (!ret) {
- *perr = EAI_MEMORY;
- }
- return ret;
-}
-
-static char *get_my_canon_name(int *perr)
-{
- char name[HOST_NAME_MAX+1];
-
- if (gethostname(name, HOST_NAME_MAX) == -1) {
- *perr = EAI_FAIL;
- return NULL;
- }
- /* Ensure null termination. */
- name[HOST_NAME_MAX] = '\0';
- return canon_name_from_hostent(gethostbyname(name), perr);
-}
-
-static char *get_canon_name_from_addr(struct in_addr ip,
- int *perr)
-{
- return canon_name_from_hostent(
- gethostbyaddr(&ip, sizeof(ip), AF_INET),
- perr);
-}
-
-static struct addrinfo *alloc_entry(const struct addrinfo *hints,
- struct in_addr ip,
- unsigned short port)
-{
- struct sockaddr_in *psin = NULL;
- struct addrinfo *ai = SMB_MALLOC(sizeof(*ai));
-
- if (!ai) {
- return NULL;
- }
- memset(ai, '\0', sizeof(*ai));
-
- psin = SMB_MALLOC(sizeof(*psin));
- if (!psin) {
- free(ai);
- return NULL;
- }
-
- memset(psin, '\0', sizeof(*psin));
-
- psin->sin_family = AF_INET;
- psin->sin_port = htons(port);
- psin->sin_addr = ip;
-
- ai->ai_flags = 0;
- ai->ai_family = AF_INET;
- ai->ai_socktype = hints->ai_socktype;
- ai->ai_protocol = hints->ai_protocol;
- ai->ai_addrlen = sizeof(*psin);
- ai->ai_addr = (struct sockaddr *) psin;
- ai->ai_canonname = NULL;
- ai->ai_next = NULL;
-
- return ai;
-}
-
-/*
- * get address info for a single ipv4 address.
- *
- * Bugs: - servname can only be a number, not text.
- */
-
-static int getaddr_info_single_addr(const char *service,
- uint32_t addr,
- const struct addrinfo *hints,
- struct addrinfo **res)
-{
-
- struct addrinfo *ai = NULL;
- struct in_addr ip;
- unsigned short port = 0;
-
- if (service) {
- port = (unsigned short)atoi(service);
- }
- ip.s_addr = htonl(addr);
-
- ai = alloc_entry(hints, ip, port);
- if (!ai) {
- return EAI_MEMORY;
- }
-
- /* If we're asked for the canonical name,
- * make sure it returns correctly. */
- if (!(hints->ai_flags & AI_NUMERICSERV) &&
- hints->ai_flags & AI_CANONNAME) {
- int err;
- if (addr == INADDR_LOOPBACK || addr == INADDR_ANY) {
- ai->ai_canonname = get_my_canon_name(&err);
- } else {
- ai->ai_canonname =
- get_canon_name_from_addr(ip,&err);
- }
- if (ai->ai_canonname == NULL) {
- freeaddrinfo(ai);
- return err;
- }
- }
-
- *res = ai;
- return 0;
-}
-
-/*
- * get address info for multiple ipv4 addresses.
- *
- * Bugs: - servname can only be a number, not text.
- */
-
-static int getaddr_info_name(const char *node,
- const char *service,
- const struct addrinfo *hints,
- struct addrinfo **res)
-{
- struct addrinfo *listp = NULL, *prevp = NULL;
- char **pptr = NULL;
- int err;
- struct hostent *hp = NULL;
- unsigned short port = 0;
-
- if (service) {
- port = (unsigned short)atoi(service);
- }
-
- hp = gethostbyname(node);
- err = check_hostent_err(hp);
- if (err) {
- return err;
- }
-
- for(pptr = hp->h_addr_list; *pptr; pptr++) {
- struct in_addr ip = *(struct in_addr *)*pptr;
- struct addrinfo *ai = alloc_entry(hints, ip, port);
-
- if (!ai) {
- freeaddrinfo(listp);
- return EAI_MEMORY;
- }
-
- if (!listp) {
- listp = ai;
- prevp = ai;
- ai->ai_canonname = SMB_STRDUP(hp->h_name);
- if (!ai->ai_canonname) {
- freeaddrinfo(listp);
- return EAI_MEMORY;
- }
- } else {
- prevp->ai_next = ai;
- prevp = ai;
- }
- }
- *res = listp;
- return 0;
-}
-
-/*
- * get address info for ipv4 sockets.
- *
- * Bugs: - servname can only be a number, not text.
- */
-
-int rep_getaddrinfo(const char *node,
- const char *service,
- const struct addrinfo * hintp,
- struct addrinfo ** res)
-{
- struct addrinfo hints;
-
- /* Setup the hints struct. */
- if (hintp == NULL) {
- memset(&hints, 0, sizeof(hints));
- hints.ai_family = AF_INET;
- hints.ai_socktype = SOCK_STREAM;
- } else {
- memcpy(&hints, hintp, sizeof(hints));
- }
-
- if (hints.ai_family != AF_INET && hints.ai_family != AF_UNSPEC) {
- return EAI_FAMILY;
- }
-
- if (hints.ai_socktype == 0) {
- hints.ai_socktype = SOCK_STREAM;
- }
-
- if (!node && !service) {
- return EAI_NONAME;
- }
-
- if (node) {
- if (node[0] == '\0') {
- return getaddr_info_single_addr(service,
- INADDR_ANY,
- &hints,
- res);
- } else if (hints.ai_flags & AI_NUMERICHOST) {
- struct in_addr ip;
- if (!inet_aton(node, &ip)) {
- return EAI_FAIL;
- }
- return getaddr_info_single_addr(service,
- ntohl(ip.s_addr),
- &hints,
- res);
- } else {
- return getaddr_info_name(node,
- service,
- &hints,
- res);
- }
- } else if (hints.ai_flags & AI_PASSIVE) {
- return getaddr_info_single_addr(service,
- INADDR_ANY,
- &hints,
- res);
- }
- return getaddr_info_single_addr(service,
- INADDR_LOOPBACK,
- &hints,
- res);
-}
-
-
-void rep_freeaddrinfo(struct addrinfo *res)
-{
- struct addrinfo *next = NULL;
-
- for (;res; res = next) {
- next = res->ai_next;
- if (res->ai_canonname) {
- free(res->ai_canonname);
- }
- if (res->ai_addr) {
- free(res->ai_addr);
- }
- free(res);
- }
-}
-
-
-const char *rep_gai_strerror(int errcode)
-{
-#ifdef HAVE_HSTRERROR
- int hcode;
-
- switch (errcode)
- {
- case EAI_NONAME:
- hcode = HOST_NOT_FOUND;
- break;
- case EAI_AGAIN:
- hcode = TRY_AGAIN;
- break;
- case EAI_FAIL:
- default:
- hcode = NO_RECOVERY;
- break;
- }
-
- return hstrerror(hcode);
-#else /* !HAVE_HSTRERROR */
-
- switch (errcode)
- {
- case EAI_NONAME:
- return "Unknown host";
- case EAI_AGAIN:
- return "Host name lookup failure";
-#ifdef EAI_BADFLAGS
- case EAI_BADFLAGS:
- return "Invalid argument";
-#endif
-#ifdef EAI_FAMILY
- case EAI_FAMILY:
- return "Address family not supported";
-#endif
-#ifdef EAI_MEMORY
- case EAI_MEMORY:
- return "Not enough memory";
-#endif
-#ifdef EAI_NODATA
- case EAI_NODATA:
- return "No host data of that type was found";
-#endif
-#ifdef EAI_SERVICE
- case EAI_SERVICE:
- return "Class type not found";
-#endif
-#ifdef EAI_SOCKTYPE
- case EAI_SOCKTYPE:
- return "Socket type not supported";
-#endif
- default:
- return "Unknown server error";
- }
-#endif /* HAVE_HSTRERROR */
-}
-
-static int gethostnameinfo(const struct sockaddr *sa,
- char *node,
- size_t nodelen,
- int flags)
-{
- int ret = -1;
- char *p = NULL;
-
- if (!(flags & NI_NUMERICHOST)) {
- struct hostent *hp = gethostbyaddr(
- &((struct sockaddr_in *)sa)->sin_addr,
- sizeof(struct in_addr),
- sa->sa_family);
- ret = check_hostent_err(hp);
- if (ret == 0) {
- /* Name looked up successfully. */
- ret = snprintf(node, nodelen, "%s", hp->h_name);
- if (ret < 0 || (size_t)ret >= nodelen) {
- return EAI_MEMORY;
- }
- if (flags & NI_NOFQDN) {
- p = strchr(node,'.');
- if (p) {
- *p = '\0';
- }
- }
- return 0;
- }
-
- if (flags & NI_NAMEREQD) {
- /* If we require a name and didn't get one,
- * automatically fail. */
- return ret;
- }
- /* Otherwise just fall into the numeric host code... */
- }
- p = inet_ntoa(((struct sockaddr_in *)sa)->sin_addr);
- ret = snprintf(node, nodelen, "%s", p);
- if (ret < 0 || (size_t)ret >= nodelen) {
- return EAI_MEMORY;
- }
- return 0;
-}
-
-static int getservicenameinfo(const struct sockaddr *sa,
- char *service,
- size_t servicelen,
- int flags)
-{
- int ret = -1;
- int port = ntohs(((struct sockaddr_in *)sa)->sin_port);
-
- if (!(flags & NI_NUMERICSERV)) {
- struct servent *se = getservbyport(
- port,
- (flags & NI_DGRAM) ? "udp" : "tcp");
- if (se && se->s_name) {
- /* Service name looked up successfully. */
- ret = snprintf(service, servicelen, "%s", se->s_name);
- if (ret < 0 || (size_t)ret >= servicelen) {
- return EAI_MEMORY;
- }
- return 0;
- }
- /* Otherwise just fall into the numeric service code... */
- }
- ret = snprintf(service, servicelen, "%d", port);
- if (ret < 0 || (size_t)ret >= servicelen) {
- return EAI_MEMORY;
- }
- return 0;
-}
-
-/*
- * Convert an ipv4 address to a hostname.
- *
- * Bugs: - No IPv6 support.
- */
-int rep_getnameinfo(const struct sockaddr *sa, socklen_t salen,
- char *node, size_t nodelen,
- char *service, size_t servicelen, int flags)
-{
-
- /* Invalid arguments. */
- if (sa == NULL || (node == NULL && service == NULL)) {
- return EAI_FAIL;
- }
-
- if (sa->sa_family != AF_INET) {
- return EAI_FAIL;
- }
-
- if (salen < sizeof(struct sockaddr_in)) {
- return EAI_FAIL;
- }
-
- if (node) {
- return gethostnameinfo(sa, node, nodelen, flags);
- }
-
- if (service) {
- return getservicenameinfo(sa, service, servicelen, flags);
- }
- return 0;
-}
diff --git a/chromium/third_party/talloc/libreplace/getaddrinfo.h b/chromium/third_party/talloc/libreplace/getaddrinfo.h
deleted file mode 100644
index cf040da2db4..00000000000
--- a/chromium/third_party/talloc/libreplace/getaddrinfo.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
-PostgreSQL Database Management System
-(formerly known as Postgres, then as Postgres95)
-
-Portions Copyright (c) 1996-2005, The PostgreSQL Global Development Group
-
-Portions Copyright (c) 1994, The Regents of the University of California
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose, without fee, and without a written agreement
-is hereby granted, provided that the above copyright notice and this paragraph
-and the following two paragraphs appear in all copies.
-
-IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
-DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
-LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
-EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
-THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
-INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
-ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS
-TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-
-*/
-
-/*-------------------------------------------------------------------------
- *
- * getaddrinfo.h
- * Support getaddrinfo() on platforms that don't have it.
- *
- * Note: we use our own routines on platforms that don't HAVE_STRUCT_ADDRINFO,
- * whether or not the library routine getaddrinfo() can be found. This
- * policy is needed because on some platforms a manually installed libbind.a
- * may provide getaddrinfo(), yet the system headers may not provide the
- * struct definitions needed to call it. To avoid conflict with the libbind
- * definition in such cases, we rename our routines to pg_xxx() via macros.
- *
-
-in lib/replace we use rep_xxx()
-
- * This code will also work on platforms where struct addrinfo is defined
- * in the system headers but no getaddrinfo() can be located.
- *
- * Copyright (c) 2003-2007, PostgreSQL Global Development Group
- *
- *-------------------------------------------------------------------------
- */
-#ifndef GETADDRINFO_H
-#define GETADDRINFO_H
-
-#ifndef HAVE_GETADDRINFO
-
-/* Rename private copies per comments above */
-#ifdef getaddrinfo
-#undef getaddrinfo
-#endif
-#define getaddrinfo rep_getaddrinfo
-#define HAVE_GETADDRINFO
-
-#ifdef freeaddrinfo
-#undef freeaddrinfo
-#endif
-#define freeaddrinfo rep_freeaddrinfo
-#define HAVE_FREEADDRINFO
-
-#ifdef gai_strerror
-#undef gai_strerror
-#endif
-#define gai_strerror rep_gai_strerror
-#define HAVE_GAI_STRERROR
-
-#ifdef getnameinfo
-#undef getnameinfo
-#endif
-#define getnameinfo rep_getnameinfo
-#ifndef HAVE_GETNAMEINFO
-#define HAVE_GETNAMEINFO
-#endif
-
-extern int rep_getaddrinfo(const char *node, const char *service,
- const struct addrinfo * hints, struct addrinfo ** res);
-extern void rep_freeaddrinfo(struct addrinfo * res);
-extern const char *rep_gai_strerror(int errcode);
-extern int rep_getnameinfo(const struct sockaddr * sa, socklen_t salen,
- char *node, size_t nodelen,
- char *service, size_t servicelen, int flags);
-#endif /* HAVE_GETADDRINFO */
-
-#endif /* GETADDRINFO_H */
diff --git a/chromium/third_party/talloc/libreplace/getifaddrs.c b/chromium/third_party/talloc/libreplace/getifaddrs.c
deleted file mode 100644
index 3a91bb40d2a..00000000000
--- a/chromium/third_party/talloc/libreplace/getifaddrs.c
+++ /dev/null
@@ -1,352 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- Samba utility functions
- Copyright (C) Andrew Tridgell 1998
- Copyright (C) Jeremy Allison 2007
- Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007
-
- 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 <http://www.gnu.org/licenses/>.
-*/
-
-#define SOCKET_WRAPPER_NOT_REPLACE
-
-#include "replace.h"
-#include "system/network.h"
-
-#include <unistd.h>
-#include <stdio.h>
-#include <sys/types.h>
-
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-
-#ifndef SIOCGIFCONF
-#ifdef HAVE_SYS_SOCKIO_H
-#include <sys/sockio.h>
-#endif
-#endif
-
-#ifdef HAVE_IFACE_GETIFADDRS
-#define _FOUND_IFACE_ANY
-#else
-
-void rep_freeifaddrs(struct ifaddrs *ifp)
-{
- if (ifp != NULL) {
- free(ifp->ifa_name);
- free(ifp->ifa_addr);
- free(ifp->ifa_netmask);
- free(ifp->ifa_dstaddr);
- freeifaddrs(ifp->ifa_next);
- free(ifp);
- }
-}
-
-static struct sockaddr *sockaddr_dup(struct sockaddr *sa)
-{
- struct sockaddr *ret;
- socklen_t socklen;
-#ifdef HAVE_SOCKADDR_SA_LEN
- socklen = sa->sa_len;
-#else
- socklen = sizeof(struct sockaddr_storage);
-#endif
- ret = calloc(1, socklen);
- if (ret == NULL)
- return NULL;
- memcpy(ret, sa, socklen);
- return ret;
-}
-#endif
-
-#if HAVE_IFACE_IFCONF
-
-/* this works for Linux 2.2, Solaris 2.5, SunOS4, HPUX 10.20, OSF1
- V4.0, Ultrix 4.4, SCO Unix 3.2, IRIX 6.4 and FreeBSD 3.2.
-
- It probably also works on any BSD style system. */
-
-int rep_getifaddrs(struct ifaddrs **ifap)
-{
- struct ifconf ifc;
- char buff[8192];
- int fd, i, n;
- struct ifreq *ifr=NULL;
- struct ifaddrs *curif;
- struct ifaddrs *lastif = NULL;
-
- *ifap = NULL;
-
- if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) {
- return -1;
- }
-
- ifc.ifc_len = sizeof(buff);
- ifc.ifc_buf = buff;
-
- if (ioctl(fd, SIOCGIFCONF, &ifc) != 0) {
- close(fd);
- return -1;
- }
-
- ifr = ifc.ifc_req;
-
- n = ifc.ifc_len / sizeof(struct ifreq);
-
- /* Loop through interfaces, looking for given IP address */
- for (i=n-1; i>=0; i--) {
- if (ioctl(fd, SIOCGIFFLAGS, &ifr[i]) == -1) {
- freeifaddrs(*ifap);
- return -1;
- }
-
- curif = calloc(1, sizeof(struct ifaddrs));
- curif->ifa_name = strdup(ifr[i].ifr_name);
- curif->ifa_flags = ifr[i].ifr_flags;
- curif->ifa_dstaddr = NULL;
- curif->ifa_data = NULL;
- curif->ifa_next = NULL;
-
- curif->ifa_addr = NULL;
- if (ioctl(fd, SIOCGIFADDR, &ifr[i]) != -1) {
- curif->ifa_addr = sockaddr_dup(&ifr[i].ifr_addr);
- }
-
- curif->ifa_netmask = NULL;
- if (ioctl(fd, SIOCGIFNETMASK, &ifr[i]) != -1) {
- curif->ifa_netmask = sockaddr_dup(&ifr[i].ifr_addr);
- }
-
- if (lastif == NULL) {
- *ifap = curif;
- } else {
- lastif->ifa_next = curif;
- }
- lastif = curif;
- }
-
- close(fd);
-
- return 0;
-}
-
-#define _FOUND_IFACE_ANY
-#endif /* HAVE_IFACE_IFCONF */
-#ifdef HAVE_IFACE_IFREQ
-
-#ifndef I_STR
-#include <sys/stropts.h>
-#endif
-
-/****************************************************************************
-this should cover most of the streams based systems
-Thanks to Andrej.Borsenkow@mow.siemens.ru for several ideas in this code
-****************************************************************************/
-int rep_getifaddrs(struct ifaddrs **ifap)
-{
- struct ifreq ifreq;
- struct strioctl strioctl;
- char buff[8192];
- int fd, i, n;
- struct ifreq *ifr=NULL;
- struct ifaddrs *curif;
- struct ifaddrs *lastif = NULL;
-
- *ifap = NULL;
-
- if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) {
- return -1;
- }
-
- strioctl.ic_cmd = SIOCGIFCONF;
- strioctl.ic_dp = buff;
- strioctl.ic_len = sizeof(buff);
- if (ioctl(fd, I_STR, &strioctl) < 0) {
- close(fd);
- return -1;
- }
-
- /* we can ignore the possible sizeof(int) here as the resulting
- number of interface structures won't change */
- n = strioctl.ic_len / sizeof(struct ifreq);
-
- /* we will assume that the kernel returns the length as an int
- at the start of the buffer if the offered size is a
- multiple of the structure size plus an int */
- if (n*sizeof(struct ifreq) + sizeof(int) == strioctl.ic_len) {
- ifr = (struct ifreq *)(buff + sizeof(int));
- } else {
- ifr = (struct ifreq *)buff;
- }
-
- /* Loop through interfaces */
-
- for (i = 0; i<n; i++) {
- ifreq = ifr[i];
-
- curif = calloc(1, sizeof(struct ifaddrs));
- if (lastif == NULL) {
- *ifap = curif;
- } else {
- lastif->ifa_next = curif;
- }
-
- strioctl.ic_cmd = SIOCGIFFLAGS;
- strioctl.ic_dp = (char *)&ifreq;
- strioctl.ic_len = sizeof(struct ifreq);
- if (ioctl(fd, I_STR, &strioctl) != 0) {
- freeifaddrs(*ifap);
- return -1;
- }
-
- curif->ifa_flags = ifreq.ifr_flags;
-
- strioctl.ic_cmd = SIOCGIFADDR;
- strioctl.ic_dp = (char *)&ifreq;
- strioctl.ic_len = sizeof(struct ifreq);
- if (ioctl(fd, I_STR, &strioctl) != 0) {
- freeifaddrs(*ifap);
- return -1;
- }
-
- curif->ifa_name = strdup(ifreq.ifr_name);
- curif->ifa_addr = sockaddr_dup(&ifreq.ifr_addr);
- curif->ifa_dstaddr = NULL;
- curif->ifa_data = NULL;
- curif->ifa_next = NULL;
- curif->ifa_netmask = NULL;
-
- strioctl.ic_cmd = SIOCGIFNETMASK;
- strioctl.ic_dp = (char *)&ifreq;
- strioctl.ic_len = sizeof(struct ifreq);
- if (ioctl(fd, I_STR, &strioctl) != 0) {
- freeifaddrs(*ifap);
- return -1;
- }
-
- curif->ifa_netmask = sockaddr_dup(&ifreq.ifr_addr);
-
- lastif = curif;
- }
-
- close(fd);
-
- return 0;
-}
-
-#define _FOUND_IFACE_ANY
-#endif /* HAVE_IFACE_IFREQ */
-#ifdef HAVE_IFACE_AIX
-
-/****************************************************************************
-this one is for AIX (tested on 4.2)
-****************************************************************************/
-int rep_getifaddrs(struct ifaddrs **ifap)
-{
- char buff[8192];
- int fd, i;
- struct ifconf ifc;
- struct ifreq *ifr=NULL;
- struct ifaddrs *curif;
- struct ifaddrs *lastif = NULL;
-
- *ifap = NULL;
-
- if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) {
- return -1;
- }
-
- ifc.ifc_len = sizeof(buff);
- ifc.ifc_buf = buff;
-
- if (ioctl(fd, SIOCGIFCONF, &ifc) != 0) {
- close(fd);
- return -1;
- }
-
- ifr = ifc.ifc_req;
-
- /* Loop through interfaces */
- i = ifc.ifc_len;
-
- while (i > 0) {
- uint_t inc;
-
- inc = ifr->ifr_addr.sa_len;
-
- if (ioctl(fd, SIOCGIFADDR, ifr) != 0) {
- freeaddrinfo(*ifap);
- return -1;
- }
-
- curif = calloc(1, sizeof(struct ifaddrs));
- if (lastif == NULL) {
- *ifap = curif;
- } else {
- lastif->ifa_next = curif;
- }
-
- curif->ifa_name = strdup(ifr->ifr_name);
- curif->ifa_addr = sockaddr_dup(&ifr->ifr_addr);
- curif->ifa_dstaddr = NULL;
- curif->ifa_data = NULL;
- curif->ifa_netmask = NULL;
- curif->ifa_next = NULL;
-
- if (ioctl(fd, SIOCGIFFLAGS, ifr) != 0) {
- freeaddrinfo(*ifap);
- return -1;
- }
-
- curif->ifa_flags = ifr->ifr_flags;
-
- if (ioctl(fd, SIOCGIFNETMASK, ifr) != 0) {
- freeaddrinfo(*ifap);
- return -1;
- }
-
- curif->ifa_netmask = sockaddr_dup(&ifr->ifr_addr);
-
- lastif = curif;
-
- next:
- /*
- * Patch from Archie Cobbs (archie@whistle.com). The
- * addresses in the SIOCGIFCONF interface list have a
- * minimum size. Usually this doesn't matter, but if
- * your machine has tunnel interfaces, etc. that have
- * a zero length "link address", this does matter. */
-
- if (inc < sizeof(ifr->ifr_addr))
- inc = sizeof(ifr->ifr_addr);
- inc += IFNAMSIZ;
-
- ifr = (struct ifreq*) (((char*) ifr) + inc);
- i -= inc;
- }
-
- close(fd);
- return 0;
-}
-
-#define _FOUND_IFACE_ANY
-#endif /* HAVE_IFACE_AIX */
-#ifndef _FOUND_IFACE_ANY
-int rep_getifaddrs(struct ifaddrs **ifap)
-{
- errno = ENOSYS;
- return -1;
-}
-#endif
diff --git a/chromium/third_party/talloc/libreplace/getpass.c b/chromium/third_party/talloc/libreplace/getpass.c
deleted file mode 100644
index 0be618fc916..00000000000
--- a/chromium/third_party/talloc/libreplace/getpass.c
+++ /dev/null
@@ -1,222 +0,0 @@
-/* Copyright (C) 1992-1998 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public License as
-published by the Free Software Foundation; either version 3 of the
-License, or (at your option) any later version.
-
-The GNU C Library 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with the GNU C Library; see the file COPYING.LIB. If
-not, see <http://www.gnu.org/licenses/>. */
-
-/* Modified to use with samba by Jeremy Allison, 8th July 1995. */
-
-#include "replace.h"
-#include "system/filesys.h"
-#include "system/wait.h"
-#include "system/terminal.h"
-#include "system/passwd.h"
-
-/*
- * Define additional missing types
- */
-#ifndef HAVE_SIG_ATOMIC_T_TYPE
-typedef int sig_atomic_t;
-#endif
-
-#ifndef SIGCLD
-#define SIGCLD SIGCHLD
-#endif
-
-#ifndef SIGNAL_CAST
-#define SIGNAL_CAST (RETSIGTYPE (*)(int))
-#endif
-
-#ifdef SYSV_TERMIO
-
-/* SYSTEM V TERMIO HANDLING */
-
-static struct termio t;
-
-#define ECHO_IS_ON(t) ((t).c_lflag & ECHO)
-#define TURN_ECHO_OFF(t) ((t).c_lflag &= ~ECHO)
-#define TURN_ECHO_ON(t) ((t).c_lflag |= ECHO)
-
-#ifndef TCSAFLUSH
-#define TCSAFLUSH 1
-#endif
-
-#ifndef TCSANOW
-#define TCSANOW 0
-#endif
-
-static int tcgetattr(int fd, struct termio *_t)
-{
- return ioctl(fd, TCGETA, _t);
-}
-
-static int tcsetattr(int fd, int flags, struct termio *_t)
-{
- if(flags & TCSAFLUSH)
- ioctl(fd, TCFLSH, TCIOFLUSH);
- return ioctl(fd, TCSETS, _t);
-}
-
-#elif !defined(TCSAFLUSH)
-
-/* BSD TERMIO HANDLING */
-
-static struct sgttyb t;
-
-#define ECHO_IS_ON(t) ((t).sg_flags & ECHO)
-#define TURN_ECHO_OFF(t) ((t).sg_flags &= ~ECHO)
-#define TURN_ECHO_ON(t) ((t).sg_flags |= ECHO)
-
-#define TCSAFLUSH 1
-#define TCSANOW 0
-
-static int tcgetattr(int fd, struct sgttyb *_t)
-{
- return ioctl(fd, TIOCGETP, (char *)_t);
-}
-
-static int tcsetattr(int fd, int flags, struct sgttyb *_t)
-{
- return ioctl(fd, TIOCSETP, (char *)_t);
-}
-
-#else /* POSIX TERMIO HANDLING */
-#define ECHO_IS_ON(t) ((t).c_lflag & ECHO)
-#define TURN_ECHO_OFF(t) ((t).c_lflag &= ~ECHO)
-#define TURN_ECHO_ON(t) ((t).c_lflag |= ECHO)
-
-static struct termios t;
-#endif /* SYSV_TERMIO */
-
-static void catch_signal(int signum,void (*handler)(int ))
-{
-#ifdef HAVE_SIGACTION
- struct sigaction act;
- struct sigaction oldact;
-
- memset(&act, 0, sizeof(act));
-
- act.sa_handler = handler;
-#ifdef SA_RESTART
- /*
- * We *want* SIGALRM to interrupt a system call.
- */
- if(signum != SIGALRM)
- act.sa_flags = SA_RESTART;
-#endif
- sigemptyset(&act.sa_mask);
- sigaddset(&act.sa_mask,signum);
- sigaction(signum,&act,&oldact);
-#else /* !HAVE_SIGACTION */
- /* FIXME: need to handle sigvec and systems with broken signal() */
- signal(signum, handler);
-#endif
-}
-
-static sig_atomic_t gotintr;
-static int in_fd = -1;
-
-/***************************************************************
- Signal function to tell us were ^C'ed.
-****************************************************************/
-
-static void gotintr_sig(void)
-{
- gotintr = 1;
- if (in_fd != -1)
- close(in_fd); /* Safe way to force a return. */
- in_fd = -1;
-}
-
-char *rep_getpass(const char *prompt)
-{
- FILE *in, *out;
- int echo_off;
- static char buf[256];
- static size_t bufsize = sizeof(buf);
- size_t nread;
-
- /* Catch problematic signals */
- catch_signal(SIGINT, SIGNAL_CAST gotintr_sig);
-
- /* Try to write to and read from the terminal if we can.
- If we can't open the terminal, use stderr and stdin. */
-
- in = fopen ("/dev/tty", "w+");
- if (in == NULL) {
- in = stdin;
- out = stderr;
- } else {
- out = in;
- }
-
- setvbuf(in, NULL, _IONBF, 0);
-
- /* Turn echoing off if it is on now. */
-
- if (tcgetattr (fileno (in), &t) == 0) {
- if (ECHO_IS_ON(t)) {
- TURN_ECHO_OFF(t);
- echo_off = tcsetattr (fileno (in), TCSAFLUSH, &t) == 0;
- TURN_ECHO_ON(t);
- } else {
- echo_off = 0;
- }
- } else {
- echo_off = 0;
- }
-
- /* Write the prompt. */
- fputs(prompt, out);
- fflush(out);
-
- /* Read the password. */
- buf[0] = 0;
- if (!gotintr) {
- in_fd = fileno(in);
- if (fgets(buf, bufsize, in) == NULL) {
- buf[0] = 0;
- }
- }
- nread = strlen(buf);
- if (nread) {
- if (buf[nread - 1] == '\n')
- buf[nread - 1] = '\0';
- }
-
- /* Restore echoing. */
- if (echo_off) {
- if (gotintr && in_fd == -1) {
- in = fopen ("/dev/tty", "w+");
- }
- if (in != NULL)
- tcsetattr (fileno (in), TCSANOW, &t);
- }
-
- fprintf(out, "\n");
- fflush(out);
-
- if (in && in != stdin) /* We opened the terminal; now close it. */
- fclose(in);
-
- /* Catch problematic signals */
- catch_signal(SIGINT, SIGNAL_CAST SIG_DFL);
-
- if (gotintr) {
- printf("Interupted by signal.\n");
- fflush(stdout);
- exit(1);
- }
- return buf;
-}
diff --git a/chromium/third_party/talloc/libreplace/getpass.m4 b/chromium/third_party/talloc/libreplace/getpass.m4
deleted file mode 100644
index 78a0afe4532..00000000000
--- a/chromium/third_party/talloc/libreplace/getpass.m4
+++ /dev/null
@@ -1,24 +0,0 @@
-AC_CHECK_FUNC(getpass, libreplace_cv_HAVE_GETPASS=yes)
-AC_CHECK_FUNC(getpassphrase, libreplace_cv_HAVE_GETPASSPHRASE=yes)
-if test x"$libreplace_cv_HAVE_GETPASS" = x"yes" -a x"$libreplace_cv_HAVE_GETPASSPHRASE" = x"yes"; then
- AC_DEFINE(REPLACE_GETPASS_BY_GETPASSPHRASE, 1, [getpass returns <9 chars where getpassphrase returns <265 chars])
- AC_DEFINE(REPLACE_GETPASS,1,[Whether getpass should be replaced])
- LIBREPLACEOBJ="${LIBREPLACEOBJ} $libreplacedir/getpass.o"
-else
-
-AC_CACHE_CHECK([whether getpass should be replaced],libreplace_cv_REPLACE_GETPASS,[
-SAVE_CPPFLAGS="$CPPFLAGS"
-CPPFLAGS="$CPPFLAGS -I$libreplacedir/"
-AC_TRY_COMPILE([
-#include "confdefs.h"
-#define NO_CONFIG_H
-#include "$libreplacedir/getpass.c"
-],[],libreplace_cv_REPLACE_GETPASS=yes,libreplace_cv_REPLACE_GETPASS=no)
-CPPFLAGS="$SAVE_CPPFLAGS"
-])
-if test x"$libreplace_cv_REPLACE_GETPASS" = x"yes"; then
- AC_DEFINE(REPLACE_GETPASS,1,[Whether getpass should be replaced])
- LIBREPLACEOBJ="${LIBREPLACEOBJ} $libreplacedir/getpass.o"
-fi
-
-fi
diff --git a/chromium/third_party/talloc/libreplace/inet_aton.c b/chromium/third_party/talloc/libreplace/inet_aton.c
deleted file mode 100644
index c6b3bb11a74..00000000000
--- a/chromium/third_party/talloc/libreplace/inet_aton.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Unix SMB/CIFS implementation.
- * replacement functions
- * Copyright (C) Michael Adam <obnox@samba.org> 2008
- *
- * ** NOTE! The following LGPL license applies to the replace
- * ** library. This does NOT imply that all of Samba is released
- * ** under the LGPL
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "replace.h"
-#include "system/network.h"
-
-/**
- * We know that we have inet_pton from earlier libreplace checks.
- */
-int rep_inet_aton(const char *src, struct in_addr *dst)
-{
- return (inet_pton(AF_INET, src, dst) > 0) ? 1 : 0;
-}
diff --git a/chromium/third_party/talloc/libreplace/inet_ntoa.c b/chromium/third_party/talloc/libreplace/inet_ntoa.c
deleted file mode 100644
index e3b80ebef8b..00000000000
--- a/chromium/third_party/talloc/libreplace/inet_ntoa.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Unix SMB/CIFS implementation.
- * replacement routines for broken systems
- * Copyright (C) Andrew Tridgell 2003
- * Copyright (C) Michael Adam 2008
- *
- * ** NOTE! The following LGPL license applies to the replace
- * ** library. This does NOT imply that all of Samba is released
- * ** under the LGPL
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "replace.h"
-#include "system/network.h"
-
-/**
- * NOTE: this is not thread safe, but it can't be, either
- * since it returns a pointer to static memory.
- */
-char *rep_inet_ntoa(struct in_addr ip)
-{
- uint8_t *p = (uint8_t *)&ip.s_addr;
- static char buf[18];
- slprintf(buf, 17, "%d.%d.%d.%d",
- (int)p[0], (int)p[1], (int)p[2], (int)p[3]);
- return buf;
-}
diff --git a/chromium/third_party/talloc/libreplace/inet_ntop.c b/chromium/third_party/talloc/libreplace/inet_ntop.c
deleted file mode 100644
index fb3d8e90c8a..00000000000
--- a/chromium/third_party/talloc/libreplace/inet_ntop.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Copyright (C) 1996-2001 Internet Software Consortium.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
- * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
- * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-
-#include "replace.h"
-#include "system/network.h"
-
-#define NS_INT16SZ 2
-#define NS_IN6ADDRSZ 16
-
-/*
- * WARNING: Don't even consider trying to compile this on a system where
- * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
- */
-
-static const char *inet_ntop4(const unsigned char *src, char *dst,
- socklen_t size);
-
-#ifdef AF_INET6
-static const char *inet_ntop6(const unsigned char *src, char *dst,
- socklen_t size);
-#endif
-
-/* char *
- * isc_net_ntop(af, src, dst, size)
- * convert a network format address to presentation format.
- * return:
- * pointer to presentation format address (`dst'), or NULL (see errno).
- * author:
- * Paul Vixie, 1996.
- */
-const char *
-rep_inet_ntop(int af, const void *src, char *dst, socklen_t size)
-{
- switch (af) {
- case AF_INET:
- return (inet_ntop4(src, dst, size));
-#ifdef AF_INET6
- case AF_INET6:
- return (inet_ntop6(src, dst, size));
-#endif
- default:
- errno = EAFNOSUPPORT;
- return (NULL);
- }
- /* NOTREACHED */
-}
-
-/* const char *
- * inet_ntop4(src, dst, size)
- * format an IPv4 address
- * return:
- * `dst' (as a const)
- * notes:
- * (1) uses no statics
- * (2) takes a unsigned char* not an in_addr as input
- * author:
- * Paul Vixie, 1996.
- */
-static const char *
-inet_ntop4(const unsigned char *src, char *dst, socklen_t size)
-{
- static const char *fmt = "%u.%u.%u.%u";
- char tmp[sizeof "255.255.255.255"];
- size_t len;
-
- len = snprintf(tmp, sizeof tmp, fmt, src[0], src[1], src[2], src[3]);
- if (len >= size) {
- errno = ENOSPC;
- return (NULL);
- }
- memcpy(dst, tmp, len + 1);
-
- return (dst);
-}
-
-/* const char *
- * isc_inet_ntop6(src, dst, size)
- * convert IPv6 binary address into presentation (printable) format
- * author:
- * Paul Vixie, 1996.
- */
-#ifdef AF_INET6
-static const char *
-inet_ntop6(const unsigned char *src, char *dst, socklen_t size)
-{
- /*
- * Note that int32_t and int16_t need only be "at least" large enough
- * to contain a value of the specified size. On some systems, like
- * Crays, there is no such thing as an integer variable with 16 bits.
- * Keep this in mind if you think this function should have been coded
- * to use pointer overlays. All the world's not a VAX.
- */
- char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp;
- struct { int base, len; } best, cur;
- unsigned int words[NS_IN6ADDRSZ / NS_INT16SZ];
- int i, inc;
-
- /*
- * Preprocess:
- * Copy the input (bytewise) array into a wordwise array.
- * Find the longest run of 0x00's in src[] for :: shorthanding.
- */
- memset(words, '\0', sizeof words);
- for (i = 0; i < NS_IN6ADDRSZ; i++)
- words[i / 2] |= (src[i] << ((1 - (i % 2)) << 3));
- best.base = -1;
- best.len = 0;
- cur.base = -1;
- cur.len = 0;
- for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) {
- if (words[i] == 0) {
- if (cur.base == -1)
- cur.base = i, cur.len = 1;
- else
- cur.len++;
- } else {
- if (cur.base != -1) {
- if (best.base == -1 || cur.len > best.len)
- best = cur;
- cur.base = -1;
- }
- }
- }
- if (cur.base != -1) {
- if (best.base == -1 || cur.len > best.len)
- best = cur;
- }
- if (best.base != -1 && best.len < 2)
- best.base = -1;
-
- /*
- * Format the result.
- */
- tp = tmp;
- for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) {
- /* Are we inside the best run of 0x00's? */
- if (best.base != -1 && i >= best.base &&
- i < (best.base + best.len)) {
- if (i == best.base)
- *tp++ = ':';
- continue;
- }
- /* Are we following an initial run of 0x00s or any real hex? */
- if (i != 0)
- *tp++ = ':';
- /* Is this address an encapsulated IPv4? */
- if (i == 6 && best.base == 0 &&
- (best.len == 6 || (best.len == 5 && words[5] == 0xffff))) {
- if (!inet_ntop4(src+12, tp, sizeof tmp - (tp - tmp)))
- return (NULL);
- tp += strlen(tp);
- break;
- }
- inc = snprintf(tp, 5, "%x", words[i]);
- if (inc >= 5) {
- abort();
- }
- tp += inc;
- }
- /* Was it a trailing run of 0x00's? */
- if (best.base != -1 && (best.base + best.len) ==
- (NS_IN6ADDRSZ / NS_INT16SZ))
- *tp++ = ':';
- *tp++ = '\0';
-
- /*
- * Check for overflow, copy, and we're done.
- */
- if ((size_t)(tp - tmp) > size) {
- errno = ENOSPC;
- return (NULL);
- }
- memcpy(dst, tmp, tp - tmp);
- return (dst);
-}
-#endif /* AF_INET6 */
diff --git a/chromium/third_party/talloc/libreplace/inet_pton.c b/chromium/third_party/talloc/libreplace/inet_pton.c
deleted file mode 100644
index 80e4865ef49..00000000000
--- a/chromium/third_party/talloc/libreplace/inet_pton.c
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * Copyright (C) 1996-2001 Internet Software Consortium.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
- * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
- * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include "replace.h"
-#include "system/network.h"
-
-#define NS_INT16SZ 2
-#define NS_INADDRSZ 4
-#define NS_IN6ADDRSZ 16
-
-/*
- * WARNING: Don't even consider trying to compile this on a system where
- * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
- */
-
-static int inet_pton4(const char *src, unsigned char *dst);
-#ifdef AF_INET6
-static int inet_pton6(const char *src, unsigned char *dst);
-#endif
-
-/* int
- * inet_pton(af, src, dst)
- * convert from presentation format (which usually means ASCII printable)
- * to network format (which is usually some kind of binary format).
- * return:
- * 1 if the address was valid for the specified address family
- * 0 if the address wasn't valid (`dst' is untouched in this case)
- * -1 if some other error occurred (`dst' is untouched in this case, too)
- * author:
- * Paul Vixie, 1996.
- */
-int
-rep_inet_pton(int af,
- const char *src,
- void *dst)
-{
- switch (af) {
- case AF_INET:
- return (inet_pton4(src, dst));
-#ifdef AF_INET6
- case AF_INET6:
- return (inet_pton6(src, dst));
-#endif
- default:
- errno = EAFNOSUPPORT;
- return (-1);
- }
- /* NOTREACHED */
-}
-
-/* int
- * inet_pton4(src, dst)
- * like inet_aton() but without all the hexadecimal and shorthand.
- * return:
- * 1 if `src' is a valid dotted quad, else 0.
- * notice:
- * does not touch `dst' unless it's returning 1.
- * author:
- * Paul Vixie, 1996.
- */
-static int
-inet_pton4(src, dst)
- const char *src;
- unsigned char *dst;
-{
- static const char digits[] = "0123456789";
- int saw_digit, octets, ch;
- unsigned char tmp[NS_INADDRSZ], *tp;
-
- saw_digit = 0;
- octets = 0;
- *(tp = tmp) = 0;
- while ((ch = *src++) != '\0') {
- const char *pch;
-
- if ((pch = strchr(digits, ch)) != NULL) {
- unsigned int new = *tp * 10 + (pch - digits);
-
- if (new > 255)
- return (0);
- *tp = new;
- if (! saw_digit) {
- if (++octets > 4)
- return (0);
- saw_digit = 1;
- }
- } else if (ch == '.' && saw_digit) {
- if (octets == 4)
- return (0);
- *++tp = 0;
- saw_digit = 0;
- } else
- return (0);
- }
- if (octets < 4)
- return (0);
- memcpy(dst, tmp, NS_INADDRSZ);
- return (1);
-}
-
-/* int
- * inet_pton6(src, dst)
- * convert presentation level address to network order binary form.
- * return:
- * 1 if `src' is a valid [RFC1884 2.2] address, else 0.
- * notice:
- * (1) does not touch `dst' unless it's returning 1.
- * (2) :: in a full address is silently ignored.
- * credit:
- * inspired by Mark Andrews.
- * author:
- * Paul Vixie, 1996.
- */
-#ifdef AF_INET6
-static int
-inet_pton6(src, dst)
- const char *src;
- unsigned char *dst;
-{
- static const char xdigits_l[] = "0123456789abcdef",
- xdigits_u[] = "0123456789ABCDEF";
- unsigned char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp;
- const char *xdigits, *curtok;
- int ch, saw_xdigit;
- unsigned int val;
-
- memset((tp = tmp), '\0', NS_IN6ADDRSZ);
- endp = tp + NS_IN6ADDRSZ;
- colonp = NULL;
- /* Leading :: requires some special handling. */
- if (*src == ':')
- if (*++src != ':')
- return (0);
- curtok = src;
- saw_xdigit = 0;
- val = 0;
- while ((ch = *src++) != '\0') {
- const char *pch;
-
- if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL)
- pch = strchr((xdigits = xdigits_u), ch);
- if (pch != NULL) {
- val <<= 4;
- val |= (pch - xdigits);
- if (val > 0xffff)
- return (0);
- saw_xdigit = 1;
- continue;
- }
- if (ch == ':') {
- curtok = src;
- if (!saw_xdigit) {
- if (colonp)
- return (0);
- colonp = tp;
- continue;
- }
- if (tp + NS_INT16SZ > endp)
- return (0);
- *tp++ = (unsigned char) (val >> 8) & 0xff;
- *tp++ = (unsigned char) val & 0xff;
- saw_xdigit = 0;
- val = 0;
- continue;
- }
- if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) &&
- inet_pton4(curtok, tp) > 0) {
- tp += NS_INADDRSZ;
- saw_xdigit = 0;
- break; /* '\0' was seen by inet_pton4(). */
- }
- return (0);
- }
- if (saw_xdigit) {
- if (tp + NS_INT16SZ > endp)
- return (0);
- *tp++ = (unsigned char) (val >> 8) & 0xff;
- *tp++ = (unsigned char) val & 0xff;
- }
- if (colonp != NULL) {
- /*
- * Since some memmove()'s erroneously fail to handle
- * overlapping regions, we'll do the shift by hand.
- */
- const int n = tp - colonp;
- int i;
-
- for (i = 1; i <= n; i++) {
- endp[- i] = colonp[n - i];
- colonp[n - i] = 0;
- }
- tp = endp;
- }
- if (tp != endp)
- return (0);
- memcpy(dst, tmp, NS_IN6ADDRSZ);
- return (1);
-}
-#endif
diff --git a/chromium/third_party/talloc/libreplace/install-sh b/chromium/third_party/talloc/libreplace/install-sh
deleted file mode 100755
index 58719246f04..00000000000
--- a/chromium/third_party/talloc/libreplace/install-sh
+++ /dev/null
@@ -1,238 +0,0 @@
-#! /bin/sh
-#
-# install - install a program, script, or datafile
-# This comes from X11R5.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch.
-#
-
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
-
-
-# put in absolute paths if you don't have them in your path; or use env. 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}"
-
-transformbasename=""
-transform_arg=""
-instcmd="$mvprog"
-chmodcmd="$chmodprog 0755"
-chowncmd=""
-chgrpcmd=""
-stripcmd=""
-rmcmd="$rmprog -f"
-mvcmd="$mvprog"
-src=""
-dst=""
-dir_arg=""
-
-while [ x"$1" != x ]; do
- case $1 in
- -c) instcmd="$cpprog"
- shift
- continue;;
-
- -d) dir_arg=true
- shift
- continue;;
-
- -m) chmodcmd="$chmodprog $2"
- shift
- shift
- continue;;
-
- -o) chowncmd="$chownprog $2"
- shift
- shift
- continue;;
-
- -g) chgrpcmd="$chgrpprog $2"
- shift
- shift
- continue;;
-
- -s) stripcmd="$stripprog"
- shift
- continue;;
-
- -t=*) transformarg=`echo $1 | sed 's/-t=//'`
- shift
- continue;;
-
- -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
- shift
- continue;;
-
- *) if [ x"$src" = x ]
- then
- src=$1
- else
- # this colon is to work around a 386BSD /bin/sh bug
- :
- dst=$1
- fi
- shift
- continue;;
- esac
-done
-
-if [ x"$src" = x ]
-then
- echo "install: no input file specified"
- exit 1
-else
- true
-fi
-
-if [ x"$dir_arg" != x ]; then
- dst=$src
- src=""
-
- if [ -d $dst ]; then
- instcmd=:
- else
- instcmd=mkdir
- fi
-else
-
-# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad
-# if $src (and thus $dsttmp) contains '*'.
-
- if [ -f $src -o -d $src ]
- then
- true
- else
- echo "install: $src does not exist"
- exit 1
- fi
-
- if [ x"$dst" = x ]
- then
- echo "install: no destination specified"
- exit 1
- else
- true
- fi
-
-# If destination is a directory, append the input filename; if your system
-# does not like double slashes in filenames, you may need to add some logic
-
- if [ -d $dst ]
- then
- dst="$dst"/`basename $src`
- else
- true
- fi
-fi
-
-## this sed command emulates the dirname command
-dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
-
-# Make sure that the destination directory exists.
-# this part is taken from Noah Friedman's mkinstalldirs script
-
-# Skip lots of stat calls in the usual case.
-if [ ! -d "$dstdir" ]; then
-defaultIFS='
-'
-IFS="${IFS-${defaultIFS}}"
-
-oIFS="${IFS}"
-# Some sh's can't handle IFS=/ for some reason.
-IFS='%'
-set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
-IFS="${oIFS}"
-
-pathcomp=''
-
-while [ $# -ne 0 ] ; do
- pathcomp="${pathcomp}${1}"
- shift
-
- if [ ! -d "${pathcomp}" ] ;
- then
- $mkdirprog "${pathcomp}"
- else
- true
- fi
-
- pathcomp="${pathcomp}/"
-done
-fi
-
-if [ x"$dir_arg" != x ]
-then
- $doit $instcmd $dst &&
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
-else
-
-# If we're going to rename the final executable, determine the name now.
-
- if [ x"$transformarg" = x ]
- then
- dstfile=`basename $dst`
- else
- dstfile=`basename $dst $transformbasename |
- sed $transformarg`$transformbasename
- fi
-
-# don't allow the sed command to completely eliminate the filename
-
- if [ x"$dstfile" = x ]
- then
- dstfile=`basename $dst`
- else
- true
- fi
-
-# Make a temp file name in the proper directory.
-
- dsttmp=$dstdir/#inst.$$#
-
-# Move or copy the file name to the temp name
-
- $doit $instcmd $src $dsttmp &&
-
- trap "rm -f ${dsttmp}" 0 &&
-
-# and set any options; do chmod last to preserve setuid bits
-
-# If any of these fail, we abort the whole thing. If we want to
-# ignore errors from any of these, just make sure not to ignore
-# errors from the above "$doit $instcmd $src $dsttmp" command.
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
-
-# Now rename the file to the real destination.
-
- $doit $rmcmd -f $dstdir/$dstfile &&
- $doit $mvcmd $dsttmp $dstdir/$dstfile
-
-fi &&
-
-
-exit 0
diff --git a/chromium/third_party/talloc/libreplace/libreplace.m4 b/chromium/third_party/talloc/libreplace/libreplace.m4
deleted file mode 100644
index af8587938d1..00000000000
--- a/chromium/third_party/talloc/libreplace/libreplace.m4
+++ /dev/null
@@ -1,311 +0,0 @@
-AC_DEFUN_ONCE(AC_LIBREPLACE_LOCATION_CHECKS,
-[
-echo "LIBREPLACE_LOCATION_CHECKS: START"
-
-dnl find the libreplace sources. This is meant to work both for
-dnl libreplace standalone builds, and builds of packages using libreplace
-libreplacedir=""
-libreplacepaths="$srcdir $srcdir/lib/replace $srcdir/libreplace $srcdir/../libreplace $srcdir/../replace $srcdir/../lib/replace $srcdir/../../../lib/replace"
-for d in $libreplacepaths; do
- if test -f "$d/replace.c"; then
- libreplacedir="$d"
- AC_SUBST(libreplacedir)
- break;
- fi
-done
-if test x"$libreplacedir" = "x"; then
- AC_MSG_ERROR([cannot find libreplace in $libreplacepaths])
-fi
-LIBREPLACEOBJ="$libreplacedir/replace.o"
-AC_SUBST(LIBREPLACEOBJ)
-
-AC_CANONICAL_BUILD
-AC_CANONICAL_HOST
-AC_CANONICAL_TARGET
-
-echo "LIBREPLACE_LOCATION_CHECKS: END"
-]) dnl end AC_LIBREPLACE_LOCATION_CHECKS
-
-
-AC_DEFUN_ONCE(AC_LIBREPLACE_BROKEN_CHECKS,
-[
-echo "LIBREPLACE_BROKEN_CHECKS: START"
-
-dnl find the libreplace sources. This is meant to work both for
-dnl libreplace standalone builds, and builds of packages using libreplace
-libreplacedir=""
-libreplacepaths="$srcdir $srcdir/lib/replace $srcdir/libreplace $srcdir/../libreplace $srcdir/../replace $srcdir/../lib/replace $srcdir/../../../lib/replace"
-for d in $libreplacepaths; do
- if test -f "$d/replace.c"; then
- libreplacedir="$d"
- AC_SUBST(libreplacedir)
- break;
- fi
-done
-if test x"$libreplacedir" = "x"; then
- AC_MSG_ERROR([cannot find libreplace in $libreplacepaths])
-fi
-
-LIBREPLACEOBJ="$libreplacedir/replace.o"
-AC_SUBST(LIBREPLACEOBJ)
-
-LIBREPLACEOBJ="${LIBREPLACEOBJ} $libreplacedir/snprintf.o"
-
-AC_TYPE_SIGNAL
-AC_TYPE_UID_T
-AC_TYPE_MODE_T
-AC_TYPE_OFF_T
-AC_TYPE_SIZE_T
-AC_TYPE_PID_T
-AC_STRUCT_ST_RDEV
-AC_CHECK_TYPE(ino_t,unsigned)
-AC_CHECK_TYPE(loff_t,off_t)
-AC_CHECK_TYPE(offset_t,loff_t)
-
-AC_FUNC_MEMCMP
-
-AC_CHECK_FUNCS([pipe strftime srandom random srand rand usleep setbuffer lstat getpgrp utime utimes])
-
-AC_CHECK_HEADERS(stdbool.h stdint.h sys/select.h)
-AC_CHECK_HEADERS(setjmp.h utime.h)
-
-LIBREPLACE_PROVIDE_HEADER([stdint.h])
-LIBREPLACE_PROVIDE_HEADER([stdbool.h])
-
-AC_CHECK_TYPE(bool,
-[AC_DEFINE(HAVE_BOOL, 1, [Whether the bool type is available])],,
-[
-AC_INCLUDES_DEFAULT
-#ifdef HAVE_STDBOOL_H
-#include <stdbool.h>
-#endif]
-)
-
-AC_CHECK_TYPE(_Bool,
-[AC_DEFINE(HAVE__Bool, 1, [Whether the _Bool type is available])],,
-[
-AC_INCLUDES_DEFAULT
-#ifdef HAVE_STDBOOL_H
-#include <stdbool.h>
-#endif]
-)
-
-AC_CACHE_CHECK([for working mmap],libreplace_cv_HAVE_MMAP,[
-AC_TRY_RUN([#include "$libreplacedir/test/shared_mmap.c"],
- libreplace_cv_HAVE_MMAP=yes,libreplace_cv_HAVE_MMAP=no,libreplace_cv_HAVE_MMAP=cross)])
-if test x"$libreplace_cv_HAVE_MMAP" = x"yes"; then
- AC_DEFINE(HAVE_MMAP,1,[Whether mmap works])
-fi
-
-
-AC_CHECK_HEADERS(sys/syslog.h syslog.h)
-AC_CHECK_HEADERS(sys/time.h time.h)
-AC_CHECK_HEADERS(stdarg.h vararg.h)
-AC_CHECK_HEADERS(sys/mount.h mntent.h)
-AC_CHECK_HEADERS(stropts.h)
-AC_CHECK_HEADERS(unix.h)
-
-AC_CHECK_FUNCS(seteuid setresuid setegid setresgid chroot bzero strerror)
-AC_CHECK_FUNCS(vsyslog setlinebuf mktime ftruncate chsize rename)
-AC_CHECK_FUNCS(waitpid wait4 strlcpy strlcat initgroups memmove strdup)
-AC_CHECK_FUNCS(pread pwrite strndup strcasestr strtok_r mkdtemp dup2)
-AC_CHECK_FUNCS(isatty chown lchown link readlink symlink realpath)
-AC_HAVE_DECL(setresuid, [#include <unistd.h>])
-AC_HAVE_DECL(setresgid, [#include <unistd.h>])
-AC_HAVE_DECL(errno, [#include <errno.h>])
-
-AC_CACHE_CHECK([for secure mkstemp],libreplace_cv_HAVE_SECURE_MKSTEMP,[
-AC_TRY_RUN([#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-main() {
- struct stat st;
- char tpl[20]="/tmp/test.XXXXXX";
- int fd = mkstemp(tpl);
- if (fd == -1) exit(1);
- unlink(tpl);
- if (fstat(fd, &st) != 0) exit(1);
- if ((st.st_mode & 0777) != 0600) exit(1);
- exit(0);
-}],
-libreplace_cv_HAVE_SECURE_MKSTEMP=yes,
-libreplace_cv_HAVE_SECURE_MKSTEMP=no,
-libreplace_cv_HAVE_SECURE_MKSTEMP=cross)])
-if test x"$libreplace_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then
- AC_DEFINE(HAVE_SECURE_MKSTEMP,1,[Whether mkstemp is secure])
-fi
-
-dnl Provided by snprintf.c:
-AC_CHECK_HEADERS(stdio.h strings.h)
-AC_CHECK_DECLS([snprintf, vsnprintf, asprintf, vasprintf])
-AC_CHECK_FUNCS(snprintf vsnprintf asprintf vasprintf)
-
-AC_CACHE_CHECK([for C99 vsnprintf],libreplace_cv_HAVE_C99_VSNPRINTF,[
-AC_TRY_RUN([
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <stdlib.h>
-void foo(const char *format, ...) {
- va_list ap;
- int len;
- char buf[20];
- long long l = 1234567890;
- l *= 100;
-
- va_start(ap, format);
- len = vsnprintf(buf, 0, format, ap);
- va_end(ap);
- if (len != 5) exit(1);
-
- va_start(ap, format);
- len = vsnprintf(0, 0, format, ap);
- va_end(ap);
- if (len != 5) exit(2);
-
- if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(3);
-
- if (snprintf(buf, 20, "%lld", l) != 12 || strcmp(buf, "123456789000") != 0) exit(4);
- if (snprintf(buf, 20, "%zu", 123456789) != 9 || strcmp(buf, "123456789") != 0) exit(5);
- if (snprintf(buf, 20, "%2\$d %1\$d", 3, 4) != 3 || strcmp(buf, "4 3") != 0) exit(6);
- if (snprintf(buf, 20, "%s", 0) < 3) exit(7);
-
- exit(0);
-}
-main() { foo("hello"); }
-],
-libreplace_cv_HAVE_C99_VSNPRINTF=yes,libreplace_cv_HAVE_C99_VSNPRINTF=no,libreplace_cv_HAVE_C99_VSNPRINTF=cross)])
-if test x"$libreplace_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
- AC_DEFINE(HAVE_C99_VSNPRINTF,1,[Whether there is a C99 compliant vsnprintf])
-fi
-
-
-dnl VA_COPY
-AC_CACHE_CHECK([for va_copy],libreplace_cv_HAVE_VA_COPY,[
-AC_TRY_LINK([#include <stdarg.h>
-va_list ap1,ap2;], [va_copy(ap1,ap2);],
-libreplace_cv_HAVE_VA_COPY=yes,libreplace_cv_HAVE_VA_COPY=no)])
-if test x"$libreplace_cv_HAVE_VA_COPY" = x"yes"; then
- AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
-fi
-
-if test x"$libreplace_cv_HAVE_VA_COPY" != x"yes"; then
-AC_CACHE_CHECK([for __va_copy],libreplace_cv_HAVE___VA_COPY,[
-AC_TRY_LINK([#include <stdarg.h>
-va_list ap1,ap2;], [__va_copy(ap1,ap2);],
-libreplace_cv_HAVE___VA_COPY=yes,libreplace_cv_HAVE___VA_COPY=no)])
-if test x"$libreplace_cv_HAVE___VA_COPY" = x"yes"; then
- AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
-fi
-fi
-
-dnl __FUNCTION__ macro
-AC_CACHE_CHECK([for __FUNCTION__ macro],libreplace_cv_HAVE_FUNCTION_MACRO,[
-AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FUNCTION__);],
-libreplace_cv_HAVE_FUNCTION_MACRO=yes,libreplace_cv_HAVE_FUNCTION_MACRO=no)])
-if test x"$libreplace_cv_HAVE_FUNCTION_MACRO" = x"yes"; then
- AC_DEFINE(HAVE_FUNCTION_MACRO,1,[Whether there is a __FUNCTION__ macro])
-else
- dnl __func__ macro
- AC_CACHE_CHECK([for __func__ macro],libreplace_cv_HAVE_func_MACRO,[
- AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __func__);],
- libreplace_cv_HAVE_func_MACRO=yes,libreplace_cv_HAVE_func_MACRO=no)])
- if test x"$libreplace_cv_HAVE_func_MACRO" = x"yes"; then
- AC_DEFINE(HAVE_func_MACRO,1,[Whether there is a __func__ macro])
- fi
-fi
-
-AC_CHECK_HEADERS([sys/param.h limits.h])
-
-AC_CHECK_TYPE(comparison_fn_t,
-[AC_DEFINE(HAVE_COMPARISON_FN_T, 1,[Whether or not we have comparison_fn_t])])
-
-AC_HAVE_DECL(setenv, [#include <stdlib.h>])
-AC_CHECK_FUNCS(setenv unsetenv)
-AC_HAVE_DECL(environ, [#include <unistd.h>])
-
-AC_CHECK_FUNCS(strnlen)
-AC_CHECK_FUNCS(strtoull __strtoull strtouq strtoll __strtoll strtoq)
-
-# this test disabled as we don't actually need __VA_ARGS__ yet
-AC_TRY_CPP([
-#define eprintf(...) fprintf(stderr, __VA_ARGS__)
-eprintf("bla", "bar");
-], AC_DEFINE(HAVE__VA_ARGS__MACRO, 1, [Whether the __VA_ARGS__ macro is available]))
-
-
-AC_CACHE_CHECK([for sig_atomic_t type],libreplace_cv_sig_atomic_t, [
- AC_TRY_COMPILE([
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-#include <signal.h>],[sig_atomic_t i = 0],
- libreplace_cv_sig_atomic_t=yes,libreplace_cv_sig_atomic_t=no)])
-if test x"$libreplace_cv_sig_atomic_t" = x"yes"; then
- AC_DEFINE(HAVE_SIG_ATOMIC_T_TYPE,1,[Whether we have the atomic_t variable type])
-fi
-
-
-AC_CACHE_CHECK([for O_DIRECT flag to open(2)],libreplace_cv_HAVE_OPEN_O_DIRECT,[
-AC_TRY_COMPILE([
-#include <unistd.h>
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif],
-[int fd = open("/dev/null", O_DIRECT);],
-libreplace_cv_HAVE_OPEN_O_DIRECT=yes,libreplace_cv_HAVE_OPEN_O_DIRECT=no)])
-if test x"$libreplace_cv_HAVE_OPEN_O_DIRECT" = x"yes"; then
- AC_DEFINE(HAVE_OPEN_O_DIRECT,1,[Whether the open(2) accepts O_DIRECT])
-fi
-
-
-dnl Check if the C compiler understands volatile (it should, being ANSI).
-AC_CACHE_CHECK([that the C compiler understands volatile],libreplace_cv_volatile, [
- AC_TRY_COMPILE([#include <sys/types.h>],[volatile int i = 0],
- libreplace_cv_volatile=yes,libreplace_cv_volatile=no)])
-if test x"$libreplace_cv_volatile" = x"yes"; then
- AC_DEFINE(HAVE_VOLATILE, 1, [Whether the C compiler understands volatile])
-fi
-
-m4_include(system/config.m4)
-
-m4_include(dlfcn.m4)
-m4_include(getpass.m4)
-m4_include(strptime.m4)
-m4_include(win32.m4)
-m4_include(timegm.m4)
-m4_include(repdir.m4)
-m4_include(crypt.m4)
-
-AC_CHECK_FUNCS([printf memset memcpy],,[AC_MSG_ERROR([Required function not found])])
-
-echo "LIBREPLACE_BROKEN_CHECKS: END"
-]) dnl end AC_LIBREPLACE_BROKEN_CHECKS
-
-AC_DEFUN_ONCE(AC__LIBREPLACE_ALL_CHECKS_START,
-[
-#LIBREPLACE_ALL_CHECKS: START"
-])
-AC_DEFUN_ONCE(AC__LIBREPLACE_ALL_CHECKS_END,
-[
-#LIBREPLACE_ALL_CHECKS: END"
-])
-m4_define(AC_LIBREPLACE_ALL_CHECKS,
-[
-AC__LIBREPLACE_ALL_CHECKS_START
-AC_LIBREPLACE_LOCATION_CHECKS
-AC_LIBREPLACE_CC_CHECKS
-AC_LIBREPLACE_BROKEN_CHECKS
-AC__LIBREPLACE_ALL_CHECKS_END
-CFLAGS="$CFLAGS -I$libreplacedir"
-])
-
-m4_include(libreplace_cc.m4)
-m4_include(libreplace_ld.m4)
-m4_include(libreplace_network.m4)
-m4_include(libreplace_macros.m4)
-
-m4_ifndef([AC_USE_SYSTEM_EXTENSIONS],[m4_include(autoconf-2.60.m4)])
diff --git a/chromium/third_party/talloc/libreplace/libreplace_cc.m4 b/chromium/third_party/talloc/libreplace/libreplace_cc.m4
deleted file mode 100644
index a26dee498e9..00000000000
--- a/chromium/third_party/talloc/libreplace/libreplace_cc.m4
+++ /dev/null
@@ -1,180 +0,0 @@
-
-AC_DEFUN_ONCE(AC__LIBREPLACE_ONLY_CC_CHECKS_START,
-[
-echo "LIBREPLACE_CC_CHECKS: START"
-])
-
-AC_DEFUN_ONCE(AC__LIBREPLACE_ONLY_CC_CHECKS_END,
-[
-echo "LIBREPLACE_CC_CHECKS: END"
-])
-
-dnl
-dnl
-dnl AC_LIBREPLACE_CC_CHECKS
-dnl
-dnl Note: we need to use m4_define instead of AC_DEFUN because
-dnl of the ordering of tests
-dnl
-dnl
-m4_define(AC_LIBREPLACE_CC_CHECKS,
-[
-AC__LIBREPLACE_ONLY_CC_CHECKS_START
-
-dnl stop the C89 attempt by autoconf - if autoconf detects -Ae it will enable it
-dnl which conflicts with C99 on HPUX
-ac_cv_prog_cc_Ae=no
-
-savedCFLAGS=$CFLAGS
-AC_PROG_CC
-CFLAGS=$savedCFLAGS
-
-dnl don't try for C99 if we are using gcc, as otherwise we
-dnl lose immediate structure constants
-if test x"$GCC" != x"yes" ; then
-AC_PROG_CC_C99
-fi
-
-if test x"$GCC" = x"yes" ; then
- AC_MSG_CHECKING([for version of gcc])
- GCC_VERSION=`$CC -dumpversion`
- AC_MSG_RESULT(${GCC_VERSION})
-fi
-AC_USE_SYSTEM_EXTENSIONS
-AC_C_BIGENDIAN
-AC_C_INLINE
-LIBREPLACE_C99_STRUCT_INIT([],[AC_MSG_WARN([c99 structure initializer are not supported])])
-
-AC_PROG_INSTALL
-
-AC_ISC_POSIX
-AC_N_DEFINE(_XOPEN_SOURCE_EXTENDED)
-
-AC_SYS_LARGEFILE
-
-dnl Add #include for broken IRIX header files
-case "$host_os" in
- *irix6*) AC_ADD_INCLUDE(<standards.h>)
- ;;
- *hpux*)
- # mmap on HPUX is completely broken...
- AC_DEFINE(MMAP_BLACKLIST, 1, [Whether MMAP is broken])
- if test "`uname -r`" = "B.11.00" -o "`uname -r`" = "B.11.11"; then
- AC_MSG_WARN([Enabling HPUX 11.00/11.11 header bug workaround])
- CFLAGS="$CFLAGS -Dpread=pread64 -Dpwrite=pwrite64"
- fi
- if test "`uname -r`" = "B.11.23"; then
- AC_MSG_WARN([Enabling HPUX 11.23 machine/sys/getppdp.h bug workaround])
- CFLAGS="$CFLAGS -D_MACHINE_SYS_GETPPDP_INCLUDED"
- fi
- ;;
- *aix*)
- AC_DEFINE(BROKEN_STRNDUP, 1, [Whether strndup is broken])
- AC_DEFINE(BROKEN_STRNLEN, 1, [Whether strnlen is broken])
- if test "${GCC}" != "yes"; then
- ## for funky AIX compiler using strncpy()
- CFLAGS="$CFLAGS -D_LINUX_SOURCE_COMPAT -qmaxmem=32000"
- fi
- ;;
- *osf*)
- # this brings in socklen_t
- AC_N_DEFINE(_XOPEN_SOURCE,600)
- AC_N_DEFINE(_OSF_SOURCE)
- ;;
- #
- # VOS may need to have POSIX support and System V compatibility enabled.
- #
- *vos*)
- case "$CFLAGS" in
- *-D_POSIX_C_SOURCE*);;
- *)
- CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=200112L"
- AC_DEFINE(_POSIX_C_SOURCE, 200112L, [Whether to enable POSIX support])
- ;;
- esac
- case "$CFLAGS" in
- *-D_SYSV*|*-D_SVID_SOURCE*);;
- *)
- CFLAGS="$CFLAGS -D_SYSV"
- AC_DEFINE(_SYSV, 1, [Whether to enable System V compatibility])
- ;;
- esac
- ;;
-esac
-
-
-
-AC_CHECK_HEADERS([standards.h])
-
-# Solaris needs HAVE_LONG_LONG defined
-AC_CHECK_TYPES(long long)
-
-AC_CHECK_SIZEOF(int)
-AC_CHECK_SIZEOF(char)
-AC_CHECK_SIZEOF(short)
-AC_CHECK_SIZEOF(long)
-AC_CHECK_SIZEOF(long long)
-
-AC_CHECK_TYPE(uint_t, unsigned int)
-AC_CHECK_TYPE(int8_t, char)
-AC_CHECK_TYPE(uint8_t, unsigned char)
-AC_CHECK_TYPE(int16_t, short)
-AC_CHECK_TYPE(uint16_t, unsigned short)
-
-if test $ac_cv_sizeof_int -eq 4 ; then
-AC_CHECK_TYPE(int32_t, int)
-AC_CHECK_TYPE(uint32_t, unsigned int)
-elif test $ac_cv_size_long -eq 4 ; then
-AC_CHECK_TYPE(int32_t, long)
-AC_CHECK_TYPE(uint32_t, unsigned long)
-else
-AC_MSG_ERROR([LIBREPLACE no 32-bit type found])
-fi
-
-AC_CHECK_TYPE(int64_t, long long)
-AC_CHECK_TYPE(uint64_t, unsigned long long)
-
-AC_CHECK_TYPE(size_t, unsigned int)
-AC_CHECK_TYPE(ssize_t, int)
-
-AC_CHECK_SIZEOF(off_t)
-AC_CHECK_SIZEOF(size_t)
-AC_CHECK_SIZEOF(ssize_t)
-
-AC_CHECK_TYPES([intptr_t, uintptr_t, ptrdiff_t])
-
-if test x"$ac_cv_type_long_long" != x"yes";then
- AC_MSG_ERROR([LIBREPLACE needs type 'long long'])
-fi
-if test $ac_cv_sizeof_long_long -lt 8;then
- AC_MSG_ERROR([LIBREPLACE needs sizeof(long long) >= 8])
-fi
-
-############################################
-# check if the compiler can do immediate structures
-AC_SUBST(libreplace_cv_immediate_structures)
-AC_CACHE_CHECK([for immediate structures],libreplace_cv_immediate_structures,[
- AC_TRY_COMPILE([
- #include <stdio.h>
- ],[
- typedef struct {unsigned x;} FOOBAR;
- #define X_FOOBAR(x) ((FOOBAR) { x })
- #define FOO_ONE X_FOOBAR(1)
- FOOBAR f = FOO_ONE;
- static const struct {
- FOOBAR y;
- } f2[] = {
- {FOO_ONE}
- };
- static const FOOBAR f3[] = {FOO_ONE};
- ],
- libreplace_cv_immediate_structures=yes,
- libreplace_cv_immediate_structures=no,
- libreplace_cv_immediate_structures=cross)
-])
-if test x"$libreplace_cv_immediate_structures" = x"yes"; then
- AC_DEFINE(HAVE_IMMEDIATE_STRUCTURES,1,[Whether the compiler supports immediate structures])
-fi
-
-AC__LIBREPLACE_ONLY_CC_CHECKS_END
-]) dnl end AC_LIBREPLACE_CC_CHECKS
diff --git a/chromium/third_party/talloc/libreplace/libreplace_ld.m4 b/chromium/third_party/talloc/libreplace/libreplace_ld.m4
deleted file mode 100644
index bf0df6186dd..00000000000
--- a/chromium/third_party/talloc/libreplace/libreplace_ld.m4
+++ /dev/null
@@ -1,337 +0,0 @@
-#
-# This offers a nice overview how to build shared libraries on all platforms
-# http://www.fortran-2000.com/ArnaudRecipes/sharedlib.html
-#
-
-AC_DEFUN([AC_LIBREPLACE_STLD],
-[
- AC_PATH_PROG(PROG_AR, ar)
-
- STLD=${PROG_AR}
-
- AC_SUBST(STLD)
-])
-
-AC_DEFUN([AC_LIBREPLACE_STLD_FLAGS],
-[
- STLD_FLAGS="-rcs"
- AC_SUBST(STLD_FLAGS)
-])
-
-AC_DEFUN([AC_LD_EXPORT_DYNAMIC],
-[
-saved_LDFLAGS="$LDFLAGS"
-if AC_TRY_COMMAND([${CC-cc} $CFLAGS -Wl,--version 2>&1 | grep "GNU ld" >/dev/null]); then
- LD_EXPORT_DYNAMIC="-Wl,-export-dynamic"
-else
- case "$host_os" in
- hpux* )
- LD_EXPORT_DYNAMIC="-Wl,-E"
- ;;
- *)
- LD_EXPORT_DYNAMIC=""
- ;;
- esac
-fi
-AC_SUBST(LD_EXPORT_DYNAMIC)
-LDFLAGS="$saved_LDFLAGS"
-])
-
-AC_DEFUN([AC_LD_PICFLAG],
-[
-case "$host_os" in
- *linux*|*gnu*)
- PICFLAG="-fPIC"
- ;;
- *solaris*)
- if test "${GCC}" = "yes"; then
- PICFLAG="-fPIC"
- else
- PICFLAG="-KPIC"
- fi
- ;;
- *sunos*)
- PICFLAG="-KPIC" # Is this correct for SunOS
- ;;
- *netbsd* | *freebsd* | *dragonfly* )
- PICFLAG="-fPIC -DPIC"
- ;;
- *openbsd*)
- PICFLAG="-fPIC"
- ;;
- *irix*)
- if test "${GCC}" = "yes"; then
- PICFLAG="-fPIC"
- else
- PICFLAG="-KPIC"
- fi
- ;;
- *aix*)
- # as AIX code is always position independent...
- PICFLAG="-O2"
- ;;
- *hpux*)
- if test "${GCC}" = "yes"; then
- PICFLAG="-fPIC"
- elif test "$host_cpu" = "ia64"; then
- PICFLAG="+z"
- elif test $ac_cv_prog_cc_Ae = yes; then
- PICFLAG="+z +ESnolit"
- fi
- ;;
- *osf*)
- PICFLAG="-fPIC"
- ;;
- *unixware*)
- PICFLAG="-KPIC"
- ;;
- *darwin*)
- PICFLAG="-fno-common"
- ;;
-esac
-AC_SUBST(PICFLAG)
-])
-
-AC_DEFUN([AC_LIBREPLACE_LD_SHLIB_LINKER],
-[
- LD_SHLIB_LINKER="${CC}"
-
- case "$host_os" in
- *irix*)
- LD_SHLIB_LINKER="${PROG_LD}"
- ;;
- esac
-
- AC_SUBST(LD_SHLIB_LINKER)
-])
-
-AC_DEFUN([AC_LIBREPLACE_LD_SHLIB_FLAGS],
-[
- LD_SHLIB_FLAGS="-shared"
-
- case "$host_os" in
- *linux*|*gnu*)
- LD_SHLIB_FLAGS="-shared -Wl,-Bsymbolic"
- ;;
- *solaris*)
- LD_SHLIB_FLAGS="-G"
- if test "${GCC}" = "no"; then
- ## ${CFLAGS} added for building 64-bit shared
- ## libs using Sun's Compiler
- LD_SHLIB_FLAGS="-G \${CFLAGS}"
- fi
- ;;
- *sunos*)
- LD_SHLIB_FLAGS="-G"
- ;;
- *irix*)
- LD_SHLIB_FLAGS="-shared"
- ;;
- *aix*)
- LD_SHLIB_FLAGS="-Wl,-G,-bexpall,-bbigtoc"
- ;;
- *hpux*)
- if test "${GCC}" = "yes"; then
- LD_SHLIB_FLAGS="-shared"
- else
- LD_SHLIB_FLAGS="-b"
- fi
- ;;
- *osf*)
- LD_SHLIB_FLAGS="-shared"
- ;;
- *darwin*)
- LD_SHLIB_FLAGS="-dynamiclib -Wl,-search_paths_first"
- ;;
- esac
-
- AC_SUBST(LD_SHLIB_FLAGS)
-])
-
-AC_DEFUN([AC_LIBREPLACE_LD_SHLIB_DISALLOW_UNDEF_FLAG],
-[
- LD_SHLIB_DISALLOW_UNDEF_FLAG=""
-
- #
- # TODO: enforce error not only warnings
- #
- # NOTE: -Wl,--no-allow-shlib-undefined isn't what we want...
- # as it bails out on broken system libraries
- #
- case "$host_os" in
- *osf*)
- LD_SHLIB_DISALLOW_UNDEF_FLAG="-warning_unresolved"
- ;;
- *darwin*)
- LD_SHLIB_DISALLOW_UNDEF_FLAG="-undefined error"
- ;;
- esac
-
- AC_SUBST(LD_SHLIB_DISALLOW_UNDEF_FLAG)
-])
-
-AC_DEFUN([AC_LIBREPLACE_SHLD],
-[
- AC_REQUIRE([AC_LIBREPLACE_LD_SHLIB_LINKER])
- SHLD="$LD_SHLIB_LINKER"
- AC_SUBST(SHLD)
-])
-
-AC_DEFUN([AC_LIBREPLACE_SHLD_FLAGS],
-[
- AC_REQUIRE([AC_LIBREPLACE_LD_SHLIB_FLAGS])
- AC_REQUIRE([AC_LIBREPLACE_LD_SHLIB_DISALLOW_UNDEF_FLAG])
- SHLD_FLAGS="$LD_SHLIB_FLAGS $LD_SHLIB_DISALLOW_UNDEF_FLAG"
- AC_SUBST(SHLD_FLAGS)
-])
-
-AC_DEFUN([AC_LD_SHLIBEXT],
-[
- SHLIBEXT="so"
- case "$host_os" in
- *hpux*)
- if test "$host_cpu" = "ia64"; then
- SHLIBEXT="so"
- else
- SHLIBEXT="sl"
- fi
- ;;
- *darwin*)
- SHLIBEXT="dylib"
- ;;
- esac
- AC_SUBST(SHLIBEXT)
-])
-
-AC_DEFUN([AC_LD_SONAMEFLAG],
-[
- AC_SUBST(SONAMEFLAG)
- SONAMEFLAG=""
- case "$host_os" in
- *linux*|*gnu*|*qnx*)
- SONAMEFLAG="-Wl,-soname="
- ;;
- *solaris*)
- SONAMEFLAG="-h "
- if test "${GCC}" = "yes"; then
- SONAMEFLAG="-Wl,-soname="
- fi
- ;;
- *sunos*)
- SONAMEFLAG="-Wl,-h,"
- ;;
- *netbsd* | *freebsd* | *dragonfly* )
- SONAMEFLAG="-Wl,-soname,"
- ;;
- *openbsd*)
- SONAMEFLAG="-Wl,-soname,"
- ;;
- *irix*)
- SONAMEFLAG="-Wl,-soname,"
- ;;
- *hpux*)
- SONAMEFLAG="-Wl,+h,"
- ;;
- *osf*)
- SONAMEFLAG="-Wl,-soname,"
- ;;
- *unixware*)
- SONAMEFLAG="-Wl,-soname,"
- ;;
- *darwin*)
- SONAMEFLAG="#"
- ;;
- *aix*)
- # Not supported
- SONAMEFLAG="#"
- ;;
- esac
-])
-
-AC_DEFUN([AC_LD_VERSIONSCRIPT],
-[
- AC_SUBST(VERSIONSCRIPT)
- VERSIONSCRIPT=""
- case "$host_os" in
- *linux*|*gnu*)
- VERSIONSCRIPT="-Wl,--version-script"
- ;;
- *solaris*)
- if test "${GCC}" = "yes"; then
- VERSIONSCRIPT="-Wl,--version-script"
- fi
- ;;
- esac
-])
-
-AC_DEFUN([AC_LIBREPLACE_MDLD],
-[
- AC_REQUIRE([AC_LIBREPLACE_LD_SHLIB_LINKER])
- MDLD="$LD_SHLIB_LINKER"
- AC_SUBST(MDLD)
-])
-
-AC_DEFUN([AC_LIBREPLACE_LD_SHLIB_ALLOW_UNDEF_FLAG],
-[
- LD_ALLOW_SHLIB_UNDEF_FLAG=""
-
- case "$host_os" in
- *linux*|*gnu*)
- LD_SHLIB_ALLOW_UNDEF_FLAG="-Wl,--allow-shlib-undefined"
- ;;
- *osf*)
- LD_SHLIB_ALLOW_UNDEF_FLAG="-Wl,-expect_unresolved,\"*\""
- ;;
- *darwin*)
- LD_SHLIB_ALLOW_UNDEF_FLAG="-undefined dynamic_lookup"
- ;;
- *aix*)
- LD_SHLIB_ALLOW_UNDEF_FLAG="-Wl,-bnoentry"
- ;;
- esac
-
- AC_SUBST(LD_SHLIB_ALLOW_UNDEF_FLAG)
-])
-
-AC_DEFUN([AC_LIBREPLACE_MDLD_FLAGS],
-[
- AC_REQUIRE([AC_LIBREPLACE_LD_SHLIB_FLAGS])
- AC_REQUIRE([AC_LIBREPLACE_LD_SHLIB_ALLOW_UNDEF_FLAG])
- MDLD_FLAGS="$LD_SHLIB_FLAGS $LD_SHLIB_ALLOW_UNDEF_FLAG"
- AC_SUBST(MDLD_FLAGS)
-])
-
-AC_DEFUN([AC_LIBREPLACE_RUNTIME_LIB_PATH_VAR],
-[
- case "$host_os" in
- *linux*|*gnu*)
- LIB_PATH_VAR=LD_LIBRARY_PATH
- ;;
- *bsd*)
- LIB_PATH_VAR=LD_LIBRARY_PATH
- ;;
- *solaris*)
- LIB_PATH_VAR=LD_LIBRARY_PATH
- ;;
- *hpux*)
- LIB_PATH_VAR=SHLIB_PATH
- ;;
- *osf*)
- LIB_PATH_VAR=LD_LIBRARY_PATH
- ;;
- *aix*)
- LIB_PATH_VAR=LIBPATH
- ;;
- *irix*)
- LIB_PATH_VAR=LD_LIBRARY_PATH
- ;;
- *darwin*)
- LIB_PATH_VAR=DYLD_LIBRARY_PATH
- ;;
- *)
- LIB_PATH_VAR=LD_LIBRARY_PATH
- ;;
- esac
-
- AC_SUBST(LIB_PATH_VAR)
-])
diff --git a/chromium/third_party/talloc/libreplace/libreplace_macros.m4 b/chromium/third_party/talloc/libreplace/libreplace_macros.m4
deleted file mode 100644
index 1856eacf66e..00000000000
--- a/chromium/third_party/talloc/libreplace/libreplace_macros.m4
+++ /dev/null
@@ -1,332 +0,0 @@
-#
-# This is a collection of useful autoconf macros
-#
-
-############################################
-# Check if the compiler handles c99 struct initialization, and if not try -AC99 and -c99 flags
-# Usage: LIBREPLACE_C99_STRUCT_INIT(success-action,failure-action)
-# changes CFLAGS to add -AC99 or -c99 if needed
-AC_DEFUN([LIBREPLACE_C99_STRUCT_INIT],
-[
-saved_CFLAGS="$CFLAGS";
-c99_init=no
-if test x"$c99_init" = x"no"; then
- AC_MSG_CHECKING(for C99 designated initializers)
- CFLAGS="$saved_CFLAGS";
- AC_TRY_COMPILE([#include <stdio.h>],
- [ struct foo {int x;char y;};
- struct foo bar = { .y = 'X', .x = 1 };
- ],
- [AC_MSG_RESULT(yes); c99_init=yes],[AC_MSG_RESULT(no)])
-fi
-if test x"$c99_init" = x"no"; then
- AC_MSG_CHECKING(for C99 designated initializers with -AC99)
- CFLAGS="$saved_CFLAGS -AC99";
- AC_TRY_COMPILE([#include <stdio.h>],
- [ struct foo {int x;char y;};
- struct foo bar = { .y = 'X', .x = 1 };
- ],
- [AC_MSG_RESULT(yes); c99_init=yes],[AC_MSG_RESULT(no)])
-fi
-if test x"$c99_init" = x"no"; then
- AC_MSG_CHECKING(for C99 designated initializers with -qlanglvl=extc99)
- CFLAGS="$saved_CFLAGS -qlanglvl=extc99";
- AC_TRY_COMPILE([#include <stdio.h>],
- [ struct foo {int x;char y;};
- struct foo bar = { .y = 'X', .x = 1 };
- ],
- [AC_MSG_RESULT(yes); c99_init=yes],[AC_MSG_RESULT(no)])
-fi
-if test x"$c99_init" = x"no"; then
- AC_MSG_CHECKING(for C99 designated initializers with -qlanglvl=stdc99)
- CFLAGS="$saved_CFLAGS -qlanglvl=stdc99";
- AC_TRY_COMPILE([#include <stdio.h>],
- [ struct foo {int x;char y;};
- struct foo bar = { .y = 'X', .x = 1 };
- ],
- [AC_MSG_RESULT(yes); c99_init=yes],[AC_MSG_RESULT(no)])
-fi
-if test x"$c99_init" = x"no"; then
- AC_MSG_CHECKING(for C99 designated initializers with -c99)
- CFLAGS="$saved_CFLAGS -c99"
- AC_TRY_COMPILE([#include <stdio.h>],
- [ struct foo {int x;char y;};
- struct foo bar = { .y = 'X', .x = 1 };
- ],
- [AC_MSG_RESULT(yes); c99_init=yes],[AC_MSG_RESULT(no)])
-fi
-
-if test "`uname`" = "HP-UX"; then
- if test "$ac_cv_c_compiler_gnu" = no; then
- # special override for broken HP-UX compiler - I can't find a way to test
- # this properly (its a compiler bug)
- CFLAGS="$CFLAGS -AC99";
- c99_init=yes;
- fi
-fi
-
-if test x"$c99_init" = x"yes"; then
- saved_CFLAGS=""
- $1
-else
- CFLAGS="$saved_CFLAGS"
- saved_CFLAGS=""
- $2
-fi
-])
-
-dnl AC_PROG_CC_FLAG(flag)
-AC_DEFUN(AC_PROG_CC_FLAG,
-[AC_CACHE_CHECK(whether ${CC-cc} accepts -$1, ac_cv_prog_cc_$1,
-[echo 'void f(){}' > conftest.c
-if test -z "`${CC-cc} -$1 -c conftest.c 2>&1`"; then
- ac_cv_prog_cc_$1=yes
-else
- ac_cv_prog_cc_$1=no
-fi
-rm -f conftest*
-])])
-
-dnl see if a declaration exists for a function or variable
-dnl defines HAVE_function_DECL if it exists
-dnl AC_HAVE_DECL(var, includes)
-AC_DEFUN(AC_HAVE_DECL,
-[
- AC_CACHE_CHECK([for $1 declaration],ac_cv_have_$1_decl,[
- AC_TRY_COMPILE([$2],[int i = (int)$1],
- ac_cv_have_$1_decl=yes,ac_cv_have_$1_decl=no)])
- if test x"$ac_cv_have_$1_decl" = x"yes"; then
- AC_DEFINE([HAVE_]translit([$1], [a-z], [A-Z])[_DECL],1,[Whether $1() is available])
- fi
-])
-
-
-# AC_CHECK_LIB_EXT(LIBRARY, [EXT_LIBS], [FUNCTION],
-# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
-# [ADD-ACTION-IF-FOUND],[OTHER-LIBRARIES])
-# ------------------------------------------------------
-#
-# Use a cache variable name containing both the library and function name,
-# because the test really is for library $1 defining function $3, not
-# just for library $1. Separate tests with the same $1 and different $3s
-# may have different results.
-#
-# Note that using directly AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1_$3])
-# is asking for trouble, since AC_CHECK_LIB($lib, fun) would give
-# ac_cv_lib_$lib_fun, which is definitely not what was meant. Hence
-# the AS_LITERAL_IF indirection.
-#
-# FIXME: This macro is extremely suspicious. It DEFINEs unconditionally,
-# whatever the FUNCTION, in addition to not being a *S macro. Note
-# that the cache does depend upon the function we are looking for.
-#
-# It is on purpose we used `ac_check_lib_ext_save_LIBS' and not just
-# `ac_save_LIBS': there are many macros which don't want to see `LIBS'
-# changed but still want to use AC_CHECK_LIB_EXT, so they save `LIBS'.
-# And ``ac_save_LIBS' is too tempting a name, so let's leave them some
-# freedom.
-AC_DEFUN([AC_CHECK_LIB_EXT],
-[
-AH_CHECK_LIB_EXT([$1])
-ac_check_lib_ext_save_LIBS=$LIBS
-LIBS="-l$1 $$2 $7 $LIBS"
-AS_LITERAL_IF([$1],
- [AS_VAR_PUSHDEF([ac_Lib_ext], [ac_cv_lib_ext_$1])],
- [AS_VAR_PUSHDEF([ac_Lib_ext], [ac_cv_lib_ext_$1''])])dnl
-
-m4_ifval([$3],
- [
- AH_CHECK_FUNC_EXT([$3])
- AS_LITERAL_IF([$1],
- [AS_VAR_PUSHDEF([ac_Lib_func], [ac_cv_lib_ext_$1_$3])],
- [AS_VAR_PUSHDEF([ac_Lib_func], [ac_cv_lib_ext_$1''_$3])])dnl
- AC_CACHE_CHECK([for $3 in -l$1], ac_Lib_func,
- [AC_TRY_LINK_FUNC($3,
- [AS_VAR_SET(ac_Lib_func, yes);
- AS_VAR_SET(ac_Lib_ext, yes)],
- [AS_VAR_SET(ac_Lib_func, no);
- AS_VAR_SET(ac_Lib_ext, no)])
- ])
- AS_IF([test AS_VAR_GET(ac_Lib_func) = yes],
- [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_$3))])dnl
- AS_VAR_POPDEF([ac_Lib_func])dnl
- ],[
- AC_CACHE_CHECK([for -l$1], ac_Lib_ext,
- [AC_TRY_LINK_FUNC([main],
- [AS_VAR_SET(ac_Lib_ext, yes)],
- [AS_VAR_SET(ac_Lib_ext, no)])
- ])
- ])
-LIBS=$ac_check_lib_ext_save_LIBS
-
-AS_IF([test AS_VAR_GET(ac_Lib_ext) = yes],
- [m4_default([$4],
- [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_LIB$1))
- case "$$2" in
- *-l$1*)
- ;;
- *)
- $2="-l$1 $$2"
- ;;
- esac])
- [$6]
- ],
- [$5])dnl
-AS_VAR_POPDEF([ac_Lib_ext])dnl
-])# AC_CHECK_LIB_EXT
-
-# AH_CHECK_LIB_EXT(LIBNAME)
-# ---------------------
-m4_define([AH_CHECK_LIB_EXT],
-[AH_TEMPLATE(AS_TR_CPP(HAVE_LIB$1),
- [Define to 1 if you have the `]$1[' library (-l]$1[).])])
-
-dnl AC_SEARCH_LIBS_EXT(FUNCTION, SEARCH-LIBS, EXT_LIBS,
-dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
-dnl [OTHER-LIBRARIES])
-dnl --------------------------------------------------------
-dnl Search for a library defining FUNC, if it's not already available.
-AC_DEFUN([AC_SEARCH_LIBS_EXT],
-[AC_CACHE_CHECK([for library containing $1], [ac_cv_search_ext_$1],
-[
-ac_func_search_ext_save_LIBS=$LIBS
-ac_cv_search_ext_$1=no
-AC_LINK_IFELSE([AC_LANG_CALL([], [$1])],
- [ac_cv_search_ext_$1="none required"])
-if test "$ac_cv_search_ext_$1" = no; then
- for ac_lib in $2; do
- LIBS="-l$ac_lib $$3 $6 $ac_func_search_save_ext_LIBS"
- AC_LINK_IFELSE([AC_LANG_CALL([], [$1])],
- [ac_cv_search_ext_$1="-l$ac_lib"
-break])
- done
-fi
-LIBS=$ac_func_search_ext_save_LIBS])
-AS_IF([test "$ac_cv_search_ext_$1" != no],
- [test "$ac_cv_search_ext_$1" = "none required" || $3="$ac_cv_search_ext_$1 $$3"
- $4],
- [$5])dnl
-])
-
-dnl check for a function in a $LIBS and $OTHER_LIBS libraries variable.
-dnl AC_CHECK_FUNC_EXT(func,OTHER_LIBS,IF-TRUE,IF-FALSE)
-AC_DEFUN([AC_CHECK_FUNC_EXT],
-[
- AH_CHECK_FUNC_EXT($1)
- ac_check_func_ext_save_LIBS=$LIBS
- LIBS="$2 $LIBS"
- AS_VAR_PUSHDEF([ac_var], [ac_cv_func_ext_$1])dnl
- AC_CACHE_CHECK([for $1], ac_var,
- [AC_LINK_IFELSE([AC_LANG_FUNC_LINK_TRY([$1])],
- [AS_VAR_SET(ac_var, yes)],
- [AS_VAR_SET(ac_var, no)])])
- LIBS=$ac_check_func_ext_save_LIBS
- AS_IF([test AS_VAR_GET(ac_var) = yes],
- [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_$1])) $3],
- [$4])dnl
-AS_VAR_POPDEF([ac_var])dnl
-])# AC_CHECK_FUNC
-
-# AH_CHECK_FUNC_EXT(FUNCNAME)
-# ---------------------
-m4_define([AH_CHECK_FUNC_EXT],
-[AH_TEMPLATE(AS_TR_CPP(HAVE_$1),
- [Define to 1 if you have the `]$1[' function.])])
-
-dnl Define an AC_DEFINE with ifndef guard.
-dnl AC_N_DEFINE(VARIABLE [, VALUE])
-AC_DEFUN([AC_N_DEFINE],
-[
-AH_VERBATIM([$1], [
-#ifndef $1
-# undef $1
-#endif
-])
-
- cat >>confdefs.h <<\EOF
-#ifndef $1
-[#define] $1 m4_if($#, 1, 1, [$2])
-#endif
-EOF
-])
-
-dnl Add an #include
-dnl AC_ADD_INCLUDE(VARIABLE)
-define(AC_ADD_INCLUDE,
-[cat >> confdefs.h <<\EOF
-[#include] $1
-EOF
-])
-
-dnl remove an #include
-dnl AC_REMOVE_INCLUDE(VARIABLE)
-define(AC_REMOVE_INCLUDE,
-[
-grep -v '[#include] $1' confdefs.h >confdefs.h.tmp
-cat confdefs.h.tmp > confdefs.h
-rm confdefs.h.tmp
-])
-
-dnl remove an #define
-dnl AC_REMOVE_DEFINE(VARIABLE)
-define(AC_REMOVE_DEFINE,
-[
-grep -v '[#define] $1 ' confdefs.h |grep -v '[#define] $1[$]'>confdefs.h.tmp
-cat confdefs.h.tmp > confdefs.h
-rm confdefs.h.tmp
-])
-
-dnl AS_HELP_STRING is not available in autoconf 2.57, and AC_HELP_STRING is deprecated
-dnl in autoconf 2.59, so define AS_HELP_STRING to be AC_HELP_STRING unless it is already
-dnl defined.
-m4_ifdef([AS_HELP_STRING], , [m4_define([AS_HELP_STRING], m4_defn([AC_HELP_STRING]))])
-
-dnl check if the prototype in the header matches the given one
-dnl AC_VERIFY_C_PROTOTYPE(prototype,functionbody,[IF-TRUE].[IF-FALSE],[extraheaders])
-AC_DEFUN(AC_VERIFY_C_PROTOTYPE,
-[AC_CACHE_CHECK([for prototype $1], AS_TR_SH([ac_cv_c_prototype_$1]),
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([
- AC_INCLUDES_DEFAULT
- $5
- $1
- {
- $2
- }
- ])],[
- AS_TR_SH([ac_cv_c_prototype_$1])=yes
- ],[
- AS_TR_SH([ac_cv_c_prototype_$1])=no
- ])
-)
-AS_IF([test $AS_TR_SH([ac_cv_c_prototype_$1]) = yes],[$3],[$4])
-])
-
-AC_DEFUN(LIBREPLACE_PROVIDE_HEADER,
-[AC_CHECK_HEADER([$1],
- [ AC_CONFIG_COMMANDS(rm-$1, [rm -f $libreplacedir/$1], [libreplacedir=$libreplacedir]) ],
- [ AC_CONFIG_COMMANDS(mk-$1, [echo "#include \"replace.h\"" > $libreplacedir/$1], [libreplacedir=$libreplacedir]) ]
- )
-])
-
-dnl AC_HAVE_TYPE(TYPE,INCLUDES)
-AC_DEFUN([AC_HAVE_TYPE], [
-AC_REQUIRE([AC_HEADER_STDC])
-cv=`echo "$1" | sed 'y%./+- %__p__%'`
-AC_MSG_CHECKING(for $1)
-AC_CACHE_VAL([ac_cv_type_$cv],
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-AC_INCLUDES_DEFAULT
-$2]],
-[[$1 foo;]])],
-[eval "ac_cv_type_$cv=yes"],
-[eval "ac_cv_type_$cv=no"]))dnl
-ac_foo=`eval echo \\$ac_cv_type_$cv`
-AC_MSG_RESULT($ac_foo)
-if test "$ac_foo" = yes; then
- ac_tr_hdr=HAVE_`echo $1 | sed 'y%abcdefghijklmnopqrstuvwxyz./- %ABCDEFGHIJKLMNOPQRSTUVWXYZ____%'`
-if false; then
- AC_CHECK_TYPES($1)
-fi
- AC_DEFINE_UNQUOTED($ac_tr_hdr, 1, [Define if you have type `$1'])
-fi
-])
diff --git a/chromium/third_party/talloc/libreplace/libreplace_network.m4 b/chromium/third_party/talloc/libreplace/libreplace_network.m4
deleted file mode 100644
index b7d15eaddbd..00000000000
--- a/chromium/third_party/talloc/libreplace/libreplace_network.m4
+++ /dev/null
@@ -1,389 +0,0 @@
-AC_DEFUN_ONCE(AC_LIBREPLACE_NETWORK_CHECKS,
-[
-echo "LIBREPLACE_NETWORK_CHECKS: START"
-
-AC_DEFINE(LIBREPLACE_NETWORK_CHECKS, 1, [LIBREPLACE_NETWORK_CHECKS were used])
-LIBREPLACE_NETWORK_OBJS=""
-LIBREPLACE_NETWORK_LIBS=""
-
-AC_CHECK_HEADERS(sys/socket.h netinet/in.h netdb.h arpa/inet.h)
-AC_CHECK_HEADERS(netinet/in_systm.h)
-AC_CHECK_HEADERS([netinet/ip.h], [], [],[
- #include <sys/types.h>
- #ifdef HAVE_NETINET_IN_H
- #include <netinet/in.h>
- #endif
- #ifdef HAVE_NETINET_IN_SYSTM_H
- #include <netinet/in_systm.h>
- #endif
-])
-AC_CHECK_HEADERS(netinet/tcp.h netinet/in_ip.h)
-AC_CHECK_HEADERS(sys/sockio.h sys/un.h)
-AC_CHECK_HEADERS(sys/uio.h)
-
-dnl we need to check that net/if.h really can be used, to cope with hpux
-dnl where including it always fails
-AC_CACHE_CHECK([for usable net/if.h],libreplace_cv_USABLE_NET_IF_H,[
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([
- AC_INCLUDES_DEFAULT
- #if HAVE_SYS_SOCKET_H
- # include <sys/socket.h>
- #endif
- #include <net/if.h>
- int main(void) {return 0;}])],
- [libreplace_cv_USABLE_NET_IF_H=yes],
- [libreplace_cv_USABLE_NET_IF_H=no]
- )
-])
-if test x"$libreplace_cv_USABLE_NET_IF_H" = x"yes";then
- AC_DEFINE(HAVE_NET_IF_H, 1, usability of net/if.h)
-fi
-
-AC_HAVE_TYPE([socklen_t],[#include <sys/socket.h>])
-AC_HAVE_TYPE([sa_family_t],[#include <sys/socket.h>])
-AC_HAVE_TYPE([struct addrinfo], [#include <netdb.h>])
-AC_HAVE_TYPE([struct sockaddr], [#include <sys/socket.h>])
-AC_HAVE_TYPE([struct sockaddr_storage], [
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-])
-AC_HAVE_TYPE([struct sockaddr_in6], [
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-])
-
-if test x"$ac_cv_type_struct_sockaddr_storage" = x"yes"; then
-AC_CHECK_MEMBER(struct sockaddr_storage.ss_family,
- AC_DEFINE(HAVE_SS_FAMILY, 1, [Defined if struct sockaddr_storage has ss_family field]),,
- [
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <netinet/in.h>
- ])
-
-if test x"$ac_cv_member_struct_sockaddr_storage_ss_family" != x"yes"; then
-AC_CHECK_MEMBER(struct sockaddr_storage.__ss_family,
- AC_DEFINE(HAVE___SS_FAMILY, 1, [Defined if struct sockaddr_storage has __ss_family field]),,
- [
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <netinet/in.h>
- ])
-fi
-fi
-
-AC_CACHE_CHECK([for sin_len in sock],libreplace_cv_HAVE_SOCK_SIN_LEN,[
- AC_TRY_COMPILE(
- [
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
- ],[
-struct sockaddr_in sock; sock.sin_len = sizeof(sock);
- ],[
- libreplace_cv_HAVE_SOCK_SIN_LEN=yes
- ],[
- libreplace_cv_HAVE_SOCK_SIN_LEN=no
- ])
-])
-if test x"$libreplace_cv_HAVE_SOCK_SIN_LEN" = x"yes"; then
- AC_DEFINE(HAVE_SOCK_SIN_LEN,1,[Whether the sockaddr_in struct has a sin_len property])
-fi
-
-############################################
-# check for unix domain sockets
-AC_CACHE_CHECK([for unix domain sockets],libreplace_cv_HAVE_UNIXSOCKET,[
- AC_TRY_COMPILE([
-#include <sys/types.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <sys/socket.h>
-#include <sys/un.h>
- ],[
-struct sockaddr_un sunaddr;
-sunaddr.sun_family = AF_UNIX;
- ],[
- libreplace_cv_HAVE_UNIXSOCKET=yes
- ],[
- libreplace_cv_HAVE_UNIXSOCKET=no
- ])
-])
-if test x"$libreplace_cv_HAVE_UNIXSOCKET" = x"yes"; then
- AC_DEFINE(HAVE_UNIXSOCKET,1,[If we need to build with unixscoket support])
-fi
-
-dnl The following test is roughl taken from the cvs sources.
-dnl
-dnl If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
-dnl The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
-dnl libsocket.so which has a bad implementation of gethostbyname (it
-dnl only looks in /etc/hosts), so we only look for -lsocket if we need
-dnl it.
-AC_CHECK_FUNCS(connect)
-if test x"$ac_cv_func_connect" = x"no"; then
- AC_CHECK_LIB_EXT(nsl_s, LIBREPLACE_NETWORK_LIBS, connect)
- AC_CHECK_LIB_EXT(nsl, LIBREPLACE_NETWORK_LIBS, connect)
- AC_CHECK_LIB_EXT(socket, LIBREPLACE_NETWORK_LIBS, connect)
- AC_CHECK_LIB_EXT(inet, LIBREPLACE_NETWORK_LIBS, connect)
- dnl We can't just call AC_CHECK_FUNCS(connect) here,
- dnl because the value has been cached.
- if test x"$ac_cv_lib_ext_nsl_s_connect" = x"yes" ||
- test x"$ac_cv_lib_ext_nsl_connect" = x"yes" ||
- test x"$ac_cv_lib_ext_socket_connect" = x"yes" ||
- test x"$ac_cv_lib_ext_inet_connect" = x"yes"
- then
- AC_DEFINE(HAVE_CONNECT,1,[Whether the system has connect()])
- fi
-fi
-
-AC_CHECK_FUNCS(gethostbyname)
-if test x"$ac_cv_func_gethostbyname" = x"no"; then
- AC_CHECK_LIB_EXT(nsl_s, LIBREPLACE_NETWORK_LIBS, gethostbyname)
- AC_CHECK_LIB_EXT(nsl, LIBREPLACE_NETWORK_LIBS, gethostbyname)
- AC_CHECK_LIB_EXT(socket, LIBREPLACE_NETWORK_LIBS, gethostbyname)
- dnl We can't just call AC_CHECK_FUNCS(gethostbyname) here,
- dnl because the value has been cached.
- if test x"$ac_cv_lib_ext_nsl_s_gethostbyname" = x"yes" ||
- test x"$ac_cv_lib_ext_nsl_gethostbyname" = x"yes" ||
- test x"$ac_cv_lib_ext_socket_gethostbyname" = x"yes"
- then
- AC_DEFINE(HAVE_GETHOSTBYNAME,1,
- [Whether the system has gethostbyname()])
- fi
-fi
-
-dnl HP-UX has if_nametoindex in -lipv6
-AC_CHECK_FUNCS(if_nametoindex)
-if test x"$ac_cv_func_if_nametoindex" = x"no"; then
- AC_CHECK_LIB_EXT(ipv6, LIBREPLACE_NETWORK_LIBS, if_nametoindex)
- dnl We can't just call AC_CHECK_FUNCS(if_nametoindex) here,
- dnl because the value has been cached.
- if test x"$ac_cv_lib_ext_ipv6_if_nametoindex" = x"yes"
- then
- AC_DEFINE(HAVE_IF_NAMETOINDEX, 1,
- [Whether the system has if_nametoindex()])
- fi
-fi
-
-# The following tests need LIBS="${LIBREPLACE_NETWORK_LIBS}"
-old_LIBS=$LIBS
-LIBS="${LIBREPLACE_NETWORK_LIBS}"
-libreplace_SAVE_CPPFLAGS="$CPPFLAGS"
-CPPFLAGS="$CPPFLAGS -I$libreplacedir"
-
-AC_CHECK_FUNCS(socketpair,[],[LIBREPLACE_NETWORK_OBJS="${LIBREPLACE_NETWORK_OBJS} $libreplacedir/socketpair.o"])
-
-AC_CACHE_CHECK([for broken inet_ntoa],libreplace_cv_REPLACE_INET_NTOA,[
-AC_TRY_RUN([
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#ifdef HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-main() { struct in_addr ip; ip.s_addr = 0x12345678;
-if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
- strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); }
-exit(1);}],
- libreplace_cv_REPLACE_INET_NTOA=yes,libreplace_cv_REPLACE_INET_NTOA=no,libreplace_cv_REPLACE_INET_NTOA=cross)])
-
-AC_CHECK_FUNCS(inet_ntoa,[],[libreplace_cv_REPLACE_INET_NTOA=yes])
-if test x"$libreplace_cv_REPLACE_INET_NTOA" = x"yes"; then
- AC_DEFINE(REPLACE_INET_NTOA,1,[Whether inet_ntoa should be replaced])
- LIBREPLACE_NETWORK_OBJS="${LIBREPLACE_NETWORK_OBJS} $libreplacedir/inet_ntoa.o"
-fi
-
-AC_CHECK_FUNCS(inet_aton,[],[LIBREPLACE_NETWORK_OBJS="${LIBREPLACE_NETWORK_OBJS} $libreplacedir/inet_aton.o"])
-
-AC_CHECK_FUNCS(inet_ntop,[],[LIBREPLACE_NETWORK_OBJS="${LIBREPLACE_NETWORK_OBJS} $libreplacedir/inet_ntop.o"])
-
-AC_CHECK_FUNCS(inet_pton,[],[LIBREPLACE_NETWORK_OBJS="${LIBREPLACE_NETWORK_OBJS} $libreplacedir/inet_pton.o"])
-
-dnl test for getaddrinfo/getnameinfo
-AC_CACHE_CHECK([for getaddrinfo],libreplace_cv_HAVE_GETADDRINFO,[
-AC_TRY_LINK([
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-#include <sys/socket.h>
-#include <netdb.h>],
-[
-struct sockaddr sa;
-struct addrinfo *ai = NULL;
-int ret = getaddrinfo(NULL, NULL, NULL, &ai);
-if (ret != 0) {
- const char *es = gai_strerror(ret);
-}
-freeaddrinfo(ai);
-ret = getnameinfo(&sa, sizeof(sa),
- NULL, 0,
- NULL, 0, 0);
-
-],
-libreplace_cv_HAVE_GETADDRINFO=yes,libreplace_cv_HAVE_GETADDRINFO=no)])
-if test x"$libreplace_cv_HAVE_GETADDRINFO" = x"yes"; then
- AC_DEFINE(HAVE_GETADDRINFO,1,[Whether the system has getaddrinfo])
- AC_DEFINE(HAVE_GETNAMEINFO,1,[Whether the system has getnameinfo])
- AC_DEFINE(HAVE_FREEADDRINFO,1,[Whether the system has freeaddrinfo])
- AC_DEFINE(HAVE_GAI_STRERROR,1,[Whether the system has gai_strerror])
-else
- LIBREPLACE_NETWORK_OBJS="${LIBREPLACE_NETWORK_OBJS} $libreplacedir/getaddrinfo.o"
-fi
-
-AC_CHECK_HEADERS([ifaddrs.h])
-
-dnl Used when getifaddrs is not available
-AC_CHECK_MEMBERS([struct sockaddr.sa_len],
- [AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Whether struct sockaddr has a sa_len member])],
- [],
- [#include <sys/socket.h>])
-
-dnl test for getifaddrs and freeifaddrs
-AC_CACHE_CHECK([for getifaddrs and freeifaddrs],libreplace_cv_HAVE_GETIFADDRS,[
-AC_TRY_LINK([
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <ifaddrs.h>
-#include <netdb.h>],
-[
-struct ifaddrs *ifp = NULL;
-int ret = getifaddrs (&ifp);
-freeifaddrs(ifp);
-],
-libreplace_cv_HAVE_GETIFADDRS=yes,libreplace_cv_HAVE_GETIFADDRS=no)])
-if test x"$libreplace_cv_HAVE_GETIFADDRS" = x"yes"; then
- AC_DEFINE(HAVE_GETIFADDRS,1,[Whether the system has getifaddrs])
- AC_DEFINE(HAVE_FREEIFADDRS,1,[Whether the system has freeifaddrs])
- AC_DEFINE(HAVE_STRUCT_IFADDRS,1,[Whether struct ifaddrs is available])
-fi
-
-##################
-# look for a method of finding the list of network interfaces
-iface=no;
-AC_CACHE_CHECK([for iface getifaddrs],libreplace_cv_HAVE_IFACE_GETIFADDRS,[
-AC_TRY_RUN([
-#define HAVE_IFACE_GETIFADDRS 1
-#define NO_CONFIG_H 1
-#define AUTOCONF_TEST 1
-#define SOCKET_WRAPPER_NOT_REPLACE
-#include "$libreplacedir/replace.c"
-#include "$libreplacedir/inet_ntop.c"
-#include "$libreplacedir/snprintf.c"
-#include "$libreplacedir/getifaddrs.c"
-#define getifaddrs_test main
-#include "$libreplacedir/test/getifaddrs.c"],
- libreplace_cv_HAVE_IFACE_GETIFADDRS=yes,libreplace_cv_HAVE_IFACE_GETIFADDRS=no,libreplace_cv_HAVE_IFACE_GETIFADDRS=cross)])
-if test x"$libreplace_cv_HAVE_IFACE_GETIFADDRS" = x"yes"; then
- iface=yes;AC_DEFINE(HAVE_IFACE_GETIFADDRS,1,[Whether iface getifaddrs is available])
-else
- LIBREPLACE_NETWORK_OBJS="${LIBREPLACE_NETWORK_OBJS} $libreplacedir/getifaddrs.o"
-fi
-
-
-if test $iface = no; then
-AC_CACHE_CHECK([for iface AIX],libreplace_cv_HAVE_IFACE_AIX,[
-AC_TRY_RUN([
-#define HAVE_IFACE_AIX 1
-#define NO_CONFIG_H 1
-#define AUTOCONF_TEST 1
-#undef _XOPEN_SOURCE_EXTENDED
-#define SOCKET_WRAPPER_NOT_REPLACE
-#include "$libreplacedir/replace.c"
-#include "$libreplacedir/inet_ntop.c"
-#include "$libreplacedir/snprintf.c"
-#include "$libreplacedir/getifaddrs.c"
-#define getifaddrs_test main
-#include "$libreplacedir/test/getifaddrs.c"],
- libreplace_cv_HAVE_IFACE_AIX=yes,libreplace_cv_HAVE_IFACE_AIX=no,libreplace_cv_HAVE_IFACE_AIX=cross)])
-if test x"$libreplace_cv_HAVE_IFACE_AIX" = x"yes"; then
- iface=yes;AC_DEFINE(HAVE_IFACE_AIX,1,[Whether iface AIX is available])
-fi
-fi
-
-
-if test $iface = no; then
-AC_CACHE_CHECK([for iface ifconf],libreplace_cv_HAVE_IFACE_IFCONF,[
-AC_TRY_RUN([
-#define HAVE_IFACE_IFCONF 1
-#define NO_CONFIG_H 1
-#define AUTOCONF_TEST 1
-#define SOCKET_WRAPPER_NOT_REPLACE
-#include "$libreplacedir/replace.c"
-#include "$libreplacedir/inet_ntop.c"
-#include "$libreplacedir/snprintf.c"
-#include "$libreplacedir/getifaddrs.c"
-#define getifaddrs_test main
-#include "$libreplacedir/test/getifaddrs.c"],
- libreplace_cv_HAVE_IFACE_IFCONF=yes,libreplace_cv_HAVE_IFACE_IFCONF=no,libreplace_cv_HAVE_IFACE_IFCONF=cross)])
-if test x"$libreplace_cv_HAVE_IFACE_IFCONF" = x"yes"; then
- iface=yes;AC_DEFINE(HAVE_IFACE_IFCONF,1,[Whether iface ifconf is available])
-fi
-fi
-
-if test $iface = no; then
-AC_CACHE_CHECK([for iface ifreq],libreplace_cv_HAVE_IFACE_IFREQ,[
-AC_TRY_RUN([
-#define HAVE_IFACE_IFREQ 1
-#define NO_CONFIG_H 1
-#define AUTOCONF_TEST 1
-#define SOCKET_WRAPPER_NOT_REPLACE
-#include "$libreplacedir/replace.c"
-#include "$libreplacedir/inet_ntop.c"
-#include "$libreplacedir/snprintf.c"
-#include "$libreplacedir/getifaddrs.c"
-#define getifaddrs_test main
-#include "$libreplacedir/test/getifaddrs.c"],
- libreplace_cv_HAVE_IFACE_IFREQ=yes,libreplace_cv_HAVE_IFACE_IFREQ=no,libreplace_cv_HAVE_IFACE_IFREQ=cross)])
-if test x"$libreplace_cv_HAVE_IFACE_IFREQ" = x"yes"; then
- iface=yes;AC_DEFINE(HAVE_IFACE_IFREQ,1,[Whether iface ifreq is available])
-fi
-fi
-
-dnl test for ipv6
-AC_CACHE_CHECK([for ipv6 support],libreplace_cv_HAVE_IPV6,[
- AC_TRY_LINK([
-#include <stdlib.h> /* for NULL */
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <netdb.h>
-#include <netinet/in.h>
- ],
- [
-struct sockaddr_storage sa_store;
-struct addrinfo *ai = NULL;
-struct in6_addr in6addr;
-int idx = if_nametoindex("iface1");
-int s = socket(AF_INET6, SOCK_STREAM, 0);
-int ret = getaddrinfo(NULL, NULL, NULL, &ai);
-if (ret != 0) {
- const char *es = gai_strerror(ret);
-}
-freeaddrinfo(ai);
- ],[
- libreplace_cv_HAVE_IPV6=yes
- ],[
- libreplace_cv_HAVE_IPV6=no
- ])
-])
-if test x"$libreplace_cv_HAVE_IPV6" = x"yes"; then
- AC_DEFINE(HAVE_IPV6,1,[Whether the system has IPv6 support])
-fi
-
-LIBS=$old_LIBS
-CPPFLAGS="$libreplace_SAVE_CPPFLAGS"
-
-LIBREPLACEOBJ="${LIBREPLACEOBJ} ${LIBREPLACE_NETWORK_OBJS}"
-
-echo "LIBREPLACE_NETWORK_CHECKS: END"
-]) dnl end AC_LIBREPLACE_NETWORK_CHECKS
diff --git a/chromium/third_party/talloc/libreplace/repdir.m4 b/chromium/third_party/talloc/libreplace/repdir.m4
deleted file mode 100644
index 682ab44c564..00000000000
--- a/chromium/third_party/talloc/libreplace/repdir.m4
+++ /dev/null
@@ -1,81 +0,0 @@
-AC_CACHE_CHECK([for broken readdir],libreplace_cv_READDIR_NEEDED,[
- AC_TRY_RUN([
-#define test_readdir_os2_delete main
-#include "$libreplacedir/test/os2_delete.c"],
- [libreplace_cv_READDIR_NEEDED=no],
- [libreplace_cv_READDIR_NEEDED=yes],
- [libreplace_cv_READDIR_NEEDED="assuming not"])
-])
-
-AC_CHECK_FUNCS(dirfd)
-AC_HAVE_DECL(dirfd, [#include <dirent.h>])
-
-#
-# try to replace with getdirentries() if needed
-#
-if test x"$libreplace_cv_READDIR_NEEDED" = x"yes"; then
-AC_CHECK_FUNCS(getdirentries)
-AC_VERIFY_C_PROTOTYPE([long telldir(const DIR *dir)],
- [
- return 0;
- ],[
- AC_DEFINE(TELLDIR_TAKES_CONST_DIR, 1, [Whether telldir takes a const pointer])
- ],[],[
- #include <dirent.h>
- ])
-
-AC_VERIFY_C_PROTOTYPE([int seekdir(DIR *dir, long ofs)],
- [
- return 0;
- ],[
- AC_DEFINE(SEEKDIR_RETURNS_INT, 1, [Whether seekdir returns an int])
- ],[],[
- #include <dirent.h>
- ])
-AC_CACHE_CHECK([for replacing readdir using getdirentries()],libreplace_cv_READDIR_GETDIRENTRIES,[
- AC_TRY_RUN([
-#define _LIBREPLACE_REPLACE_H
-#include "$libreplacedir/repdir_getdirentries.c"
-#define test_readdir_os2_delete main
-#include "$libreplacedir/test/os2_delete.c"],
- [libreplace_cv_READDIR_GETDIRENTRIES=yes],
- [libreplace_cv_READDIR_GETDIRENTRIES=no])
-])
-fi
-if test x"$libreplace_cv_READDIR_GETDIRENTRIES" = x"yes"; then
- AC_DEFINE(REPLACE_READDIR,1,[replace readdir])
- AC_DEFINE(REPLACE_READDIR_GETDIRENTRIES,1,[replace readdir using getdirentries()])
- LIBREPLACEOBJ="${LIBREPLACEOBJ} $libreplacedir/repdir_getdirentries.o"
- libreplace_cv_READDIR_NEEDED=no
-fi
-
-#
-# try to replace with getdents() if needed
-#
-if test x"$libreplace_cv_READDIR_NEEDED" = x"yes"; then
-AC_CHECK_FUNCS(getdents)
-AC_CACHE_CHECK([for replacing readdir using getdents()],libreplace_cv_READDIR_GETDENTS,[
- AC_TRY_RUN([
-#define _LIBREPLACE_REPLACE_H
-#error _donot_use_getdents_replacement_anymore
-#include "$libreplacedir/repdir_getdents.c"
-#define test_readdir_os2_delete main
-#include "$libreplacedir/test/os2_delete.c"],
- [libreplace_cv_READDIR_GETDENTS=yes],
- [libreplace_cv_READDIR_GETDENTS=no])
-])
-fi
-if test x"$libreplace_cv_READDIR_GETDENTS" = x"yes"; then
- AC_DEFINE(REPLACE_READDIR,1,[replace readdir])
- AC_DEFINE(REPLACE_READDIR_GETDENTS,1,[replace readdir using getdents()])
- LIBREPLACEOBJ="${LIBREPLACEOBJ} $libreplacedir/repdir_getdents.o"
- libreplace_cv_READDIR_NEEDED=no
-fi
-
-AC_MSG_CHECKING([a usable readdir()])
-if test x"$libreplace_cv_READDIR_NEEDED" = x"yes"; then
- AC_MSG_RESULT(no)
- AC_MSG_WARN([the provided readdir() is broken])
-else
- AC_MSG_RESULT(yes)
-fi
diff --git a/chromium/third_party/talloc/libreplace/repdir_getdents.c b/chromium/third_party/talloc/libreplace/repdir_getdents.c
deleted file mode 100644
index afc634a7962..00000000000
--- a/chromium/third_party/talloc/libreplace/repdir_getdents.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- Copyright (C) Andrew Tridgell 2005
-
- ** NOTE! The following LGPL license applies to the replace
- ** library. This does NOT imply that all of Samba is released
- ** under the LGPL
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, see <http://www.gnu.org/licenses/>.
-*/
-/*
- a replacement for opendir/readdir/telldir/seekdir/closedir for BSD systems
-
- This is needed because the existing directory handling in FreeBSD
- and OpenBSD (and possibly NetBSD) doesn't correctly handle unlink()
- on files in a directory where telldir() has been used. On a block
- boundary it will occasionally miss a file when seekdir() is used to
- return to a position previously recorded with telldir().
-
- This also fixes a severe performance and memory usage problem with
- telldir() on BSD systems. Each call to telldir() in BSD adds an
- entry to a linked list, and those entries are cleaned up on
- closedir(). This means with a large directory closedir() can take an
- arbitrary amount of time, causing network timeouts as millions of
- telldir() entries are freed
-
- Note! This replacement code is not portable. It relies on getdents()
- always leaving the file descriptor at a seek offset that is a
- multiple of DIR_BUF_SIZE. If the code detects that this doesn't
- happen then it will abort(). It also does not handle directories
- with offsets larger than can be stored in a long,
-
- This code is available under other free software licenses as
- well. Contact the author.
-*/
-
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <dirent.h>
-
-#define DIR_BUF_BITS 9
-#define DIR_BUF_SIZE (1<<DIR_BUF_BITS)
-
-struct dir_buf {
- int fd;
- int nbytes, ofs;
- off_t seekpos;
- char buf[DIR_BUF_SIZE];
-};
-
-DIR *opendir(const char *dname)
-{
- struct dir_buf *d;
- struct stat sb;
- d = malloc(sizeof(*d));
- if (d == NULL) {
- errno = ENOMEM;
- return NULL;
- }
- d->fd = open(dname, O_RDONLY);
- if (d->fd == -1) {
- free(d);
- return NULL;
- }
- if (fstat(d->fd, &sb) < 0) {
- close(d->fd);
- free(d);
- return NULL;
- }
- if (!S_ISDIR(sb.st_mode)) {
- close(d->fd);
- free(d);
- errno = ENOTDIR;
- return NULL;
- }
- d->ofs = 0;
- d->seekpos = 0;
- d->nbytes = 0;
- return (DIR *)d;
-}
-
-struct dirent *readdir(DIR *dir)
-{
- struct dir_buf *d = (struct dir_buf *)dir;
- struct dirent *de;
-
- if (d->ofs >= d->nbytes) {
- d->seekpos = lseek(d->fd, 0, SEEK_CUR);
- d->nbytes = getdents(d->fd, d->buf, DIR_BUF_SIZE);
- d->ofs = 0;
- }
- if (d->ofs >= d->nbytes) {
- return NULL;
- }
- de = (struct dirent *)&d->buf[d->ofs];
- d->ofs += de->d_reclen;
- return de;
-}
-
-long telldir(DIR *dir)
-{
- struct dir_buf *d = (struct dir_buf *)dir;
- if (d->ofs >= d->nbytes) {
- d->seekpos = lseek(d->fd, 0, SEEK_CUR);
- d->ofs = 0;
- d->nbytes = 0;
- }
- /* this relies on seekpos always being a multiple of
- DIR_BUF_SIZE. Is that always true on BSD systems? */
- if (d->seekpos & (DIR_BUF_SIZE-1)) {
- abort();
- }
- return d->seekpos + d->ofs;
-}
-
-void seekdir(DIR *dir, long ofs)
-{
- struct dir_buf *d = (struct dir_buf *)dir;
- d->seekpos = lseek(d->fd, ofs & ~(DIR_BUF_SIZE-1), SEEK_SET);
- d->nbytes = getdents(d->fd, d->buf, DIR_BUF_SIZE);
- d->ofs = 0;
- while (d->ofs < (ofs & (DIR_BUF_SIZE-1))) {
- if (readdir(dir) == NULL) break;
- }
-}
-
-void rewinddir(DIR *dir)
-{
- seekdir(dir, 0);
-}
-
-int closedir(DIR *dir)
-{
- struct dir_buf *d = (struct dir_buf *)dir;
- int r = close(d->fd);
- if (r != 0) {
- return r;
- }
- free(d);
- return 0;
-}
-
-#ifndef dirfd
-/* darn, this is a macro on some systems. */
-int dirfd(DIR *dir)
-{
- struct dir_buf *d = (struct dir_buf *)dir;
- return d->fd;
-}
-#endif
diff --git a/chromium/third_party/talloc/libreplace/repdir_getdirentries.c b/chromium/third_party/talloc/libreplace/repdir_getdirentries.c
deleted file mode 100644
index 197e5931fc7..00000000000
--- a/chromium/third_party/talloc/libreplace/repdir_getdirentries.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- Copyright (C) Andrew Tridgell 2005
-
- ** NOTE! The following LGPL license applies to the replace
- ** library. This does NOT imply that all of Samba is released
- ** under the LGPL
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, see <http://www.gnu.org/licenses/>.
-*/
-/*
- a replacement for opendir/readdir/telldir/seekdir/closedir for BSD
- systems using getdirentries
-
- This is needed because the existing directory handling in FreeBSD
- and OpenBSD (and possibly NetBSD) doesn't correctly handle unlink()
- on files in a directory where telldir() has been used. On a block
- boundary it will occasionally miss a file when seekdir() is used to
- return to a position previously recorded with telldir().
-
- This also fixes a severe performance and memory usage problem with
- telldir() on BSD systems. Each call to telldir() in BSD adds an
- entry to a linked list, and those entries are cleaned up on
- closedir(). This means with a large directory closedir() can take an
- arbitrary amount of time, causing network timeouts as millions of
- telldir() entries are freed
-
- Note! This replacement code is not portable. It relies on
- getdirentries() always leaving the file descriptor at a seek offset
- that is a multiple of DIR_BUF_SIZE. If the code detects that this
- doesn't happen then it will abort(). It also does not handle
- directories with offsets larger than can be stored in a long,
-
- This code is available under other free software licenses as
- well. Contact the author.
-*/
-
-#include "replace.h"
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <dirent.h>
-
-#define DIR_BUF_BITS 9
-#define DIR_BUF_SIZE (1<<DIR_BUF_BITS)
-
-struct dir_buf {
- int fd;
- int nbytes, ofs;
- off_t seekpos;
- char buf[DIR_BUF_SIZE];
-};
-
-DIR *opendir(const char *dname)
-{
- struct dir_buf *d;
- struct stat sb;
- d = malloc(sizeof(*d));
- if (d == NULL) {
- errno = ENOMEM;
- return NULL;
- }
- d->fd = open(dname, O_RDONLY);
- if (d->fd == -1) {
- free(d);
- return NULL;
- }
- if (fstat(d->fd, &sb) < 0) {
- close(d->fd);
- free(d);
- return NULL;
- }
- if (!S_ISDIR(sb.st_mode)) {
- close(d->fd);
- free(d);
- errno = ENOTDIR;
- return NULL;
- }
- d->ofs = 0;
- d->seekpos = 0;
- d->nbytes = 0;
- return (DIR *)d;
-}
-
-struct dirent *readdir(DIR *dir)
-{
- struct dir_buf *d = (struct dir_buf *)dir;
- struct dirent *de;
-
- if (d->ofs >= d->nbytes) {
- long pos;
- d->nbytes = getdirentries(d->fd, d->buf, DIR_BUF_SIZE, &pos);
- d->seekpos = pos;
- d->ofs = 0;
- }
- if (d->ofs >= d->nbytes) {
- return NULL;
- }
- de = (struct dirent *)&d->buf[d->ofs];
- d->ofs += de->d_reclen;
- return de;
-}
-
-#ifdef TELLDIR_TAKES_CONST_DIR
-long telldir(const DIR *dir)
-#else
-long telldir(DIR *dir)
-#endif
-{
- struct dir_buf *d = (struct dir_buf *)dir;
- if (d->ofs >= d->nbytes) {
- d->seekpos = lseek(d->fd, 0, SEEK_CUR);
- d->ofs = 0;
- d->nbytes = 0;
- }
- /* this relies on seekpos always being a multiple of
- DIR_BUF_SIZE. Is that always true on BSD systems? */
- if (d->seekpos & (DIR_BUF_SIZE-1)) {
- abort();
- }
- return d->seekpos + d->ofs;
-}
-
-#ifdef SEEKDIR_RETURNS_INT
-int seekdir(DIR *dir, long ofs)
-#else
-void seekdir(DIR *dir, long ofs)
-#endif
-{
- struct dir_buf *d = (struct dir_buf *)dir;
- long pos;
- d->seekpos = lseek(d->fd, ofs & ~(DIR_BUF_SIZE-1), SEEK_SET);
- d->nbytes = getdirentries(d->fd, d->buf, DIR_BUF_SIZE, &pos);
- d->ofs = 0;
- while (d->ofs < (ofs & (DIR_BUF_SIZE-1))) {
- if (readdir(dir) == NULL) break;
- }
-#ifdef SEEKDIR_RETURNS_INT
- return -1;
-#endif
-}
-
-void rewinddir(DIR *dir)
-{
- seekdir(dir, 0);
-}
-
-int closedir(DIR *dir)
-{
- struct dir_buf *d = (struct dir_buf *)dir;
- int r = close(d->fd);
- if (r != 0) {
- return r;
- }
- free(d);
- return 0;
-}
-
-#ifndef dirfd
-/* darn, this is a macro on some systems. */
-int dirfd(DIR *dir)
-{
- struct dir_buf *d = (struct dir_buf *)dir;
- return d->fd;
-}
-#endif
-
-
diff --git a/chromium/third_party/talloc/libreplace/replace.c b/chromium/third_party/talloc/libreplace/replace.c
deleted file mode 100644
index fc15717349e..00000000000
--- a/chromium/third_party/talloc/libreplace/replace.c
+++ /dev/null
@@ -1,683 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- replacement routines for broken systems
- Copyright (C) Andrew Tridgell 1992-1998
- Copyright (C) Jelmer Vernooij 2005-2008
-
- ** NOTE! The following LGPL license applies to the replace
- ** library. This does NOT imply that all of Samba is released
- ** under the LGPL
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "replace.h"
-
-#include "system/filesys.h"
-#include "system/time.h"
-#include "system/passwd.h"
-#include "system/syslog.h"
-#include "system/locale.h"
-#include "system/wait.h"
-
-#ifdef _WIN32
-#define mkdir(d,m) _mkdir(d)
-#endif
-
-void replace_dummy(void);
-void replace_dummy(void) {}
-
-#ifndef HAVE_FTRUNCATE
- /*******************************************************************
-ftruncate for operating systems that don't have it
-********************************************************************/
-int rep_ftruncate(int f, off_t l)
-{
-#ifdef HAVE_CHSIZE
- return chsize(f,l);
-#elif defined(F_FREESP)
- struct flock fl;
-
- fl.l_whence = 0;
- fl.l_len = 0;
- fl.l_start = l;
- fl.l_type = F_WRLCK;
- return fcntl(f, F_FREESP, &fl);
-#else
-#error "you must have a ftruncate function"
-#endif
-}
-#endif /* HAVE_FTRUNCATE */
-
-
-#ifndef HAVE_STRLCPY
-/* like strncpy but does not 0 fill the buffer and always null
- terminates. bufsize is the size of the destination buffer */
-size_t rep_strlcpy(char *d, const char *s, size_t bufsize)
-{
- size_t len = strlen(s);
- size_t ret = len;
- if (bufsize <= 0) return 0;
- if (len >= bufsize) len = bufsize-1;
- memcpy(d, s, len);
- d[len] = 0;
- return ret;
-}
-#endif
-
-#ifndef HAVE_STRLCAT
-/* like strncat but does not 0 fill the buffer and always null
- terminates. bufsize is the length of the buffer, which should
- be one more than the maximum resulting string length */
-size_t rep_strlcat(char *d, const char *s, size_t bufsize)
-{
- size_t len1 = strlen(d);
- size_t len2 = strlen(s);
- size_t ret = len1 + len2;
-
- if (len1+len2 >= bufsize) {
- if (bufsize < (len1+1)) {
- return ret;
- }
- len2 = bufsize - (len1+1);
- }
- if (len2 > 0) {
- memcpy(d+len1, s, len2);
- d[len1+len2] = 0;
- }
- return ret;
-}
-#endif
-
-#ifndef HAVE_MKTIME
-/*******************************************************************
-a mktime() replacement for those who don't have it - contributed by
-C.A. Lademann <cal@zls.com>
-Corrections by richard.kettlewell@kewill.com
-********************************************************************/
-
-#define MINUTE 60
-#define HOUR 60*MINUTE
-#define DAY 24*HOUR
-#define YEAR 365*DAY
-time_t rep_mktime(struct tm *t)
-{
- struct tm *u;
- time_t epoch = 0;
- int n;
- int mon [] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
- y, m, i;
-
- if(t->tm_year < 70)
- return((time_t)-1);
-
- n = t->tm_year + 1900 - 1;
- epoch = (t->tm_year - 70) * YEAR +
- ((n / 4 - n / 100 + n / 400) - (1969 / 4 - 1969 / 100 + 1969 / 400)) * DAY;
-
- y = t->tm_year + 1900;
- m = 0;
-
- for(i = 0; i < t->tm_mon; i++) {
- epoch += mon [m] * DAY;
- if(m == 1 && y % 4 == 0 && (y % 100 != 0 || y % 400 == 0))
- epoch += DAY;
-
- if(++m > 11) {
- m = 0;
- y++;
- }
- }
-
- epoch += (t->tm_mday - 1) * DAY;
- epoch += t->tm_hour * HOUR + t->tm_min * MINUTE + t->tm_sec;
-
- if((u = localtime(&epoch)) != NULL) {
- t->tm_sec = u->tm_sec;
- t->tm_min = u->tm_min;
- t->tm_hour = u->tm_hour;
- t->tm_mday = u->tm_mday;
- t->tm_mon = u->tm_mon;
- t->tm_year = u->tm_year;
- t->tm_wday = u->tm_wday;
- t->tm_yday = u->tm_yday;
- t->tm_isdst = u->tm_isdst;
- }
-
- return(epoch);
-}
-#endif /* !HAVE_MKTIME */
-
-
-#ifndef HAVE_INITGROUPS
-/****************************************************************************
- some systems don't have an initgroups call
-****************************************************************************/
-int rep_initgroups(char *name, gid_t id)
-{
-#ifndef HAVE_SETGROUPS
- /* yikes! no SETGROUPS or INITGROUPS? how can this work? */
- errno = ENOSYS;
- return -1;
-#else /* HAVE_SETGROUPS */
-
-#include <grp.h>
-
- gid_t *grouplst = NULL;
- int max_gr = NGROUPS_MAX;
- int ret;
- int i,j;
- struct group *g;
- char *gr;
-
- if((grouplst = malloc(sizeof(gid_t) * max_gr)) == NULL) {
- errno = ENOMEM;
- return -1;
- }
-
- grouplst[0] = id;
- i = 1;
- while (i < max_gr && ((g = (struct group *)getgrent()) != (struct group *)NULL)) {
- if (g->gr_gid == id)
- continue;
- j = 0;
- gr = g->gr_mem[0];
- while (gr && (*gr != (char)NULL)) {
- if (strcmp(name,gr) == 0) {
- grouplst[i] = g->gr_gid;
- i++;
- gr = (char *)NULL;
- break;
- }
- gr = g->gr_mem[++j];
- }
- }
- endgrent();
- ret = setgroups(i, grouplst);
- free(grouplst);
- return ret;
-#endif /* HAVE_SETGROUPS */
-}
-#endif /* HAVE_INITGROUPS */
-
-
-#if (defined(SecureWare) && defined(SCO))
-/* This is needed due to needing the nap() function but we don't want
- to include the Xenix libraries since that will break other things...
- BTW: system call # 0x0c28 is the same as calling nap() */
-long nap(long milliseconds) {
- return syscall(0x0c28, milliseconds);
- }
-#endif
-
-
-#ifndef HAVE_MEMMOVE
-/*******************************************************************
-safely copies memory, ensuring no overlap problems.
-this is only used if the machine does not have its own memmove().
-this is not the fastest algorithm in town, but it will do for our
-needs.
-********************************************************************/
-void *rep_memmove(void *dest,const void *src,int size)
-{
- unsigned long d,s;
- int i;
- if (dest==src || !size) return(dest);
-
- d = (unsigned long)dest;
- s = (unsigned long)src;
-
- if ((d >= (s+size)) || (s >= (d+size))) {
- /* no overlap */
- memcpy(dest,src,size);
- return(dest);
- }
-
- if (d < s) {
- /* we can forward copy */
- if (s-d >= sizeof(int) &&
- !(s%sizeof(int)) &&
- !(d%sizeof(int)) &&
- !(size%sizeof(int))) {
- /* do it all as words */
- int *idest = (int *)dest;
- int *isrc = (int *)src;
- size /= sizeof(int);
- for (i=0;i<size;i++) idest[i] = isrc[i];
- } else {
- /* simplest */
- char *cdest = (char *)dest;
- char *csrc = (char *)src;
- for (i=0;i<size;i++) cdest[i] = csrc[i];
- }
- } else {
- /* must backward copy */
- if (d-s >= sizeof(int) &&
- !(s%sizeof(int)) &&
- !(d%sizeof(int)) &&
- !(size%sizeof(int))) {
- /* do it all as words */
- int *idest = (int *)dest;
- int *isrc = (int *)src;
- size /= sizeof(int);
- for (i=size-1;i>=0;i--) idest[i] = isrc[i];
- } else {
- /* simplest */
- char *cdest = (char *)dest;
- char *csrc = (char *)src;
- for (i=size-1;i>=0;i--) cdest[i] = csrc[i];
- }
- }
- return(dest);
-}
-#endif /* HAVE_MEMMOVE */
-
-#ifndef HAVE_STRDUP
-/****************************************************************************
-duplicate a string
-****************************************************************************/
-char *rep_strdup(const char *s)
-{
- size_t len;
- char *ret;
-
- if (!s) return(NULL);
-
- len = strlen(s)+1;
- ret = (char *)malloc(len);
- if (!ret) return(NULL);
- memcpy(ret,s,len);
- return(ret);
-}
-#endif /* HAVE_STRDUP */
-
-#ifndef HAVE_SETLINEBUF
-void rep_setlinebuf(FILE *stream)
-{
- setvbuf(stream, (char *)NULL, _IOLBF, 0);
-}
-#endif /* HAVE_SETLINEBUF */
-
-#ifndef HAVE_VSYSLOG
-#ifdef HAVE_SYSLOG
-void rep_vsyslog (int facility_priority, const char *format, va_list arglist)
-{
- char *msg = NULL;
- vasprintf(&msg, format, arglist);
- if (!msg)
- return;
- syslog(facility_priority, "%s", msg);
- free(msg);
-}
-#endif /* HAVE_SYSLOG */
-#endif /* HAVE_VSYSLOG */
-
-#ifndef HAVE_STRNLEN
-/**
- Some platforms don't have strnlen
-**/
- size_t rep_strnlen(const char *s, size_t max)
-{
- size_t len;
-
- for (len = 0; len < max; len++) {
- if (s[len] == '\0') {
- break;
- }
- }
- return len;
-}
-#endif
-
-#ifndef HAVE_STRNDUP
-/**
- Some platforms don't have strndup.
-**/
-char *rep_strndup(const char *s, size_t n)
-{
- char *ret;
-
- n = strnlen(s, n);
- ret = malloc(n+1);
- if (!ret)
- return NULL;
- memcpy(ret, s, n);
- ret[n] = 0;
-
- return ret;
-}
-#endif
-
-#if !defined(HAVE_WAITPID) && defined(HAVE_WAIT4)
-int rep_waitpid(pid_t pid,int *status,int options)
-{
- return wait4(pid, status, options, NULL);
-}
-#endif
-
-#ifndef HAVE_SETEUID
-int rep_seteuid(uid_t euid)
-{
-#ifdef HAVE_SETRESUID
- return setresuid(-1, euid, -1);
-#else
- errno = ENOSYS;
- return -1;
-#endif
-}
-#endif
-
-#ifndef HAVE_SETEGID
-int rep_setegid(gid_t egid)
-{
-#ifdef HAVE_SETRESGID
- return setresgid(-1, egid, -1);
-#else
- errno = ENOSYS;
- return -1;
-#endif
-}
-#endif
-
-/*******************************************************************
-os/2 also doesn't have chroot
-********************************************************************/
-#ifndef HAVE_CHROOT
-int rep_chroot(const char *dname)
-{
- errno = ENOSYS;
- return -1;
-}
-#endif
-
-/*****************************************************************
- Possibly replace mkstemp if it is broken.
-*****************************************************************/
-
-#ifndef HAVE_SECURE_MKSTEMP
-int rep_mkstemp(char *template)
-{
- /* have a reasonable go at emulating it. Hope that
- the system mktemp() isn't completly hopeless */
- char *p = mktemp(template);
- if (!p)
- return -1;
- return open(p, O_CREAT|O_EXCL|O_RDWR, 0600);
-}
-#endif
-
-#ifndef HAVE_MKDTEMP
-char *rep_mkdtemp(char *template)
-{
- char *dname;
-
- if ((dname = mktemp(template))) {
- if (mkdir(dname, 0700) >= 0) {
- return dname;
- }
- }
-
- return NULL;
-}
-#endif
-
-/*****************************************************************
- Watch out: this is not thread safe.
-*****************************************************************/
-
-#ifndef HAVE_PREAD
-ssize_t rep_pread(int __fd, void *__buf, size_t __nbytes, off_t __offset)
-{
- if (lseek(__fd, __offset, SEEK_SET) != __offset) {
- return -1;
- }
- return read(__fd, __buf, __nbytes);
-}
-#endif
-
-/*****************************************************************
- Watch out: this is not thread safe.
-*****************************************************************/
-
-#ifndef HAVE_PWRITE
-ssize_t rep_pwrite(int __fd, const void *__buf, size_t __nbytes, off_t __offset)
-{
- if (lseek(__fd, __offset, SEEK_SET) != __offset) {
- return -1;
- }
- return write(__fd, __buf, __nbytes);
-}
-#endif
-
-#ifndef HAVE_STRCASESTR
-char *rep_strcasestr(const char *haystack, const char *needle)
-{
- const char *s;
- size_t nlen = strlen(needle);
- for (s=haystack;*s;s++) {
- if (toupper(*needle) == toupper(*s) &&
- strncasecmp(s, needle, nlen) == 0) {
- return (char *)((uintptr_t)s);
- }
- }
- return NULL;
-}
-#endif
-
-#ifndef HAVE_STRTOK_R
-/* based on GLIBC version, copyright Free Software Foundation */
-char *rep_strtok_r(char *s, const char *delim, char **save_ptr)
-{
- char *token;
-
- if (s == NULL) s = *save_ptr;
-
- s += strspn(s, delim);
- if (*s == '\0') {
- *save_ptr = s;
- return NULL;
- }
-
- token = s;
- s = strpbrk(token, delim);
- if (s == NULL) {
- *save_ptr = token + strlen(token);
- } else {
- *s = '\0';
- *save_ptr = s + 1;
- }
-
- return token;
-}
-#endif
-
-#ifndef HAVE_STRTOLL
-long long int rep_strtoll(const char *str, char **endptr, int base)
-{
-#ifdef HAVE_STRTOQ
- return strtoq(str, endptr, base);
-#elif defined(HAVE___STRTOLL)
- return __strtoll(str, endptr, base);
-#elif SIZEOF_LONG == SIZEOF_LONG_LONG
- return (long long int) strtol(str, endptr, base);
-#else
-# error "You need a strtoll function"
-#endif
-}
-#endif
-
-
-#ifndef HAVE_STRTOULL
-unsigned long long int rep_strtoull(const char *str, char **endptr, int base)
-{
-#ifdef HAVE_STRTOUQ
- return strtouq(str, endptr, base);
-#elif defined(HAVE___STRTOULL)
- return __strtoull(str, endptr, base);
-#elif SIZEOF_LONG == SIZEOF_LONG_LONG
- return (unsigned long long int) strtoul(str, endptr, base);
-#else
-# error "You need a strtoull function"
-#endif
-}
-#endif
-
-#ifndef HAVE_SETENV
-int rep_setenv(const char *name, const char *value, int overwrite)
-{
- char *p;
- size_t l1, l2;
- int ret;
-
- if (!overwrite && getenv(name)) {
- return 0;
- }
-
- l1 = strlen(name);
- l2 = strlen(value);
-
- p = malloc(l1+l2+2);
- if (p == NULL) {
- return -1;
- }
- memcpy(p, name, l1);
- p[l1] = '=';
- memcpy(p+l1+1, value, l2);
- p[l1+l2+1] = 0;
-
- ret = putenv(p);
- if (ret != 0) {
- free(p);
- }
-
- return ret;
-}
-#endif
-
-#ifndef HAVE_UNSETENV
-int rep_unsetenv(const char *name)
-{
- extern char **environ;
- size_t len = strlen(name);
- size_t i, count;
-
- if (environ == NULL || getenv(name) == NULL) {
- return 0;
- }
-
- for (i=0;environ[i];i++) /* noop */ ;
-
- count=i;
-
- for (i=0;i<count;) {
- if (strncmp(environ[i], name, len) == 0 && environ[i][len] == '=') {
- /* note: we do _not_ free the old variable here. It is unsafe to
- do so, as the pointer may not have come from malloc */
- memmove(&environ[i], &environ[i+1], (count-i)*sizeof(char *));
- count--;
- } else {
- i++;
- }
- }
-
- return 0;
-}
-#endif
-
-#ifndef HAVE_UTIME
-int rep_utime(const char *filename, const struct utimbuf *buf)
-{
- errno = ENOSYS;
- return -1;
-}
-#endif
-
-#ifndef HAVE_UTIMES
-int rep_utimes(const char *filename, const struct timeval tv[2])
-{
- struct utimbuf u;
-
- u.actime = tv[0].tv_sec;
- if (tv[0].tv_usec > 500000) {
- u.actime += 1;
- }
-
- u.modtime = tv[1].tv_sec;
- if (tv[1].tv_usec > 500000) {
- u.modtime += 1;
- }
-
- return utime(filename, &u);
-}
-#endif
-
-#ifndef HAVE_DUP2
-int rep_dup2(int oldfd, int newfd)
-{
- errno = ENOSYS;
- return -1;
-}
-#endif
-
-#ifndef HAVE_CHOWN
-/**
-chown isn't used much but OS/2 doesn't have it
-**/
-int rep_chown(const char *fname, uid_t uid, gid_t gid)
-{
- errno = ENOSYS;
- return -1;
-}
-#endif
-
-#ifndef HAVE_LINK
-int rep_link(const char *oldpath, const char *newpath)
-{
- errno = ENOSYS;
- return -1;
-}
-#endif
-
-#ifndef HAVE_READLINK
-int rep_readlink(const char *path, char *buf, size_t bufsiz)
-{
- errno = ENOSYS;
- return -1;
-}
-#endif
-
-#ifndef HAVE_SYMLINK
-int rep_symlink(const char *oldpath, const char *newpath)
-{
- errno = ENOSYS;
- return -1;
-}
-#endif
-
-#ifndef HAVE_LCHOWN
-int rep_lchown(const char *fname,uid_t uid,gid_t gid)
-{
- errno = ENOSYS;
- return -1;
-}
-#endif
-
-#ifndef HAVE_REALPATH
-char *rep_realpath(const char *path, char *resolved_path)
-{
- /* As realpath is not a system call we can't return ENOSYS. */
- errno = EINVAL;
- return NULL;
-}
-#endif
diff --git a/chromium/third_party/talloc/libreplace/replace.h b/chromium/third_party/talloc/libreplace/replace.h
deleted file mode 100644
index 6424d10c0f9..00000000000
--- a/chromium/third_party/talloc/libreplace/replace.h
+++ /dev/null
@@ -1,726 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- macros to go along with the lib/replace/ portability layer code
-
- Copyright (C) Andrew Tridgell 2005
- Copyright (C) Jelmer Vernooij 2006-2008
- Copyright (C) Jeremy Allison 2007.
-
- ** NOTE! The following LGPL license applies to the replace
- ** library. This does NOT imply that all of Samba is released
- ** under the LGPL
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _LIBREPLACE_REPLACE_H
-#define _LIBREPLACE_REPLACE_H
-
-#ifndef NO_CONFIG_H
-#include "config.h"
-#endif
-
-#ifdef HAVE_STANDARDS_H
-#include <standards.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <errno.h>
-
-#if defined(_MSC_VER) || defined(__MINGW32__)
-#include "win32_replace.h"
-#endif
-
-
-#ifdef HAVE_STDINT_H
-#include <stdint.h>
-/* force off HAVE_INTTYPES_H so that roken doesn't try to include both,
- which causes a warning storm on irix */
-#undef HAVE_INTTYPES_H
-#elif HAVE_INTTYPES_H
-#define __STDC_FORMAT_MACROS
-#include <inttypes.h>
-#endif
-
-#ifndef __PRI64_PREFIX
-# if __WORDSIZE == 64
-# define __PRI64_PREFIX "l"
-# else
-# define __PRI64_PREFIX "ll"
-# endif
-#endif
-
-/* Decimal notation. */
-#ifndef PRId8
-# define PRId8 "d"
-#endif
-#ifndef PRId16
-# define PRId16 "d"
-#endif
-#ifndef PRId32
-# define PRId32 "d"
-#endif
-#ifndef PRId64
-# define PRId64 __PRI64_PREFIX "d"
-#endif
-
-#ifndef PRIi8
-# define PRIi8 "i"
-#endif
-#ifndef PRIi8
-# define PRIi16 "i"
-#endif
-#ifndef PRIi8
-# define PRIi32 "i"
-#endif
-#ifndef PRIi8
-# define PRIi64 __PRI64_PREFIX "i"
-#endif
-
-#ifndef PRIu8
-# define PRIu8 "u"
-#endif
-#ifndef PRIu16
-# define PRIu16 "u"
-#endif
-#ifndef PRIu32
-# define PRIu32 "u"
-#endif
-#ifndef PRIu64
-# define PRIu64 __PRI64_PREFIX "u"
-#endif
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-
-#ifndef HAVE_STRERROR
-extern char *sys_errlist[];
-#define strerror(i) sys_errlist[i]
-#endif
-
-#ifndef HAVE_ERRNO_DECL
-extern int errno;
-#endif
-
-#ifndef HAVE_STRDUP
-#define strdup rep_strdup
-char *rep_strdup(const char *s);
-#endif
-
-#ifndef HAVE_MEMMOVE
-#define memmove rep_memmove
-void *rep_memmove(void *dest,const void *src,int size);
-#endif
-
-#ifndef HAVE_MKTIME
-#define mktime rep_mktime
-/* prototype is in "system/time.h" */
-#endif
-
-#ifndef HAVE_TIMEGM
-#define timegm rep_timegm
-/* prototype is in "system/time.h" */
-#endif
-
-#ifndef HAVE_UTIME
-#define utime rep_utime
-/* prototype is in "system/time.h" */
-#endif
-
-#ifndef HAVE_UTIMES
-#define utimes rep_utimes
-/* prototype is in "system/time.h" */
-#endif
-
-#ifndef HAVE_STRLCPY
-#define strlcpy rep_strlcpy
-size_t rep_strlcpy(char *d, const char *s, size_t bufsize);
-#endif
-
-#ifndef HAVE_STRLCAT
-#define strlcat rep_strlcat
-size_t rep_strlcat(char *d, const char *s, size_t bufsize);
-#endif
-
-#if (defined(BROKEN_STRNDUP) || !defined(HAVE_STRNDUP))
-#undef HAVE_STRNDUP
-#define strndup rep_strndup
-char *rep_strndup(const char *s, size_t n);
-#endif
-
-#if (defined(BROKEN_STRNLEN) || !defined(HAVE_STRNLEN))
-#undef HAVE_STRNLEN
-#define strnlen rep_strnlen
-size_t rep_strnlen(const char *s, size_t n);
-#endif
-
-#if !HAVE_DECL_ENVIRON
-#ifdef __APPLE__
-#include <crt_externs.h>
-#define environ (*_NSGetEnviron())
-#else
-extern char **environ;
-#endif
-#endif
-
-#ifndef HAVE_SETENV
-#define setenv rep_setenv
-int rep_setenv(const char *name, const char *value, int overwrite);
-#else
-#ifndef HAVE_SETENV_DECL
-int setenv(const char *name, const char *value, int overwrite);
-#endif
-#endif
-
-#ifndef HAVE_UNSETENV
-#define unsetenv rep_unsetenv
-int rep_unsetenv(const char *name);
-#endif
-
-#ifndef HAVE_SETEUID
-#define seteuid rep_seteuid
-int rep_seteuid(uid_t);
-#endif
-
-#ifndef HAVE_SETEGID
-#define setegid rep_setegid
-int rep_setegid(gid_t);
-#endif
-
-#if (defined(USE_SETRESUID) && !defined(HAVE_SETRESUID_DECL))
-/* stupid glibc */
-int setresuid(uid_t ruid, uid_t euid, uid_t suid);
-#endif
-#if (defined(USE_SETRESUID) && !defined(HAVE_SETRESGID_DECL))
-int setresgid(gid_t rgid, gid_t egid, gid_t sgid);
-#endif
-
-#ifndef HAVE_CHOWN
-#define chown rep_chown
-int rep_chown(const char *path, uid_t uid, gid_t gid);
-#endif
-
-#ifndef HAVE_CHROOT
-#define chroot rep_chroot
-int rep_chroot(const char *dirname);
-#endif
-
-#ifndef HAVE_LINK
-#define link rep_link
-int rep_link(const char *oldpath, const char *newpath);
-#endif
-
-#ifndef HAVE_READLINK
-#define readlink rep_readlink
-ssize_t rep_readlink(const char *path, char *buf, size_t bufsize);
-#endif
-
-#ifndef HAVE_SYMLINK
-#define symlink rep_symlink
-int rep_symlink(const char *oldpath, const char *newpath);
-#endif
-
-#ifndef HAVE_REALPATH
-#define realpath rep_realpath
-char *rep_realpath(const char *path, char *resolved_path);
-#endif
-
-#ifndef HAVE_LCHOWN
-#define lchown rep_lchown
-int rep_lchown(const char *fname,uid_t uid,gid_t gid);
-#endif
-
-#ifdef HAVE_UNIX_H
-#include <unix.h>
-#endif
-
-#ifndef HAVE_SETLINEBUF
-#define setlinebuf rep_setlinebuf
-void rep_setlinebuf(FILE *);
-#endif
-
-#ifndef HAVE_STRCASESTR
-#define strcasestr rep_strcasestr
-char *rep_strcasestr(const char *haystack, const char *needle);
-#endif
-
-#ifndef HAVE_STRTOK_R
-#define strtok_r rep_strtok_r
-char *rep_strtok_r(char *s, const char *delim, char **save_ptr);
-#endif
-
-#ifndef HAVE_STRTOLL
-#define strtoll rep_strtoll
-long long int rep_strtoll(const char *str, char **endptr, int base);
-#endif
-
-#ifndef HAVE_STRTOULL
-#define strtoull rep_strtoull
-unsigned long long int rep_strtoull(const char *str, char **endptr, int base);
-#endif
-
-#ifndef HAVE_FTRUNCATE
-#define ftruncate rep_ftruncate
-int rep_ftruncate(int,off_t);
-#endif
-
-#ifndef HAVE_INITGROUPS
-#define initgroups rep_initgroups
-int rep_initgroups(char *name, gid_t id);
-#endif
-
-#if !defined(HAVE_BZERO) && defined(HAVE_MEMSET)
-#define bzero(a,b) memset((a),'\0',(b))
-#endif
-
-#ifndef HAVE_DLERROR
-#define dlerror rep_dlerror
-char *rep_dlerror(void);
-#endif
-
-#ifndef HAVE_DLOPEN
-#define dlopen rep_dlopen
-#ifdef DLOPEN_TAKES_UNSIGNED_FLAGS
-void *rep_dlopen(const char *name, unsigned int flags);
-#else
-void *rep_dlopen(const char *name, int flags);
-#endif
-#endif
-
-#ifndef HAVE_DLSYM
-#define dlsym rep_dlsym
-void *rep_dlsym(void *handle, const char *symbol);
-#endif
-
-#ifndef HAVE_DLCLOSE
-#define dlclose rep_dlclose
-int rep_dlclose(void *handle);
-#endif
-
-#ifndef HAVE_SOCKETPAIR
-#define socketpair rep_socketpair
-/* prototype is in system/network.h */
-#endif
-
-#ifndef PRINTF_ATTRIBUTE
-#if (__GNUC__ >= 3) && (__GNUC_MINOR__ >= 1 )
-/** Use gcc attribute to check printf fns. a1 is the 1-based index of
- * the parameter containing the format, and a2 the index of the first
- * argument. Note that some gcc 2.x versions don't handle this
- * properly **/
-#define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format (__printf__, a1, a2)))
-#else
-#define PRINTF_ATTRIBUTE(a1, a2)
-#endif
-#endif
-
-#ifndef _DEPRECATED_
-#if (__GNUC__ >= 3) && (__GNUC_MINOR__ >= 1 )
-#define _DEPRECATED_ __attribute__ ((deprecated))
-#else
-#define _DEPRECATED_
-#endif
-#endif
-
-#ifndef HAVE_VASPRINTF
-#define vasprintf rep_vasprintf
-int rep_vasprintf(char **ptr, const char *format, va_list ap) PRINTF_ATTRIBUTE(2,0);
-#endif
-
-#if !defined(HAVE_SNPRINTF) || !defined(HAVE_C99_VSNPRINTF)
-#define snprintf rep_snprintf
-int rep_snprintf(char *,size_t ,const char *, ...) PRINTF_ATTRIBUTE(3,4);
-#endif
-
-#if !defined(HAVE_VSNPRINTF) || !defined(HAVE_C99_VSNPRINTF)
-#define vsnprintf rep_vsnprintf
-int rep_vsnprintf(char *,size_t ,const char *, va_list ap) PRINTF_ATTRIBUTE(3,0);
-#endif
-
-#ifndef HAVE_ASPRINTF
-#define asprintf rep_asprintf
-int rep_asprintf(char **,const char *, ...) PRINTF_ATTRIBUTE(2,3);
-#endif
-
-#ifndef HAVE_VSYSLOG
-#ifdef HAVE_SYSLOG
-#define vsyslog rep_vsyslog
-void rep_vsyslog (int facility_priority, const char *format, va_list arglist) PRINTF_ATTRIBUTE(2,0);
-#endif
-#endif
-
-/* we used to use these fns, but now we have good replacements
- for snprintf and vsnprintf */
-#define slprintf snprintf
-
-
-#ifndef HAVE_VA_COPY
-#undef va_copy
-#ifdef HAVE___VA_COPY
-#define va_copy(dest, src) __va_copy(dest, src)
-#else
-#define va_copy(dest, src) (dest) = (src)
-#endif
-#endif
-
-#ifndef HAVE_VOLATILE
-#define volatile
-#endif
-
-#ifndef HAVE_COMPARISON_FN_T
-typedef int (*comparison_fn_t)(const void *, const void *);
-#endif
-
-#ifdef REPLACE_STRPTIME
-#define strptime rep_strptime
-struct tm;
-char *rep_strptime(const char *buf, const char *format, struct tm *tm);
-#endif
-
-#ifndef HAVE_DUP2
-#define dup2 rep_dup2
-int rep_dup2(int oldfd, int newfd);
-#endif
-
-/* Load header file for dynamic linking stuff */
-#ifdef HAVE_DLFCN_H
-#include <dlfcn.h>
-#endif
-
-#ifndef RTLD_LAZY
-#define RTLD_LAZY 0
-#endif
-#ifndef RTLD_NOW
-#define RTLD_NOW 0
-#endif
-#ifndef RTLD_GLOBAL
-#define RTLD_GLOBAL 0
-#endif
-
-#ifndef HAVE_SECURE_MKSTEMP
-#define mkstemp(path) rep_mkstemp(path)
-int rep_mkstemp(char *temp);
-#endif
-
-#ifndef HAVE_MKDTEMP
-#define mkdtemp rep_mkdtemp
-char *rep_mkdtemp(char *template);
-#endif
-
-#ifndef HAVE_PREAD
-#define pread rep_pread
-ssize_t rep_pread(int __fd, void *__buf, size_t __nbytes, off_t __offset);
-#define LIBREPLACE_PREAD_REPLACED 1
-#else
-#define LIBREPLACE_PREAD_NOT_REPLACED 1
-#endif
-
-#ifndef HAVE_PWRITE
-#define pwrite rep_pwrite
-ssize_t rep_pwrite(int __fd, const void *__buf, size_t __nbytes, off_t __offset);
-#define LIBREPLACE_PWRITE_REPLACED 1
-#else
-#define LIBREPLACE_PWRITE_NOT_REPLACED 1
-#endif
-
-#if !defined(HAVE_INET_NTOA) || defined(REPLACE_INET_NTOA)
-#define inet_ntoa rep_inet_ntoa
-/* prototype is in "system/network.h" */
-#endif
-
-#ifndef HAVE_INET_PTON
-#define inet_pton rep_inet_pton
-/* prototype is in "system/network.h" */
-#endif
-
-#ifndef HAVE_INET_NTOP
-#define inet_ntop rep_inet_ntop
-/* prototype is in "system/network.h" */
-#endif
-
-#ifndef HAVE_INET_ATON
-#define inet_aton rep_inet_aton
-/* prototype is in "system/network.h" */
-#endif
-
-#ifndef HAVE_CONNECT
-#define connect rep_connect
-/* prototype is in "system/network.h" */
-#endif
-
-#ifndef HAVE_GETHOSTBYNAME
-#define gethostbyname rep_gethostbyname
-/* prototype is in "system/network.h" */
-#endif
-
-#ifndef HAVE_GETIFADDRS
-#define getifaddrs rep_getifaddrs
-/* prototype is in "system/network.h" */
-#endif
-
-#ifndef HAVE_FREEIFADDRS
-#define freeifaddrs rep_freeifaddrs
-/* prototype is in "system/network.h" */
-#endif
-
-#ifdef HAVE_LIMITS_H
-#include <limits.h>
-#endif
-
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif
-
-/* The extra casts work around common compiler bugs. */
-#define _TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
-/* The outer cast is needed to work around a bug in Cray C 5.0.3.0.
- It is necessary at least when t == time_t. */
-#define _TYPE_MINIMUM(t) ((t) (_TYPE_SIGNED (t) \
- ? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) : (t) 0))
-#define _TYPE_MAXIMUM(t) ((t) (~ (t) 0 - _TYPE_MINIMUM (t)))
-
-#ifndef UINT16_MAX
-#define UINT16_MAX 65535
-#endif
-
-#ifndef UINT32_MAX
-#define UINT32_MAX (4294967295U)
-#endif
-
-#ifndef UINT64_MAX
-#define UINT64_MAX ((uint64_t)-1)
-#endif
-
-#ifndef CHAR_BIT
-#define CHAR_BIT 8
-#endif
-
-#ifndef INT32_MAX
-#define INT32_MAX _TYPE_MAXIMUM(int32_t)
-#endif
-
-#ifdef HAVE_STDBOOL_H
-#include <stdbool.h>
-#endif
-
-#if !defined(HAVE_BOOL)
-#ifdef HAVE__Bool
-#define bool _Bool
-#else
-typedef int bool;
-#endif
-#endif
-
-#if !defined(HAVE_INTPTR_T)
-typedef long long intptr_t ;
-#endif
-
-#if !defined(HAVE_UINTPTR_T)
-typedef unsigned long long uintptr_t ;
-#endif
-
-#if !defined(HAVE_PTRDIFF_T)
-typedef unsigned long long ptrdiff_t ;
-#endif
-
-/*
- * to prevent <rpcsvc/yp_prot.h> from doing a redefine of 'bool'
- *
- * IRIX, HPUX, MacOS 10 and Solaris need BOOL_DEFINED
- * Tru64 needs _BOOL_EXISTS
- * AIX needs _BOOL,_TRUE,_FALSE
- */
-#ifndef BOOL_DEFINED
-#define BOOL_DEFINED
-#endif
-#ifndef _BOOL_EXISTS
-#define _BOOL_EXISTS
-#endif
-#ifndef _BOOL
-#define _BOOL
-#endif
-
-#ifndef __bool_true_false_are_defined
-#define __bool_true_false_are_defined
-#endif
-
-#ifndef true
-#define true (1)
-#endif
-#ifndef false
-#define false (0)
-#endif
-
-#ifndef _TRUE
-#define _TRUE true
-#endif
-#ifndef _FALSE
-#define _FALSE false
-#endif
-
-#ifndef HAVE_FUNCTION_MACRO
-#ifdef HAVE_func_MACRO
-#define __FUNCTION__ __func__
-#else
-#define __FUNCTION__ ("")
-#endif
-#endif
-
-
-#ifndef MIN
-#define MIN(a,b) ((a)<(b)?(a):(b))
-#endif
-
-#ifndef MAX
-#define MAX(a,b) ((a)>(b)?(a):(b))
-#endif
-
-#if !defined(HAVE_VOLATILE)
-#define volatile
-#endif
-
-/**
- this is a warning hack. The idea is to use this everywhere that we
- get the "discarding const" warning from gcc. That doesn't actually
- fix the problem of course, but it means that when we do get to
- cleaning them up we can do it by searching the code for
- discard_const.
-
- It also means that other error types aren't as swamped by the noise
- of hundreds of const warnings, so we are more likely to notice when
- we get new errors.
-
- Please only add more uses of this macro when you find it
- _really_ hard to fix const warnings. Our aim is to eventually use
- this function in only a very few places.
-
- Also, please call this via the discard_const_p() macro interface, as that
- makes the return type safe.
-*/
-#define discard_const(ptr) ((void *)((uintptr_t)(ptr)))
-
-/** Type-safe version of discard_const */
-#define discard_const_p(type, ptr) ((type *)discard_const(ptr))
-
-#ifndef __STRING
-#define __STRING(x) #x
-#endif
-
-#ifndef __STRINGSTRING
-#define __STRINGSTRING(x) __STRING(x)
-#endif
-
-#ifndef __LINESTR__
-#define __LINESTR__ __STRINGSTRING(__LINE__)
-#endif
-
-#ifndef __location__
-#define __location__ __FILE__ ":" __LINESTR__
-#endif
-
-/**
- * zero a structure
- */
-#define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x))
-
-/**
- * zero a structure given a pointer to the structure
- */
-#define ZERO_STRUCTP(x) do { if ((x) != NULL) memset((char *)(x), 0, sizeof(*(x))); } while(0)
-
-/**
- * zero a structure given a pointer to the structure - no zero check
- */
-#define ZERO_STRUCTPN(x) memset((char *)(x), 0, sizeof(*(x)))
-
-/* zero an array - note that sizeof(array) must work - ie. it must not be a
- pointer */
-#define ZERO_ARRAY(x) memset((char *)(x), 0, sizeof(x))
-
-/**
- * work out how many elements there are in a static array
- */
-#define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
-
-/**
- * pointer difference macro
- */
-#define PTR_DIFF(p1,p2) ((ptrdiff_t)(((const char *)(p1)) - (const char *)(p2)))
-
-#if MMAP_BLACKLIST
-#undef HAVE_MMAP
-#endif
-
-#ifdef __COMPAR_FN_T
-#define QSORT_CAST (__compar_fn_t)
-#endif
-
-#ifndef QSORT_CAST
-#define QSORT_CAST (int (*)(const void *, const void *))
-#endif
-
-#ifndef PATH_MAX
-#define PATH_MAX 1024
-#endif
-
-#ifndef MAX_DNS_NAME_LENGTH
-#define MAX_DNS_NAME_LENGTH 256 /* Actually 255 but +1 for terminating null. */
-#endif
-
-#ifndef HAVE_CRYPT
-char *ufc_crypt(const char *key, const char *salt);
-#define crypt ufc_crypt
-#else
-#ifdef HAVE_CRYPT_H
-#include <crypt.h>
-#endif
-#endif
-
-/* these macros gain us a few percent of speed on gcc */
-#if (__GNUC__ >= 3)
-/* the strange !! is to ensure that __builtin_expect() takes either 0 or 1
- as its first argument */
-#ifndef likely
-#define likely(x) __builtin_expect(!!(x), 1)
-#endif
-#ifndef unlikely
-#define unlikely(x) __builtin_expect(!!(x), 0)
-#endif
-#else
-#ifndef likely
-#define likely(x) (x)
-#endif
-#ifndef unlikely
-#define unlikely(x) (x)
-#endif
-#endif
-
-#endif /* _LIBREPLACE_REPLACE_H */
diff --git a/chromium/third_party/talloc/libreplace/samba.m4 b/chromium/third_party/talloc/libreplace/samba.m4
deleted file mode 100644
index b7582202f17..00000000000
--- a/chromium/third_party/talloc/libreplace/samba.m4
+++ /dev/null
@@ -1,34 +0,0 @@
-AC_LIBREPLACE_BROKEN_CHECKS
-AC_LIBREPLACE_NETWORK_CHECKS
-
-SMB_EXT_LIB(LIBREPLACE_EXT, [${LIBDL} ${CRYPT_LIBS}])
-SMB_ENABLE(LIBREPLACE_EXT)
-
-SMB_EXT_LIB(LIBREPLACE_NETWORK, [${LIBREPLACE_NETWORK_LIBS}])
-SMB_ENABLE(LIBREPLACE_NETWORK)
-
-# remove leading ./
-LIBREPLACE_DIR=`echo ${libreplacedir} |sed -e 's/^\.\///g'`
-
-# remove leading srcdir .. we are looking for the relative
-# path within the samba source tree or wherever libreplace is.
-# We need to make sure the object is not forced to end up in
-# the source directory because we might be using a separate
-# build directory.
-LIBREPLACE_DIR=`echo ${LIBREPLACE_DIR} | sed -e "s|^$srcdir/||g"`
-
-LIBREPLACE_OBJS="${LIBREPLACEOBJ}"
-
-SMB_SUBSYSTEM(LIBREPLACE,
- [${LIBREPLACE_OBJS}],
- [LIBREPLACE_EXT LIBREPLACE_NETWORK],
- [-Ilib/replace])
-
-LIBREPLACE_HOSTCC_OBJS=`echo ${LIBREPLACE_OBJS} |sed -e 's/\.o/\.ho/g'`
-
-SMB_SUBSYSTEM(LIBREPLACE_HOSTCC,
- [${LIBREPLACE_HOSTCC_OBJS}],
- [],
- [-Ilib/replace])
-
-AC_CHECK_FUNCS([syslog],,[AC_MSG_ERROR([Required function not found])])
diff --git a/chromium/third_party/talloc/libreplace/snprintf.c b/chromium/third_party/talloc/libreplace/snprintf.c
deleted file mode 100644
index c54d721ce5e..00000000000
--- a/chromium/third_party/talloc/libreplace/snprintf.c
+++ /dev/null
@@ -1,1530 +0,0 @@
-/*
- * NOTE: If you change this file, please merge it into rsync, samba, etc.
- */
-
-/*
- * Copyright Patrick Powell 1995
- * This code is based on code written by Patrick Powell (papowell@astart.com)
- * It may be used for any purpose as long as this notice remains intact
- * on all source code distributions
- */
-
-/**************************************************************
- * Original:
- * Patrick Powell Tue Apr 11 09:48:21 PDT 1995
- * A bombproof version of doprnt (dopr) included.
- * Sigh. This sort of thing is always nasty do deal with. Note that
- * the version here does not include floating point...
- *
- * snprintf() is used instead of sprintf() as it does limit checks
- * for string length. This covers a nasty loophole.
- *
- * The other functions are there to prevent NULL pointers from
- * causing nast effects.
- *
- * More Recently:
- * Brandon Long <blong@fiction.net> 9/15/96 for mutt 0.43
- * This was ugly. It is still ugly. I opted out of floating point
- * numbers, but the formatter understands just about everything
- * from the normal C string format, at least as far as I can tell from
- * the Solaris 2.5 printf(3S) man page.
- *
- * Brandon Long <blong@fiction.net> 10/22/97 for mutt 0.87.1
- * Ok, added some minimal floating point support, which means this
- * probably requires libm on most operating systems. Don't yet
- * support the exponent (e,E) and sigfig (g,G). Also, fmtint()
- * was pretty badly broken, it just wasn't being exercised in ways
- * which showed it, so that's been fixed. Also, formated the code
- * to mutt conventions, and removed dead code left over from the
- * original. Also, there is now a builtin-test, just compile with:
- * gcc -DTEST_SNPRINTF -o snprintf snprintf.c -lm
- * and run snprintf for results.
- *
- * Thomas Roessler <roessler@guug.de> 01/27/98 for mutt 0.89i
- * The PGP code was using unsigned hexadecimal formats.
- * Unfortunately, unsigned formats simply didn't work.
- *
- * Michael Elkins <me@cs.hmc.edu> 03/05/98 for mutt 0.90.8
- * The original code assumed that both snprintf() and vsnprintf() were
- * missing. Some systems only have snprintf() but not vsnprintf(), so
- * the code is now broken down under HAVE_SNPRINTF and HAVE_VSNPRINTF.
- *
- * Andrew Tridgell (tridge@samba.org) Oct 1998
- * fixed handling of %.0f
- * added test for HAVE_LONG_DOUBLE
- *
- * tridge@samba.org, idra@samba.org, April 2001
- * got rid of fcvt code (twas buggy and made testing harder)
- * added C99 semantics
- *
- * date: 2002/12/19 19:56:31; author: herb; state: Exp; lines: +2 -0
- * actually print args for %g and %e
- *
- * date: 2002/06/03 13:37:52; author: jmcd; state: Exp; lines: +8 -0
- * Since includes.h isn't included here, VA_COPY has to be defined here. I don't
- * see any include file that is guaranteed to be here, so I'm defining it
- * locally. Fixes AIX and Solaris builds.
- *
- * date: 2002/06/03 03:07:24; author: tridge; state: Exp; lines: +5 -13
- * put the ifdef for HAVE_VA_COPY in one place rather than in lots of
- * functions
- *
- * date: 2002/05/17 14:51:22; author: jmcd; state: Exp; lines: +21 -4
- * Fix usage of va_list passed as an arg. Use __va_copy before using it
- * when it exists.
- *
- * date: 2002/04/16 22:38:04; author: idra; state: Exp; lines: +20 -14
- * Fix incorrect zpadlen handling in fmtfp.
- * Thanks to Ollie Oldham <ollie.oldham@metro-optix.com> for spotting it.
- * few mods to make it easier to compile the tests.
- * addedd the "Ollie" test to the floating point ones.
- *
- * Martin Pool (mbp@samba.org) April 2003
- * Remove NO_CONFIG_H so that the test case can be built within a source
- * tree with less trouble.
- * Remove unnecessary SAFE_FREE() definition.
- *
- * Martin Pool (mbp@samba.org) May 2003
- * Put in a prototype for dummy_snprintf() to quiet compiler warnings.
- *
- * Move #endif to make sure VA_COPY, LDOUBLE, etc are defined even
- * if the C library has some snprintf functions already.
- *
- * Darren Tucker (dtucker@zip.com.au) 2005
- * Fix bug allowing read overruns of the source string with "%.*s"
- * Usually harmless unless the read runs outside the process' allocation
- * (eg if your malloc does guard pages) in which case it will segfault.
- * From OpenSSH. Also added test for same.
- *
- * Simo Sorce (idra@samba.org) Jan 2006
- *
- * Add support for position independent parameters
- * fix fmtstr now it conforms to sprintf wrt min.max
- *
- **************************************************************/
-
-#include "replace.h"
-#include "system/locale.h"
-
-#ifdef TEST_SNPRINTF /* need math library headers for testing */
-
-/* In test mode, we pretend that this system doesn't have any snprintf
- * functions, regardless of what config.h says. */
-# undef HAVE_SNPRINTF
-# undef HAVE_VSNPRINTF
-# undef HAVE_C99_VSNPRINTF
-# undef HAVE_ASPRINTF
-# undef HAVE_VASPRINTF
-# include <math.h>
-#endif /* TEST_SNPRINTF */
-
-#if defined(HAVE_SNPRINTF) && defined(HAVE_VSNPRINTF) && defined(HAVE_C99_VSNPRINTF)
-/* only include stdio.h if we are not re-defining snprintf or vsnprintf */
-#include <stdio.h>
- /* make the compiler happy with an empty file */
- void dummy_snprintf(void);
- void dummy_snprintf(void) {}
-#endif /* HAVE_SNPRINTF, etc */
-
-/* yes this really must be a ||. Don't muck with this (tridge) */
-#if !defined(HAVE_VSNPRINTF) || !defined(HAVE_C99_VSNPRINTF)
-
-#ifdef HAVE_LONG_DOUBLE
-#define LDOUBLE long double
-#else
-#define LDOUBLE double
-#endif
-
-#ifdef HAVE_LONG_LONG
-#define LLONG long long
-#else
-#define LLONG long
-#endif
-
-#ifndef VA_COPY
-#ifdef HAVE_VA_COPY
-#define VA_COPY(dest, src) va_copy(dest, src)
-#else
-#ifdef HAVE___VA_COPY
-#define VA_COPY(dest, src) __va_copy(dest, src)
-#else
-#define VA_COPY(dest, src) (dest) = (src)
-#endif
-#endif
-
-/*
- * dopr(): poor man's version of doprintf
- */
-
-/* format read states */
-#define DP_S_DEFAULT 0
-#define DP_S_FLAGS 1
-#define DP_S_MIN 2
-#define DP_S_DOT 3
-#define DP_S_MAX 4
-#define DP_S_MOD 5
-#define DP_S_CONV 6
-#define DP_S_DONE 7
-
-/* format flags - Bits */
-#define DP_F_MINUS (1 << 0)
-#define DP_F_PLUS (1 << 1)
-#define DP_F_SPACE (1 << 2)
-#define DP_F_NUM (1 << 3)
-#define DP_F_ZERO (1 << 4)
-#define DP_F_UP (1 << 5)
-#define DP_F_UNSIGNED (1 << 6)
-
-/* Conversion Flags */
-#define DP_C_CHAR 1
-#define DP_C_SHORT 2
-#define DP_C_LONG 3
-#define DP_C_LDOUBLE 4
-#define DP_C_LLONG 5
-#define DP_C_SIZET 6
-
-/* Chunk types */
-#define CNK_FMT_STR 0
-#define CNK_INT 1
-#define CNK_OCTAL 2
-#define CNK_UINT 3
-#define CNK_HEX 4
-#define CNK_FLOAT 5
-#define CNK_CHAR 6
-#define CNK_STRING 7
-#define CNK_PTR 8
-#define CNK_NUM 9
-#define CNK_PRCNT 10
-
-#define char_to_int(p) ((p)- '0')
-#ifndef MAX
-#define MAX(p,q) (((p) >= (q)) ? (p) : (q))
-#endif
-
-struct pr_chunk {
- int type; /* chunk type */
- int num; /* parameter number */
- int min;
- int max;
- int flags;
- int cflags;
- int start;
- int len;
- LLONG value;
- LDOUBLE fvalue;
- char *strvalue;
- void *pnum;
- struct pr_chunk *min_star;
- struct pr_chunk *max_star;
- struct pr_chunk *next;
-};
-
-struct pr_chunk_x {
- struct pr_chunk **chunks;
- int num;
-};
-
-static int dopr(char *buffer, size_t maxlen, const char *format,
- va_list args_in);
-static void fmtstr(char *buffer, size_t *currlen, size_t maxlen,
- char *value, int flags, int min, int max);
-static void fmtint(char *buffer, size_t *currlen, size_t maxlen,
- LLONG value, int base, int min, int max, int flags);
-static void fmtfp(char *buffer, size_t *currlen, size_t maxlen,
- LDOUBLE fvalue, int min, int max, int flags);
-static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c);
-static struct pr_chunk *new_chunk(void);
-static int add_cnk_list_entry(struct pr_chunk_x **list,
- int max_num, struct pr_chunk *chunk);
-
-static int dopr(char *buffer, size_t maxlen, const char *format, va_list args_in)
-{
- char ch;
- int state;
- int pflag;
- int pnum;
- int pfirst;
- size_t currlen;
- va_list args;
- const char *base;
- struct pr_chunk *chunks = NULL;
- struct pr_chunk *cnk = NULL;
- struct pr_chunk_x *clist = NULL;
- int max_pos;
- int ret = -1;
-
- VA_COPY(args, args_in);
-
- state = DP_S_DEFAULT;
- pfirst = 1;
- pflag = 0;
- pnum = 0;
-
- max_pos = 0;
- base = format;
- ch = *format++;
-
- /* retrieve the string structure as chunks */
- while (state != DP_S_DONE) {
- if (ch == '\0')
- state = DP_S_DONE;
-
- switch(state) {
- case DP_S_DEFAULT:
-
- if (cnk) {
- cnk->next = new_chunk();
- cnk = cnk->next;
- } else {
- cnk = new_chunk();
- }
- if (!cnk) goto done;
- if (!chunks) chunks = cnk;
-
- if (ch == '%') {
- state = DP_S_FLAGS;
- ch = *format++;
- } else {
- cnk->type = CNK_FMT_STR;
- cnk->start = format - base -1;
- while ((ch != '\0') && (ch != '%')) ch = *format++;
- cnk->len = format - base - cnk->start -1;
- }
- break;
- case DP_S_FLAGS:
- switch (ch) {
- case '-':
- cnk->flags |= DP_F_MINUS;
- ch = *format++;
- break;
- case '+':
- cnk->flags |= DP_F_PLUS;
- ch = *format++;
- break;
- case ' ':
- cnk->flags |= DP_F_SPACE;
- ch = *format++;
- break;
- case '#':
- cnk->flags |= DP_F_NUM;
- ch = *format++;
- break;
- case '0':
- cnk->flags |= DP_F_ZERO;
- ch = *format++;
- break;
- case 'I':
- /* internationalization not supported yet */
- ch = *format++;
- break;
- default:
- state = DP_S_MIN;
- break;
- }
- break;
- case DP_S_MIN:
- if (isdigit((unsigned char)ch)) {
- cnk->min = 10 * cnk->min + char_to_int (ch);
- ch = *format++;
- } else if (ch == '$') {
- if (!pfirst && !pflag) {
- /* parameters must be all positioned or none */
- goto done;
- }
- if (pfirst) {
- pfirst = 0;
- pflag = 1;
- }
- if (cnk->min == 0) /* what ?? */
- goto done;
- cnk->num = cnk->min;
- cnk->min = 0;
- ch = *format++;
- } else if (ch == '*') {
- if (pfirst) pfirst = 0;
- cnk->min_star = new_chunk();
- if (!cnk->min_star) /* out of memory :-( */
- goto done;
- cnk->min_star->type = CNK_INT;
- if (pflag) {
- int num;
- ch = *format++;
- if (!isdigit((unsigned char)ch)) {
- /* parameters must be all positioned or none */
- goto done;
- }
- for (num = 0; isdigit((unsigned char)ch); ch = *format++) {
- num = 10 * num + char_to_int(ch);
- }
- cnk->min_star->num = num;
- if (ch != '$') /* what ?? */
- goto done;
- } else {
- cnk->min_star->num = ++pnum;
- }
- max_pos = add_cnk_list_entry(&clist, max_pos, cnk->min_star);
- if (max_pos == 0) /* out of memory :-( */
- goto done;
- ch = *format++;
- state = DP_S_DOT;
- } else {
- if (pfirst) pfirst = 0;
- state = DP_S_DOT;
- }
- break;
- case DP_S_DOT:
- if (ch == '.') {
- state = DP_S_MAX;
- ch = *format++;
- } else {
- state = DP_S_MOD;
- }
- break;
- case DP_S_MAX:
- if (isdigit((unsigned char)ch)) {
- if (cnk->max < 0)
- cnk->max = 0;
- cnk->max = 10 * cnk->max + char_to_int (ch);
- ch = *format++;
- } else if (ch == '$') {
- if (!pfirst && !pflag) {
- /* parameters must be all positioned or none */
- goto done;
- }
- if (cnk->max <= 0) /* what ?? */
- goto done;
- cnk->num = cnk->max;
- cnk->max = -1;
- ch = *format++;
- } else if (ch == '*') {
- cnk->max_star = new_chunk();
- if (!cnk->max_star) /* out of memory :-( */
- goto done;
- cnk->max_star->type = CNK_INT;
- if (pflag) {
- int num;
- ch = *format++;
- if (!isdigit((unsigned char)ch)) {
- /* parameters must be all positioned or none */
- goto done;
- }
- for (num = 0; isdigit((unsigned char)ch); ch = *format++) {
- num = 10 * num + char_to_int(ch);
- }
- cnk->max_star->num = num;
- if (ch != '$') /* what ?? */
- goto done;
- } else {
- cnk->max_star->num = ++pnum;
- }
- max_pos = add_cnk_list_entry(&clist, max_pos, cnk->max_star);
- if (max_pos == 0) /* out of memory :-( */
- goto done;
-
- ch = *format++;
- state = DP_S_MOD;
- } else {
- state = DP_S_MOD;
- }
- break;
- case DP_S_MOD:
- switch (ch) {
- case 'h':
- cnk->cflags = DP_C_SHORT;
- ch = *format++;
- if (ch == 'h') {
- cnk->cflags = DP_C_CHAR;
- ch = *format++;
- }
- break;
- case 'l':
- cnk->cflags = DP_C_LONG;
- ch = *format++;
- if (ch == 'l') { /* It's a long long */
- cnk->cflags = DP_C_LLONG;
- ch = *format++;
- }
- break;
- case 'L':
- cnk->cflags = DP_C_LDOUBLE;
- ch = *format++;
- break;
- case 'z':
- cnk->cflags = DP_C_SIZET;
- ch = *format++;
- break;
- default:
- break;
- }
- state = DP_S_CONV;
- break;
- case DP_S_CONV:
- if (cnk->num == 0) cnk->num = ++pnum;
- max_pos = add_cnk_list_entry(&clist, max_pos, cnk);
- if (max_pos == 0) /* out of memory :-( */
- goto done;
-
- switch (ch) {
- case 'd':
- case 'i':
- cnk->type = CNK_INT;
- break;
- case 'o':
- cnk->type = CNK_OCTAL;
- cnk->flags |= DP_F_UNSIGNED;
- break;
- case 'u':
- cnk->type = CNK_UINT;
- cnk->flags |= DP_F_UNSIGNED;
- break;
- case 'X':
- cnk->flags |= DP_F_UP;
- case 'x':
- cnk->type = CNK_HEX;
- cnk->flags |= DP_F_UNSIGNED;
- break;
- case 'A':
- /* hex float not supported yet */
- case 'E':
- case 'G':
- case 'F':
- cnk->flags |= DP_F_UP;
- case 'a':
- /* hex float not supported yet */
- case 'e':
- case 'f':
- case 'g':
- cnk->type = CNK_FLOAT;
- break;
- case 'c':
- cnk->type = CNK_CHAR;
- break;
- case 's':
- cnk->type = CNK_STRING;
- break;
- case 'p':
- cnk->type = CNK_PTR;
- break;
- case 'n':
- cnk->type = CNK_NUM;
- break;
- case '%':
- cnk->type = CNK_PRCNT;
- break;
- default:
- /* Unknown, bail out*/
- goto done;
- }
- ch = *format++;
- state = DP_S_DEFAULT;
- break;
- case DP_S_DONE:
- break;
- default:
- /* hmm? */
- break; /* some picky compilers need this */
- }
- }
-
- /* retrieve the format arguments */
- for (pnum = 0; pnum < max_pos; pnum++) {
- int i;
-
- if (clist[pnum].num == 0) {
- /* ignoring a parameter should not be permitted
- * all parameters must be matched at least once
- * BUT seem some system ignore this rule ...
- * at least my glibc based system does --SSS
- */
-#ifdef DEBUG_SNPRINTF
- printf("parameter at position %d not used\n", pnum+1);
-#endif
- /* eat the parameter */
- va_arg (args, int);
- continue;
- }
- for (i = 1; i < clist[pnum].num; i++) {
- if (clist[pnum].chunks[0]->type != clist[pnum].chunks[i]->type) {
- /* nooo noo no!
- * all the references to a parameter
- * must be of the same type
- */
- goto done;
- }
- }
- cnk = clist[pnum].chunks[0];
- switch (cnk->type) {
- case CNK_INT:
- if (cnk->cflags == DP_C_SHORT)
- cnk->value = va_arg (args, int);
- else if (cnk->cflags == DP_C_LONG)
- cnk->value = va_arg (args, long int);
- else if (cnk->cflags == DP_C_LLONG)
- cnk->value = va_arg (args, LLONG);
- else if (cnk->cflags == DP_C_SIZET)
- cnk->value = va_arg (args, ssize_t);
- else
- cnk->value = va_arg (args, int);
-
- for (i = 1; i < clist[pnum].num; i++) {
- clist[pnum].chunks[i]->value = cnk->value;
- }
- break;
-
- case CNK_OCTAL:
- case CNK_UINT:
- case CNK_HEX:
- if (cnk->cflags == DP_C_SHORT)
- cnk->value = va_arg (args, unsigned int);
- else if (cnk->cflags == DP_C_LONG)
- cnk->value = (unsigned long int)va_arg (args, unsigned long int);
- else if (cnk->cflags == DP_C_LLONG)
- cnk->value = (LLONG)va_arg (args, unsigned LLONG);
- else if (cnk->cflags == DP_C_SIZET)
- cnk->value = (size_t)va_arg (args, size_t);
- else
- cnk->value = (unsigned int)va_arg (args, unsigned int);
-
- for (i = 1; i < clist[pnum].num; i++) {
- clist[pnum].chunks[i]->value = cnk->value;
- }
- break;
-
- case CNK_FLOAT:
- if (cnk->cflags == DP_C_LDOUBLE)
- cnk->fvalue = va_arg (args, LDOUBLE);
- else
- cnk->fvalue = va_arg (args, double);
-
- for (i = 1; i < clist[pnum].num; i++) {
- clist[pnum].chunks[i]->fvalue = cnk->fvalue;
- }
- break;
-
- case CNK_CHAR:
- cnk->value = va_arg (args, int);
-
- for (i = 1; i < clist[pnum].num; i++) {
- clist[pnum].chunks[i]->value = cnk->value;
- }
- break;
-
- case CNK_STRING:
- cnk->strvalue = va_arg (args, char *);
- if (!cnk->strvalue) cnk->strvalue = "(NULL)";
-
- for (i = 1; i < clist[pnum].num; i++) {
- clist[pnum].chunks[i]->strvalue = cnk->strvalue;
- }
- break;
-
- case CNK_PTR:
- cnk->strvalue = va_arg (args, void *);
- for (i = 1; i < clist[pnum].num; i++) {
- clist[pnum].chunks[i]->strvalue = cnk->strvalue;
- }
- break;
-
- case CNK_NUM:
- if (cnk->cflags == DP_C_CHAR)
- cnk->pnum = va_arg (args, char *);
- else if (cnk->cflags == DP_C_SHORT)
- cnk->pnum = va_arg (args, short int *);
- else if (cnk->cflags == DP_C_LONG)
- cnk->pnum = va_arg (args, long int *);
- else if (cnk->cflags == DP_C_LLONG)
- cnk->pnum = va_arg (args, LLONG *);
- else if (cnk->cflags == DP_C_SIZET)
- cnk->pnum = va_arg (args, ssize_t *);
- else
- cnk->pnum = va_arg (args, int *);
-
- for (i = 1; i < clist[pnum].num; i++) {
- clist[pnum].chunks[i]->pnum = cnk->pnum;
- }
- break;
-
- case CNK_PRCNT:
- break;
-
- default:
- /* what ?? */
- goto done;
- }
- }
- /* print out the actual string from chunks */
- currlen = 0;
- cnk = chunks;
- while (cnk) {
- int len, min, max;
-
- if (cnk->min_star) min = cnk->min_star->value;
- else min = cnk->min;
- if (cnk->max_star) max = cnk->max_star->value;
- else max = cnk->max;
-
- switch (cnk->type) {
-
- case CNK_FMT_STR:
- if (maxlen != 0 && maxlen > currlen) {
- if (maxlen > (currlen + cnk->len)) len = cnk->len;
- else len = maxlen - currlen;
-
- memcpy(&(buffer[currlen]), &(base[cnk->start]), len);
- }
- currlen += cnk->len;
-
- break;
-
- case CNK_INT:
- case CNK_UINT:
- fmtint (buffer, &currlen, maxlen, cnk->value, 10, min, max, cnk->flags);
- break;
-
- case CNK_OCTAL:
- fmtint (buffer, &currlen, maxlen, cnk->value, 8, min, max, cnk->flags);
- break;
-
- case CNK_HEX:
- fmtint (buffer, &currlen, maxlen, cnk->value, 16, min, max, cnk->flags);
- break;
-
- case CNK_FLOAT:
- fmtfp (buffer, &currlen, maxlen, cnk->fvalue, min, max, cnk->flags);
- break;
-
- case CNK_CHAR:
- dopr_outch (buffer, &currlen, maxlen, cnk->value);
- break;
-
- case CNK_STRING:
- if (max == -1) {
- max = strlen(cnk->strvalue);
- }
- fmtstr (buffer, &currlen, maxlen, cnk->strvalue, cnk->flags, min, max);
- break;
-
- case CNK_PTR:
- fmtint (buffer, &currlen, maxlen, (long)(cnk->strvalue), 16, min, max, cnk->flags);
- break;
-
- case CNK_NUM:
- if (cnk->cflags == DP_C_CHAR)
- *((char *)(cnk->pnum)) = (char)currlen;
- else if (cnk->cflags == DP_C_SHORT)
- *((short int *)(cnk->pnum)) = (short int)currlen;
- else if (cnk->cflags == DP_C_LONG)
- *((long int *)(cnk->pnum)) = (long int)currlen;
- else if (cnk->cflags == DP_C_LLONG)
- *((LLONG *)(cnk->pnum)) = (LLONG)currlen;
- else if (cnk->cflags == DP_C_SIZET)
- *((ssize_t *)(cnk->pnum)) = (ssize_t)currlen;
- else
- *((int *)(cnk->pnum)) = (int)currlen;
- break;
-
- case CNK_PRCNT:
- dopr_outch (buffer, &currlen, maxlen, '%');
- break;
-
- default:
- /* what ?? */
- goto done;
- }
- cnk = cnk->next;
- }
- if (maxlen != 0) {
- if (currlen < maxlen - 1)
- buffer[currlen] = '\0';
- else if (maxlen > 0)
- buffer[maxlen - 1] = '\0';
- }
- ret = currlen;
-
-done:
- va_end(args);
-
- while (chunks) {
- cnk = chunks->next;
- free(chunks);
- chunks = cnk;
- }
- if (clist) {
- for (pnum = 0; pnum < max_pos; pnum++) {
- if (clist[pnum].chunks) free(clist[pnum].chunks);
- }
- free(clist);
- }
- return ret;
-}
-
-static void fmtstr(char *buffer, size_t *currlen, size_t maxlen,
- char *value, int flags, int min, int max)
-{
- int padlen, strln; /* amount to pad */
- int cnt = 0;
-
-#ifdef DEBUG_SNPRINTF
- printf("fmtstr min=%d max=%d s=[%s]\n", min, max, value);
-#endif
- if (value == 0) {
- value = "<NULL>";
- }
-
- for (strln = 0; strln < max && value[strln]; ++strln); /* strlen */
- padlen = min - strln;
- if (padlen < 0)
- padlen = 0;
- if (flags & DP_F_MINUS)
- padlen = -padlen; /* Left Justify */
-
- while (padlen > 0) {
- dopr_outch (buffer, currlen, maxlen, ' ');
- --padlen;
- }
- while (*value && (cnt < max)) {
- dopr_outch (buffer, currlen, maxlen, *value++);
- ++cnt;
- }
- while (padlen < 0) {
- dopr_outch (buffer, currlen, maxlen, ' ');
- ++padlen;
- }
-}
-
-/* Have to handle DP_F_NUM (ie 0x and 0 alternates) */
-
-static void fmtint(char *buffer, size_t *currlen, size_t maxlen,
- LLONG value, int base, int min, int max, int flags)
-{
- int signvalue = 0;
- unsigned LLONG uvalue;
- char convert[20];
- int place = 0;
- int spadlen = 0; /* amount to space pad */
- int zpadlen = 0; /* amount to zero pad */
- int caps = 0;
-
- if (max < 0)
- max = 0;
-
- uvalue = value;
-
- if(!(flags & DP_F_UNSIGNED)) {
- if( value < 0 ) {
- signvalue = '-';
- uvalue = -value;
- } else {
- if (flags & DP_F_PLUS) /* Do a sign (+/i) */
- signvalue = '+';
- else if (flags & DP_F_SPACE)
- signvalue = ' ';
- }
- }
-
- if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */
-
- do {
- convert[place++] =
- (caps? "0123456789ABCDEF":"0123456789abcdef")
- [uvalue % (unsigned)base ];
- uvalue = (uvalue / (unsigned)base );
- } while(uvalue && (place < 20));
- if (place == 20) place--;
- convert[place] = 0;
-
- zpadlen = max - place;
- spadlen = min - MAX (max, place) - (signvalue ? 1 : 0);
- if (zpadlen < 0) zpadlen = 0;
- if (spadlen < 0) spadlen = 0;
- if (flags & DP_F_ZERO) {
- zpadlen = MAX(zpadlen, spadlen);
- spadlen = 0;
- }
- if (flags & DP_F_MINUS)
- spadlen = -spadlen; /* Left Justifty */
-
-#ifdef DEBUG_SNPRINTF
- printf("zpad: %d, spad: %d, min: %d, max: %d, place: %d\n",
- zpadlen, spadlen, min, max, place);
-#endif
-
- /* Spaces */
- while (spadlen > 0) {
- dopr_outch (buffer, currlen, maxlen, ' ');
- --spadlen;
- }
-
- /* Sign */
- if (signvalue)
- dopr_outch (buffer, currlen, maxlen, signvalue);
-
- /* Zeros */
- if (zpadlen > 0) {
- while (zpadlen > 0) {
- dopr_outch (buffer, currlen, maxlen, '0');
- --zpadlen;
- }
- }
-
- /* Digits */
- while (place > 0)
- dopr_outch (buffer, currlen, maxlen, convert[--place]);
-
- /* Left Justified spaces */
- while (spadlen < 0) {
- dopr_outch (buffer, currlen, maxlen, ' ');
- ++spadlen;
- }
-}
-
-static LDOUBLE abs_val(LDOUBLE value)
-{
- LDOUBLE result = value;
-
- if (value < 0)
- result = -value;
-
- return result;
-}
-
-static LDOUBLE POW10(int exp)
-{
- LDOUBLE result = 1;
-
- while (exp) {
- result *= 10;
- exp--;
- }
-
- return result;
-}
-
-static LLONG ROUND(LDOUBLE value)
-{
- LLONG intpart;
-
- intpart = (LLONG)value;
- value = value - intpart;
- if (value >= 0.5) intpart++;
-
- return intpart;
-}
-
-/* a replacement for modf that doesn't need the math library. Should
- be portable, but slow */
-static double my_modf(double x0, double *iptr)
-{
- int i;
- LLONG l=0;
- double x = x0;
- double f = 1.0;
-
- for (i=0;i<100;i++) {
- l = (long)x;
- if (l <= (x+1) && l >= (x-1)) break;
- x *= 0.1;
- f *= 10.0;
- }
-
- if (i == 100) {
- /* yikes! the number is beyond what we can handle. What do we do? */
- (*iptr) = 0;
- return 0;
- }
-
- if (i != 0) {
- double i2;
- double ret;
-
- ret = my_modf(x0-l*f, &i2);
- (*iptr) = l*f + i2;
- return ret;
- }
-
- (*iptr) = l;
- return x - (*iptr);
-}
-
-
-static void fmtfp (char *buffer, size_t *currlen, size_t maxlen,
- LDOUBLE fvalue, int min, int max, int flags)
-{
- int signvalue = 0;
- double ufvalue;
- char iconvert[311];
- char fconvert[311];
- int iplace = 0;
- int fplace = 0;
- int padlen = 0; /* amount to pad */
- int zpadlen = 0;
- int caps = 0;
- int idx;
- double intpart;
- double fracpart;
- double temp;
-
- /*
- * AIX manpage says the default is 0, but Solaris says the default
- * is 6, and sprintf on AIX defaults to 6
- */
- if (max < 0)
- max = 6;
-
- ufvalue = abs_val (fvalue);
-
- if (fvalue < 0) {
- signvalue = '-';
- } else {
- if (flags & DP_F_PLUS) { /* Do a sign (+/i) */
- signvalue = '+';
- } else {
- if (flags & DP_F_SPACE)
- signvalue = ' ';
- }
- }
-
-#if 0
- if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */
-#endif
-
-#if 0
- if (max == 0) ufvalue += 0.5; /* if max = 0 we must round */
-#endif
-
- /*
- * Sorry, we only support 9 digits past the decimal because of our
- * conversion method
- */
- if (max > 9)
- max = 9;
-
- /* We "cheat" by converting the fractional part to integer by
- * multiplying by a factor of 10
- */
-
- temp = ufvalue;
- my_modf(temp, &intpart);
-
- fracpart = ROUND((POW10(max)) * (ufvalue - intpart));
-
- if (fracpart >= POW10(max)) {
- intpart++;
- fracpart -= POW10(max);
- }
-
-
- /* Convert integer part */
- do {
- temp = intpart*0.1;
- my_modf(temp, &intpart);
- idx = (int) ((temp -intpart +0.05)* 10.0);
- /* idx = (int) (((double)(temp*0.1) -intpart +0.05) *10.0); */
- /* printf ("%llf, %f, %x\n", temp, intpart, idx); */
- iconvert[iplace++] =
- (caps? "0123456789ABCDEF":"0123456789abcdef")[idx];
- } while (intpart && (iplace < 311));
- if (iplace == 311) iplace--;
- iconvert[iplace] = 0;
-
- /* Convert fractional part */
- if (fracpart)
- {
- do {
- temp = fracpart*0.1;
- my_modf(temp, &fracpart);
- idx = (int) ((temp -fracpart +0.05)* 10.0);
- /* idx = (int) ((((temp/10) -fracpart) +0.05) *10); */
- /* printf ("%lf, %lf, %ld\n", temp, fracpart, idx ); */
- fconvert[fplace++] =
- (caps? "0123456789ABCDEF":"0123456789abcdef")[idx];
- } while(fracpart && (fplace < 311));
- if (fplace == 311) fplace--;
- }
- fconvert[fplace] = 0;
-
- /* -1 for decimal point, another -1 if we are printing a sign */
- padlen = min - iplace - max - 1 - ((signvalue) ? 1 : 0);
- zpadlen = max - fplace;
- if (zpadlen < 0) zpadlen = 0;
- if (padlen < 0)
- padlen = 0;
- if (flags & DP_F_MINUS)
- padlen = -padlen; /* Left Justifty */
-
- if ((flags & DP_F_ZERO) && (padlen > 0)) {
- if (signvalue) {
- dopr_outch (buffer, currlen, maxlen, signvalue);
- --padlen;
- signvalue = 0;
- }
- while (padlen > 0) {
- dopr_outch (buffer, currlen, maxlen, '0');
- --padlen;
- }
- }
- while (padlen > 0) {
- dopr_outch (buffer, currlen, maxlen, ' ');
- --padlen;
- }
- if (signvalue)
- dopr_outch (buffer, currlen, maxlen, signvalue);
-
- while (iplace > 0)
- dopr_outch (buffer, currlen, maxlen, iconvert[--iplace]);
-
-#ifdef DEBUG_SNPRINTF
- printf("fmtfp: fplace=%d zpadlen=%d\n", fplace, zpadlen);
-#endif
-
- /*
- * Decimal point. This should probably use locale to find the correct
- * char to print out.
- */
- if (max > 0) {
- dopr_outch (buffer, currlen, maxlen, '.');
-
- while (zpadlen > 0) {
- dopr_outch (buffer, currlen, maxlen, '0');
- --zpadlen;
- }
-
- while (fplace > 0)
- dopr_outch (buffer, currlen, maxlen, fconvert[--fplace]);
- }
-
- while (padlen < 0) {
- dopr_outch (buffer, currlen, maxlen, ' ');
- ++padlen;
- }
-}
-
-static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c)
-{
- if (*currlen < maxlen) {
- buffer[(*currlen)] = c;
- }
- (*currlen)++;
-}
-
-static struct pr_chunk *new_chunk(void) {
- struct pr_chunk *new_c = (struct pr_chunk *)malloc(sizeof(struct pr_chunk));
-
- if (!new_c)
- return NULL;
-
- new_c->type = 0;
- new_c->num = 0;
- new_c->min = 0;
- new_c->min_star = NULL;
- new_c->max = -1;
- new_c->max_star = NULL;
- new_c->flags = 0;
- new_c->cflags = 0;
- new_c->start = 0;
- new_c->len = 0;
- new_c->value = 0;
- new_c->fvalue = 0;
- new_c->strvalue = NULL;
- new_c->pnum = NULL;
- new_c->next = NULL;
-
- return new_c;
-}
-
-static int add_cnk_list_entry(struct pr_chunk_x **list,
- int max_num, struct pr_chunk *chunk) {
- struct pr_chunk_x *l;
- struct pr_chunk **c;
- int max;
- int cnum;
- int i, pos;
-
- if (chunk->num > max_num) {
- max = chunk->num;
-
- if (*list == NULL) {
- l = (struct pr_chunk_x *)malloc(sizeof(struct pr_chunk_x) * max);
- pos = 0;
- } else {
- l = (struct pr_chunk_x *)realloc(*list, sizeof(struct pr_chunk_x) * max);
- pos = max_num;
- }
- if (l == NULL) {
- for (i = 0; i < max; i++) {
- if ((*list)[i].chunks) free((*list)[i].chunks);
- }
- return 0;
- }
- for (i = pos; i < max; i++) {
- l[i].chunks = NULL;
- l[i].num = 0;
- }
- } else {
- l = *list;
- max = max_num;
- }
-
- i = chunk->num - 1;
- cnum = l[i].num + 1;
- if (l[i].chunks == NULL) {
- c = (struct pr_chunk **)malloc(sizeof(struct pr_chunk *) * cnum);
- } else {
- c = (struct pr_chunk **)realloc(l[i].chunks, sizeof(struct pr_chunk *) * cnum);
- }
- if (c == NULL) {
- for (i = 0; i < max; i++) {
- if (l[i].chunks) free(l[i].chunks);
- }
- return 0;
- }
- c[l[i].num] = chunk;
- l[i].chunks = c;
- l[i].num = cnum;
-
- *list = l;
- return max;
-}
-
- int vsnprintf (char *str, size_t count, const char *fmt, va_list args)
-{
- return dopr(str, count, fmt, args);
-}
-#endif
-
-/* yes this really must be a ||. Don't muck with this (tridge)
- *
- * The logic for these two is that we need our own definition if the
- * OS *either* has no definition of *sprintf, or if it does have one
- * that doesn't work properly according to the autoconf test.
- */
-#if !defined(HAVE_SNPRINTF) || !defined(HAVE_C99_VSNPRINTF)
- int snprintf(char *str,size_t count,const char *fmt,...)
-{
- size_t ret;
- va_list ap;
-
- va_start(ap, fmt);
- ret = vsnprintf(str, count, fmt, ap);
- va_end(ap);
- return ret;
-}
-#endif
-
-#ifndef HAVE_C99_VSNPRINTF
- int printf(const char *fmt, ...)
-{
- va_list ap;
- int ret;
- char *s;
-
- s = NULL;
- va_start(ap, fmt);
- ret = vasprintf(&s, fmt, ap);
- va_end(ap);
-
- if (s) {
- fwrite(s, 1, strlen(s), stdout);
- }
- free(s);
-
- return ret;
-}
-#endif
-
-#ifndef HAVE_C99_VSNPRINTF
- int fprintf(FILE *stream, const char *fmt, ...)
-{
- va_list ap;
- int ret;
- char *s;
-
- s = NULL;
- va_start(ap, fmt);
- ret = vasprintf(&s, fmt, ap);
- va_end(ap);
-
- if (s) {
- fwrite(s, 1, strlen(s), stream);
- }
- free(s);
-
- return ret;
-}
-#endif
-
-#endif
-
-#ifndef HAVE_VASPRINTF
- int vasprintf(char **ptr, const char *format, va_list ap)
-{
- int ret;
- va_list ap2;
-
- VA_COPY(ap2, ap);
- ret = vsnprintf(NULL, 0, format, ap2);
- va_end(ap2);
- if (ret < 0) return ret;
-
- (*ptr) = (char *)malloc(ret+1);
- if (!*ptr) return -1;
-
- VA_COPY(ap2, ap);
- ret = vsnprintf(*ptr, ret+1, format, ap2);
- va_end(ap2);
-
- return ret;
-}
-#endif
-
-
-#ifndef HAVE_ASPRINTF
- int asprintf(char **ptr, const char *format, ...)
-{
- va_list ap;
- int ret;
-
- *ptr = NULL;
- va_start(ap, format);
- ret = vasprintf(ptr, format, ap);
- va_end(ap);
-
- return ret;
-}
-#endif
-
-#ifdef TEST_SNPRINTF
-
- int sprintf(char *str,const char *fmt,...);
- int printf(const char *fmt,...);
-
- int main (void)
-{
- char buf1[1024];
- char buf2[1024];
- char *buf3;
- char *fp_fmt[] = {
- "%1.1f",
- "%-1.5f",
- "%1.5f",
- "%123.9f",
- "%10.5f",
- "% 10.5f",
- "%+22.9f",
- "%+4.9f",
- "%01.3f",
- "%4f",
- "%3.1f",
- "%3.2f",
- "%.0f",
- "%f",
- "%-8.8f",
- "%-9.9f",
- NULL
- };
- double fp_nums[] = { 6442452944.1234, -1.5, 134.21, 91340.2, 341.1234, 203.9, 0.96, 0.996,
- 0.9996, 1.996, 4.136, 5.030201, 0.00205,
- /* END LIST */ 0};
- char *int_fmt[] = {
- "%-1.5d",
- "%1.5d",
- "%123.9d",
- "%5.5d",
- "%10.5d",
- "% 10.5d",
- "%+22.33d",
- "%01.3d",
- "%4d",
- "%d",
- NULL
- };
- long int_nums[] = { -1, 134, 91340, 341, 0203, 1234567890, 0};
- char *str_fmt[] = {
- "%10.5s",
- "%-10.5s",
- "%5.10s",
- "%-5.10s",
- "%10.1s",
- "%0.10s",
- "%10.0s",
- "%1.10s",
- "%s",
- "%.1s",
- "%.10s",
- "%10s",
- NULL
- };
- char *str_vals[] = {"hello", "a", "", "a longer string", NULL};
-#ifdef HAVE_LONG_LONG
- char *ll_fmt[] = {
- "%llu",
- NULL
- };
- LLONG ll_nums[] = { 134, 91340, 341, 0203, 1234567890, 128006186140000000LL, 0};
-#endif
- int x, y;
- int fail = 0;
- int num = 0;
- int l1, l2;
- char *ss_fmt[] = {
- "%zd",
- "%zu",
- NULL
- };
- size_t ss_nums[] = {134, 91340, 123456789, 0203, 1234567890, 0};
-
- printf ("Testing snprintf format codes against system sprintf...\n");
-
- for (x = 0; fp_fmt[x] ; x++) {
- for (y = 0; fp_nums[y] != 0 ; y++) {
- buf1[0] = buf2[0] = '\0';
- l1 = snprintf(buf1, sizeof(buf1), fp_fmt[x], fp_nums[y]);
- l2 = sprintf (buf2, fp_fmt[x], fp_nums[y]);
- buf1[1023] = buf2[1023] = '\0';
- if (strcmp (buf1, buf2) || (l1 != l2)) {
- printf("snprintf doesn't match Format: %s\n\tsnprintf(%d) = [%s]\n\t sprintf(%d) = [%s]\n",
- fp_fmt[x], l1, buf1, l2, buf2);
- fail++;
- }
- num++;
- }
- }
-
- for (x = 0; int_fmt[x] ; x++) {
- for (y = 0; int_nums[y] != 0 ; y++) {
- buf1[0] = buf2[0] = '\0';
- l1 = snprintf(buf1, sizeof(buf1), int_fmt[x], int_nums[y]);
- l2 = sprintf (buf2, int_fmt[x], int_nums[y]);
- buf1[1023] = buf2[1023] = '\0';
- if (strcmp (buf1, buf2) || (l1 != l2)) {
- printf("snprintf doesn't match Format: %s\n\tsnprintf(%d) = [%s]\n\t sprintf(%d) = [%s]\n",
- int_fmt[x], l1, buf1, l2, buf2);
- fail++;
- }
- num++;
- }
- }
-
- for (x = 0; str_fmt[x] ; x++) {
- for (y = 0; str_vals[y] != 0 ; y++) {
- buf1[0] = buf2[0] = '\0';
- l1 = snprintf(buf1, sizeof(buf1), str_fmt[x], str_vals[y]);
- l2 = sprintf (buf2, str_fmt[x], str_vals[y]);
- buf1[1023] = buf2[1023] = '\0';
- if (strcmp (buf1, buf2) || (l1 != l2)) {
- printf("snprintf doesn't match Format: %s\n\tsnprintf(%d) = [%s]\n\t sprintf(%d) = [%s]\n",
- str_fmt[x], l1, buf1, l2, buf2);
- fail++;
- }
- num++;
- }
- }
-
-#ifdef HAVE_LONG_LONG
- for (x = 0; ll_fmt[x] ; x++) {
- for (y = 0; ll_nums[y] != 0 ; y++) {
- buf1[0] = buf2[0] = '\0';
- l1 = snprintf(buf1, sizeof(buf1), ll_fmt[x], ll_nums[y]);
- l2 = sprintf (buf2, ll_fmt[x], ll_nums[y]);
- buf1[1023] = buf2[1023] = '\0';
- if (strcmp (buf1, buf2) || (l1 != l2)) {
- printf("snprintf doesn't match Format: %s\n\tsnprintf(%d) = [%s]\n\t sprintf(%d) = [%s]\n",
- ll_fmt[x], l1, buf1, l2, buf2);
- fail++;
- }
- num++;
- }
- }
-#endif
-
-#define BUFSZ 2048
-
- buf1[0] = buf2[0] = '\0';
- if ((buf3 = malloc(BUFSZ)) == NULL) {
- fail++;
- } else {
- num++;
- memset(buf3, 'a', BUFSZ);
- snprintf(buf1, sizeof(buf1), "%.*s", 1, buf3);
- buf1[1023] = '\0';
- if (strcmp(buf1, "a") != 0) {
- printf("length limit buf1 '%s' expected 'a'\n", buf1);
- fail++;
- }
- }
-
- buf1[0] = buf2[0] = '\0';
- l1 = snprintf(buf1, sizeof(buf1), "%4$*1$d %2$s %3$*1$.*1$f", 3, "pos test", 12.3456, 9);
- l2 = sprintf(buf2, "%4$*1$d %2$s %3$*1$.*1$f", 3, "pos test", 12.3456, 9);
- buf1[1023] = buf2[1023] = '\0';
- if (strcmp(buf1, buf2) || (l1 != l2)) {
- printf("snprintf doesn't match Format: %s\n\tsnprintf(%d) = [%s]\n\t sprintf(%d) = [%s]\n",
- "%4$*1$d %2$s %3$*1$.*1$f", l1, buf1, l2, buf2);
- fail++;
- }
-
- buf1[0] = buf2[0] = '\0';
- l1 = snprintf(buf1, sizeof(buf1), "%4$*4$d %2$s %3$*4$.*4$f", 3, "pos test", 12.3456, 9);
- l2 = sprintf(buf2, "%4$*4$d %2$s %3$*4$.*4$f", 3, "pos test", 12.3456, 9);
- buf1[1023] = buf2[1023] = '\0';
- if (strcmp(buf1, buf2)) {
- printf("snprintf doesn't match Format: %s\n\tsnprintf(%d) = [%s]\n\t sprintf(%d) = [%s]\n",
- "%4$*1$d %2$s %3$*1$.*1$f", l1, buf1, l2, buf2);
- fail++;
- }
-
- for (x = 0; ss_fmt[x] ; x++) {
- for (y = 0; ss_nums[y] != 0 ; y++) {
- buf1[0] = buf2[0] = '\0';
- l1 = snprintf(buf1, sizeof(buf1), ss_fmt[x], ss_nums[y]);
- l2 = sprintf (buf2, ss_fmt[x], ss_nums[y]);
- buf1[1023] = buf2[1023] = '\0';
- if (strcmp (buf1, buf2) || (l1 != l2)) {
- printf("snprintf doesn't match Format: %s\n\tsnprintf(%d) = [%s]\n\t sprintf(%d) = [%s]\n",
- ss_fmt[x], l1, buf1, l2, buf2);
- fail++;
- }
- num++;
- }
- }
-#if 0
- buf1[0] = buf2[0] = '\0';
- l1 = snprintf(buf1, sizeof(buf1), "%lld", (LLONG)1234567890);
- l2 = sprintf(buf2, "%lld", (LLONG)1234567890);
- buf1[1023] = buf2[1023] = '\0';
- if (strcmp(buf1, buf2)) {
- printf("snprintf doesn't match Format: %s\n\tsnprintf(%d) = [%s]\n\t sprintf(%d) = [%s]\n",
- "%lld", l1, buf1, l2, buf2);
- fail++;
- }
-
- buf1[0] = buf2[0] = '\0';
- l1 = snprintf(buf1, sizeof(buf1), "%Lf", (LDOUBLE)890.1234567890123);
- l2 = sprintf(buf2, "%Lf", (LDOUBLE)890.1234567890123);
- buf1[1023] = buf2[1023] = '\0';
- if (strcmp(buf1, buf2)) {
- printf("snprintf doesn't match Format: %s\n\tsnprintf(%d) = [%s]\n\t sprintf(%d) = [%s]\n",
- "%Lf", l1, buf1, l2, buf2);
- fail++;
- }
-#endif
- printf ("%d tests failed out of %d.\n", fail, num);
-
- printf("seeing how many digits we support\n");
- {
- double v0 = 0.12345678901234567890123456789012345678901;
- for (x=0; x<100; x++) {
- double p = pow(10, x);
- double r = v0*p;
- snprintf(buf1, sizeof(buf1), "%1.1f", r);
- sprintf(buf2, "%1.1f", r);
- if (strcmp(buf1, buf2)) {
- printf("we seem to support %d digits\n", x-1);
- break;
- }
- }
- }
-
- return 0;
-}
-#endif /* TEST_SNPRINTF */
diff --git a/chromium/third_party/talloc/libreplace/socket.c b/chromium/third_party/talloc/libreplace/socket.c
deleted file mode 100644
index 35e975fce74..00000000000
--- a/chromium/third_party/talloc/libreplace/socket.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Unix SMB/CIFS implementation.
- *
- * Dummy replacements for socket functions.
- *
- * Copyright (C) Michael Adam <obnox@samba.org> 2008
- *
- * 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 <http://www.gnu.org/licenses/>.
- */
-
-#include "replace.h"
-#include "system/network.h"
-
-int rep_connect(int sockfd, const struct sockaddr *serv_addr, socklen_t addrlen)
-{
- errno = ENOSYS;
- return -1;
-}
-
-struct hostent *rep_gethostbyname(const char *name)
-{
- errno = ENOSYS;
- return NULL;
-}
diff --git a/chromium/third_party/talloc/libreplace/socketpair.c b/chromium/third_party/talloc/libreplace/socketpair.c
deleted file mode 100644
index c7757309522..00000000000
--- a/chromium/third_party/talloc/libreplace/socketpair.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Unix SMB/CIFS implementation.
- * replacement routines for broken systems
- * Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2006
- * Copyright (C) Michael Adam <obnox@samba.org> 2008
- *
- * ** NOTE! The following LGPL license applies to the replace
- * ** library. This does NOT imply that all of Samba is released
- * ** under the LGPL
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "replace.h"
-#include "system/network.h"
-
-int rep_socketpair(int d, int type, int protocol, int sv[2])
-{
- if (d != AF_UNIX) {
- errno = EAFNOSUPPORT;
- return -1;
- }
-
- if (protocol != 0) {
- errno = EPROTONOSUPPORT;
- return -1;
- }
-
- if (type != SOCK_STREAM) {
- errno = EOPNOTSUPP;
- return -1;
- }
-
- return pipe(sv);
-}
diff --git a/chromium/third_party/talloc/libreplace/strptime.c b/chromium/third_party/talloc/libreplace/strptime.c
deleted file mode 100644
index 0e40f7561ac..00000000000
--- a/chromium/third_party/talloc/libreplace/strptime.c
+++ /dev/null
@@ -1,990 +0,0 @@
-/* Convert a string representation of time to a time value.
- Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 3 of the
- License, or (at your option) any later version.
-
- The GNU C Library 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- see <http://www.gnu.org/licenses/>. */
-
-/* XXX This version of the implementation is not really complete.
- Some of the fields cannot add information alone. But if seeing
- some of them in the same format (such as year, week and weekday)
- this is enough information for determining the date. */
-
-#include "replace.h"
-#include "system/locale.h"
-#include "system/time.h"
-
-#ifndef __P
-# if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
-# define __P(args) args
-# else
-# define __P(args) ()
-# endif /* GCC. */
-#endif /* Not __P. */
-
-#if ! HAVE_LOCALTIME_R && ! defined localtime_r
-# ifdef _LIBC
-# define localtime_r __localtime_r
-# else
-/* Approximate localtime_r as best we can in its absence. */
-# define localtime_r my_localtime_r
-static struct tm *localtime_r __P ((const time_t *, struct tm *));
-static struct tm *
-localtime_r (t, tp)
- const time_t *t;
- struct tm *tp;
-{
- struct tm *l = localtime (t);
- if (! l)
- return 0;
- *tp = *l;
- return tp;
-}
-# endif /* ! _LIBC */
-#endif /* ! HAVE_LOCALTIME_R && ! defined (localtime_r) */
-
-
-#define match_char(ch1, ch2) if (ch1 != ch2) return NULL
-#if defined __GNUC__ && __GNUC__ >= 2
-# define match_string(cs1, s2) \
- ({ size_t len = strlen (cs1); \
- int result = strncasecmp ((cs1), (s2), len) == 0; \
- if (result) (s2) += len; \
- result; })
-#else
-/* Oh come on. Get a reasonable compiler. */
-# define match_string(cs1, s2) \
- (strncasecmp ((cs1), (s2), strlen (cs1)) ? 0 : ((s2) += strlen (cs1), 1))
-#endif
-/* We intentionally do not use isdigit() for testing because this will
- lead to problems with the wide character version. */
-#define get_number(from, to, n) \
- do { \
- int __n = n; \
- val = 0; \
- while (*rp == ' ') \
- ++rp; \
- if (*rp < '0' || *rp > '9') \
- return NULL; \
- do { \
- val *= 10; \
- val += *rp++ - '0'; \
- } while (--__n > 0 && val * 10 <= to && *rp >= '0' && *rp <= '9'); \
- if (val < from || val > to) \
- return NULL; \
- } while (0)
-#ifdef _NL_CURRENT
-# define get_alt_number(from, to, n) \
- ({ \
- __label__ do_normal; \
- if (*decided != raw) \
- { \
- const char *alts = _NL_CURRENT (LC_TIME, ALT_DIGITS); \
- int __n = n; \
- int any = 0; \
- while (*rp == ' ') \
- ++rp; \
- val = 0; \
- do { \
- val *= 10; \
- while (*alts != '\0') \
- { \
- size_t len = strlen (alts); \
- if (strncasecmp (alts, rp, len) == 0) \
- break; \
- alts += len + 1; \
- ++val; \
- } \
- if (*alts == '\0') \
- { \
- if (*decided == not && ! any) \
- goto do_normal; \
- /* If we haven't read anything it's an error. */ \
- if (! any) \
- return NULL; \
- /* Correct the premature multiplication. */ \
- val /= 10; \
- break; \
- } \
- else \
- *decided = loc; \
- } while (--__n > 0 && val * 10 <= to); \
- if (val < from || val > to) \
- return NULL; \
- } \
- else \
- { \
- do_normal: \
- get_number (from, to, n); \
- } \
- 0; \
- })
-#else
-# define get_alt_number(from, to, n) \
- /* We don't have the alternate representation. */ \
- get_number(from, to, n)
-#endif
-#define recursive(new_fmt) \
- (*(new_fmt) != '\0' \
- && (rp = strptime_internal (rp, (new_fmt), tm, decided, era_cnt)) != NULL)
-
-
-#ifdef _LIBC
-/* This is defined in locale/C-time.c in the GNU libc. */
-extern const struct locale_data _nl_C_LC_TIME;
-extern const unsigned short int __mon_yday[2][13];
-
-# define weekday_name (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (DAY_1)].string)
-# define ab_weekday_name \
- (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (ABDAY_1)].string)
-# define month_name (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (MON_1)].string)
-# define ab_month_name (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (ABMON_1)].string)
-# define HERE_D_T_FMT (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (D_T_FMT)].string)
-# define HERE_D_FMT (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (D_FMT)].string)
-# define HERE_AM_STR (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (AM_STR)].string)
-# define HERE_PM_STR (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (PM_STR)].string)
-# define HERE_T_FMT_AMPM \
- (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (T_FMT_AMPM)].string)
-# define HERE_T_FMT (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (T_FMT)].string)
-
-# define strncasecmp(s1, s2, n) __strncasecmp (s1, s2, n)
-#else
-static char const weekday_name[][10] =
- {
- "Sunday", "Monday", "Tuesday", "Wednesday",
- "Thursday", "Friday", "Saturday"
- };
-static char const ab_weekday_name[][4] =
- {
- "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
- };
-static char const month_name[][10] =
- {
- "January", "February", "March", "April", "May", "June",
- "July", "August", "September", "October", "November", "December"
- };
-static char const ab_month_name[][4] =
- {
- "Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
- };
-# define HERE_D_T_FMT "%a %b %e %H:%M:%S %Y"
-# define HERE_D_FMT "%m/%d/%y"
-# define HERE_AM_STR "AM"
-# define HERE_PM_STR "PM"
-# define HERE_T_FMT_AMPM "%I:%M:%S %p"
-# define HERE_T_FMT "%H:%M:%S"
-
-static const unsigned short int __mon_yday[2][13] =
- {
- /* Normal years. */
- { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
- /* Leap years. */
- { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
- };
-#endif
-
-/* Status of lookup: do we use the locale data or the raw data? */
-enum locale_status { not, loc, raw };
-
-
-#ifndef __isleap
-/* Nonzero if YEAR is a leap year (every 4 years,
- except every 100th isn't, and every 400th is). */
-# define __isleap(year) \
- ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))
-#endif
-
-/* Compute the day of the week. */
-static void
-day_of_the_week (struct tm *tm)
-{
- /* We know that January 1st 1970 was a Thursday (= 4). Compute the
- the difference between this data in the one on TM and so determine
- the weekday. */
- int corr_year = 1900 + tm->tm_year - (tm->tm_mon < 2);
- int wday = (-473
- + (365 * (tm->tm_year - 70))
- + (corr_year / 4)
- - ((corr_year / 4) / 25) + ((corr_year / 4) % 25 < 0)
- + (((corr_year / 4) / 25) / 4)
- + __mon_yday[0][tm->tm_mon]
- + tm->tm_mday - 1);
- tm->tm_wday = ((wday % 7) + 7) % 7;
-}
-
-/* Compute the day of the year. */
-static void
-day_of_the_year (struct tm *tm)
-{
- tm->tm_yday = (__mon_yday[__isleap (1900 + tm->tm_year)][tm->tm_mon]
- + (tm->tm_mday - 1));
-}
-
-static char *
-#ifdef _LIBC
-internal_function
-#endif
-strptime_internal __P ((const char *rp, const char *fmt, struct tm *tm,
- enum locale_status *decided, int era_cnt));
-
-static char *
-#ifdef _LIBC
-internal_function
-#endif
-strptime_internal (rp, fmt, tm, decided, era_cnt)
- const char *rp;
- const char *fmt;
- struct tm *tm;
- enum locale_status *decided;
- int era_cnt;
-{
- const char *rp_backup;
- int cnt;
- size_t val;
- int have_I, is_pm;
- int century, want_century;
- int want_era;
- int have_wday, want_xday;
- int have_yday;
- int have_mon, have_mday;
-#ifdef _NL_CURRENT
- size_t num_eras;
-#endif
- struct era_entry *era;
-
- have_I = is_pm = 0;
- century = -1;
- want_century = 0;
- want_era = 0;
- era = NULL;
-
- have_wday = want_xday = have_yday = have_mon = have_mday = 0;
-
- while (*fmt != '\0')
- {
- /* A white space in the format string matches 0 more or white
- space in the input string. */
- if (isspace (*fmt))
- {
- while (isspace (*rp))
- ++rp;
- ++fmt;
- continue;
- }
-
- /* Any character but `%' must be matched by the same character
- in the iput string. */
- if (*fmt != '%')
- {
- match_char (*fmt++, *rp++);
- continue;
- }
-
- ++fmt;
-#ifndef _NL_CURRENT
- /* We need this for handling the `E' modifier. */
- start_over:
-#endif
-
- /* Make back up of current processing pointer. */
- rp_backup = rp;
-
- switch (*fmt++)
- {
- case '%':
- /* Match the `%' character itself. */
- match_char ('%', *rp++);
- break;
- case 'a':
- case 'A':
- /* Match day of week. */
- for (cnt = 0; cnt < 7; ++cnt)
- {
-#ifdef _NL_CURRENT
- if (*decided !=raw)
- {
- if (match_string (_NL_CURRENT (LC_TIME, DAY_1 + cnt), rp))
- {
- if (*decided == not
- && strcmp (_NL_CURRENT (LC_TIME, DAY_1 + cnt),
- weekday_name[cnt]))
- *decided = loc;
- break;
- }
- if (match_string (_NL_CURRENT (LC_TIME, ABDAY_1 + cnt), rp))
- {
- if (*decided == not
- && strcmp (_NL_CURRENT (LC_TIME, ABDAY_1 + cnt),
- ab_weekday_name[cnt]))
- *decided = loc;
- break;
- }
- }
-#endif
- if (*decided != loc
- && (match_string (weekday_name[cnt], rp)
- || match_string (ab_weekday_name[cnt], rp)))
- {
- *decided = raw;
- break;
- }
- }
- if (cnt == 7)
- /* Does not match a weekday name. */
- return NULL;
- tm->tm_wday = cnt;
- have_wday = 1;
- break;
- case 'b':
- case 'B':
- case 'h':
- /* Match month name. */
- for (cnt = 0; cnt < 12; ++cnt)
- {
-#ifdef _NL_CURRENT
- if (*decided !=raw)
- {
- if (match_string (_NL_CURRENT (LC_TIME, MON_1 + cnt), rp))
- {
- if (*decided == not
- && strcmp (_NL_CURRENT (LC_TIME, MON_1 + cnt),
- month_name[cnt]))
- *decided = loc;
- break;
- }
- if (match_string (_NL_CURRENT (LC_TIME, ABMON_1 + cnt), rp))
- {
- if (*decided == not
- && strcmp (_NL_CURRENT (LC_TIME, ABMON_1 + cnt),
- ab_month_name[cnt]))
- *decided = loc;
- break;
- }
- }
-#endif
- if (match_string (month_name[cnt], rp)
- || match_string (ab_month_name[cnt], rp))
- {
- *decided = raw;
- break;
- }
- }
- if (cnt == 12)
- /* Does not match a month name. */
- return NULL;
- tm->tm_mon = cnt;
- want_xday = 1;
- break;
- case 'c':
- /* Match locale's date and time format. */
-#ifdef _NL_CURRENT
- if (*decided != raw)
- {
- if (!recursive (_NL_CURRENT (LC_TIME, D_T_FMT)))
- {
- if (*decided == loc)
- return NULL;
- else
- rp = rp_backup;
- }
- else
- {
- if (*decided == not &&
- strcmp (_NL_CURRENT (LC_TIME, D_T_FMT), HERE_D_T_FMT))
- *decided = loc;
- want_xday = 1;
- break;
- }
- *decided = raw;
- }
-#endif
- if (!recursive (HERE_D_T_FMT))
- return NULL;
- want_xday = 1;
- break;
- case 'C':
- /* Match century number. */
-#ifdef _NL_CURRENT
- match_century:
-#endif
- get_number (0, 99, 2);
- century = val;
- want_xday = 1;
- break;
- case 'd':
- case 'e':
- /* Match day of month. */
- get_number (1, 31, 2);
- tm->tm_mday = val;
- have_mday = 1;
- want_xday = 1;
- break;
- case 'F':
- if (!recursive ("%Y-%m-%d"))
- return NULL;
- want_xday = 1;
- break;
- case 'x':
-#ifdef _NL_CURRENT
- if (*decided != raw)
- {
- if (!recursive (_NL_CURRENT (LC_TIME, D_FMT)))
- {
- if (*decided == loc)
- return NULL;
- else
- rp = rp_backup;
- }
- else
- {
- if (*decided == not
- && strcmp (_NL_CURRENT (LC_TIME, D_FMT), HERE_D_FMT))
- *decided = loc;
- want_xday = 1;
- break;
- }
- *decided = raw;
- }
-#endif
- /* Fall through. */
- case 'D':
- /* Match standard day format. */
- if (!recursive (HERE_D_FMT))
- return NULL;
- want_xday = 1;
- break;
- case 'k':
- case 'H':
- /* Match hour in 24-hour clock. */
- get_number (0, 23, 2);
- tm->tm_hour = val;
- have_I = 0;
- break;
- case 'I':
- /* Match hour in 12-hour clock. */
- get_number (1, 12, 2);
- tm->tm_hour = val % 12;
- have_I = 1;
- break;
- case 'j':
- /* Match day number of year. */
- get_number (1, 366, 3);
- tm->tm_yday = val - 1;
- have_yday = 1;
- break;
- case 'm':
- /* Match number of month. */
- get_number (1, 12, 2);
- tm->tm_mon = val - 1;
- have_mon = 1;
- want_xday = 1;
- break;
- case 'M':
- /* Match minute. */
- get_number (0, 59, 2);
- tm->tm_min = val;
- break;
- case 'n':
- case 't':
- /* Match any white space. */
- while (isspace (*rp))
- ++rp;
- break;
- case 'p':
- /* Match locale's equivalent of AM/PM. */
-#ifdef _NL_CURRENT
- if (*decided != raw)
- {
- if (match_string (_NL_CURRENT (LC_TIME, AM_STR), rp))
- {
- if (strcmp (_NL_CURRENT (LC_TIME, AM_STR), HERE_AM_STR))
- *decided = loc;
- break;
- }
- if (match_string (_NL_CURRENT (LC_TIME, PM_STR), rp))
- {
- if (strcmp (_NL_CURRENT (LC_TIME, PM_STR), HERE_PM_STR))
- *decided = loc;
- is_pm = 1;
- break;
- }
- *decided = raw;
- }
-#endif
- if (!match_string (HERE_AM_STR, rp)) {
- if (match_string (HERE_PM_STR, rp)) {
- is_pm = 1;
- } else {
- return NULL;
- }
- }
- break;
- case 'r':
-#ifdef _NL_CURRENT
- if (*decided != raw)
- {
- if (!recursive (_NL_CURRENT (LC_TIME, T_FMT_AMPM)))
- {
- if (*decided == loc)
- return NULL;
- else
- rp = rp_backup;
- }
- else
- {
- if (*decided == not &&
- strcmp (_NL_CURRENT (LC_TIME, T_FMT_AMPM),
- HERE_T_FMT_AMPM))
- *decided = loc;
- break;
- }
- *decided = raw;
- }
-#endif
- if (!recursive (HERE_T_FMT_AMPM))
- return NULL;
- break;
- case 'R':
- if (!recursive ("%H:%M"))
- return NULL;
- break;
- case 's':
- {
- /* The number of seconds may be very high so we cannot use
- the `get_number' macro. Instead read the number
- character for character and construct the result while
- doing this. */
- time_t secs = 0;
- if (*rp < '0' || *rp > '9')
- /* We need at least one digit. */
- return NULL;
-
- do
- {
- secs *= 10;
- secs += *rp++ - '0';
- }
- while (*rp >= '0' && *rp <= '9');
-
- if (localtime_r (&secs, tm) == NULL)
- /* Error in function. */
- return NULL;
- }
- break;
- case 'S':
- get_number (0, 61, 2);
- tm->tm_sec = val;
- break;
- case 'X':
-#ifdef _NL_CURRENT
- if (*decided != raw)
- {
- if (!recursive (_NL_CURRENT (LC_TIME, T_FMT)))
- {
- if (*decided == loc)
- return NULL;
- else
- rp = rp_backup;
- }
- else
- {
- if (strcmp (_NL_CURRENT (LC_TIME, T_FMT), HERE_T_FMT))
- *decided = loc;
- break;
- }
- *decided = raw;
- }
-#endif
- /* Fall through. */
- case 'T':
- if (!recursive (HERE_T_FMT))
- return NULL;
- break;
- case 'u':
- get_number (1, 7, 1);
- tm->tm_wday = val % 7;
- have_wday = 1;
- break;
- case 'g':
- get_number (0, 99, 2);
- /* XXX This cannot determine any field in TM. */
- break;
- case 'G':
- if (*rp < '0' || *rp > '9')
- return NULL;
- /* XXX Ignore the number since we would need some more
- information to compute a real date. */
- do
- ++rp;
- while (*rp >= '0' && *rp <= '9');
- break;
- case 'U':
- case 'V':
- case 'W':
- get_number (0, 53, 2);
- /* XXX This cannot determine any field in TM without some
- information. */
- break;
- case 'w':
- /* Match number of weekday. */
- get_number (0, 6, 1);
- tm->tm_wday = val;
- have_wday = 1;
- break;
- case 'y':
-#ifdef _NL_CURRENT
- match_year_in_century:
-#endif
- /* Match year within century. */
- get_number (0, 99, 2);
- /* The "Year 2000: The Millennium Rollover" paper suggests that
- values in the range 69-99 refer to the twentieth century. */
- tm->tm_year = val >= 69 ? val : val + 100;
- /* Indicate that we want to use the century, if specified. */
- want_century = 1;
- want_xday = 1;
- break;
- case 'Y':
- /* Match year including century number. */
- get_number (0, 9999, 4);
- tm->tm_year = val - 1900;
- want_century = 0;
- want_xday = 1;
- break;
- case 'Z':
- /* XXX How to handle this? */
- break;
- case 'E':
-#ifdef _NL_CURRENT
- switch (*fmt++)
- {
- case 'c':
- /* Match locale's alternate date and time format. */
- if (*decided != raw)
- {
- const char *fmt = _NL_CURRENT (LC_TIME, ERA_D_T_FMT);
-
- if (*fmt == '\0')
- fmt = _NL_CURRENT (LC_TIME, D_T_FMT);
-
- if (!recursive (fmt))
- {
- if (*decided == loc)
- return NULL;
- else
- rp = rp_backup;
- }
- else
- {
- if (strcmp (fmt, HERE_D_T_FMT))
- *decided = loc;
- want_xday = 1;
- break;
- }
- *decided = raw;
- }
- /* The C locale has no era information, so use the
- normal representation. */
- if (!recursive (HERE_D_T_FMT))
- return NULL;
- want_xday = 1;
- break;
- case 'C':
- if (*decided != raw)
- {
- if (era_cnt >= 0)
- {
- era = _nl_select_era_entry (era_cnt);
- if (match_string (era->era_name, rp))
- {
- *decided = loc;
- break;
- }
- else
- return NULL;
- }
- else
- {
- num_eras = _NL_CURRENT_WORD (LC_TIME,
- _NL_TIME_ERA_NUM_ENTRIES);
- for (era_cnt = 0; era_cnt < (int) num_eras;
- ++era_cnt, rp = rp_backup)
- {
- era = _nl_select_era_entry (era_cnt);
- if (match_string (era->era_name, rp))
- {
- *decided = loc;
- break;
- }
- }
- if (era_cnt == (int) num_eras)
- {
- era_cnt = -1;
- if (*decided == loc)
- return NULL;
- }
- else
- break;
- }
-
- *decided = raw;
- }
- /* The C locale has no era information, so use the
- normal representation. */
- goto match_century;
- case 'y':
- if (*decided == raw)
- goto match_year_in_century;
-
- get_number(0, 9999, 4);
- tm->tm_year = val;
- want_era = 1;
- want_xday = 1;
- break;
- case 'Y':
- if (*decided != raw)
- {
- num_eras = _NL_CURRENT_WORD (LC_TIME,
- _NL_TIME_ERA_NUM_ENTRIES);
- for (era_cnt = 0; era_cnt < (int) num_eras;
- ++era_cnt, rp = rp_backup)
- {
- era = _nl_select_era_entry (era_cnt);
- if (recursive (era->era_format))
- break;
- }
- if (era_cnt == (int) num_eras)
- {
- era_cnt = -1;
- if (*decided == loc)
- return NULL;
- else
- rp = rp_backup;
- }
- else
- {
- *decided = loc;
- era_cnt = -1;
- break;
- }
-
- *decided = raw;
- }
- get_number (0, 9999, 4);
- tm->tm_year = val - 1900;
- want_century = 0;
- want_xday = 1;
- break;
- case 'x':
- if (*decided != raw)
- {
- const char *fmt = _NL_CURRENT (LC_TIME, ERA_D_FMT);
-
- if (*fmt == '\0')
- fmt = _NL_CURRENT (LC_TIME, D_FMT);
-
- if (!recursive (fmt))
- {
- if (*decided == loc)
- return NULL;
- else
- rp = rp_backup;
- }
- else
- {
- if (strcmp (fmt, HERE_D_FMT))
- *decided = loc;
- break;
- }
- *decided = raw;
- }
- if (!recursive (HERE_D_FMT))
- return NULL;
- break;
- case 'X':
- if (*decided != raw)
- {
- const char *fmt = _NL_CURRENT (LC_TIME, ERA_T_FMT);
-
- if (*fmt == '\0')
- fmt = _NL_CURRENT (LC_TIME, T_FMT);
-
- if (!recursive (fmt))
- {
- if (*decided == loc)
- return NULL;
- else
- rp = rp_backup;
- }
- else
- {
- if (strcmp (fmt, HERE_T_FMT))
- *decided = loc;
- break;
- }
- *decided = raw;
- }
- if (!recursive (HERE_T_FMT))
- return NULL;
- break;
- default:
- return NULL;
- }
- break;
-#else
- /* We have no information about the era format. Just use
- the normal format. */
- if (*fmt != 'c' && *fmt != 'C' && *fmt != 'y' && *fmt != 'Y'
- && *fmt != 'x' && *fmt != 'X')
- /* This is an illegal format. */
- return NULL;
-
- goto start_over;
-#endif
- case 'O':
- switch (*fmt++)
- {
- case 'd':
- case 'e':
- /* Match day of month using alternate numeric symbols. */
- get_alt_number (1, 31, 2);
- tm->tm_mday = val;
- have_mday = 1;
- want_xday = 1;
- break;
- case 'H':
- /* Match hour in 24-hour clock using alternate numeric
- symbols. */
- get_alt_number (0, 23, 2);
- tm->tm_hour = val;
- have_I = 0;
- break;
- case 'I':
- /* Match hour in 12-hour clock using alternate numeric
- symbols. */
- get_alt_number (1, 12, 2);
- tm->tm_hour = val - 1;
- have_I = 1;
- break;
- case 'm':
- /* Match month using alternate numeric symbols. */
- get_alt_number (1, 12, 2);
- tm->tm_mon = val - 1;
- have_mon = 1;
- want_xday = 1;
- break;
- case 'M':
- /* Match minutes using alternate numeric symbols. */
- get_alt_number (0, 59, 2);
- tm->tm_min = val;
- break;
- case 'S':
- /* Match seconds using alternate numeric symbols. */
- get_alt_number (0, 61, 2);
- tm->tm_sec = val;
- break;
- case 'U':
- case 'V':
- case 'W':
- get_alt_number (0, 53, 2);
- /* XXX This cannot determine any field in TM without
- further information. */
- break;
- case 'w':
- /* Match number of weekday using alternate numeric symbols. */
- get_alt_number (0, 6, 1);
- tm->tm_wday = val;
- have_wday = 1;
- break;
- case 'y':
- /* Match year within century using alternate numeric symbols. */
- get_alt_number (0, 99, 2);
- tm->tm_year = val >= 69 ? val : val + 100;
- want_xday = 1;
- break;
- default:
- return NULL;
- }
- break;
- default:
- return NULL;
- }
- }
-
- if (have_I && is_pm)
- tm->tm_hour += 12;
-
- if (century != -1)
- {
- if (want_century)
- tm->tm_year = tm->tm_year % 100 + (century - 19) * 100;
- else
- /* Only the century, but not the year. Strange, but so be it. */
- tm->tm_year = (century - 19) * 100;
- }
-
-#ifdef _NL_CURRENT
- if (era_cnt != -1)
- {
- era = _nl_select_era_entry(era_cnt);
- if (want_era)
- tm->tm_year = (era->start_date[0]
- + ((tm->tm_year - era->offset)
- * era->absolute_direction));
- else
- /* Era start year assumed. */
- tm->tm_year = era->start_date[0];
- }
- else
-#endif
- if (want_era)
- return NULL;
-
- if (want_xday && !have_wday)
- {
- if ( !(have_mon && have_mday) && have_yday)
- {
- /* We don't have tm_mon and/or tm_mday, compute them. */
- int t_mon = 0;
- while (__mon_yday[__isleap(1900 + tm->tm_year)][t_mon] <= tm->tm_yday)
- t_mon++;
- if (!have_mon)
- tm->tm_mon = t_mon - 1;
- if (!have_mday)
- tm->tm_mday =
- (tm->tm_yday
- - __mon_yday[__isleap(1900 + tm->tm_year)][t_mon - 1] + 1);
- }
- day_of_the_week (tm);
- }
- if (want_xday && !have_yday)
- day_of_the_year (tm);
-
- return discard_const_p(char, rp);
-}
-
-
-char *rep_strptime(const char *buf, const char *format, struct tm *tm)
-{
- enum locale_status decided;
-
-#ifdef _NL_CURRENT
- decided = not;
-#else
- decided = raw;
-#endif
- return strptime_internal (buf, format, tm, &decided, -1);
-}
diff --git a/chromium/third_party/talloc/libreplace/strptime.m4 b/chromium/third_party/talloc/libreplace/strptime.m4
deleted file mode 100644
index b1a56b4aab1..00000000000
--- a/chromium/third_party/talloc/libreplace/strptime.m4
+++ /dev/null
@@ -1,13 +0,0 @@
-AC_CACHE_CHECK([whether strptime is available and works],libreplace_cv_STRPTIME_OK,[
- AC_TRY_RUN([
- #define LIBREPLACE_CONFIGURE_TEST_STRPTIME
- #include "$libreplacedir/test/strptime.c"
- ],
- [libreplace_cv_STRPTIME_OK=yes],
- [libreplace_cv_STRPTIME_OK=no],
- [libreplace_cv_STRPTIME_OK="assuming not"])
-])
-if test x"$libreplace_cv_STRPTIME_OK" != x"yes"; then
- AC_DEFINE(REPLACE_STRPTIME,1,[Whether strptime should be replaced])
- LIBREPLACEOBJ="${LIBREPLACEOBJ} $libreplacedir/strptime.o"
-fi
diff --git a/chromium/third_party/talloc/libreplace/system/README b/chromium/third_party/talloc/libreplace/system/README
deleted file mode 100644
index 69a2b80b56c..00000000000
--- a/chromium/third_party/talloc/libreplace/system/README
+++ /dev/null
@@ -1,4 +0,0 @@
-This directory contains wrappers around logical groups of system
-include files. The idea is to avoid #ifdef blocks in the main code,
-and instead put all the necessary conditional includes in subsystem
-specific header files in this directory.
diff --git a/chromium/third_party/talloc/libreplace/system/aio.h b/chromium/third_party/talloc/libreplace/system/aio.h
deleted file mode 100644
index 784d77fa280..00000000000
--- a/chromium/third_party/talloc/libreplace/system/aio.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef _system_aio_h
-#define _system_aio_h
-/*
- Unix SMB/CIFS implementation.
-
- AIO system include wrappers
-
- Copyright (C) Andrew Tridgell 2006
-
- ** NOTE! The following LGPL license applies to the replace
- ** library. This does NOT imply that all of Samba is released
- ** under the LGPL
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifdef HAVE_LIBAIO_H
-#include <libaio.h>
-#endif
-
-#endif
diff --git a/chromium/third_party/talloc/libreplace/system/capability.h b/chromium/third_party/talloc/libreplace/system/capability.h
deleted file mode 100644
index a7b78f02756..00000000000
--- a/chromium/third_party/talloc/libreplace/system/capability.h
+++ /dev/null
@@ -1,55 +0,0 @@
-#ifndef _system_capability_h
-#define _system_capability_h
-/*
- Unix SMB/CIFS implementation.
-
- capability system include wrappers
-
- Copyright (C) Andrew Tridgell 2004
-
- ** NOTE! The following LGPL license applies to the replace
- ** library. This does NOT imply that all of Samba is released
- ** under the LGPL
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifdef HAVE_SYS_CAPABILITY_H
-
-#if defined(BROKEN_REDHAT_7_SYSTEM_HEADERS) && !defined(_I386_STATFS_H) && !defined(_PPC_STATFS_H)
-#define _I386_STATFS_H
-#define _PPC_STATFS_H
-#define BROKEN_REDHAT_7_STATFS_WORKAROUND
-#endif
-
-#if defined(BROKEN_RHEL5_SYS_CAP_HEADER) && !defined(_LINUX_TYPES_H)
-#define BROKEN_RHEL5_SYS_CAP_HEADER_WORKAROUND
-#endif
-
-#include <sys/capability.h>
-
-#ifdef BROKEN_RHEL5_SYS_CAP_HEADER_WORKAROUND
-#undef _LINUX_TYPES_H
-#undef BROKEN_RHEL5_SYS_CAP_HEADER_WORKAROUND
-#endif
-
-#ifdef BROKEN_REDHAT_7_STATFS_WORKAROUND
-#undef _PPC_STATFS_H
-#undef _I386_STATFS_H
-#undef BROKEN_REDHAT_7_STATFS_WORKAROUND
-#endif
-
-#endif
-
-#endif
diff --git a/chromium/third_party/talloc/libreplace/system/config.m4 b/chromium/third_party/talloc/libreplace/system/config.m4
deleted file mode 100644
index 39c2f58283b..00000000000
--- a/chromium/third_party/talloc/libreplace/system/config.m4
+++ /dev/null
@@ -1,131 +0,0 @@
-# filesys
-AC_HEADER_DIRENT
-AC_CHECK_HEADERS(fcntl.h sys/fcntl.h sys/resource.h sys/ioctl.h sys/mode.h sys/filio.h sys/fs/s5param.h sys/filsys.h)
-AC_CHECK_HEADERS(sys/acl.h acl/libacl.h)
-
-# select
-AC_CHECK_HEADERS(sys/select.h)
-
-# time
-AC_CHECK_HEADERS(sys/time.h utime.h)
-AC_HEADER_TIME
-AC_CHECK_FUNCS(utime utimes)
-
-# wait
-AC_HEADER_SYS_WAIT
-
-# capability
-AC_CHECK_HEADERS(sys/capability.h)
-
-case "$host_os" in
-*linux*)
-AC_CACHE_CHECK([for broken RedHat 7.2 system header files],libreplace_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS,[
-AC_TRY_COMPILE([
- #ifdef HAVE_SYS_VFS_H
- #include <sys/vfs.h>
- #endif
- #ifdef HAVE_SYS_CAPABILITY_H
- #include <sys/capability.h>
- #endif
- ],[
- int i;
- ],
- libreplace_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=no,
- libreplace_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=yes
-)])
-if test x"$libreplace_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS" = x"yes"; then
- AC_DEFINE(BROKEN_REDHAT_7_SYSTEM_HEADERS,1,[Broken RedHat 7.2 system header files])
-fi
-
-AC_CACHE_CHECK([for broken RHEL5 sys/capability.h],libreplace_cv_BROKEN_RHEL5_SYS_CAP_HEADER,[
-AC_TRY_COMPILE([
- #ifdef HAVE_SYS_CAPABILITY_H
- #include <sys/capability.h>
- #endif
- #include <linux/types.h>
- ],[
- __s8 i;
- ],
- libreplace_cv_BROKEN_RHEL5_SYS_CAP_HEADER=no,
- libreplace_cv_BROKEN_RHEL5_SYS_CAP_HEADER=yes
-)])
-if test x"$libreplace_cv_BROKEN_RHEL5_SYS_CAP_HEADER" = x"yes"; then
- AC_DEFINE(BROKEN_RHEL5_SYS_CAP_HEADER,1,[Broken RHEL5 sys/capability.h])
-fi
-;;
-esac
-
-# passwd
-AC_CHECK_HEADERS(grp.h sys/id.h compat.h shadow.h sys/priv.h pwd.h sys/security.h)
-AC_CHECK_FUNCS(getpwnam_r getpwuid_r getpwent_r)
-AC_HAVE_DECL(getpwent_r, [
- #include <unistd.h>
- #include <pwd.h>
- ])
-AC_VERIFY_C_PROTOTYPE([struct passwd *getpwent_r(struct passwd *src, char *buf, int buflen)],
- [
- #ifndef HAVE_GETPWENT_R_DECL
- #error missing getpwent_r prototype
- #endif
- return NULL;
- ],[
- AC_DEFINE(SOLARIS_GETPWENT_R, 1, [getpwent_r solaris function prototype])
- ],[],[
- #include <unistd.h>
- #include <pwd.h>
- ])
-AC_VERIFY_C_PROTOTYPE([struct passwd *getpwent_r(struct passwd *src, char *buf, size_t buflen)],
- [
- #ifndef HAVE_GETPWENT_R_DECL
- #error missing getpwent_r prototype
- #endif
- return NULL;
- ],[
- AC_DEFINE(SOLARIS_GETPWENT_R, 1, [getpwent_r irix (similar to solaris) function prototype])
- ],[],[
- #include <unistd.h>
- #include <pwd.h>
- ])
-AC_CHECK_FUNCS(getgrnam_r getgrgid_r getgrent_r)
-AC_HAVE_DECL(getgrent_r, [
- #include <unistd.h>
- #include <grp.h>
- ])
-AC_VERIFY_C_PROTOTYPE([struct group *getgrent_r(struct group *src, char *buf, int buflen)],
- [
- #ifndef HAVE_GETGRENT_R_DECL
- #error missing getgrent_r prototype
- #endif
- return NULL;
- ],[
- AC_DEFINE(SOLARIS_GETGRENT_R, 1, [getgrent_r solaris function prototype])
- ],[],[
- #include <unistd.h>
- #include <grp.h>
- ])
-
-AC_VERIFY_C_PROTOTYPE([struct group *getgrent_r(struct group *src, char *buf, size_t buflen)],
- [
- #ifndef HAVE_GETGRENT_R_DECL
- #error missing getgrent_r prototype
- #endif
- return NULL;
- ],[
- AC_DEFINE(SOLARIS_GETGRENT_R, 1, [getgrent_r irix (similar to solaris) function prototype])
- ],[],[
- #include <unistd.h>
- #include <grp.h>
- ])
-AC_CHECK_FUNCS(getgrouplist)
-
-# locale
-AC_CHECK_HEADERS(ctype.h locale.h langinfo.h)
-
-# glob
-AC_CHECK_HEADERS(fnmatch.h)
-
-# shmem
-AC_CHECK_HEADERS(sys/ipc.h sys/mman.h sys/shm.h )
-
-# terminal
-AC_CHECK_HEADERS(termios.h termio.h sys/termio.h )
diff --git a/chromium/third_party/talloc/libreplace/system/dir.h b/chromium/third_party/talloc/libreplace/system/dir.h
deleted file mode 100644
index dec2d546492..00000000000
--- a/chromium/third_party/talloc/libreplace/system/dir.h
+++ /dev/null
@@ -1,67 +0,0 @@
-#ifndef _system_dir_h
-#define _system_dir_h
-/*
- Unix SMB/CIFS implementation.
-
- directory system include wrappers
-
- Copyright (C) Andrew Tridgell 2004
-
- ** NOTE! The following LGPL license applies to the replace
- ** library. This does NOT imply that all of Samba is released
- ** under the LGPL
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, see <http://www.gnu.org/licenses/>.
-*/
-
-#if HAVE_DIRENT_H
-# include <dirent.h>
-# define NAMLEN(dirent) strlen((dirent)->d_name)
-#else
-# define dirent direct
-# define NAMLEN(dirent) (dirent)->d_namlen
-# if HAVE_SYS_NDIR_H
-# include <sys/ndir.h>
-# endif
-# if HAVE_SYS_DIR_H
-# include <sys/dir.h>
-# endif
-# if HAVE_NDIR_H
-# include <ndir.h>
-# endif
-#endif
-
-#ifndef HAVE_MKDIR_MODE
-#define mkdir(dir, mode) mkdir(dir)
-#endif
-
-/* Test whether a file name is the "." or ".." directory entries.
- * These really should be inline functions.
- */
-#ifndef ISDOT
-#define ISDOT(path) ( \
- *((const char *)(path)) == '.' && \
- *(((const char *)(path)) + 1) == '\0' \
- )
-#endif
-
-#ifndef ISDOTDOT
-#define ISDOTDOT(path) ( \
- *((const char *)(path)) == '.' && \
- *(((const char *)(path)) + 1) == '.' && \
- *(((const char *)(path)) + 2) == '\0' \
- )
-#endif
-
-#endif
diff --git a/chromium/third_party/talloc/libreplace/system/filesys.h b/chromium/third_party/talloc/libreplace/system/filesys.h
deleted file mode 100644
index 22e3d23f3e7..00000000000
--- a/chromium/third_party/talloc/libreplace/system/filesys.h
+++ /dev/null
@@ -1,186 +0,0 @@
-#ifndef _system_filesys_h
-#define _system_filesys_h
-/*
- Unix SMB/CIFS implementation.
-
- filesystem system include wrappers
-
- Copyright (C) Andrew Tridgell 2004
-
- ** NOTE! The following LGPL license applies to the replace
- ** library. This does NOT imply that all of Samba is released
- ** under the LGPL
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#include <unistd.h>
-#include <sys/stat.h>
-
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif
-
-#ifdef HAVE_SYS_MOUNT_H
-#include <sys/mount.h>
-#endif
-
-#ifdef HAVE_MNTENT_H
-#include <mntent.h>
-#endif
-
-#ifdef HAVE_SYS_VFS_H
-#include <sys/vfs.h>
-#endif
-
-#ifdef HAVE_SYS_ACL_H
-#include <sys/acl.h>
-#endif
-
-#ifdef HAVE_ACL_LIBACL_H
-#include <acl/libacl.h>
-#endif
-
-#ifdef HAVE_SYS_FS_S5PARAM_H
-#include <sys/fs/s5param.h>
-#endif
-
-#if defined (HAVE_SYS_FILSYS_H) && !defined (_CRAY)
-#include <sys/filsys.h>
-#endif
-
-#ifdef HAVE_SYS_STATFS_H
-# include <sys/statfs.h>
-#endif
-
-#ifdef HAVE_DUSTAT_H
-#include <sys/dustat.h>
-#endif
-
-#ifdef HAVE_SYS_STATVFS_H
-#include <sys/statvfs.h>
-#endif
-
-#ifdef HAVE_SYS_FILIO_H
-#include <sys/filio.h>
-#endif
-
-#include <sys/file.h>
-
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#else
-#ifdef HAVE_SYS_FCNTL_H
-#include <sys/fcntl.h>
-#endif
-#endif
-
-#ifdef HAVE_SYS_MODE_H
-/* apparently AIX needs this for S_ISLNK */
-#ifndef S_ISLNK
-#include <sys/mode.h>
-#endif
-#endif
-
-#ifdef HAVE_SYS_IOCTL_H
-#include <sys/ioctl.h>
-#endif
-
-/*
- * Veritas File System. Often in addition to native.
- * Quotas different.
- */
-#if defined(HAVE_SYS_FS_VX_QUOTA_H)
-#define VXFS_QUOTA
-#endif
-
-#if HAVE_SYS_ATTRIBUTES_H
-#include <sys/attributes.h>
-#endif
-
-/* mutually exclusive (SuSE 8.2) */
-#if HAVE_ATTR_XATTR_H
-#include <attr/xattr.h>
-#elif HAVE_SYS_XATTR_H
-#include <sys/xattr.h>
-#endif
-
-
-#ifdef HAVE_SYS_RESOURCE_H
-#include <sys/resource.h>
-#endif
-
-/* Some POSIX definitions for those without */
-
-#ifndef S_IFDIR
-#define S_IFDIR 0x4000
-#endif
-#ifndef S_ISDIR
-#define S_ISDIR(mode) ((mode & 0xF000) == S_IFDIR)
-#endif
-#ifndef S_IRWXU
-#define S_IRWXU 00700 /* read, write, execute: owner */
-#endif
-#ifndef S_IRUSR
-#define S_IRUSR 00400 /* read permission: owner */
-#endif
-#ifndef S_IWUSR
-#define S_IWUSR 00200 /* write permission: owner */
-#endif
-#ifndef S_IXUSR
-#define S_IXUSR 00100 /* execute permission: owner */
-#endif
-#ifndef S_IRWXG
-#define S_IRWXG 00070 /* read, write, execute: group */
-#endif
-#ifndef S_IRGRP
-#define S_IRGRP 00040 /* read permission: group */
-#endif
-#ifndef S_IWGRP
-#define S_IWGRP 00020 /* write permission: group */
-#endif
-#ifndef S_IXGRP
-#define S_IXGRP 00010 /* execute permission: group */
-#endif
-#ifndef S_IRWXO
-#define S_IRWXO 00007 /* read, write, execute: other */
-#endif
-#ifndef S_IROTH
-#define S_IROTH 00004 /* read permission: other */
-#endif
-#ifndef S_IWOTH
-#define S_IWOTH 00002 /* write permission: other */
-#endif
-#ifndef S_IXOTH
-#define S_IXOTH 00001 /* execute permission: other */
-#endif
-
-#ifndef O_ACCMODE
-#define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
-#endif
-
-#ifndef MAXPATHLEN
-#define MAXPATHLEN 256
-#endif
-
-#ifndef SEEK_SET
-#define SEEK_SET 0
-#endif
-
-#ifdef _WIN32
-#define mkdir(d,m) _mkdir(d)
-#endif
-
-#endif
diff --git a/chromium/third_party/talloc/libreplace/system/glob.h b/chromium/third_party/talloc/libreplace/system/glob.h
deleted file mode 100644
index 3e23db6828f..00000000000
--- a/chromium/third_party/talloc/libreplace/system/glob.h
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef _system_glob_h
-#define _system_glob_h
-/*
- Unix SMB/CIFS implementation.
-
- glob system include wrappers
-
- Copyright (C) Andrew Tridgell 2004
-
- ** NOTE! The following LGPL license applies to the replace
- ** library. This does NOT imply that all of Samba is released
- ** under the LGPL
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_GLOB_H
-#include <glob.h>
-#endif
-
-#ifdef HAVE_FNMATCH_H
-#include <fnmatch.h>
-#endif
-
-#endif
diff --git a/chromium/third_party/talloc/libreplace/system/iconv.h b/chromium/third_party/talloc/libreplace/system/iconv.h
deleted file mode 100644
index 3c8a71f2f7b..00000000000
--- a/chromium/third_party/talloc/libreplace/system/iconv.h
+++ /dev/null
@@ -1,57 +0,0 @@
-#ifndef _system_iconv_h
-#define _system_iconv_h
-/*
- Unix SMB/CIFS implementation.
-
- iconv memory system include wrappers
-
- Copyright (C) Andrew Tridgell 2004
-
- ** NOTE! The following LGPL license applies to the replace
- ** library. This does NOT imply that all of Samba is released
- ** under the LGPL
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined(HAVE_ICONV) && defined(HAVE_ICONV_H)
-#define HAVE_ICONV
-#endif
-
-#if !defined(HAVE_GICONV) && defined(HAVE_GICONV_H)
-#define HAVE_GICONV
-#endif
-
-#if !defined(HAVE_BICONV) && defined(HAVE_BICONV_H)
-#define HAVE_BICONV
-#endif
-
-#ifdef HAVE_NATIVE_ICONV
-#if defined(HAVE_ICONV)
-#include <iconv.h>
-#elif defined(HAVE_GICONV)
-#include <giconv.h>
-#elif defined(HAVE_BICONV)
-#include <biconv.h>
-#endif
-#endif /* HAVE_NATIVE_ICONV */
-
-/* needed for some systems without iconv. Doesn't really matter
- what error code we use */
-#ifndef EILSEQ
-#define EILSEQ EIO
-#endif
-
-#endif
diff --git a/chromium/third_party/talloc/libreplace/system/kerberos.h b/chromium/third_party/talloc/libreplace/system/kerberos.h
deleted file mode 100644
index a1685ad3330..00000000000
--- a/chromium/third_party/talloc/libreplace/system/kerberos.h
+++ /dev/null
@@ -1,141 +0,0 @@
-#ifndef _system_kerberos_h
-#define _system_kerberos_h
-
-/*
- Unix SMB/CIFS implementation.
-
- kerberos system include wrappers
-
- Copyright (C) Andrew Tridgell 2004
-
- ** NOTE! The following LGPL license applies to the replace
- ** library. This does NOT imply that all of Samba is released
- ** under the LGPL
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_KRB5
-/* Whether the krb5_address struct has a addrtype property */
-/* #undef HAVE_ADDRTYPE_IN_KRB5_ADDRESS */
-/* Whether the krb5_address struct has a addr_type property */
-#define HAVE_ADDR_TYPE_IN_KRB5_ADDRESS 1
-/* Define to 1 if you have the `gsskrb5_extract_authz_data_from_sec_context' */
-#define HAVE_GSSKRB5_EXTRACT_AUTHZ_DATA_FROM_SEC_CONTEXT 1
-/* Define to 1 if you have the `gsskrb5_get_initiator_subkey' function. */
-#define HAVE_GSSKRB5_GET_INITIATOR_SUBKEY 1
-/* Define to 1 if you have the `gsskrb5_register_acceptor_identity' function. */
-#define HAVE_GSSKRB5_REGISTER_ACCEPTOR_IDENTITY 1
-/* Define to 1 if you have the `gss_krb5_ccache_name' function. */
-#define HAVE_GSS_KRB5_CCACHE_NAME 1
-/* Define to 1 if you have the `krb5_addlog_func' function. */
-#define HAVE_KRB5_ADDLOG_FUNC 1
-/* Define to 1 if you have the `krb5_auth_con_setkey' function. */
-#define HAVE_KRB5_AUTH_CON_SETKEY 1
-/* Define to 1 if you have the `krb5_auth_con_setuseruserkey' function. */
-/* #undef HAVE_KRB5_AUTH_CON_SETUSERUSERKEY */
-/* Define to 1 if you have the `krb5_c_enctype_compare' function. */
-#define HAVE_KRB5_C_ENCTYPE_COMPARE 1
-/* Define to 1 if you have the `krb5_c_verify_checksum' function. */
-#define HAVE_KRB5_C_VERIFY_CHECKSUM 1
-/* Whether the type krb5_encrypt_block exists */
-/* #undef HAVE_KRB5_ENCRYPT_BLOCK */
-/* Define to 1 if you have the `krb5_encrypt_data' function. */
-/* #undef HAVE_KRB5_ENCRYPT_DATA */
-/* Define to 1 if you have the `krb5_enctypes_compatible_keys' function. */
-#define HAVE_KRB5_ENCTYPES_COMPATIBLE_KEYS 1
-/* Define to 1 if you have the `krb5_free_data_contents' function. */
-#define HAVE_KRB5_FREE_DATA_CONTENTS 1
-/* Define to 1 if you have the `krb5_free_error_string' function. */
-/* #undef HAVE_KRB5_FREE_ERROR_STRING */
-/* Define to 1 if you have the `krb5_free_error_message' function. */
-#define HAVE_KRB5_FREE_ERROR_MESSAGE 1
-/* Define to 1 if you have the `krb5_free_keytab_entry_contents' function. */
-/* #undef HAVE_KRB5_FREE_KEYTAB_ENTRY_CONTENTS */
-/* Define to 1 if you have the `krb5_free_ktypes' function. */
-/* #undef HAVE_KRB5_FREE_KTYPES */
-/* Define to 1 if you have the `krb5_free_unparsed_name' function. */
-/* #undef HAVE_KRB5_FREE_UNPARSED_NAME */
-/* Define to 1 if you have the `krb5_get_default_in_tkt_etypes' function. */
-#define HAVE_KRB5_GET_DEFAULT_IN_TKT_ETYPES 1
-/* Define to 1 if you have the `krb5_get_error_string' function. */
-#define HAVE_KRB5_GET_ERROR_STRING 1
-/* Define to 1 if you have the `krb5_get_error_message' function. */
-#define HAVE_KRB5_GET_ERROR_MESSAGE 1
-/* Define to 1 if you have the `krb5_get_permitted_enctypes' function. */
-/* #undef HAVE_KRB5_GET_PERMITTED_ENCTYPES */
-/* Define to 1 if you have the `krb5_get_pw_salt' function. */
-#define HAVE_KRB5_GET_PW_SALT 1
-/* Define to 1 if you have the <krb5.h> header file. */
-#define HAVE_KRB5_H 1
-/* Define to 1 if you have the `krb5_initlog' function. */
-#define HAVE_KRB5_INITLOG 1
-/* Define to 1 if you have the `krb5_kdc_default_config' function. */
-#define HAVE_KRB5_KDC_DEFAULT_CONFIG 1
-/* Whether the krb5_creds struct has a keyblock property */
-/* #undef HAVE_KRB5_KEYBLOCK_IN_CREDS */
-/* Whether the krb5_keyblock struct has a keyvalue property */
-#define HAVE_KRB5_KEYBLOCK_KEYVALUE 1
-/* Whether krb5_keytab_entry has key member */
-/* #undef HAVE_KRB5_KEYTAB_ENTRY_KEY */
-/* Whether krb5_keytab_entry has keyblock member */
-#define HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK 1
-/* Define to 1 if you have the `krb5_krbhst_get_addrinfo' function. */
-#define HAVE_KRB5_KRBHST_GET_ADDRINFO 1
-/* Define to 1 if you have the `krb5_kt_compare' function. */
-#define HAVE_KRB5_KT_COMPARE 1
-/* Define to 1 if you have the `krb5_kt_free_entry' function. */
-#define HAVE_KRB5_KT_FREE_ENTRY 1
-/* Whether the type krb5_log_facility exists */
-#define HAVE_KRB5_LOG_FACILITY 1
-/* Define to 1 if you have the `krb5_mk_req_extended' function. */
-#define HAVE_KRB5_MK_REQ_EXTENDED 1
-/* Define to 1 if you have the `krb5_principal2salt' function. */
-/* #undef HAVE_KRB5_PRINCIPAL2SALT */
-/* Define to 1 if you have the `krb5_principal_get_comp_string' function. */
-#define HAVE_KRB5_PRINCIPAL_GET_COMP_STRING 1
-/* Whether krb5_princ_component is available */
-/* #undef HAVE_KRB5_PRINC_COMPONENT */
-/* Whether the krb5_creds struct has a session property */
-#define HAVE_KRB5_SESSION_IN_CREDS 1
-/* Define to 1 if you have the `krb5_set_default_in_tkt_etypes' function. */
-#define HAVE_KRB5_SET_DEFAULT_IN_TKT_ETYPES 1
-/* Define to 1 if you have the `krb5_set_default_tgs_ktypes' function. */
-/* #undef HAVE_KRB5_SET_DEFAULT_TGS_KTYPES */
-/* Define to 1 if you have the `krb5_set_real_time' function. */
-#define HAVE_KRB5_SET_REAL_TIME 1
-/* Define to 1 if you have the `krb5_set_warn_dest' function. */
-#define HAVE_KRB5_SET_WARN_DEST 1
-/* Define to 1 if you have the `krb5_string_to_key' function. */
-#define HAVE_KRB5_STRING_TO_KEY 1
-/* Define to 1 if you have the `krb5_string_to_key_salt' function. */
-#define HAVE_KRB5_STRING_TO_KEY_SALT 1
-/* Define to 1 if you have the `krb5_ticket_get_authorization_data_type' */
-#define HAVE_KRB5_TICKET_GET_AUTHORIZATION_DATA_TYPE 1
-/* Whether the krb5_ticket struct has a enc_part2 property */
-/* #undef HAVE_KRB5_TKT_ENC_PART2 */
-/* Define to 1 if you have the `krb5_use_enctype' function. */
-/* #undef HAVE_KRB5_USE_ENCTYPE */
-/* Define to 1 if you have the `krb5_verify_checksum' function. */
-#define HAVE_KRB5_VERIFY_CHECKSUM 1
-/* Whether krb5_princ_realm returns krb5_realm or krb5_data */
-#define KRB5_PRINC_REALM_RETURNS_REALM 1
-
-#include <krb5.h>
-#include <com_err.h>
-
-#endif
-
-#endif
diff --git a/chromium/third_party/talloc/libreplace/system/locale.h b/chromium/third_party/talloc/libreplace/system/locale.h
deleted file mode 100644
index 504a3bb470e..00000000000
--- a/chromium/third_party/talloc/libreplace/system/locale.h
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef _system_locale_h
-#define _system_locale_h
-
-/*
- Unix SMB/CIFS implementation.
-
- locale include wrappers
-
- Copyright (C) Andrew Tridgell 2004
-
- ** NOTE! The following LGPL license applies to the replace
- ** library. This does NOT imply that all of Samba is released
- ** under the LGPL
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CTYPE_H
-#include <ctype.h>
-#endif
-
-#ifdef HAVE_LOCALE_H
-#include <locale.h>
-#endif
-
-#ifdef HAVE_LANGINFO_H
-#include <langinfo.h>
-#endif
-
-#endif
diff --git a/chromium/third_party/talloc/libreplace/system/network.h b/chromium/third_party/talloc/libreplace/system/network.h
deleted file mode 100644
index 1f510350bd9..00000000000
--- a/chromium/third_party/talloc/libreplace/system/network.h
+++ /dev/null
@@ -1,372 +0,0 @@
-#ifndef _system_network_h
-#define _system_network_h
-/*
- Unix SMB/CIFS implementation.
-
- networking system include wrappers
-
- Copyright (C) Andrew Tridgell 2004
- Copyright (C) Jelmer Vernooij 2007
-
- ** NOTE! The following LGPL license applies to the replace
- ** library. This does NOT imply that all of Samba is released
- ** under the LGPL
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#ifndef LIBREPLACE_NETWORK_CHECKS
-#error "AC_LIBREPLACE_NETWORK_CHECKS missing in configure"
-#endif
-
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-
-#ifdef HAVE_UNIXSOCKET
-#include <sys/un.h>
-#endif
-
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-#ifdef HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#endif
-
-#ifdef HAVE_NETINET_TCP_H
-#include <netinet/tcp.h>
-#endif
-
-/*
- * The next three defines are needed to access the IPTOS_* options
- * on some systems.
- */
-
-#ifdef HAVE_NETINET_IN_SYSTM_H
-#include <netinet/in_systm.h>
-#endif
-
-#ifdef HAVE_NETINET_IN_IP_H
-#include <netinet/in_ip.h>
-#endif
-
-#ifdef HAVE_NETINET_IP_H
-#include <netinet/ip.h>
-#endif
-
-#ifdef HAVE_NET_IF_H
-#include <net/if.h>
-#endif
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifdef HAVE_SYS_IOCTL_H
-#include <sys/ioctl.h>
-#endif
-
-#ifdef HAVE_SYS_UIO_H
-#include <sys/uio.h>
-#endif
-
-#ifdef HAVE_STROPTS_H
-#include <stropts.h>
-#endif
-
-#ifndef HAVE_SOCKLEN_T
-#define HAVE_SOCKLEN_T
-typedef int socklen_t;
-#endif
-
-#if !defined (HAVE_INET_NTOA) || defined(REPLACE_INET_NTOA)
-/* define is in "replace.h" */
-char *rep_inet_ntoa(struct in_addr ip);
-#endif
-
-#ifndef HAVE_INET_PTON
-/* define is in "replace.h" */
-int rep_inet_pton(int af, const char *src, void *dst);
-#endif
-
-#ifndef HAVE_INET_NTOP
-/* define is in "replace.h" */
-const char *rep_inet_ntop(int af, const void *src, char *dst, socklen_t size);
-#endif
-
-#ifndef HAVE_INET_ATON
-/* define is in "replace.h" */
-int rep_inet_aton(const char *src, struct in_addr *dst);
-#endif
-
-#ifndef HAVE_CONNECT
-/* define is in "replace.h" */
-int rep_connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
-#endif
-
-#ifndef HAVE_GETHOSTBYNAME
-/* define is in "replace.h" */
-struct hostent *rep_gethostbyname(const char *name);
-#endif
-
-#ifdef HAVE_IFADDRS_H
-#include <ifaddrs.h>
-#endif
-
-#ifndef HAVE_STRUCT_IFADDRS
-struct ifaddrs {
- struct ifaddrs *ifa_next; /* Pointer to next struct */
- char *ifa_name; /* Interface name */
- unsigned int ifa_flags; /* Interface flags */
- struct sockaddr *ifa_addr; /* Interface address */
- struct sockaddr *ifa_netmask; /* Interface netmask */
-#undef ifa_dstaddr
- struct sockaddr *ifa_dstaddr; /* P2P interface destination */
- void *ifa_data; /* Address specific data */
-};
-#endif
-
-#ifndef HAVE_GETIFADDRS
-int rep_getifaddrs(struct ifaddrs **);
-#endif
-
-#ifndef HAVE_FREEIFADDRS
-void rep_freeifaddrs(struct ifaddrs *);
-#endif
-
-#ifndef HAVE_SOCKETPAIR
-/* define is in "replace.h" */
-int rep_socketpair(int d, int type, int protocol, int sv[2]);
-#endif
-
-/*
- * Some systems have getaddrinfo but not the
- * defines needed to use it.
- */
-
-/* Various macros that ought to be in <netdb.h>, but might not be */
-
-#ifndef EAI_FAIL
-#define EAI_BADFLAGS (-1)
-#define EAI_NONAME (-2)
-#define EAI_AGAIN (-3)
-#define EAI_FAIL (-4)
-#define EAI_FAMILY (-6)
-#define EAI_SOCKTYPE (-7)
-#define EAI_SERVICE (-8)
-#define EAI_MEMORY (-10)
-#define EAI_SYSTEM (-11)
-#endif /* !EAI_FAIL */
-
-#ifndef AI_PASSIVE
-#define AI_PASSIVE 0x0001
-#endif
-
-#ifndef AI_CANONNAME
-#define AI_CANONNAME 0x0002
-#endif
-
-#ifndef AI_NUMERICHOST
-/*
- * some platforms don't support AI_NUMERICHOST; define as zero if using
- * the system version of getaddrinfo...
- */
-#if defined(HAVE_STRUCT_ADDRINFO) && defined(HAVE_GETADDRINFO)
-#define AI_NUMERICHOST 0
-#else
-#define AI_NUMERICHOST 0x0004
-#endif
-#endif
-
-/*
- * Some of the functions in source3/lib/util_sock.c use AI_ADDRCONFIG. On QNX
- * 6.3.0, this macro is defined but, if it's used, getaddrinfo will fail. This
- * prevents smbd from opening any sockets.
- *
- * If I undefine AI_ADDRCONFIG on such systems and define it to be 0,
- * this works around the issue.
- */
-#ifdef __QNX__
-#include <sys/neutrino.h>
-#if _NTO_VERSION == 630
-#undef AI_ADDRCONFIG
-#endif
-#endif
-#ifndef AI_ADDRCONFIG
-/*
- * logic copied from AI_NUMERICHOST
- */
-#if defined(HAVE_STRUCT_ADDRINFO) && defined(HAVE_GETADDRINFO)
-#define AI_ADDRCONFIG 0
-#else
-#define AI_ADDRCONFIG 0x0020
-#endif
-#endif
-
-#ifndef AI_NUMERICSERV
-/*
- * logic copied from AI_NUMERICHOST
- */
-#if defined(HAVE_STRUCT_ADDRINFO) && defined(HAVE_GETADDRINFO)
-#define AI_NUMERICSERV 0
-#else
-#define AI_NUMERICSERV 0x0400
-#endif
-#endif
-
-#ifndef NI_NUMERICHOST
-#define NI_NUMERICHOST 1
-#endif
-
-#ifndef NI_NUMERICSERV
-#define NI_NUMERICSERV 2
-#endif
-
-#ifndef NI_NOFQDN
-#define NI_NOFQDN 4
-#endif
-
-#ifndef NI_NAMEREQD
-#define NI_NAMEREQD 8
-#endif
-
-#ifndef NI_DGRAM
-#define NI_DGRAM 16
-#endif
-
-
-#ifndef NI_MAXHOST
-#define NI_MAXHOST 1025
-#endif
-
-#ifndef NI_MAXSERV
-#define NI_MAXSERV 32
-#endif
-
-/*
- * glibc on linux doesn't seem to have MSG_WAITALL
- * defined. I think the kernel has it though..
- */
-#ifndef MSG_WAITALL
-#define MSG_WAITALL 0
-#endif
-
-#ifndef INADDR_LOOPBACK
-#define INADDR_LOOPBACK 0x7f000001
-#endif
-
-#ifndef INADDR_NONE
-#define INADDR_NONE 0xffffffff
-#endif
-
-#ifndef EAFNOSUPPORT
-#define EAFNOSUPPORT EINVAL
-#endif
-
-#ifndef INET_ADDRSTRLEN
-#define INET_ADDRSTRLEN 16
-#endif
-
-#ifndef INET6_ADDRSTRLEN
-#define INET6_ADDRSTRLEN 46
-#endif
-
-#ifndef HOST_NAME_MAX
-#define HOST_NAME_MAX 255
-#endif
-
-#ifndef MAXHOSTNAMELEN
-#define MAXHOSTNAMELEN HOST_NAME_MAX
-#endif
-
-#ifndef HAVE_SA_FAMILY_T
-#define HAVE_SA_FAMILY_T
-typedef unsigned short int sa_family_t;
-#endif
-
-#ifndef HAVE_STRUCT_SOCKADDR_STORAGE
-#define HAVE_STRUCT_SOCKADDR_STORAGE
-#ifdef HAVE_STRUCT_SOCKADDR_IN6
-#define sockaddr_storage sockaddr_in6
-#define ss_family sin6_family
-#define HAVE_SS_FAMILY 1
-#else
-#define sockaddr_storage sockaddr_in
-#define ss_family sin_family
-#define HAVE_SS_FAMILY 1
-#endif
-#endif
-
-#ifndef HAVE_SS_FAMILY
-#ifdef HAVE___SS_FAMILY
-#define ss_family __ss_family
-#define HAVE_SS_FAMILY 1
-#endif
-#endif
-
-#ifndef IOV_MAX
-# ifdef UIO_MAXIOV
-# define IOV_MAX UIO_MAXIOV
-# else
-# ifdef __sgi
- /*
- * IRIX 6.5 has sysconf(_SC_IOV_MAX)
- * which might return 512 or bigger
- */
-# define IOV_MAX 512
-# else
-# error IOV_MAX and UIO_MAXIOV undefined
-# endif
-# endif
-#endif
-
-#ifndef HAVE_STRUCT_ADDRINFO
-#define HAVE_STRUCT_ADDRINFO
-struct addrinfo {
- int ai_flags;
- int ai_family;
- int ai_socktype;
- int ai_protocol;
- socklen_t ai_addrlen;
- struct sockaddr *ai_addr;
- char *ai_canonname;
- struct addrinfo *ai_next;
-};
-#endif /* HAVE_STRUCT_ADDRINFO */
-
-#if !defined(HAVE_GETADDRINFO)
-#include "getaddrinfo.h"
-#endif
-
-/* Needed for some systems that don't define it (Solaris). */
-#ifndef ifr_netmask
-#define ifr_netmask ifr_addr
-#endif
-
-#ifdef SOCKET_WRAPPER
-#ifndef SOCKET_WRAPPER_DISABLE
-#ifndef SOCKET_WRAPPER_NOT_REPLACE
-#define SOCKET_WRAPPER_REPLACE
-#endif /* SOCKET_WRAPPER_NOT_REPLACE */
-#include "../socket_wrapper/socket_wrapper.h"
-#endif /* SOCKET_WRAPPER_DISABLE */
-#endif /* SOCKET_WRAPPER */
-
-#endif
diff --git a/chromium/third_party/talloc/libreplace/system/passwd.h b/chromium/third_party/talloc/libreplace/system/passwd.h
deleted file mode 100644
index b41608c551b..00000000000
--- a/chromium/third_party/talloc/libreplace/system/passwd.h
+++ /dev/null
@@ -1,110 +0,0 @@
-#ifndef _system_passwd_h
-#define _system_passwd_h
-
-/*
- Unix SMB/CIFS implementation.
-
- passwd system include wrappers
-
- Copyright (C) Andrew Tridgell 2004
-
- ** NOTE! The following LGPL license applies to the replace
- ** library. This does NOT imply that all of Samba is released
- ** under the LGPL
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-/* this needs to be included before nss_wrapper.h on some systems */
-#include <unistd.h>
-
-#ifdef HAVE_PWD_H
-#include <pwd.h>
-#endif
-#ifdef HAVE_GRP_H
-#include <grp.h>
-#endif
-#ifdef HAVE_SYS_PRIV_H
-#include <sys/priv.h>
-#endif
-#ifdef HAVE_SYS_ID_H
-#include <sys/id.h>
-#endif
-
-#ifdef HAVE_CRYPT_H
-#include <crypt.h>
-#endif
-
-#ifdef HAVE_SHADOW_H
-#include <shadow.h>
-#endif
-
-#ifdef HAVE_SYS_SECURITY_H
-#include <sys/security.h>
-#include <prot.h>
-#define PASSWORD_LENGTH 16
-#endif /* HAVE_SYS_SECURITY_H */
-
-#ifdef HAVE_GETPWANAM
-#include <sys/label.h>
-#include <sys/audit.h>
-#include <pwdadj.h>
-#endif
-
-#ifdef HAVE_COMPAT_H
-#include <compat.h>
-#endif
-
-#ifdef REPLACE_GETPASS
-#if defined(REPLACE_GETPASS_BY_GETPASSPHRASE)
-#define getpass(prompt) getpassphrase(prompt)
-#else
-#define getpass(prompt) rep_getpass(prompt)
-char *rep_getpass(const char *prompt);
-#endif
-#endif
-
-#ifndef NGROUPS_MAX
-#define NGROUPS_MAX 32 /* Guess... */
-#endif
-
-/* what is the longest significant password available on your system?
- Knowing this speeds up password searches a lot */
-#ifndef PASSWORD_LENGTH
-#define PASSWORD_LENGTH 8
-#endif
-
-#if defined(HAVE_PUTPRPWNAM) && defined(AUTH_CLEARTEXT_SEG_CHARS)
-#define OSF1_ENH_SEC 1
-#endif
-
-#ifndef ALLOW_CHANGE_PASSWORD
-#if (defined(HAVE_TERMIOS_H) && defined(HAVE_DUP2) && defined(HAVE_SETSID))
-#define ALLOW_CHANGE_PASSWORD 1
-#endif
-#endif
-
-#if defined(HAVE_CRYPT16) && defined(HAVE_GETAUTHUID)
-#define ULTRIX_AUTH 1
-#endif
-
-#ifdef NSS_WRAPPER
-#ifndef NSS_WRAPPER_NOT_REPLACE
-#define NSS_WRAPPER_REPLACE
-#endif
-#include "../nss_wrapper/nss_wrapper.h"
-#endif
-
-#endif
diff --git a/chromium/third_party/talloc/libreplace/system/readline.h b/chromium/third_party/talloc/libreplace/system/readline.h
deleted file mode 100644
index ba34dc6a612..00000000000
--- a/chromium/third_party/talloc/libreplace/system/readline.h
+++ /dev/null
@@ -1,52 +0,0 @@
-#ifndef _system_readline_h
-#define _system_readline_h
-/*
- Unix SMB/CIFS implementation.
-
- Readline wrappers
-
- ** NOTE! The following LGPL license applies to the replace
- ** library. This does NOT imply that all of Samba is released
- ** under the LGPL
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_LIBREADLINE
-# ifdef HAVE_READLINE_READLINE_H
-# include <readline/readline.h>
-# ifdef HAVE_READLINE_HISTORY_H
-# include <readline/history.h>
-# endif
-# else
-# ifdef HAVE_READLINE_H
-# include <readline.h>
-# ifdef HAVE_HISTORY_H
-# include <history.h>
-# endif
-# else
-# undef HAVE_LIBREADLINE
-# endif
-# endif
-#endif
-
-#ifdef HAVE_NEW_LIBREADLINE
-# define RL_COMPLETION_CAST (rl_completion_func_t *)
-#else
-/* This type is missing from libreadline<4.0 (approximately) */
-# define RL_COMPLETION_CAST
-#endif /* HAVE_NEW_LIBREADLINE */
-
-#endif
diff --git a/chromium/third_party/talloc/libreplace/system/select.h b/chromium/third_party/talloc/libreplace/system/select.h
deleted file mode 100644
index da18de0cfc7..00000000000
--- a/chromium/third_party/talloc/libreplace/system/select.h
+++ /dev/null
@@ -1,41 +0,0 @@
-#ifndef _system_select_h
-#define _system_select_h
-/*
- Unix SMB/CIFS implementation.
-
- select system include wrappers
-
- Copyright (C) Andrew Tridgell 2004
-
- ** NOTE! The following LGPL license applies to the replace
- ** library. This does NOT imply that all of Samba is released
- ** under the LGPL
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
-
-#ifdef HAVE_SYS_EPOLL_H
-#include <sys/epoll.h>
-#endif
-
-#ifndef SELECT_CAST
-#define SELECT_CAST
-#endif
-
-#endif
diff --git a/chromium/third_party/talloc/libreplace/system/shmem.h b/chromium/third_party/talloc/libreplace/system/shmem.h
deleted file mode 100644
index 64fe39b6cb2..00000000000
--- a/chromium/third_party/talloc/libreplace/system/shmem.h
+++ /dev/null
@@ -1,59 +0,0 @@
-#ifndef _system_shmem_h
-#define _system_shmem_h
-/*
- Unix SMB/CIFS implementation.
-
- shared memory system include wrappers
-
- Copyright (C) Andrew Tridgell 2004
-
- ** NOTE! The following LGPL license applies to the replace
- ** library. This does NOT imply that all of Samba is released
- ** under the LGPL
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#if defined(HAVE_SYS_IPC_H)
-#include <sys/ipc.h>
-#endif /* HAVE_SYS_IPC_H */
-
-#if defined(HAVE_SYS_SHM_H)
-#include <sys/shm.h>
-#endif /* HAVE_SYS_SHM_H */
-
-#ifdef HAVE_SYS_MMAN_H
-#include <sys/mman.h>
-#endif
-
-/* NetBSD doesn't have these */
-#ifndef SHM_R
-#define SHM_R 0400
-#endif
-
-#ifndef SHM_W
-#define SHM_W 0200
-#endif
-
-
-#ifndef MAP_FILE
-#define MAP_FILE 0
-#endif
-
-#ifndef MAP_FAILED
-#define MAP_FAILED ((void *)-1)
-#endif
-
-#endif
diff --git a/chromium/third_party/talloc/libreplace/system/syslog.h b/chromium/third_party/talloc/libreplace/system/syslog.h
deleted file mode 100644
index 104be1df848..00000000000
--- a/chromium/third_party/talloc/libreplace/system/syslog.h
+++ /dev/null
@@ -1,70 +0,0 @@
-#ifndef _system_syslog_h
-#define _system_syslog_h
-/*
- Unix SMB/CIFS implementation.
-
- syslog system include wrappers
-
- Copyright (C) Andrew Tridgell 2004
-
- ** NOTE! The following LGPL license applies to the replace
- ** library. This does NOT imply that all of Samba is released
- ** under the LGPL
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_SYSLOG_H
-#include <syslog.h>
-#else
-#ifdef HAVE_SYS_SYSLOG_H
-#include <sys/syslog.h>
-#endif
-#endif
-
-/* For sys_adminlog(). */
-#ifndef LOG_EMERG
-#define LOG_EMERG 0 /* system is unusable */
-#endif
-
-#ifndef LOG_ALERT
-#define LOG_ALERT 1 /* action must be taken immediately */
-#endif
-
-#ifndef LOG_CRIT
-#define LOG_CRIT 2 /* critical conditions */
-#endif
-
-#ifndef LOG_ERR
-#define LOG_ERR 3 /* error conditions */
-#endif
-
-#ifndef LOG_WARNING
-#define LOG_WARNING 4 /* warning conditions */
-#endif
-
-#ifndef LOG_NOTICE
-#define LOG_NOTICE 5 /* normal but significant condition */
-#endif
-
-#ifndef LOG_INFO
-#define LOG_INFO 6 /* informational */
-#endif
-
-#ifndef LOG_DEBUG
-#define LOG_DEBUG 7 /* debug-level messages */
-#endif
-
-#endif
diff --git a/chromium/third_party/talloc/libreplace/system/terminal.h b/chromium/third_party/talloc/libreplace/system/terminal.h
deleted file mode 100644
index 9ad601ace08..00000000000
--- a/chromium/third_party/talloc/libreplace/system/terminal.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifndef _system_terminal_h
-#define _system_terminal_h
-/*
- Unix SMB/CIFS implementation.
-
- terminal system include wrappers
-
- Copyright (C) Andrew Tridgell 2004
-
- ** NOTE! The following LGPL license applies to the replace
- ** library. This does NOT imply that all of Samba is released
- ** under the LGPL
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef SUNOS4
-/* on SUNOS4 termios.h conflicts with sys/ioctl.h */
-#undef HAVE_TERMIOS_H
-#endif
-
-
-#if defined(HAVE_TERMIOS_H)
-/* POSIX terminal handling. */
-#include <termios.h>
-#elif defined(HAVE_TERMIO_H)
-/* Older SYSV terminal handling - don't use if we can avoid it. */
-#include <termio.h>
-#elif defined(HAVE_SYS_TERMIO_H)
-/* Older SYSV terminal handling - don't use if we can avoid it. */
-#include <sys/termio.h>
-#endif
-
-#endif
diff --git a/chromium/third_party/talloc/libreplace/system/time.h b/chromium/third_party/talloc/libreplace/system/time.h
deleted file mode 100644
index 4abf295d1af..00000000000
--- a/chromium/third_party/talloc/libreplace/system/time.h
+++ /dev/null
@@ -1,69 +0,0 @@
-#ifndef _system_time_h
-#define _system_time_h
-/*
- Unix SMB/CIFS implementation.
-
- time system include wrappers
-
- Copyright (C) Andrew Tridgell 2004
-
- ** NOTE! The following LGPL license applies to the replace
- ** library. This does NOT imply that all of Samba is released
- ** under the LGPL
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef TIME_WITH_SYS_TIME
-#include <sys/time.h>
-#include <time.h>
-#else
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#else
-#include <time.h>
-#endif
-#endif
-
-#ifdef HAVE_UTIME_H
-#include <utime.h>
-#else
-struct utimbuf {
- time_t actime; /* access time */
- time_t modtime; /* modification time */
-};
-#endif
-
-#ifndef HAVE_MKTIME
-/* define is in "replace.h" */
-time_t rep_mktime(struct tm *t);
-#endif
-
-#ifndef HAVE_TIMEGM
-/* define is in "replace.h" */
-time_t rep_timegm(struct tm *tm);
-#endif
-
-#ifndef HAVE_UTIME
-/* define is in "replace.h" */
-int rep_utime(const char *filename, const struct utimbuf *buf);
-#endif
-
-#ifndef HAVE_UTIMES
-/* define is in "replace.h" */
-int rep_utimes(const char *filename, const struct timeval tv[2]);
-#endif
-
-#endif
diff --git a/chromium/third_party/talloc/libreplace/system/wait.h b/chromium/third_party/talloc/libreplace/system/wait.h
deleted file mode 100644
index 79583ad2abc..00000000000
--- a/chromium/third_party/talloc/libreplace/system/wait.h
+++ /dev/null
@@ -1,59 +0,0 @@
-#ifndef _system_wait_h
-#define _system_wait_h
-/*
- Unix SMB/CIFS implementation.
-
- waitpid system include wrappers
-
- Copyright (C) Andrew Tridgell 2004
-
- ** NOTE! The following LGPL license applies to the replace
- ** library. This does NOT imply that all of Samba is released
- ** under the LGPL
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_SYS_WAIT_H
-#include <sys/wait.h>
-#endif
-
-#include <signal.h>
-
-#ifndef SIGCLD
-#define SIGCLD SIGCHLD
-#endif
-
-#ifndef SIGNAL_CAST
-#define SIGNAL_CAST (RETSIGTYPE (*)(int))
-#endif
-
-#ifdef HAVE_SETJMP_H
-#include <setjmp.h>
-#endif
-
-#ifndef SA_RESETHAND
-#define SA_RESETHAND SA_ONESHOT
-#endif
-
-#if !defined(HAVE_SIG_ATOMIC_T_TYPE)
-typedef int sig_atomic_t;
-#endif
-
-#if !defined(HAVE_WAITPID) && defined(HAVE_WAIT4)
-int rep_waitpid(pid_t pid,int *status,int options)
-#endif
-
-#endif
diff --git a/chromium/third_party/talloc/libreplace/timegm.c b/chromium/third_party/talloc/libreplace/timegm.c
deleted file mode 100644
index 93263a2d182..00000000000
--- a/chromium/third_party/talloc/libreplace/timegm.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 1997 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the Institute nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- adapted for Samba4 by Andrew Tridgell
-*/
-
-#include "replace.h"
-#include "system/time.h"
-
-static int is_leap(unsigned y)
-{
- y += 1900;
- return (y % 4) == 0 && ((y % 100) != 0 || (y % 400) == 0);
-}
-
-time_t rep_timegm(struct tm *tm)
-{
- static const unsigned ndays[2][12] ={
- {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
- {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}};
- time_t res = 0;
- unsigned i;
-
- if (tm->tm_mon > 12 ||
- tm->tm_mon < 0 ||
- tm->tm_mday > 31 ||
- tm->tm_min > 60 ||
- tm->tm_sec > 60 ||
- tm->tm_hour > 24) {
- /* invalid tm structure */
- return 0;
- }
-
- for (i = 70; i < tm->tm_year; ++i)
- res += is_leap(i) ? 366 : 365;
-
- for (i = 0; i < tm->tm_mon; ++i)
- res += ndays[is_leap(tm->tm_year)][i];
- res += tm->tm_mday - 1;
- res *= 24;
- res += tm->tm_hour;
- res *= 60;
- res += tm->tm_min;
- res *= 60;
- res += tm->tm_sec;
- return res;
-}
diff --git a/chromium/third_party/talloc/libreplace/timegm.m4 b/chromium/third_party/talloc/libreplace/timegm.m4
deleted file mode 100644
index 9b76d0c7278..00000000000
--- a/chromium/third_party/talloc/libreplace/timegm.m4
+++ /dev/null
@@ -1 +0,0 @@
-AC_CHECK_FUNCS(timegm,[],[LIBREPLACEOBJ="${LIBREPLACEOBJ} $libreplacedir/timegm.o"])
diff --git a/chromium/third_party/talloc/libreplace/win32.m4 b/chromium/third_party/talloc/libreplace/win32.m4
deleted file mode 100644
index eb364e2cb9f..00000000000
--- a/chromium/third_party/talloc/libreplace/win32.m4
+++ /dev/null
@@ -1,20 +0,0 @@
-AC_CHECK_HEADERS(direct.h windows.h winsock2.h ws2tcpip.h)
-
-#######################################
-# Check for mkdir mode
-AC_CACHE_CHECK( [whether mkdir supports mode], libreplace_cv_mkdir_has_mode,
- AC_TRY_COMPILE([
- #include <stdio.h>
- #ifdef HAVE_DIRECT_H
- #include <direct.h>
- #endif],[
- mkdir("foo",0777);
- return 0;
- ],
- libreplace_cv_mkdir_has_mode="yes",
- libreplace_cv_mkdir_has_mode="no") )
-
-if test "$libreplace_cv_mkdir_has_mode" = "yes"
-then
- AC_DEFINE(HAVE_MKDIR_MODE, 1, [Define if target mkdir supports mode option])
-fi
diff --git a/chromium/third_party/talloc/libreplace/win32_replace.h b/chromium/third_party/talloc/libreplace/win32_replace.h
deleted file mode 100644
index 9901e72f6ef..00000000000
--- a/chromium/third_party/talloc/libreplace/win32_replace.h
+++ /dev/null
@@ -1,159 +0,0 @@
-#ifndef _WIN32_REPLACE_H
-#define _WIN32_REPLACE_H
-
-#ifdef HAVE_WINSOCK2_H
-#include <winsock2.h>
-#endif
-
-#ifdef HAVE_WS2TCPIP_H
-#include <ws2tcpip.h>
-#endif
-
-#ifdef HAVE_WINDOWS_H
-#include <windows.h>
-#endif
-
-/* Map BSD Socket errorcodes to the WSA errorcodes (if possible) */
-
-#define EAFNOSUPPORT WSAEAFNOSUPPORT
-#define ECONNREFUSED WSAECONNREFUSED
-#define EINPROGRESS WSAEINPROGRESS
-#define EMSGSIZE WSAEMSGSIZE
-#define ENOBUFS WSAENOBUFS
-#define ENOTSOCK WSAENOTSOCK
-#define ENETUNREACH WSAENETUNREACH
-#define ENOPROTOOPT WSAENOPROTOOPT
-#define ENOTCONN WSAENOTCONN
-#define ENOTSUP 134
-
-/* We undefine the following constants due to conflicts with the w32api headers
- * and the Windows Platform SDK/DDK.
- */
-
-#undef interface
-
-#undef ERROR_INVALID_PARAMETER
-#undef ERROR_INSUFFICIENT_BUFFER
-#undef ERROR_INVALID_DATATYPE
-
-#undef FILE_GENERIC_READ
-#undef FILE_GENERIC_WRITE
-#undef FILE_GENERIC_EXECUTE
-#undef FILE_ATTRIBUTE_READONLY
-#undef FILE_ATTRIBUTE_HIDDEN
-#undef FILE_ATTRIBUTE_SYSTEM
-#undef FILE_ATTRIBUTE_DIRECTORY
-#undef FILE_ATTRIBUTE_ARCHIVE
-#undef FILE_ATTRIBUTE_DEVICE
-#undef FILE_ATTRIBUTE_NORMAL
-#undef FILE_ATTRIBUTE_TEMPORARY
-#undef FILE_ATTRIBUTE_REPARSE_POINT
-#undef FILE_ATTRIBUTE_COMPRESSED
-#undef FILE_ATTRIBUTE_OFFLINE
-#undef FILE_ATTRIBUTE_ENCRYPTED
-#undef FILE_FLAG_WRITE_THROUGH
-#undef FILE_FLAG_NO_BUFFERING
-#undef FILE_FLAG_RANDOM_ACCESS
-#undef FILE_FLAG_SEQUENTIAL_SCAN
-#undef FILE_FLAG_DELETE_ON_CLOSE
-#undef FILE_FLAG_BACKUP_SEMANTICS
-#undef FILE_FLAG_POSIX_SEMANTICS
-#undef FILE_TYPE_DISK
-#undef FILE_TYPE_UNKNOWN
-#undef FILE_CASE_SENSITIVE_SEARCH
-#undef FILE_CASE_PRESERVED_NAMES
-#undef FILE_UNICODE_ON_DISK
-#undef FILE_PERSISTENT_ACLS
-#undef FILE_FILE_COMPRESSION
-#undef FILE_VOLUME_QUOTAS
-#undef FILE_VOLUME_IS_COMPRESSED
-#undef FILE_NOTIFY_CHANGE_FILE_NAME
-#undef FILE_NOTIFY_CHANGE_DIR_NAME
-#undef FILE_NOTIFY_CHANGE_ATTRIBUTES
-#undef FILE_NOTIFY_CHANGE_SIZE
-#undef FILE_NOTIFY_CHANGE_LAST_WRITE
-#undef FILE_NOTIFY_CHANGE_LAST_ACCESS
-#undef FILE_NOTIFY_CHANGE_CREATION
-#undef FILE_NOTIFY_CHANGE_EA
-#undef FILE_NOTIFY_CHANGE_SECURITY
-#undef FILE_NOTIFY_CHANGE_STREAM_NAME
-#undef FILE_NOTIFY_CHANGE_STREAM_SIZE
-#undef FILE_NOTIFY_CHANGE_STREAM_WRITE
-#undef FILE_NOTIFY_CHANGE_NAME
-
-#undef PRINTER_ATTRIBUTE_QUEUED
-#undef PRINTER_ATTRIBUTE_DIRECT
-#undef PRINTER_ATTRIBUTE_DEFAULT
-#undef PRINTER_ATTRIBUTE_SHARED
-#undef PRINTER_ATTRIBUTE_NETWORK
-#undef PRINTER_ATTRIBUTE_HIDDEN
-#undef PRINTER_ATTRIBUTE_LOCAL
-#undef PRINTER_ATTRIBUTE_ENABLE_DEVQ
-#undef PRINTER_ATTRIBUTE_KEEPPRINTEDJOBS
-#undef PRINTER_ATTRIBUTE_DO_COMPLETE_FIRST
-#undef PRINTER_ATTRIBUTE_WORK_OFFLINE
-#undef PRINTER_ATTRIBUTE_ENABLE_BIDI
-#undef PRINTER_ATTRIBUTE_RAW_ONLY
-#undef PRINTER_ATTRIBUTE_PUBLISHED
-#undef PRINTER_ENUM_DEFAULT
-#undef PRINTER_ENUM_LOCAL
-#undef PRINTER_ENUM_CONNECTIONS
-#undef PRINTER_ENUM_FAVORITE
-#undef PRINTER_ENUM_NAME
-#undef PRINTER_ENUM_REMOTE
-#undef PRINTER_ENUM_SHARED
-#undef PRINTER_ENUM_NETWORK
-#undef PRINTER_ENUM_EXPAND
-#undef PRINTER_ENUM_CONTAINER
-#undef PRINTER_ENUM_ICON1
-#undef PRINTER_ENUM_ICON2
-#undef PRINTER_ENUM_ICON3
-#undef PRINTER_ENUM_ICON4
-#undef PRINTER_ENUM_ICON5
-#undef PRINTER_ENUM_ICON6
-#undef PRINTER_ENUM_ICON7
-#undef PRINTER_ENUM_ICON8
-#undef PRINTER_STATUS_PAUSED
-#undef PRINTER_STATUS_ERROR
-#undef PRINTER_STATUS_PENDING_DELETION
-#undef PRINTER_STATUS_PAPER_JAM
-#undef PRINTER_STATUS_PAPER_OUT
-#undef PRINTER_STATUS_MANUAL_FEED
-#undef PRINTER_STATUS_PAPER_PROBLEM
-#undef PRINTER_STATUS_OFFLINE
-#undef PRINTER_STATUS_IO_ACTIVE
-#undef PRINTER_STATUS_BUSY
-#undef PRINTER_STATUS_PRINTING
-#undef PRINTER_STATUS_OUTPUT_BIN_FULL
-#undef PRINTER_STATUS_NOT_AVAILABLE
-#undef PRINTER_STATUS_WAITING
-#undef PRINTER_STATUS_PROCESSING
-#undef PRINTER_STATUS_INITIALIZING
-#undef PRINTER_STATUS_WARMING_UP
-#undef PRINTER_STATUS_TONER_LOW
-#undef PRINTER_STATUS_NO_TONER
-#undef PRINTER_STATUS_PAGE_PUNT
-#undef PRINTER_STATUS_USER_INTERVENTION
-#undef PRINTER_STATUS_OUT_OF_MEMORY
-#undef PRINTER_STATUS_DOOR_OPEN
-#undef PRINTER_STATUS_SERVER_UNKNOWN
-#undef PRINTER_STATUS_POWER_SAVE
-
-#undef DWORD
-#undef HKEY_CLASSES_ROOT
-#undef HKEY_CURRENT_USER
-#undef HKEY_LOCAL_MACHINE
-#undef HKEY_USERS
-#undef HKEY_PERFORMANCE_DATA
-#undef HKEY_CURRENT_CONFIG
-#undef HKEY_DYN_DATA
-#undef REG_DWORD
-#undef REG_QWORD
-
-#undef SERVICE_STATE_ALL
-
-#undef SE_GROUP_MANDATORY
-#undef SE_GROUP_ENABLED_BY_DEFAULT
-#undef SE_GROUP_ENABLED
-
-#endif /* _WIN32_REPLACE_H */
diff --git a/chromium/third_party/talloc/libtalloc.m4 b/chromium/third_party/talloc/libtalloc.m4
deleted file mode 100644
index 4b22c8e41a9..00000000000
--- a/chromium/third_party/talloc/libtalloc.m4
+++ /dev/null
@@ -1,38 +0,0 @@
-dnl find the talloc sources. This is meant to work both for
-dnl talloc standalone builds, and builds of packages using talloc
-tallocdir=""
-tallocpaths=". lib/talloc talloc ../talloc ../lib/talloc"
-for d in $tallocpaths; do
- if test -f "$srcdir/$d/talloc.c"; then
- tallocdir="$d"
- AC_SUBST(tallocdir)
- break;
- fi
-done
-if test x"$tallocdir" = "x"; then
- AC_MSG_ERROR([cannot find talloc source in $tallocpaths])
-fi
-TALLOC_OBJ="talloc.o"
-AC_SUBST(TALLOC_OBJ)
-
-TALLOC_CFLAGS="-I$srcdir/$tallocdir"
-AC_SUBST(TALLOC_CFLAGS)
-
-TALLOC_LIBS=""
-AC_SUBST(TALLOC_LIBS)
-
-AC_CHECK_SIZEOF(size_t,cross)
-AC_CHECK_SIZEOF(void *,cross)
-
-if test $ac_cv_sizeof_size_t -lt $ac_cv_sizeof_void_p; then
- AC_WARN([size_t cannot represent the amount of used memory of a process])
- AC_WARN([please report this to <samba-technical@samba.org>])
- AC_WARN([sizeof(size_t) = $ac_cv_sizeof_size_t])
- AC_WARN([sizeof(void *) = $ac_cv_sizeof_void_p])
- AC_ERROR([sizeof(size_t) < sizeof(void *)])
-fi
-
-if test x"$VERSIONSCRIPT" != "x"; then
- EXPORTSFILE=talloc.exports
- AC_SUBST(EXPORTSFILE)
-fi
diff --git a/chromium/third_party/talloc/pytalloc.c b/chromium/third_party/talloc/pytalloc.c
deleted file mode 100644
index c6decf33f16..00000000000
--- a/chromium/third_party/talloc/pytalloc.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- Python/Talloc glue
- Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2008
-
- 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 <http://www.gnu.org/licenses/>.
-*/
-
-#include "replace.h"
-#include <talloc.h>
-#include <pytalloc.h>
-
-/**
- * Simple dealloc for talloc-wrapping PyObjects
- */
-void py_talloc_dealloc(PyObject* self)
-{
- py_talloc_Object *obj = (py_talloc_Object *)self;
- talloc_free(obj->talloc_ctx);
- obj->talloc_ctx = NULL;
- self->ob_type->tp_free(self);
-}
-
-/**
- * Import an existing talloc pointer into a Python object.
- */
-PyObject *py_talloc_steal_ex(PyTypeObject *py_type, TALLOC_CTX *mem_ctx,
- void *ptr)
-{
- py_talloc_Object *ret = (py_talloc_Object *)py_type->tp_alloc(py_type, 0);
- ret->talloc_ctx = talloc_new(NULL);
- if (ret->talloc_ctx == NULL) {
- return NULL;
- }
- if (talloc_steal(ret->talloc_ctx, mem_ctx) == NULL) {
- return NULL;
- }
- ret->ptr = ptr;
- return (PyObject *)ret;
-}
-
-
-/**
- * Import an existing talloc pointer into a Python object, leaving the
- * original parent, and creating a reference to the object in the python
- * object
- */
-PyObject *py_talloc_reference_ex(PyTypeObject *py_type, TALLOC_CTX *mem_ctx, void *ptr)
-{
- py_talloc_Object *ret = (py_talloc_Object *)py_type->tp_alloc(py_type, 0);
- ret->talloc_ctx = talloc_new(NULL);
- if (ret->talloc_ctx == NULL) {
- return NULL;
- }
- if (talloc_reference(ret->talloc_ctx, mem_ctx) == NULL) {
- return NULL;
- }
- ret->ptr = ptr;
- return (PyObject *)ret;
-}
-
-/**
- * Default (but slightly more useful than the default) implementation of Repr().
- */
-PyObject *py_talloc_default_repr(PyObject *obj)
-{
- py_talloc_Object *talloc_obj = (py_talloc_Object *)obj;
- PyTypeObject *type = (PyTypeObject*)PyObject_Type(obj);
-
- return PyString_FromFormat("<%s talloc object at 0x%p>",
- type->tp_name, talloc_obj->ptr);
-}
-
-static void py_cobject_talloc_free(void *ptr)
-{
- talloc_free(ptr);
-}
-
-PyObject *PyCObject_FromTallocPtr(void *ptr)
-{
- return PyCObject_FromVoidPtr(ptr, py_cobject_talloc_free);
-}
diff --git a/chromium/third_party/talloc/pytalloc.h b/chromium/third_party/talloc/pytalloc.h
deleted file mode 100644
index 9b6587261c2..00000000000
--- a/chromium/third_party/talloc/pytalloc.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- Samba utility functions
- Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2008
-
- 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 <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _PY_TALLOC_H_
-#define _PY_TALLOC_H_
-
-#include <Python.h>
-#include <talloc.h>
-
-typedef struct {
- PyObject_HEAD
- TALLOC_CTX *talloc_ctx;
- void *ptr;
-} py_talloc_Object;
-
-/* Deallocate a py_talloc_Object */
-void py_talloc_dealloc(PyObject* self);
-
-/* Retrieve the pointer for a py_talloc_object. Like talloc_get_type()
- * but for py_talloc_Objects. */
-
-/* FIXME: Call PyErr_SetString(PyExc_TypeError, "expected " __STR(type) ")
- * when talloc_get_type() returns NULL. */
-#define py_talloc_get_type(py_obj, type) (talloc_get_type(py_talloc_get_ptr(py_obj), type))
-
-#define py_talloc_get_ptr(py_obj) (((py_talloc_Object *)py_obj)->ptr)
-#define py_talloc_get_mem_ctx(py_obj) ((py_talloc_Object *)py_obj)->talloc_ctx
-
-PyObject *py_talloc_steal_ex(PyTypeObject *py_type, TALLOC_CTX *mem_ctx, void *ptr);
-PyObject *py_talloc_reference_ex(PyTypeObject *py_type, TALLOC_CTX *mem_ctx, void *ptr);
-#define py_talloc_steal(py_type, talloc_ptr) py_talloc_steal_ex(py_type, talloc_ptr, talloc_ptr)
-#define py_talloc_reference(py_type, talloc_ptr) py_talloc_reference_ex(py_type, talloc_ptr, talloc_ptr)
-
-/* Sane default implementation of reprfunc. */
-PyObject *py_talloc_default_repr(PyObject *py_obj);
-
-#define py_talloc_new(type, typeobj) py_talloc_steal(typeobj, talloc_zero(NULL, type))
-
-PyObject *PyCObject_FromTallocPtr(void *);
-
-#endif /* _PY_TALLOC_H_ */
diff --git a/chromium/third_party/talloc/script/abi_checks.sh b/chromium/third_party/talloc/script/abi_checks.sh
deleted file mode 100755
index 66c4e60e45c..00000000000
--- a/chromium/third_party/talloc/script/abi_checks.sh
+++ /dev/null
@@ -1,80 +0,0 @@
-#!/bin/sh
-
-#
-# abi_checks.sh - check for possible abi changes
-#
-# Copyright (C) 2009 Michael Adam <obnox@samba.org>
-#
-# 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 <http://www.gnu.org/licenses/>.
-#
-
-#
-# USAGE: abi_checks.sh LIBNAME header1 [header2 ...]
-#
-# This script creates symbol and signature lists from the provided header
-# files with the aid of the mksyms.sh and mksigs.pl scripts (saved as
-# $LIBNAME.exports.check and $LIBNAME.sigatures.check). It then compares
-# the resulting files with the files $LIBNAME.exports and $LIBNME.signatures
-# which it expects to find in the current directory.
-#
-
-LANG=C; export LANG
-LC_ALL=C; export LC_ALL
-LC_COLLATE=C; export LC_COLLATE
-
-exit_status=0
-script=$0
-dir_name=$(dirname ${script})
-
-if test x"$1" = "x" ; then
- echo "USAGE: ${script} libname header [header ...]"
- exit 1
-fi
-
-libname="$1"
-shift
-
-if test x"$1" = "x" ; then
- echo "USAGE: ${script} libname header [header ...]"
- exit 1
-fi
-
-headers="$*"
-
-exports_file=${libname}.exports
-exports_file_check=${exports_file}.check
-signatures_file=${libname}.signatures
-signatures_file_check=${signatures_file}.check
-
-
-${dir_name}/mksyms.sh awk ${exports_file_check} ${headers} 2>&1 > /dev/null
-cat ${headers} | ${dir_name}/mksigs.pl | sort| uniq > ${signatures_file_check} 2> /dev/null
-
-diff -u ${exports_file} ${exports_file_check}
-if test "x$?" != "x0" ; then
- echo "WARNING: possible ABI change detected in exports!"
- let exit_status++
-else
- echo "exports check: OK"
-fi
-
-diff -u ${signatures_file} ${signatures_file_check}
-if test "x$?" != "x0" ; then
- echo "WARNING: possible ABI change detected in signatures!"
- let exit_status++
-else
- echo "signatures check: OK"
-fi
-
-exit $exit_status
diff --git a/chromium/third_party/talloc/script/abi_checks_gcc.sh b/chromium/third_party/talloc/script/abi_checks_gcc.sh
deleted file mode 100755
index e3d3b042faa..00000000000
--- a/chromium/third_party/talloc/script/abi_checks_gcc.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/bash
-
-make clean
-
-mkdir abi
-ABI_CHECKS="-aux-info abi/\$@.X"
-make ABI_CHECK="$ABI_CHECKS" CC="/usr/bin/gcc"
-
-for i in abi/*.X; do cat $i | grep 'talloc\.h'; done | sort | uniq | awk -F "extern " '{ print $2 }' | sort > abi/signatures
-
-cat > abi/exports << EOF
-{
- global:
-EOF
-cat abi/signatures | awk -F '(' '{ print $1 }' | awk -F ' ' '{ print " "$NF";" }' | tr -d '*' | sort >> abi/exports
-# need to manually add talloc free for backward ABI compat
-echo ' talloc_free;' >> abi/exports
-cat >> abi/exports << EOF
-
- local: *;
-};
-EOF
-
-rm -fr abi/*.X
-
-diff -u talloc.signatures abi/signatures
-if [ "$?" != "0" ]; then
- echo "WARNING: Possible ABI Change!!"
-fi
-
-diff -u talloc.exports abi/exports
-if [ "$?" != "0" ]; then
- echo "WARNING: Export file may be outdated!!"
-fi
diff --git a/chromium/third_party/talloc/script/mksigs.pl b/chromium/third_party/talloc/script/mksigs.pl
deleted file mode 100755
index 755cd796039..00000000000
--- a/chromium/third_party/talloc/script/mksigs.pl
+++ /dev/null
@@ -1,183 +0,0 @@
-#!/usr/bin/perl
-
-# mksigs.pl - extract signatures from C headers
-#
-# Copyright (C) Michael Adam 2009
-#
-# 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 <http://www.gnu.org/licenses/>.
-
-# USAGE: cat $header_files | mksigs.pl > $signature_file
-#
-# The header files to parse are read from stdin.
-# The output is in a form as produced by gcc with the -aux-info switch
-# and printed to stdout.
-
-use strict;
-use warnings;
-
-my $in_comment = 0;
-my $extern_C_block = 0;
-
-while (my $LINE = <>) {
- # find end of started multi-line-comment
- if ($in_comment) {
- if ($LINE =~ /^.*?\*\/(.*)$/) {
- $LINE = $1;
- $in_comment = 0;
- } else {
- # whole line within comment
- next;
- }
- }
-
- # strip C++-style comments
- $LINE =~ s/^(.*?)\/\/.*$/$1/;
-
- # strip in-line-comments:
- while ($LINE =~ /\/\*.*?\*\//) {
- $LINE =~ s/\/\*.*?\*\///;
- }
-
- # find starts of multi-line-comments
- if ($LINE =~ /^(.*)\/\*/) {
- $in_comment = 1;
- $LINE = $1;
- }
-
- # skip empty lines
- next if $LINE =~ /^\s*$/;
-
- # remove leading spaces
- $LINE =~ s/^\s*(.*)$/$1/;
-
- # concatenate lines split with "\" (usually macro defines)
- while ($LINE =~ /^(.*?)\s+\\$/) {
- my $LINE2 = <>;
- $LINE = $1;
- $LINE2 =~ s/^\s*(.*)$/$1/;
- $LINE .= " " . $LINE2;
- }
-
- # remove all preprocessor directives
- next if ($LINE =~ /^#/);
-
- if ($LINE =~ /^extern\s+"C"\s+\{/) {
- $extern_C_block = 1;
- next;
- }
-
- if (($LINE =~ /^[^\{]*\}/) and $extern_C_block) {
- $extern_C_block = 0;
- next;
- }
-
- $LINE =~ s/^extern\s//;
-
- # concatenate braces stretched over multiple lines
- # (from structs or enums)
- my $REST = $LINE;
- my $braces = 0;
- while (($REST =~ /[\{\}]/) or ($braces)) {
- while ($REST =~ /[\{\}]/) {
- # collect opening
- while ($REST =~ /^[^\{\}]*\{(.*)$/) {
- $braces++;
- $REST = $1;
- }
-
- # collect closing
- while ($REST =~ /^[^\{\}]*\}(.*)$/) {
- $braces--;
- $REST = $1;
- }
- }
-
- # concatenate if not balanced
- if ($braces) {
- if (my $LINE2 = <>) {
- $LINE2 =~ s/^\s*(.*)$/$1/;
- chomp($LINE);
- $LINE .= " " . $LINE2;
- chomp $REST;
- $REST .= " " . $LINE2;
- } else {
- print "ERROR: unbalanced braces ($braces)\n";
- last;
- }
- }
- }
-
- # concetenate function prototypes that stretch over multiple lines
- $REST = $LINE;
- my $parenthesis = 0;
- while (($REST =~ /[\(\)]/) or ($parenthesis)) {
- while ($REST =~ /[\(\)]/) {
- # collect opening
- while ($REST =~ /^[^\(\)]*\((.*)$/) {
- $parenthesis++;
- $REST = $1;
- }
-
- # collect closing
- while ($REST =~ /^[^\(\)]*\)(.*)$/) {
- $parenthesis--;
- $REST = $1;
- }
- }
-
- # concatenate if not balanced
- if ($parenthesis) {
- if (my $LINE2 = <>) {
- $LINE2 =~ s/^\s*(.*)$/$1/;
- chomp($LINE);
- $LINE .= " " . $LINE2;
- chomp($REST);
- $REST .= " " . $LINE2;
- } else {
- print "ERROR: unbalanced parantheses ($parenthesis)\n";
- last;
- }
- }
- }
-
- next if ($LINE =~ /^typedef\s/);
- next if ($LINE =~ /^enum\s+[^\{\(]+\s+\{/);
- next if ($LINE =~ /^struct\s+[^\{\(]+\s+\{.*\}\s*;/);
- next if ($LINE =~ /^struct\s+[a-zA-Z0-9_]+\s*;/);
-
- # remove trailing spaces
- $LINE =~ s/(.*?)\s*$/$1/;
-
- $LINE =~ s/^(.*\))\s+PRINTF_ATTRIBUTE\([^\)]*\)(\s*[;,])/$1$2/;
- $LINE =~ s/^(.*\))\s*[a-zA-Z0-9_]+\s*;$/$1;/;
-
- # remove parameter names - slightly too coarse probably
- $LINE =~ s/([\s\(]\*?)[_0-9a-zA-Z]+\s*([,\)])/$1$2/g;
-
- # remedy (void) from last line
- $LINE =~ s/\(\)/(void)/g;
-
- # normalize spaces
- $LINE =~ s/\s*\)\s*/)/g;
- $LINE =~ s/\s*\(\s*/ (/g;
- $LINE =~ s/\s*,\s*/, /g;
-
- # normalize unsigned
- $LINE =~ s/([\s,\(])unsigned([,\)])/$1unsigned int$2/g;
-
- # normalize bool
- $LINE =~ s/(\b)bool(\b)/_Bool/g;
-
- print $LINE . "\n";
-}
diff --git a/chromium/third_party/talloc/script/mksyms.awk b/chromium/third_party/talloc/script/mksyms.awk
deleted file mode 100644
index 8775faff3fe..00000000000
--- a/chromium/third_party/talloc/script/mksyms.awk
+++ /dev/null
@@ -1,63 +0,0 @@
-#
-# mksyms.awk
-#
-# Extract symbols to export from C-header files.
-# output in version-script format for linking shared libraries.
-#
-# Copyright (C) 2008 Micheal Adam <obnox@samba.org>
-#
-BEGIN {
- inheader=0;
-}
-
-END {
-}
-
-{
- if (inheader) {
- if (match($0,"[)][^()]*[;][ \t]*$")) {
- inheader = 0;
- }
- next;
- }
-}
-
-/^static/ || /^[ \t]*typedef/ || !/^[a-zA-Z\_]/ {
- next;
-}
-
-/^extern[ \t]+[^()]+[;][ \t]*$/ {
- gsub(/[^ \t]+[ \t]+/, "");
- sub(/[;][ \t]*$/, "");
- printf " %s;\n", $0;
- next;
-}
-
-# look for function headers:
-{
- gotstart = 0;
- if ($0 ~ /^[A-Za-z_][A-Za-z0-9_]+/) {
- gotstart = 1;
- }
- if(!gotstart) {
- next;
- }
-}
-
-/[_A-Za-z0-9]+[ \t]*[(].*[)][^()]*;[ \t]*$/ {
- sub(/[(].*$/, "");
- gsub(/[^ \t]+[ \t]+/, "");
- gsub(/^[*]+/, "");
- printf " %s;\n",$0;
- next;
-}
-
-/[_A-Za-z0-9]+[ \t]*[(]/ {
- inheader=1;
- sub(/[(].*$/, "");
- gsub(/[^ \t]+[ \t]+/, "");
- gsub(/^[*]/, "");
- printf " %s;\n",$0;
- next;
-}
-
diff --git a/chromium/third_party/talloc/script/mksyms.sh b/chromium/third_party/talloc/script/mksyms.sh
deleted file mode 100755
index 089344f8f03..00000000000
--- a/chromium/third_party/talloc/script/mksyms.sh
+++ /dev/null
@@ -1,62 +0,0 @@
-#! /bin/sh
-
-#
-# mksyms.sh
-#
-# Extract symbols to export from C-header files.
-# output in version-script format for linking shared libraries.
-#
-# This is the shell wrapper for the mksyms.awk core script.
-#
-# Copyright (C) 2008 Micheal Adam <obnox@samba.org>
-#
-
-LANG=C; export LANG
-LC_ALL=C; export LC_ALL
-LC_COLLATE=C; export LC_COLLATE
-
-if [ $# -lt 2 ]
-then
- echo "Usage: $0 awk output_file header_files"
- exit 1
-fi
-
-awk="$1"
-shift
-
-symsfile="$1"
-shift
-symsfile_tmp="$symsfile.$$.tmp~"
-
-proto_src="`echo $@ | tr ' ' '\n' | sort | uniq `"
-
-echo creating $symsfile
-
-mkdir -p `dirname $symsfile`
-
-#Write header
-cat > $symsfile_tmp << EOF
-# This file is autogenerated, please DO NOT EDIT
-{
- global:
-EOF
-
-#loop on each header
-for i in $proto_src; do
-${awk} -f `dirname $0`/mksyms.awk $i | sort >> $symsfile_tmp
-done;
-
-#Write tail
-cat >> $symsfile_tmp << EOF
-
- local: *;
-};
-EOF
-
-if cmp -s $symsfile $symsfile_tmp 2>/dev/null
-then
- echo "$symsfile unchanged"
- rm $symsfile_tmp
-else
- mv $symsfile_tmp $symsfile
-fi
diff --git a/chromium/third_party/talloc/script/release-script.sh b/chromium/third_party/talloc/script/release-script.sh
deleted file mode 100755
index fd5c1eff5db..00000000000
--- a/chromium/third_party/talloc/script/release-script.sh
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/bin/bash
-
-if [ "$1" = "" ]; then
- echo "Please provide version string, eg: 1.2.0"
- exit 1
-fi
-
-if [ ! -d "lib/talloc" ]; then
- echo "Run this script from the samba base directory."
- exit 1
-fi
-
-# Check exports and signatures are up to date
-pushd lib/talloc
-./script/abi_checks.sh talloc talloc.h
-abicheck=$?
-popd
-if [ ! "$abicheck" = "0" ]; then
- echo "ERROR: ABI Checks produced warnings!"
- exit 1
-fi
-
-git clean -f -x -d lib/talloc
-git clean -f -x -d lib/replace
-
-curbranch=`git branch |grep "^*" | tr -d "* "`
-
-version=$1
-strver=`echo ${version} | tr "." "-"`
-
-# Checkout the release tag
-git branch -f talloc-release-script-${strver} talloc-${strver}
-if [ ! "$?" = "0" ]; then
- echo "Unable to checkout talloc-${strver} release"
- exit 1
-fi
-
-git checkout talloc-release-script-${strver}
-
-# Test configure agrees with us
-confver=`grep "^AC_INIT" lib/talloc/configure.ac | tr -d "AC_INIT(talloc, " | tr -d ")"`
-if [ ! "$confver" = "$version" ]; then
- echo "Wrong version, requested release for ${version}, found ${confver}"
- exit 1
-fi
-
-# Now build tarball
-cp -a lib/talloc talloc-${version}
-cp -a lib/replace talloc-${version}/libreplace
-pushd talloc-${version}
-./autogen.sh
-popd
-tar cvzf talloc-${version}.tar.gz talloc-${version}
-rm -fr talloc-${version}
-
-#Clean up
-git checkout $curbranch
-git branch -d talloc-release-script-${strver}
diff --git a/chromium/third_party/talloc/talloc.3.xml b/chromium/third_party/talloc/talloc.3.xml
deleted file mode 100644
index 8d9e08226d4..00000000000
--- a/chromium/third_party/talloc/talloc.3.xml
+++ /dev/null
@@ -1,812 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
-<refentry>
- <refmeta>
- <refentrytitle>talloc</refentrytitle>
- <manvolnum>3</manvolnum>
- </refmeta>
- <refnamediv>
- <refname>talloc</refname>
-<refpurpose>hierarchical reference counted memory pool system with destructors</refpurpose>
- </refnamediv>
- <refsynopsisdiv>
-<synopsis>#include &lt;talloc/talloc.h&gt;</synopsis>
- </refsynopsisdiv>
- <refsect1><title>DESCRIPTION</title>
- <para>
- If you are used to talloc from Samba3 then please read this
- carefully, as talloc has changed a lot.
- </para>
- <para>
- The new talloc is a hierarchical, reference counted memory pool
- system with destructors. Quite a mouthful really, but not too bad
- once you get used to it.
- </para>
- <para>
- Perhaps the biggest change from Samba3 is that there is no
- distinction between a "talloc context" and a "talloc pointer". Any
- pointer returned from talloc() is itself a valid talloc context.
- This means you can do this:
- </para>
- <programlisting>
- struct foo *X = talloc(mem_ctx, struct foo);
- X->name = talloc_strdup(X, "foo");
- </programlisting>
- <para>
- and the pointer <literal role="code">X-&gt;name</literal>
- would be a "child" of the talloc context <literal
- role="code">X</literal> which is itself a child of
- <literal role="code">mem_ctx</literal>. So if you do
- <literal role="code">talloc_free(mem_ctx)</literal> then
- it is all destroyed, whereas if you do <literal
- role="code">talloc_free(X)</literal> then just <literal
- role="code">X</literal> and <literal
- role="code">X-&gt;name</literal> are destroyed, and if
- you do <literal
- role="code">talloc_free(X-&gt;name)</literal> then just
- the name element of <literal role="code">X</literal> is
- destroyed.
- </para>
- <para>
- If you think about this, then what this effectively gives you is an
- n-ary tree, where you can free any part of the tree with
- talloc_free().
- </para>
- <para>
- If you find this confusing, then I suggest you run the <literal
- role="code">testsuite</literal> program to watch talloc
- in action. You may also like to add your own tests to <literal
- role="code">testsuite.c</literal> to clarify how some
- particular situation is handled.
- </para>
- </refsect1>
- <refsect1><title>TALLOC API</title>
- <para>
- The following is a complete guide to the talloc API. Read it all at
- least twice.
- </para>
- <refsect2><title>(type *)talloc(const void *ctx, type);</title>
- <para>
- The talloc() macro is the core of the talloc library. It takes a
- memory <emphasis role="italic">ctx</emphasis> and a <emphasis
- role="italic">type</emphasis>, and returns a pointer to a new
- area of memory of the given <emphasis
- role="italic">type</emphasis>.
- </para>
- <para>
- The returned pointer is itself a talloc context, so you can use
- it as the <emphasis role="italic">ctx</emphasis> argument to more
- calls to talloc() if you wish.
- </para>
- <para>
- The returned pointer is a "child" of the supplied context. This
- means that if you talloc_free() the <emphasis
- role="italic">ctx</emphasis> then the new child disappears as
- well. Alternatively you can free just the child.
- </para>
- <para>
- The <emphasis role="italic">ctx</emphasis> argument to talloc()
- can be NULL, in which case a new top level context is created.
- </para>
- </refsect2>
- <refsect2><title>void *talloc_size(const void *ctx, size_t size);</title>
- <para>
- The function talloc_size() should be used when you don't have a
- convenient type to pass to talloc(). Unlike talloc(), it is not
- type safe (as it returns a void *), so you are on your own for
- type checking.
- </para>
- </refsect2>
- <refsect2><title>(typeof(ptr)) talloc_ptrtype(const void *ctx, ptr);</title>
- <para>
- The talloc_ptrtype() macro should be used when you have a pointer and
- want to allocate memory to point at with this pointer. When compiling
- with gcc >= 3 it is typesafe. Note this is a wrapper of talloc_size()
- and talloc_get_name() will return the current location in the source file.
- and not the type.
- </para>
- </refsect2>
- <refsect2><title>int talloc_free(void *ptr);</title>
- <para>
- The talloc_free() function frees a piece of talloc memory, and
- all its children. You can call talloc_free() on any pointer
- returned by talloc().
- </para>
- <para>
- The return value of talloc_free() indicates success or failure,
- with 0 returned for success and -1 for failure. The only
- possible failure condition is if <emphasis
- role="italic">ptr</emphasis> had a destructor attached to it and
- the destructor returned -1. See <link
- linkend="talloc_set_destructor"><quote>talloc_set_destructor()</quote></link>
- for details on destructors.
- </para>
- <para>
- If this pointer has an additional parent when talloc_free() is
- called then the memory is not actually released, but instead the
- most recently established parent is destroyed. See <link
- linkend="talloc_reference"><quote>talloc_reference()</quote></link>
- for details on establishing additional parents.
- </para>
- <para>
- For more control on which parent is removed, see <link
- linkend="talloc_unlink"><quote>talloc_unlink()</quote></link>.
- </para>
- <para>
- talloc_free() operates recursively on its children.
- </para>
- <para>
- From the 2.0 version of talloc, as a special case,
- talloc_free() is refused on pointers that have more than one
- parent, as talloc would have no way of knowing which parent
- should be removed. To free a pointer that has more than one
- parent please use talloc_unlink().
- </para>
- <para>
- To help you find problems in your code caused by this behaviour, if
- you do try and free a pointer with more than one parent then the
- talloc logging function will be called to give output like this:
- </para>
- <para>
- <screen format="linespecific">
- ERROR: talloc_free with references at some_dir/source/foo.c:123
- reference at some_dir/source/other.c:325
- reference at some_dir/source/third.c:121
- </screen>
- </para>
- <para>
- Please see the documentation for talloc_set_log_fn() and
- talloc_set_log_stderr() for more information on talloc logging
- functions.
- </para>
- </refsect2>
- <refsect2 id="talloc_reference"><title>void *talloc_reference(const void *ctx, const void *ptr);</title>
- <para>
- The talloc_reference() function makes <emphasis
- role="italic">ctx</emphasis> an additional parent of <emphasis
- role="italic">ptr</emphasis>.
- </para>
- <para>
- The return value of talloc_reference() is always the original
- pointer <emphasis role="italic">ptr</emphasis>, unless talloc ran
- out of memory in creating the reference in which case it will
- return NULL (each additional reference consumes around 48 bytes
- of memory on intel x86 platforms).
- </para>
- <para>
- If <emphasis role="italic">ptr</emphasis> is NULL, then the
- function is a no-op, and simply returns NULL.
- </para>
- <para>
- After creating a reference you can free it in one of the
- following ways:
- </para>
- <para>
- <itemizedlist>
- <listitem>
- <para>
- you can talloc_free() any parent of the original pointer.
- That will reduce the number of parents of this pointer by 1,
- and will cause this pointer to be freed if it runs out of
- parents.
- </para>
- </listitem>
- <listitem>
- <para>
- you can talloc_free() the pointer itself. That will destroy
- the most recently established parent to the pointer and leave
- the pointer as a child of its current parent.
- </para>
- </listitem>
- </itemizedlist>
- </para>
- <para>
- For more control on which parent to remove, see <link
- linkend="talloc_unlink"><quote>talloc_unlink()</quote></link>.
- </para>
- </refsect2>
- <refsect2 id="talloc_unlink"><title>int talloc_unlink(const void *ctx, const void *ptr);</title>
- <para>
- The talloc_unlink() function removes a specific parent from
- <emphasis role="italic">ptr</emphasis>. The <emphasis
- role="italic">ctx</emphasis> passed must either be a context used
- in talloc_reference() with this pointer, or must be a direct
- parent of ptr.
- </para>
- <para>
- Note that if the parent has already been removed using
- talloc_free() then this function will fail and will return -1.
- Likewise, if <emphasis role="italic">ptr</emphasis> is NULL, then
- the function will make no modifications and return -1.
- </para>
- <para>
- Usually you can just use talloc_free() instead of
- talloc_unlink(), but sometimes it is useful to have the
- additional control on which parent is removed.
- </para>
- </refsect2>
- <refsect2 id="talloc_set_destructor"><title>void talloc_set_destructor(const void *ptr, int (*destructor)(void *));</title>
- <para>
- The function talloc_set_destructor() sets the <emphasis
- role="italic">destructor</emphasis> for the pointer <emphasis
- role="italic">ptr</emphasis>. A <emphasis
- role="italic">destructor</emphasis> is a function that is called
- when the memory used by a pointer is about to be released. The
- destructor receives <emphasis role="italic">ptr</emphasis> as an
- argument, and should return 0 for success and -1 for failure.
- </para>
- <para>
- The <emphasis role="italic">destructor</emphasis> can do anything
- it wants to, including freeing other pieces of memory. A common
- use for destructors is to clean up operating system resources
- (such as open file descriptors) contained in the structure the
- destructor is placed on.
- </para>
- <para>
- You can only place one destructor on a pointer. If you need more
- than one destructor then you can create a zero-length child of
- the pointer and place an additional destructor on that.
- </para>
- <para>
- To remove a destructor call talloc_set_destructor() with NULL for
- the destructor.
- </para>
- <para>
- If your destructor attempts to talloc_free() the pointer that it
- is the destructor for then talloc_free() will return -1 and the
- free will be ignored. This would be a pointless operation
- anyway, as the destructor is only called when the memory is just
- about to go away.
- </para>
- </refsect2>
- <refsect2><title>int talloc_increase_ref_count(const void *<emphasis role="italic">ptr</emphasis>);</title>
- <para>
- The talloc_increase_ref_count(<emphasis
- role="italic">ptr</emphasis>) function is exactly equivalent to:
- </para>
- <programlisting>talloc_reference(NULL, ptr);</programlisting>
- <para>
- You can use either syntax, depending on which you think is
- clearer in your code.
- </para>
- <para>
- It returns 0 on success and -1 on failure.
- </para>
- </refsect2>
- <refsect2><title>size_t talloc_reference_count(const void *<emphasis role="italic">ptr</emphasis>);</title>
- <para>
- Return the number of references to the pointer.
- </para>
- </refsect2>
- <refsect2 id="talloc_set_name"><title>void talloc_set_name(const void *ptr, const char *fmt, ...);</title>
- <para>
- Each talloc pointer has a "name". The name is used principally
- for debugging purposes, although it is also possible to set and
- get the name on a pointer in as a way of "marking" pointers in
- your code.
- </para>
- <para>
- The main use for names on pointer is for "talloc reports". See
- <link
- linkend="talloc_report"><quote>talloc_report_depth_cb()</quote></link>,
- <link
- linkend="talloc_report"><quote>talloc_report_depth_file()</quote></link>,
- <link
- linkend="talloc_report"><quote>talloc_report()</quote></link>
- <link
- linkend="talloc_report"><quote>talloc_report()</quote></link>
- and <link
- linkend="talloc_report_full"><quote>talloc_report_full()</quote></link>
- for details. Also see <link
- linkend="talloc_enable_leak_report"><quote>talloc_enable_leak_report()</quote></link>
- and <link
- linkend="talloc_enable_leak_report_full"><quote>talloc_enable_leak_report_full()</quote></link>.
- </para>
- <para>
- The talloc_set_name() function allocates memory as a child of the
- pointer. It is logically equivalent to:
- </para>
- <programlisting>talloc_set_name_const(ptr, talloc_asprintf(ptr, fmt, ...));</programlisting>
- <para>
- Note that multiple calls to talloc_set_name() will allocate more
- memory without releasing the name. All of the memory is released
- when the ptr is freed using talloc_free().
- </para>
- </refsect2>
- <refsect2><title>void talloc_set_name_const(const void *<emphasis role="italic">ptr</emphasis>, const char *<emphasis role="italic">name</emphasis>);</title>
- <para>
- The function talloc_set_name_const() is just like
- talloc_set_name(), but it takes a string constant, and is much
- faster. It is extensively used by the "auto naming" macros, such
- as talloc_p().
- </para>
- <para>
- This function does not allocate any memory. It just copies the
- supplied pointer into the internal representation of the talloc
- ptr. This means you must not pass a <emphasis
- role="italic">name</emphasis> pointer to memory that will
- disappear before <emphasis role="italic">ptr</emphasis> is freed
- with talloc_free().
- </para>
- </refsect2>
- <refsect2><title>void *talloc_named(const void *<emphasis role="italic">ctx</emphasis>, size_t <emphasis role="italic">size</emphasis>, const char *<emphasis role="italic">fmt</emphasis>, ...);</title>
- <para>
- The talloc_named() function creates a named talloc pointer. It
- is equivalent to:
- </para>
- <programlisting>ptr = talloc_size(ctx, size);
-talloc_set_name(ptr, fmt, ....);</programlisting>
- </refsect2>
- <refsect2><title>void *talloc_named_const(const void *<emphasis role="italic">ctx</emphasis>, size_t <emphasis role="italic">size</emphasis>, const char *<emphasis role="italic">name</emphasis>);</title>
- <para>
- This is equivalent to:
- </para>
- <programlisting>ptr = talloc_size(ctx, size);
-talloc_set_name_const(ptr, name);</programlisting>
- </refsect2>
- <refsect2><title>const char *talloc_get_name(const void *<emphasis role="italic">ptr</emphasis>);</title>
- <para>
- This returns the current name for the given talloc pointer,
- <emphasis role="italic">ptr</emphasis>. See <link
- linkend="talloc_set_name"><quote>talloc_set_name()</quote></link>
- for details.
- </para>
- </refsect2>
- <refsect2><title>void *talloc_init(const char *<emphasis role="italic">fmt</emphasis>, ...);</title>
- <para>
- This function creates a zero length named talloc context as a top
- level context. It is equivalent to:
- </para>
- <programlisting>talloc_named(NULL, 0, fmt, ...);</programlisting>
- </refsect2>
- <refsect2><title>void *talloc_new(void *<emphasis role="italic">ctx</emphasis>);</title>
- <para>
- This is a utility macro that creates a new memory context hanging
- off an exiting context, automatically naming it "talloc_new:
- __location__" where __location__ is the source line it is called
- from. It is particularly useful for creating a new temporary
- working context.
- </para>
- </refsect2>
- <refsect2><title>(<emphasis role="italic">type</emphasis> *)talloc_realloc(const void *<emphasis role="italic">ctx</emphasis>, void *<emphasis role="italic">ptr</emphasis>, <emphasis role="italic">type</emphasis>, <emphasis role="italic">count</emphasis>);</title>
- <para>
- The talloc_realloc() macro changes the size of a talloc pointer.
- It has the following equivalences:
- </para>
- <programlisting>talloc_realloc(ctx, NULL, type, 1) ==> talloc(ctx, type);
-talloc_realloc(ctx, ptr, type, 0) ==> talloc_free(ptr);</programlisting>
- <para>
- The <emphasis role="italic">ctx</emphasis> argument is only used
- if <emphasis role="italic">ptr</emphasis> is not NULL, otherwise
- it is ignored.
- </para>
- <para>
- talloc_realloc() returns the new pointer, or NULL on failure.
- The call will fail either due to a lack of memory, or because the
- pointer has more than one parent (see <link
- linkend="talloc_reference"><quote>talloc_reference()</quote></link>).
- </para>
- </refsect2>
- <refsect2><title>void *talloc_realloc_size(const void *ctx, void *ptr, size_t size);</title>
- <para>
- the talloc_realloc_size() function is useful when the type is not
- known so the type-safe talloc_realloc() cannot be used.
- </para>
- </refsect2>
- <refsect2><title>TYPE *talloc_steal(const void *<emphasis role="italic">new_ctx</emphasis>, const TYPE *<emphasis role="italic">ptr</emphasis>);</title>
- <para>
- The talloc_steal() function changes the parent context of a
- talloc pointer. It is typically used when the context that the
- pointer is currently a child of is going to be freed and you wish
- to keep the memory for a longer time.
- </para>
- <para>
- The talloc_steal() function returns the pointer that you pass it.
- It does not have any failure modes.
- </para>
- <para>
- It is possible to produce loops in the parent/child
- relationship if you are not careful with talloc_steal(). No
- guarantees are provided as to your sanity or the safety of your
- data if you do this.
- </para>
- <para>
- Note that if you try and call talloc_steal() on a pointer that has
- more than one parent then the result is ambiguous. Talloc will choose
- to remove the parent that is currently indicated by talloc_parent()
- and replace it with the chosen parent. You will also get a message
- like this via the talloc logging functions:
- </para>
- <para>
- <screen format="linespecific">
- WARNING: talloc_steal with references at some_dir/source/foo.c:123
- reference at some_dir/source/other.c:325
- reference at some_dir/source/third.c:121
- </screen>
- </para>
- <para>
- To unambiguously change the parent of a pointer please see
- the
- function <link linkend="talloc_reference"><quote>talloc_reparent()</quote></link>. See
- the talloc_set_log_fn() documentation for more information
- on talloc logging.
- </para>
- </refsect2>
- <refsect2><title>TYPE *talloc_reparent(const void *<emphasis role="italic">old_parent</emphasis>, const void *<emphasis role="italic">new_parent</emphasis>, const TYPE *<emphasis role="italic">ptr</emphasis>);</title>
- <para>
- The talloc_reparent() function changes the parent context of a talloc
- pointer. It is typically used when the context that the pointer is
- currently a child of is going to be freed and you wish to keep the
- memory for a longer time.
- </para>
- <para>
- The talloc_reparent() function returns the pointer that you pass it. It
- does not have any failure modes.
- </para>
- <para>
- The difference between talloc_reparent() and talloc_steal() is that
- talloc_reparent() can specify which parent you wish to change. This is
- useful when a pointer has multiple parents via references.
- </para>
- </refsect2>
- <refsect2><title>TYPE *talloc_move(const void *<emphasis role="italic">new_ctx</emphasis>, TYPE **<emphasis role="italic">ptr</emphasis>);</title>
- <para>
- The talloc_move() function is a wrapper around
- talloc_steal() which zeros the source pointer after the
- move. This avoids a potential source of bugs where a
- programmer leaves a pointer in two structures, and uses the
- pointer from the old structure after it has been moved to a
- new one.
- </para>
- </refsect2>
- <refsect2><title>size_t talloc_total_size(const void *<emphasis role="italic">ptr</emphasis>);</title>
- <para>
- The talloc_total_size() function returns the total size in bytes
- used by this pointer and all child pointers. Mostly useful for
- debugging.
- </para>
- <para>
- Passing NULL is allowed, but it will only give a meaningful
- result if talloc_enable_leak_report() or
- talloc_enable_leak_report_full() has been called.
- </para>
- </refsect2>
- <refsect2><title>size_t talloc_total_blocks(const void *<emphasis role="italic">ptr</emphasis>);</title>
- <para>
- The talloc_total_blocks() function returns the total memory block
- count used by this pointer and all child pointers. Mostly useful
- for debugging.
- </para>
- <para>
- Passing NULL is allowed, but it will only give a meaningful
- result if talloc_enable_leak_report() or
- talloc_enable_leak_report_full() has been called.
- </para>
- </refsect2>
- <refsect2 id="talloc_report"><title>void talloc_report(const void *ptr, FILE *f);</title>
- <para>
- The talloc_report() function prints a summary report of all
- memory used by <emphasis role="italic">ptr</emphasis>. One line
- of report is printed for each immediate child of ptr, showing the
- total memory and number of blocks used by that child.
- </para>
- <para>
- You can pass NULL for the pointer, in which case a report is
- printed for the top level memory context, but only if
- talloc_enable_leak_report() or talloc_enable_leak_report_full()
- has been called.
- </para>
- </refsect2>
- <refsect2 id="talloc_report_full"><title>void talloc_report_full(const void *<emphasis role="italic">ptr</emphasis>, FILE *<emphasis role="italic">f</emphasis>);</title>
- <para>
- This provides a more detailed report than talloc_report(). It
- will recursively print the entire tree of memory referenced by
- the pointer. References in the tree are shown by giving the name
- of the pointer that is referenced.
- </para>
- <para>
- You can pass NULL for the pointer, in which case a report is
- printed for the top level memory context, but only if
- talloc_enable_leak_report() or talloc_enable_leak_report_full()
- has been called.
- </para>
- </refsect2>
- <refsect2 id="talloc_report_depth_cb">
- <funcsynopsis><funcprototype>
- <funcdef>void <function>talloc_report_depth_cb</function></funcdef>
- <paramdef><parameter>const void *ptr</parameter></paramdef>
- <paramdef><parameter>int depth</parameter></paramdef>
- <paramdef><parameter>int max_depth</parameter></paramdef>
- <paramdef><parameter>void (*callback)(const void *ptr, int depth, int max_depth, int is_ref, void *priv)</parameter></paramdef>
- <paramdef><parameter>void *priv</parameter></paramdef>
- </funcprototype></funcsynopsis>
- <para>
- This provides a more flexible reports than talloc_report(). It
- will recursively call the callback for the entire tree of memory
- referenced by the pointer. References in the tree are passed with
- <emphasis role="italic">is_ref = 1</emphasis> and the pointer that is referenced.
- </para>
- <para>
- You can pass NULL for the pointer, in which case a report is
- printed for the top level memory context, but only if
- talloc_enable_leak_report() or talloc_enable_leak_report_full()
- has been called.
- </para>
- <para>
- The recursion is stopped when depth >= max_depth.
- max_depth = -1 means only stop at leaf nodes.
- </para>
- </refsect2>
- <refsect2 id="talloc_report_depth_file">
- <funcsynopsis><funcprototype>
- <funcdef>void <function>talloc_report_depth_file</function></funcdef>
- <paramdef><parameter>const void *ptr</parameter></paramdef>
- <paramdef><parameter>int depth</parameter></paramdef>
- <paramdef><parameter>int max_depth</parameter></paramdef>
- <paramdef><parameter>FILE *f</parameter></paramdef>
- </funcprototype></funcsynopsis>
- <para>
- This provides a more flexible reports than talloc_report(). It
- will let you specify the depth and max_depth.
- </para>
- </refsect2>
- <refsect2 id="talloc_enable_leak_report"><title>void talloc_enable_leak_report(void);</title>
- <para>
- This enables calling of talloc_report(NULL, stderr) when the
- program exits. In Samba4 this is enabled by using the
- --leak-report command line option.
- </para>
- <para>
- For it to be useful, this function must be called before any
- other talloc function as it establishes a "null context" that
- acts as the top of the tree. If you don't call this function
- first then passing NULL to talloc_report() or
- talloc_report_full() won't give you the full tree printout.
- </para>
- <para>
- Here is a typical talloc report:
- </para>
- <screen format="linespecific">talloc report on 'null_context' (total 267 bytes in 15 blocks)
-libcli/auth/spnego_parse.c:55 contains 31 bytes in 2 blocks
-libcli/auth/spnego_parse.c:55 contains 31 bytes in 2 blocks
-iconv(UTF8,CP850) contains 42 bytes in 2 blocks
-libcli/auth/spnego_parse.c:55 contains 31 bytes in 2 blocks
-iconv(CP850,UTF8) contains 42 bytes in 2 blocks
-iconv(UTF8,UTF-16LE) contains 45 bytes in 2 blocks
-iconv(UTF-16LE,UTF8) contains 45 bytes in 2 blocks
- </screen>
- </refsect2>
- <refsect2 id="talloc_enable_leak_report_full"><title>void talloc_enable_leak_report_full(void);</title>
- <para>
- This enables calling of talloc_report_full(NULL, stderr) when the
- program exits. In Samba4 this is enabled by using the
- --leak-report-full command line option.
- </para>
- <para>
- For it to be useful, this function must be called before any
- other talloc function as it establishes a "null context" that
- acts as the top of the tree. If you don't call this function
- first then passing NULL to talloc_report() or
- talloc_report_full() won't give you the full tree printout.
- </para>
- <para>
- Here is a typical full report:
- </para>
- <screen format="linespecific">full talloc report on 'root' (total 18 bytes in 8 blocks)
-p1 contains 18 bytes in 7 blocks (ref 0)
- r1 contains 13 bytes in 2 blocks (ref 0)
- reference to: p2
- p2 contains 1 bytes in 1 blocks (ref 1)
- x3 contains 1 bytes in 1 blocks (ref 0)
- x2 contains 1 bytes in 1 blocks (ref 0)
- x1 contains 1 bytes in 1 blocks (ref 0)
- </screen>
- </refsect2>
- <refsect2><title>(<emphasis role="italic">type</emphasis> *)talloc_zero(const void *<emphasis role="italic">ctx</emphasis>, <emphasis role="italic">type</emphasis>);</title>
- <para>
- The talloc_zero() macro is equivalent to:
- </para>
- <programlisting>ptr = talloc(ctx, type);
-if (ptr) memset(ptr, 0, sizeof(type));</programlisting>
- </refsect2>
- <refsect2><title>void *talloc_zero_size(const void *<emphasis role="italic">ctx</emphasis>, size_t <emphasis role="italic">size</emphasis>)</title>
- <para>
- The talloc_zero_size() function is useful when you don't have a
- known type.
- </para>
- </refsect2>
- <refsect2><title>void *talloc_memdup(const void *<emphasis role="italic">ctx</emphasis>, const void *<emphasis role="italic">p</emphasis>, size_t size);</title>
- <para>
- The talloc_memdup() function is equivalent to:
- </para>
- <programlisting>ptr = talloc_size(ctx, size);
-if (ptr) memcpy(ptr, p, size);</programlisting>
- </refsect2>
- <refsect2><title>char *talloc_strdup(const void *<emphasis role="italic">ctx</emphasis>, const char *<emphasis role="italic">p</emphasis>);</title>
- <para>
- The talloc_strdup() function is equivalent to:
- </para>
- <programlisting>ptr = talloc_size(ctx, strlen(p)+1);
-if (ptr) memcpy(ptr, p, strlen(p)+1);</programlisting>
- <para>
- This function sets the name of the new pointer to the passed
- string. This is equivalent to:
- </para>
- <programlisting>talloc_set_name_const(ptr, ptr)</programlisting>
- </refsect2>
- <refsect2><title>char *talloc_strndup(const void *<emphasis role="italic">t</emphasis>, const char *<emphasis role="italic">p</emphasis>, size_t <emphasis role="italic">n</emphasis>);</title>
- <para>
- The talloc_strndup() function is the talloc equivalent of the C
- library function strndup(3).
- </para>
- <para>
- This function sets the name of the new pointer to the passed
- string. This is equivalent to:
- </para>
- <programlisting>talloc_set_name_const(ptr, ptr)</programlisting>
- </refsect2>
- <refsect2><title>char *talloc_append_string(const void *<emphasis role="italic">t</emphasis>, char *<emphasis role="italic">orig</emphasis>, const char *<emphasis role="italic">append</emphasis>);</title>
- <para>
- The talloc_append_string() function appends the given formatted
- string to the given string.
- </para>
- <para>
- This function sets the name of the new pointer to the new
- string. This is equivalent to:
- </para>
- <programlisting>talloc_set_name_const(ptr, ptr)</programlisting>
- </refsect2>
- <refsect2><title>char *talloc_vasprintf(const void *<emphasis role="italic">t</emphasis>, const char *<emphasis role="italic">fmt</emphasis>, va_list <emphasis role="italic">ap</emphasis>);</title>
- <para>
- The talloc_vasprintf() function is the talloc equivalent of the C
- library function vasprintf(3).
- </para>
- <para>
- This function sets the name of the new pointer to the new
- string. This is equivalent to:
- </para>
- <programlisting>talloc_set_name_const(ptr, ptr)</programlisting>
- </refsect2>
- <refsect2><title>char *talloc_asprintf(const void *<emphasis role="italic">t</emphasis>, const char *<emphasis role="italic">fmt</emphasis>, ...);</title>
- <para>
- The talloc_asprintf() function is the talloc equivalent of the C
- library function asprintf(3).
- </para>
- <para>
- This function sets the name of the new pointer to the passed
- string. This is equivalent to:
- </para>
- <programlisting>talloc_set_name_const(ptr, ptr)</programlisting>
- </refsect2>
- <refsect2><title>char *talloc_asprintf_append(char *s, const char *fmt, ...);</title>
- <para>
- The talloc_asprintf_append() function appends the given formatted
- string to the given string.
- </para>
- <para>
- This function sets the name of the new pointer to the new
- string. This is equivalent to:
- </para>
- <programlisting>talloc_set_name_const(ptr, ptr)</programlisting>
- </refsect2>
- <refsect2><title>(type *)talloc_array(const void *ctx, type, uint_t count);</title>
- <para>
- The talloc_array() macro is equivalent to:
- </para>
- <programlisting>(type *)talloc_size(ctx, sizeof(type) * count);</programlisting>
- <para>
- except that it provides integer overflow protection for the
- multiply, returning NULL if the multiply overflows.
- </para>
- </refsect2>
- <refsect2><title>void *talloc_array_size(const void *ctx, size_t size, uint_t count);</title>
- <para>
- The talloc_array_size() function is useful when the type is not
- known. It operates in the same way as talloc_array(), but takes a
- size instead of a type.
- </para>
- </refsect2>
- <refsect2><title>(typeof(ptr)) talloc_array_ptrtype(const void *ctx, ptr, uint_t count);</title>
- <para>
- The talloc_ptrtype() macro should be used when you have a pointer to an array
- and want to allocate memory of an array to point at with this pointer. When compiling
- with gcc >= 3 it is typesafe. Note this is a wrapper of talloc_array_size()
- and talloc_get_name() will return the current location in the source file.
- and not the type.
- </para>
- </refsect2>
- <refsect2><title>void *talloc_realloc_fn(const void *ctx, void *ptr, size_t size)</title>
- <para>
- This is a non-macro version of talloc_realloc(), which is useful
- as libraries sometimes want a realloc function pointer. A
- realloc(3) implementation encapsulates the functionality of
- malloc(3), free(3) and realloc(3) in one call, which is why it is
- useful to be able to pass around a single function pointer.
- </para>
- </refsect2>
- <refsect2><title>void *talloc_autofree_context(void);</title>
- <para>
- This is a handy utility function that returns a talloc context
- which will be automatically freed on program exit. This can be
- used to reduce the noise in memory leak reports.
- </para>
- </refsect2>
- <refsect2><title>void *talloc_check_name(const void *ptr, const char *name);</title>
- <para>
- This function checks if a pointer has the specified <emphasis
- role="italic">name</emphasis>. If it does then the pointer is
- returned. It it doesn't then NULL is returned.
- </para>
- </refsect2>
- <refsect2><title>(type *)talloc_get_type(const void *ptr, type);</title>
- <para>
- This macro allows you to do type checking on talloc pointers. It
- is particularly useful for void* private pointers. It is
- equivalent to this:
- </para>
- <programlisting>(type *)talloc_check_name(ptr, #type)</programlisting>
- </refsect2>
- <refsect2><title>talloc_set_type(const void *ptr, type);</title>
- <para>
- This macro allows you to force the name of a pointer to be a
- particular <emphasis>type</emphasis>. This can be
- used in conjunction with talloc_get_type() to do type checking on
- void* pointers.
- </para>
- <para>
- It is equivalent to this:
- </para>
- <programlisting>talloc_set_name_const(ptr, #type)</programlisting>
- </refsect2>
- <refsect2><title>talloc_set_log_fn(void (*log_fn)(const char *message));</title>
- <para>
- This function sets a logging function that talloc will use for
- warnings and errors. By default talloc will not print any warnings or
- errors.
- </para>
- </refsect2>
- <refsect2><title>talloc_set_log_stderr(void);</title>
- <para>
- This sets the talloc log function to write log messages to stderr
- </para>
- </refsect2>
- </refsect1>
- <refsect1><title>PERFORMANCE</title>
- <para>
- All the additional features of talloc(3) over malloc(3) do come at a
- price. We have a simple performance test in Samba4 that measures
- talloc() versus malloc() performance, and it seems that talloc() is
- about 10% slower than malloc() on my x86 Debian Linux box. For
- Samba, the great reduction in code complexity that we get by using
- talloc makes this worthwhile, especially as the total overhead of
- talloc/malloc in Samba is already quite small.
- </para>
- </refsect1>
- <refsect1><title>SEE ALSO</title>
- <para>
- malloc(3), strndup(3), vasprintf(3), asprintf(3),
- <ulink url="http://talloc.samba.org/"/>
- </para>
- </refsect1>
- <refsect1><title>COPYRIGHT/LICENSE</title>
- <para>
- Copyright (C) Andrew Tridgell 2004
- </para>
- <para>
- 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.
- </para>
- <para>
- 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.
- </para>
- <para>
- You should have received a copy of the GNU General Public License
- along with this program; if not, see http://www.gnu.org/licenses/.
- </para>
- </refsect1>
-</refentry>
diff --git a/chromium/third_party/talloc/talloc.c b/chromium/third_party/talloc/talloc.c
deleted file mode 100644
index 4bcd65d18bb..00000000000
--- a/chromium/third_party/talloc/talloc.c
+++ /dev/null
@@ -1,2020 +0,0 @@
-/*
- Samba Unix SMB/CIFS implementation.
-
- Samba trivial allocation library - new interface
-
- NOTE: Please read talloc_guide.txt for full documentation
-
- Copyright (C) Andrew Tridgell 2004
- Copyright (C) Stefan Metzmacher 2006
-
- ** NOTE! The following LGPL license applies to the talloc
- ** library. This does NOT imply that all of Samba is released
- ** under the LGPL
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, see <http://www.gnu.org/licenses/>.
-*/
-
-/*
- inspired by http://swapped.cc/halloc/
-*/
-
-/* Commented out for building within Chromium */
-/* #include "replace.h" */
-#include "talloc.h"
-
-#ifdef TALLOC_BUILD_VERSION_MAJOR
-#if (TALLOC_VERSION_MAJOR != TALLOC_BUILD_VERSION_MAJOR)
-#error "TALLOC_VERSION_MAJOR != TALLOC_BUILD_VERSION_MAJOR"
-#endif
-#endif
-
-#ifdef TALLOC_BUILD_VERSION_MINOR
-#if (TALLOC_VERSION_MINOR != TALLOC_BUILD_VERSION_MINOR)
-#error "TALLOC_VERSION_MINOR != TALLOC_BUILD_VERSION_MINOR"
-#endif
-#endif
-
-/* use this to force every realloc to change the pointer, to stress test
- code that might not cope */
-#define ALWAYS_REALLOC 0
-
-
-#define MAX_TALLOC_SIZE 0x10000000
-#define TALLOC_MAGIC_BASE 0xe814ec70
-#define TALLOC_MAGIC ( \
- TALLOC_MAGIC_BASE + \
- (TALLOC_VERSION_MAJOR << 12) + \
- (TALLOC_VERSION_MINOR << 4) \
-)
-
-#define TALLOC_FLAG_FREE 0x01
-#define TALLOC_FLAG_LOOP 0x02
-#define TALLOC_FLAG_POOL 0x04 /* This is a talloc pool */
-#define TALLOC_FLAG_POOLMEM 0x08 /* This is allocated in a pool */
-#define TALLOC_MAGIC_REFERENCE ((const char *)1)
-
-/* by default we abort when given a bad pointer (such as when talloc_free() is called
- on a pointer that came from malloc() */
-#ifndef TALLOC_ABORT
-#define TALLOC_ABORT(reason) abort()
-#endif
-
-#ifndef discard_const_p
-#if defined(__intptr_t_defined) || defined(HAVE_INTPTR_T)
-# define discard_const_p(type, ptr) ((type *)((intptr_t)(ptr)))
-#else
-# define discard_const_p(type, ptr) ((type *)(ptr))
-#endif
-#endif
-
-/* these macros gain us a few percent of speed on gcc */
-#if (__GNUC__ >= 3)
-/* the strange !! is to ensure that __builtin_expect() takes either 0 or 1
- as its first argument */
-#ifndef likely
-#define likely(x) __builtin_expect(!!(x), 1)
-#endif
-#ifndef unlikely
-#define unlikely(x) __builtin_expect(!!(x), 0)
-#endif
-#else
-#ifndef likely
-#define likely(x) (x)
-#endif
-#ifndef unlikely
-#define unlikely(x) (x)
-#endif
-#endif
-
-/* inline isn't supported in C files in Visual Studio 2008 on Windows */
-#ifdef _MSC_VER
-#define INLINE
-#else
-#define INLINE inline
-#endif
-
-/* this null_context is only used if talloc_enable_leak_report() or
- talloc_enable_leak_report_full() is called, otherwise it remains
- NULL
-*/
-static void *null_context;
-static void *autofree_context;
-
-struct talloc_reference_handle {
- struct talloc_reference_handle *next, *prev;
- void *ptr;
- const char *location;
-};
-
-typedef int (*talloc_destructor_t)(void *);
-
-struct talloc_chunk {
- struct talloc_chunk *next, *prev;
- struct talloc_chunk *parent, *child;
- struct talloc_reference_handle *refs;
- talloc_destructor_t destructor;
- const char *name;
- size_t size;
- unsigned flags;
-
- /*
- * "pool" has dual use:
- *
- * For the talloc pool itself (i.e. TALLOC_FLAG_POOL is set), "pool"
- * marks the end of the currently allocated area.
- *
- * For members of the pool (i.e. TALLOC_FLAG_POOLMEM is set), "pool"
- * is a pointer to the struct talloc_chunk of the pool that it was
- * allocated from. This way children can quickly find the pool to chew
- * from.
- */
- void *pool;
-};
-
-/* 16 byte alignment seems to keep everyone happy */
-#define TC_HDR_SIZE ((sizeof(struct talloc_chunk)+15)&~15)
-#define TC_PTR_FROM_CHUNK(tc) ((void *)(TC_HDR_SIZE + (char*)tc))
-
-int talloc_version_major(void)
-{
- return TALLOC_VERSION_MAJOR;
-}
-
-int talloc_version_minor(void)
-{
- return TALLOC_VERSION_MINOR;
-}
-
-static void (*talloc_log_fn)(const char *message);
-
-void talloc_set_log_fn(void (*log_fn)(const char *message))
-{
- talloc_log_fn = log_fn;
-}
-
-static void talloc_log(const char *fmt, ...) PRINTF_ATTRIBUTE(1,2);
-static void talloc_log(const char *fmt, ...)
-{
- va_list ap;
- char *message;
-
- if (!talloc_log_fn) {
- return;
- }
-
- va_start(ap, fmt);
- message = talloc_vasprintf(NULL, fmt, ap);
- va_end(ap);
-
- talloc_log_fn(message);
- talloc_free(message);
-}
-
-static void talloc_log_stderr(const char *message)
-{
- fprintf(stderr, "%s", message);
-}
-
-void talloc_set_log_stderr(void)
-{
- talloc_set_log_fn(talloc_log_stderr);
-}
-
-static void (*talloc_abort_fn)(const char *reason);
-
-void talloc_set_abort_fn(void (*abort_fn)(const char *reason))
-{
- talloc_abort_fn = abort_fn;
-}
-
-static void talloc_abort(const char *reason)
-{
- talloc_log("%s\n", reason);
-
- if (!talloc_abort_fn) {
- TALLOC_ABORT(reason);
- }
-
- talloc_abort_fn(reason);
-}
-
-static void talloc_abort_magic(unsigned magic)
-{
- unsigned striped = magic - TALLOC_MAGIC_BASE;
- unsigned major = (striped & 0xFFFFF000) >> 12;
- unsigned minor = (striped & 0x00000FF0) >> 4;
- talloc_log("Bad talloc magic[0x%08X/%u/%u] expected[0x%08X/%u/%u]\n",
- magic, major, minor,
- TALLOC_MAGIC, TALLOC_VERSION_MAJOR, TALLOC_VERSION_MINOR);
- talloc_abort("Bad talloc magic value - wrong talloc version used/mixed");
-}
-
-static void talloc_abort_double_free(void)
-{
- talloc_abort("Bad talloc magic value - double free");
-}
-
-static void talloc_abort_unknown_value(void)
-{
- talloc_abort("Bad talloc magic value - unknown value");
-}
-
-/* panic if we get a bad magic value */
-static INLINE struct talloc_chunk *talloc_chunk_from_ptr(const void *ptr)
-{
- const char *pp = (const char *)ptr;
- struct talloc_chunk *tc = discard_const_p(struct talloc_chunk, pp - TC_HDR_SIZE);
- if (unlikely((tc->flags & (TALLOC_FLAG_FREE | ~0xF)) != TALLOC_MAGIC)) {
- if ((tc->flags & (~0xFFF)) == TALLOC_MAGIC_BASE) {
- talloc_abort_magic(tc->flags & (~0xF));
- return NULL;
- }
-
- if (tc->flags & TALLOC_FLAG_FREE) {
- talloc_log("talloc: double free error - first free may be at %s\n", tc->name);
- talloc_abort_double_free();
- return NULL;
- } else {
- talloc_abort_unknown_value();
- return NULL;
- }
- }
- return tc;
-}
-
-/* hook into the front of the list */
-#define _TLIST_ADD(list, p) \
-do { \
- if (!(list)) { \
- (list) = (p); \
- (p)->next = (p)->prev = NULL; \
- } else { \
- (list)->prev = (p); \
- (p)->next = (list); \
- (p)->prev = NULL; \
- (list) = (p); \
- }\
-} while (0)
-
-/* remove an element from a list - element doesn't have to be in list. */
-#define _TLIST_REMOVE(list, p) \
-do { \
- if ((p) == (list)) { \
- (list) = (p)->next; \
- if (list) (list)->prev = NULL; \
- } else { \
- if ((p)->prev) (p)->prev->next = (p)->next; \
- if ((p)->next) (p)->next->prev = (p)->prev; \
- } \
- if ((p) && ((p) != (list))) (p)->next = (p)->prev = NULL; \
-} while (0)
-
-
-/*
- return the parent chunk of a pointer
-*/
-static INLINE struct talloc_chunk *talloc_parent_chunk(const void *ptr)
-{
- struct talloc_chunk *tc;
-
- if (unlikely(ptr == NULL)) {
- return NULL;
- }
-
- tc = talloc_chunk_from_ptr(ptr);
- while (tc->prev) tc=tc->prev;
-
- return tc->parent;
-}
-
-void *talloc_parent(const void *ptr)
-{
- struct talloc_chunk *tc = talloc_parent_chunk(ptr);
- return tc? TC_PTR_FROM_CHUNK(tc) : NULL;
-}
-
-/*
- find parents name
-*/
-const char *talloc_parent_name(const void *ptr)
-{
- struct talloc_chunk *tc = talloc_parent_chunk(ptr);
- return tc? tc->name : NULL;
-}
-
-/*
- A pool carries an in-pool object count count in the first 16 bytes.
- bytes. This is done to support talloc_steal() to a parent outside of the
- pool. The count includes the pool itself, so a talloc_free() on a pool will
- only destroy the pool if the count has dropped to zero. A talloc_free() of a
- pool member will reduce the count, and eventually also call free(3) on the
- pool memory.
-
- The object count is not put into "struct talloc_chunk" because it is only
- relevant for talloc pools and the alignment to 16 bytes would increase the
- memory footprint of each talloc chunk by those 16 bytes.
-*/
-
-#define TALLOC_POOL_HDR_SIZE 16
-
-static unsigned int *talloc_pool_objectcount(struct talloc_chunk *tc)
-{
- return (unsigned int *)((char *)tc + sizeof(struct talloc_chunk));
-}
-
-/*
- Allocate from a pool
-*/
-
-static struct talloc_chunk *talloc_alloc_pool(struct talloc_chunk *parent,
- size_t size)
-{
- struct talloc_chunk *pool_ctx = NULL;
- size_t space_left;
- struct talloc_chunk *result;
- size_t chunk_size;
-
- if (parent == NULL) {
- return NULL;
- }
-
- if (parent->flags & TALLOC_FLAG_POOL) {
- pool_ctx = parent;
- }
- else if (parent->flags & TALLOC_FLAG_POOLMEM) {
- pool_ctx = (struct talloc_chunk *)parent->pool;
- }
-
- if (pool_ctx == NULL) {
- return NULL;
- }
-
- space_left = ((char *)pool_ctx + TC_HDR_SIZE + pool_ctx->size)
- - ((char *)pool_ctx->pool);
-
- /*
- * Align size to 16 bytes
- */
- chunk_size = ((size + 15) & ~15);
-
- if (space_left < chunk_size) {
- return NULL;
- }
-
- result = (struct talloc_chunk *)pool_ctx->pool;
-
-#if defined(DEVELOPER) && defined(VALGRIND_MAKE_MEM_UNDEFINED)
- VALGRIND_MAKE_MEM_UNDEFINED(result, size);
-#endif
-
- pool_ctx->pool = (void *)((char *)result + chunk_size);
-
- result->flags = TALLOC_MAGIC | TALLOC_FLAG_POOLMEM;
- result->pool = pool_ctx;
-
- *talloc_pool_objectcount(pool_ctx) += 1;
-
- return result;
-}
-
-/*
- Allocate a bit of memory as a child of an existing pointer
-*/
-static INLINE void *__talloc(const void *context, size_t size)
-{
- struct talloc_chunk *tc = NULL;
-
- if (unlikely(context == NULL)) {
- context = null_context;
- }
-
- if (unlikely(size >= MAX_TALLOC_SIZE)) {
- return NULL;
- }
-
- if (context != NULL) {
- tc = talloc_alloc_pool(talloc_chunk_from_ptr(context),
- TC_HDR_SIZE+size);
- }
-
- if (tc == NULL) {
- tc = (struct talloc_chunk *)malloc(TC_HDR_SIZE+size);
- if (unlikely(tc == NULL)) return NULL;
- tc->flags = TALLOC_MAGIC;
- tc->pool = NULL;
- }
-
- tc->size = size;
- tc->destructor = NULL;
- tc->child = NULL;
- tc->name = NULL;
- tc->refs = NULL;
-
- if (likely(context)) {
- struct talloc_chunk *parent = talloc_chunk_from_ptr(context);
-
- if (parent->child) {
- parent->child->parent = NULL;
- tc->next = parent->child;
- tc->next->prev = tc;
- } else {
- tc->next = NULL;
- }
- tc->parent = parent;
- tc->prev = NULL;
- parent->child = tc;
- } else {
- tc->next = tc->prev = tc->parent = NULL;
- }
-
- return TC_PTR_FROM_CHUNK(tc);
-}
-
-/*
- * Create a talloc pool
- */
-
-void *talloc_pool(const void *context, size_t size)
-{
- void *result = __talloc(context, size + TALLOC_POOL_HDR_SIZE);
- struct talloc_chunk *tc;
-
- if (unlikely(result == NULL)) {
- return NULL;
- }
-
- tc = talloc_chunk_from_ptr(result);
-
- tc->flags |= TALLOC_FLAG_POOL;
- tc->pool = (char *)result + TALLOC_POOL_HDR_SIZE;
-
- *talloc_pool_objectcount(tc) = 1;
-
-#if defined(DEVELOPER) && defined(VALGRIND_MAKE_MEM_NOACCESS)
- VALGRIND_MAKE_MEM_NOACCESS(tc->pool, size);
-#endif
-
- return result;
-}
-
-/*
- setup a destructor to be called on free of a pointer
- the destructor should return 0 on success, or -1 on failure.
- if the destructor fails then the free is failed, and the memory can
- be continued to be used
-*/
-void _talloc_set_destructor(const void *ptr, int (*destructor)(void *))
-{
- struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr);
- tc->destructor = destructor;
-}
-
-/*
- increase the reference count on a piece of memory.
-*/
-int talloc_increase_ref_count(const void *ptr)
-{
- if (unlikely(!talloc_reference(null_context, ptr))) {
- return -1;
- }
- return 0;
-}
-
-/*
- helper for talloc_reference()
-
- this is referenced by a function pointer and should not be inline
-*/
-static int talloc_reference_destructor(struct talloc_reference_handle *handle)
-{
- struct talloc_chunk *ptr_tc = talloc_chunk_from_ptr(handle->ptr);
- _TLIST_REMOVE(ptr_tc->refs, handle);
- return 0;
-}
-
-/*
- more efficient way to add a name to a pointer - the name must point to a
- true string constant
-*/
-static INLINE void _talloc_set_name_const(const void *ptr, const char *name)
-{
- struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr);
- tc->name = name;
-}
-
-/*
- internal talloc_named_const()
-*/
-static INLINE void *_talloc_named_const(const void *context, size_t size, const char *name)
-{
- void *ptr;
-
- ptr = __talloc(context, size);
- if (unlikely(ptr == NULL)) {
- return NULL;
- }
-
- _talloc_set_name_const(ptr, name);
-
- return ptr;
-}
-
-/*
- make a secondary reference to a pointer, hanging off the given context.
- the pointer remains valid until both the original caller and this given
- context are freed.
-
- the major use for this is when two different structures need to reference the
- same underlying data, and you want to be able to free the two instances separately,
- and in either order
-*/
-void *_talloc_reference_loc(const void *context, const void *ptr, const char *location)
-{
- struct talloc_chunk *tc;
- struct talloc_reference_handle *handle;
- if (unlikely(ptr == NULL)) return NULL;
-
- tc = talloc_chunk_from_ptr(ptr);
- handle = (struct talloc_reference_handle *)_talloc_named_const(context,
- sizeof(struct talloc_reference_handle),
- TALLOC_MAGIC_REFERENCE);
- if (unlikely(handle == NULL)) return NULL;
-
- /* note that we hang the destructor off the handle, not the
- main context as that allows the caller to still setup their
- own destructor on the context if they want to */
- talloc_set_destructor(handle, talloc_reference_destructor);
- handle->ptr = discard_const_p(void, ptr);
- handle->location = location;
- _TLIST_ADD(tc->refs, handle);
- return handle->ptr;
-}
-
-static void *_talloc_steal_internal(const void *new_ctx, const void *ptr);
-
-/*
- internal talloc_free call
-*/
-static INLINE int _talloc_free_internal(void *ptr, const char *location)
-{
- struct talloc_chunk *tc;
-
- if (unlikely(ptr == NULL)) {
- return -1;
- }
-
- tc = talloc_chunk_from_ptr(ptr);
-
- if (unlikely(tc->refs)) {
- int is_child;
- /* check this is a reference from a child or grantchild
- * back to it's parent or grantparent
- *
- * in that case we need to remove the reference and
- * call another instance of talloc_free() on the current
- * pointer.
- */
- is_child = talloc_is_parent(tc->refs, ptr);
- _talloc_free_internal(tc->refs, location);
- if (is_child) {
- return _talloc_free_internal(ptr, location);
- }
- return -1;
- }
-
- if (unlikely(tc->flags & TALLOC_FLAG_LOOP)) {
- /* we have a free loop - stop looping */
- return 0;
- }
-
- if (unlikely(tc->destructor)) {
- talloc_destructor_t d = tc->destructor;
- if (d == (talloc_destructor_t)-1) {
- return -1;
- }
- tc->destructor = (talloc_destructor_t)-1;
- if (d(ptr) == -1) {
- tc->destructor = d;
- return -1;
- }
- tc->destructor = NULL;
- }
-
- if (tc->parent) {
- _TLIST_REMOVE(tc->parent->child, tc);
- if (tc->parent->child) {
- tc->parent->child->parent = tc->parent;
- }
- } else {
- if (tc->prev) tc->prev->next = tc->next;
- if (tc->next) tc->next->prev = tc->prev;
- }
-
- tc->flags |= TALLOC_FLAG_LOOP;
-
- while (tc->child) {
- /* we need to work out who will own an abandoned child
- if it cannot be freed. In priority order, the first
- choice is owner of any remaining reference to this
- pointer, the second choice is our parent, and the
- final choice is the null context. */
- void *child = TC_PTR_FROM_CHUNK(tc->child);
- const void *new_parent = null_context;
- if (unlikely(tc->child->refs)) {
- struct talloc_chunk *p = talloc_parent_chunk(tc->child->refs);
- if (p) new_parent = TC_PTR_FROM_CHUNK(p);
- }
- if (unlikely(_talloc_free_internal(child, location) == -1)) {
- if (new_parent == null_context) {
- struct talloc_chunk *p = talloc_parent_chunk(ptr);
- if (p) new_parent = TC_PTR_FROM_CHUNK(p);
- }
- _talloc_steal_internal(new_parent, child);
- }
- }
-
- tc->flags |= TALLOC_FLAG_FREE;
-
- /* we mark the freed memory with where we called the free
- * from. This means on a double free error we can report where
- * the first free came from
- */
- tc->name = location;
-
- if (tc->flags & (TALLOC_FLAG_POOL|TALLOC_FLAG_POOLMEM)) {
- struct talloc_chunk *pool;
- unsigned int *pool_object_count;
-
- pool = (tc->flags & TALLOC_FLAG_POOL)
- ? tc : (struct talloc_chunk *)tc->pool;
-
- pool_object_count = talloc_pool_objectcount(pool);
-
- if (*pool_object_count == 0) {
- talloc_abort("Pool object count zero!");
- return 0;
- }
-
- *pool_object_count -= 1;
-
- if (*pool_object_count == 0) {
- free(pool);
- }
- }
- else {
- free(tc);
- }
- return 0;
-}
-
-/*
- move a lump of memory from one talloc context to another return the
- ptr on success, or NULL if it could not be transferred.
- passing NULL as ptr will always return NULL with no side effects.
-*/
-static void *_talloc_steal_internal(const void *new_ctx, const void *ptr)
-{
- struct talloc_chunk *tc, *new_tc;
-
- if (unlikely(!ptr)) {
- return NULL;
- }
-
- if (unlikely(new_ctx == NULL)) {
- new_ctx = null_context;
- }
-
- tc = talloc_chunk_from_ptr(ptr);
-
- if (unlikely(new_ctx == NULL)) {
- if (tc->parent) {
- _TLIST_REMOVE(tc->parent->child, tc);
- if (tc->parent->child) {
- tc->parent->child->parent = tc->parent;
- }
- } else {
- if (tc->prev) tc->prev->next = tc->next;
- if (tc->next) tc->next->prev = tc->prev;
- }
-
- tc->parent = tc->next = tc->prev = NULL;
- return discard_const_p(void, ptr);
- }
-
- new_tc = talloc_chunk_from_ptr(new_ctx);
-
- if (unlikely(tc == new_tc || tc->parent == new_tc)) {
- return discard_const_p(void, ptr);
- }
-
- if (tc->parent) {
- _TLIST_REMOVE(tc->parent->child, tc);
- if (tc->parent->child) {
- tc->parent->child->parent = tc->parent;
- }
- } else {
- if (tc->prev) tc->prev->next = tc->next;
- if (tc->next) tc->next->prev = tc->prev;
- }
-
- tc->parent = new_tc;
- if (new_tc->child) new_tc->child->parent = NULL;
- _TLIST_ADD(new_tc->child, tc);
-
- return discard_const_p(void, ptr);
-}
-
-/*
- move a lump of memory from one talloc context to another return the
- ptr on success, or NULL if it could not be transferred.
- passing NULL as ptr will always return NULL with no side effects.
-*/
-void *_talloc_steal_loc(const void *new_ctx, const void *ptr, const char *location)
-{
- struct talloc_chunk *tc;
-
- if (unlikely(ptr == NULL)) {
- return NULL;
- }
-
- tc = talloc_chunk_from_ptr(ptr);
-
- if (unlikely(tc->refs != NULL) && talloc_parent(ptr) != new_ctx) {
- struct talloc_reference_handle *h;
-
- talloc_log("WARNING: talloc_steal with references at %s\n",
- location);
-
- for (h=tc->refs; h; h=h->next) {
- talloc_log("\treference at %s\n",
- h->location);
- }
- }
-
- return _talloc_steal_internal(new_ctx, ptr);
-}
-
-/*
- this is like a talloc_steal(), but you must supply the old
- parent. This resolves the ambiguity in a talloc_steal() which is
- called on a context that has more than one parent (via references)
-
- The old parent can be either a reference or a parent
-*/
-void *talloc_reparent(const void *old_parent, const void *new_parent, const void *ptr)
-{
- struct talloc_chunk *tc;
- struct talloc_reference_handle *h;
-
- if (unlikely(ptr == NULL)) {
- return NULL;
- }
-
- if (old_parent == talloc_parent(ptr)) {
- return _talloc_steal_internal(new_parent, ptr);
- }
-
- tc = talloc_chunk_from_ptr(ptr);
- for (h=tc->refs;h;h=h->next) {
- if (talloc_parent(h) == old_parent) {
- if (_talloc_steal_internal(new_parent, h) != h) {
- return NULL;
- }
- return discard_const_p(void, ptr);
- }
- }
-
- /* it wasn't a parent */
- return NULL;
-}
-
-/*
- remove a secondary reference to a pointer. This undo's what
- talloc_reference() has done. The context and pointer arguments
- must match those given to a talloc_reference()
-*/
-static INLINE int talloc_unreference(const void *context, const void *ptr)
-{
- struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr);
- struct talloc_reference_handle *h;
-
- if (unlikely(context == NULL)) {
- context = null_context;
- }
-
- for (h=tc->refs;h;h=h->next) {
- struct talloc_chunk *p = talloc_parent_chunk(h);
- if (p == NULL) {
- if (context == NULL) break;
- } else if (TC_PTR_FROM_CHUNK(p) == context) {
- break;
- }
- }
- if (h == NULL) {
- return -1;
- }
-
- return _talloc_free_internal(h, __location__);
-}
-
-/*
- remove a specific parent context from a pointer. This is a more
- controlled varient of talloc_free()
-*/
-int talloc_unlink(const void *context, void *ptr)
-{
- struct talloc_chunk *tc_p, *new_p;
- void *new_parent;
-
- if (ptr == NULL) {
- return -1;
- }
-
- if (context == NULL) {
- context = null_context;
- }
-
- if (talloc_unreference(context, ptr) == 0) {
- return 0;
- }
-
- if (context == NULL) {
- if (talloc_parent_chunk(ptr) != NULL) {
- return -1;
- }
- } else {
- if (talloc_chunk_from_ptr(context) != talloc_parent_chunk(ptr)) {
- return -1;
- }
- }
-
- tc_p = talloc_chunk_from_ptr(ptr);
-
- if (tc_p->refs == NULL) {
- return _talloc_free_internal(ptr, __location__);
- }
-
- new_p = talloc_parent_chunk(tc_p->refs);
- if (new_p) {
- new_parent = TC_PTR_FROM_CHUNK(new_p);
- } else {
- new_parent = NULL;
- }
-
- if (talloc_unreference(new_parent, ptr) != 0) {
- return -1;
- }
-
- _talloc_steal_internal(new_parent, ptr);
-
- return 0;
-}
-
-/*
- add a name to an existing pointer - va_list version
-*/
-static INLINE const char *talloc_set_name_v(const void *ptr, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(2,0);
-
-static INLINE const char *talloc_set_name_v(const void *ptr, const char *fmt, va_list ap)
-{
- struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr);
- tc->name = talloc_vasprintf(ptr, fmt, ap);
- if (likely(tc->name)) {
- _talloc_set_name_const(tc->name, ".name");
- }
- return tc->name;
-}
-
-/*
- add a name to an existing pointer
-*/
-const char *talloc_set_name(const void *ptr, const char *fmt, ...)
-{
- const char *name;
- va_list ap;
- va_start(ap, fmt);
- name = talloc_set_name_v(ptr, fmt, ap);
- va_end(ap);
- return name;
-}
-
-
-/*
- create a named talloc pointer. Any talloc pointer can be named, and
- talloc_named() operates just like talloc() except that it allows you
- to name the pointer.
-*/
-void *talloc_named(const void *context, size_t size, const char *fmt, ...)
-{
- va_list ap;
- void *ptr;
- const char *name;
-
- ptr = __talloc(context, size);
- if (unlikely(ptr == NULL)) return NULL;
-
- va_start(ap, fmt);
- name = talloc_set_name_v(ptr, fmt, ap);
- va_end(ap);
-
- if (unlikely(name == NULL)) {
- _talloc_free_internal(ptr, __location__);
- return NULL;
- }
-
- return ptr;
-}
-
-/*
- return the name of a talloc ptr, or "UNNAMED"
-*/
-const char *talloc_get_name(const void *ptr)
-{
- struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr);
- if (unlikely(tc->name == TALLOC_MAGIC_REFERENCE)) {
- return ".reference";
- }
- if (likely(tc->name)) {
- return tc->name;
- }
- return "UNNAMED";
-}
-
-
-/*
- check if a pointer has the given name. If it does, return the pointer,
- otherwise return NULL
-*/
-void *talloc_check_name(const void *ptr, const char *name)
-{
- const char *pname;
- if (unlikely(ptr == NULL)) return NULL;
- pname = talloc_get_name(ptr);
- if (likely(pname == name || strcmp(pname, name) == 0)) {
- return discard_const_p(void, ptr);
- }
- return NULL;
-}
-
-static void talloc_abort_type_missmatch(const char *location,
- const char *name,
- const char *expected)
-{
- const char *reason;
-
- reason = talloc_asprintf(NULL,
- "%s: Type mismatch: name[%s] expected[%s]",
- location,
- name?name:"NULL",
- expected);
- if (!reason) {
- reason = "Type mismatch";
- }
-
- talloc_abort(reason);
-}
-
-void *_talloc_get_type_abort(const void *ptr, const char *name, const char *location)
-{
- const char *pname;
-
- if (unlikely(ptr == NULL)) {
- talloc_abort_type_missmatch(location, NULL, name);
- return NULL;
- }
-
- pname = talloc_get_name(ptr);
- if (likely(pname == name || strcmp(pname, name) == 0)) {
- return discard_const_p(void, ptr);
- }
-
- talloc_abort_type_missmatch(location, pname, name);
- return NULL;
-}
-
-/*
- this is for compatibility with older versions of talloc
-*/
-void *talloc_init(const char *fmt, ...)
-{
- va_list ap;
- void *ptr;
- const char *name;
-
- /*
- * samba3 expects talloc_report_depth_cb(NULL, ...)
- * reports all talloc'ed memory, so we need to enable
- * null_tracking
- */
- talloc_enable_null_tracking();
-
- ptr = __talloc(NULL, 0);
- if (unlikely(ptr == NULL)) return NULL;
-
- va_start(ap, fmt);
- name = talloc_set_name_v(ptr, fmt, ap);
- va_end(ap);
-
- if (unlikely(name == NULL)) {
- _talloc_free_internal(ptr, __location__);
- return NULL;
- }
-
- return ptr;
-}
-
-/*
- this is a replacement for the Samba3 talloc_destroy_pool functionality. It
- should probably not be used in new code. It's in here to keep the talloc
- code consistent across Samba 3 and 4.
-*/
-void talloc_free_children(void *ptr)
-{
- struct talloc_chunk *tc;
-
- if (unlikely(ptr == NULL)) {
- return;
- }
-
- tc = talloc_chunk_from_ptr(ptr);
-
- while (tc->child) {
- /* we need to work out who will own an abandoned child
- if it cannot be freed. In priority order, the first
- choice is owner of any remaining reference to this
- pointer, the second choice is our parent, and the
- final choice is the null context. */
- void *child = TC_PTR_FROM_CHUNK(tc->child);
- const void *new_parent = null_context;
- if (unlikely(tc->child->refs)) {
- struct talloc_chunk *p = talloc_parent_chunk(tc->child->refs);
- if (p) new_parent = TC_PTR_FROM_CHUNK(p);
- }
- if (unlikely(talloc_free(child) == -1)) {
- if (new_parent == null_context) {
- struct talloc_chunk *p = talloc_parent_chunk(ptr);
- if (p) new_parent = TC_PTR_FROM_CHUNK(p);
- }
- _talloc_steal_internal(new_parent, child);
- }
- }
-
- if ((tc->flags & TALLOC_FLAG_POOL)
- && (*talloc_pool_objectcount(tc) == 1)) {
- tc->pool = ((char *)tc + TC_HDR_SIZE + TALLOC_POOL_HDR_SIZE);
-#if defined(DEVELOPER) && defined(VALGRIND_MAKE_MEM_NOACCESS)
- VALGRIND_MAKE_MEM_NOACCESS(
- tc->pool, tc->size - TALLOC_POOL_HDR_SIZE);
-#endif
- }
-}
-
-/*
- Allocate a bit of memory as a child of an existing pointer
-*/
-void *_talloc(const void *context, size_t size)
-{
- return __talloc(context, size);
-}
-
-/*
- externally callable talloc_set_name_const()
-*/
-void talloc_set_name_const(const void *ptr, const char *name)
-{
- _talloc_set_name_const(ptr, name);
-}
-
-/*
- create a named talloc pointer. Any talloc pointer can be named, and
- talloc_named() operates just like talloc() except that it allows you
- to name the pointer.
-*/
-void *talloc_named_const(const void *context, size_t size, const char *name)
-{
- return _talloc_named_const(context, size, name);
-}
-
-/*
- free a talloc pointer. This also frees all child pointers of this
- pointer recursively
-
- return 0 if the memory is actually freed, otherwise -1. The memory
- will not be freed if the ref_count is > 1 or the destructor (if
- any) returns non-zero
-*/
-int _talloc_free(void *ptr, const char *location)
-{
- struct talloc_chunk *tc;
-
- if (unlikely(ptr == NULL)) {
- return -1;
- }
-
- tc = talloc_chunk_from_ptr(ptr);
-
- if (unlikely(tc->refs != NULL)) {
- struct talloc_reference_handle *h;
-
- talloc_log("ERROR: talloc_free with references at %s\n",
- location);
-
- for (h=tc->refs; h; h=h->next) {
- talloc_log("\treference at %s\n",
- h->location);
- }
- return -1;
- }
-
- return _talloc_free_internal(ptr, location);
-}
-
-
-static INLINE size_t min_size(size_t a, size_t b)
-{
- return a > b ? b : a;
-}
-
-/*
- A talloc version of realloc. The context argument is only used if
- ptr is NULL
-*/
-void *_talloc_realloc(const void *context, void *ptr, size_t size, const char *name)
-{
- struct talloc_chunk *tc;
- void *new_ptr;
- int malloced = 0;
-
- /* size zero is equivalent to free() */
- if (unlikely(size == 0)) {
- talloc_unlink(context, ptr);
- return NULL;
- }
-
- if (unlikely(size >= MAX_TALLOC_SIZE)) {
- return NULL;
- }
-
- /* realloc(NULL) is equivalent to malloc() */
- if (ptr == NULL) {
- return _talloc_named_const(context, size, name);
- }
-
- tc = talloc_chunk_from_ptr(ptr);
-
- /* don't allow realloc on referenced pointers */
- if (unlikely(tc->refs)) {
- return NULL;
- }
-
- /* don't let anybody try to realloc a talloc_pool */
- if (unlikely(tc->flags & TALLOC_FLAG_POOL)) {
- return NULL;
- }
-
- /* don't shrink if we have less than 1k to gain */
- if ((size < tc->size) && ((tc->size - size) < 1024)) {
- tc->size = size;
- return ptr;
- }
-
- /* by resetting magic we catch users of the old memory */
- tc->flags |= TALLOC_FLAG_FREE;
-
-#if ALWAYS_REALLOC
- new_ptr = malloc(size + TC_HDR_SIZE);
- if (new_ptr) {
- memcpy(new_ptr, tc, tc->size + TC_HDR_SIZE);
- free(tc);
- }
-#else
- if (tc->flags & TALLOC_FLAG_POOLMEM) {
-
- new_ptr = talloc_alloc_pool(tc, size + TC_HDR_SIZE);
- *talloc_pool_objectcount((struct talloc_chunk *)
- (tc->pool)) -= 1;
-
- if (new_ptr == NULL) {
- new_ptr = malloc(TC_HDR_SIZE+size);
- malloced = 1;
- }
-
- if (new_ptr) {
- memcpy(new_ptr, tc, min_size(tc->size,size) + TC_HDR_SIZE);
- }
- }
- else {
- new_ptr = realloc(tc, size + TC_HDR_SIZE);
- }
-#endif
- if (unlikely(!new_ptr)) {
- tc->flags &= ~TALLOC_FLAG_FREE;
- return NULL;
- }
-
- tc = (struct talloc_chunk *)new_ptr;
- tc->flags &= ~TALLOC_FLAG_FREE;
- if (malloced) {
- tc->flags &= ~TALLOC_FLAG_POOLMEM;
- }
- if (tc->parent) {
- tc->parent->child = tc;
- }
- if (tc->child) {
- tc->child->parent = tc;
- }
-
- if (tc->prev) {
- tc->prev->next = tc;
- }
- if (tc->next) {
- tc->next->prev = tc;
- }
-
- tc->size = size;
- _talloc_set_name_const(TC_PTR_FROM_CHUNK(tc), name);
-
- return TC_PTR_FROM_CHUNK(tc);
-}
-
-/*
- a wrapper around talloc_steal() for situations where you are moving a pointer
- between two structures, and want the old pointer to be set to NULL
-*/
-void *_talloc_move(const void *new_ctx, const void *_pptr)
-{
- const void **pptr = discard_const_p(const void *,_pptr);
- void *ret = talloc_steal(new_ctx, discard_const_p(void, *pptr));
- (*pptr) = NULL;
- return ret;
-}
-
-/*
- return the total size of a talloc pool (subtree)
-*/
-size_t talloc_total_size(const void *ptr)
-{
- size_t total = 0;
- struct talloc_chunk *c, *tc;
-
- if (ptr == NULL) {
- ptr = null_context;
- }
- if (ptr == NULL) {
- return 0;
- }
-
- tc = talloc_chunk_from_ptr(ptr);
-
- if (tc->flags & TALLOC_FLAG_LOOP) {
- return 0;
- }
-
- tc->flags |= TALLOC_FLAG_LOOP;
-
- if (likely(tc->name != TALLOC_MAGIC_REFERENCE)) {
- total = tc->size;
- }
- for (c=tc->child;c;c=c->next) {
- total += talloc_total_size(TC_PTR_FROM_CHUNK(c));
- }
-
- tc->flags &= ~TALLOC_FLAG_LOOP;
-
- return total;
-}
-
-/*
- return the total number of blocks in a talloc pool (subtree)
-*/
-size_t talloc_total_blocks(const void *ptr)
-{
- size_t total = 0;
- struct talloc_chunk *c, *tc;
-
- if (ptr == NULL) {
- ptr = null_context;
- }
- if (ptr == NULL) {
- return 0;
- }
-
- tc = talloc_chunk_from_ptr(ptr);
-
- if (tc->flags & TALLOC_FLAG_LOOP) {
- return 0;
- }
-
- tc->flags |= TALLOC_FLAG_LOOP;
-
- total++;
- for (c=tc->child;c;c=c->next) {
- total += talloc_total_blocks(TC_PTR_FROM_CHUNK(c));
- }
-
- tc->flags &= ~TALLOC_FLAG_LOOP;
-
- return total;
-}
-
-/*
- return the number of external references to a pointer
-*/
-size_t talloc_reference_count(const void *ptr)
-{
- struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr);
- struct talloc_reference_handle *h;
- size_t ret = 0;
-
- for (h=tc->refs;h;h=h->next) {
- ret++;
- }
- return ret;
-}
-
-/*
- report on memory usage by all children of a pointer, giving a full tree view
-*/
-void talloc_report_depth_cb(const void *ptr, int depth, int max_depth,
- void (*callback)(const void *ptr,
- int depth, int max_depth,
- int is_ref,
- void *private_data),
- void *private_data)
-{
- struct talloc_chunk *c, *tc;
-
- if (ptr == NULL) {
- ptr = null_context;
- }
- if (ptr == NULL) return;
-
- tc = talloc_chunk_from_ptr(ptr);
-
- if (tc->flags & TALLOC_FLAG_LOOP) {
- return;
- }
-
- callback(ptr, depth, max_depth, 0, private_data);
-
- if (max_depth >= 0 && depth >= max_depth) {
- return;
- }
-
- tc->flags |= TALLOC_FLAG_LOOP;
- for (c=tc->child;c;c=c->next) {
- if (c->name == TALLOC_MAGIC_REFERENCE) {
- struct talloc_reference_handle *h = (struct talloc_reference_handle *)TC_PTR_FROM_CHUNK(c);
- callback(h->ptr, depth + 1, max_depth, 1, private_data);
- } else {
- talloc_report_depth_cb(TC_PTR_FROM_CHUNK(c), depth + 1, max_depth, callback, private_data);
- }
- }
- tc->flags &= ~TALLOC_FLAG_LOOP;
-}
-
-static void talloc_report_depth_FILE_helper(const void *ptr, int depth, int max_depth, int is_ref, void *_f)
-{
- const char *name = talloc_get_name(ptr);
- FILE *f = (FILE *)_f;
-
- if (is_ref) {
- fprintf(f, "%*sreference to: %s\n", depth*4, "", name);
- return;
- }
-
- if (depth == 0) {
- fprintf(f,"%stalloc report on '%s' (total %6lu bytes in %3lu blocks)\n",
- (max_depth < 0 ? "full " :""), name,
- (unsigned long)talloc_total_size(ptr),
- (unsigned long)talloc_total_blocks(ptr));
- return;
- }
-
- fprintf(f, "%*s%-30s contains %6lu bytes in %3lu blocks (ref %d) %p\n",
- depth*4, "",
- name,
- (unsigned long)talloc_total_size(ptr),
- (unsigned long)talloc_total_blocks(ptr),
- (int)talloc_reference_count(ptr), ptr);
-
-#if 0
- fprintf(f, "content: ");
- if (talloc_total_size(ptr)) {
- int tot = talloc_total_size(ptr);
- int i;
-
- for (i = 0; i < tot; i++) {
- if ((((char *)ptr)[i] > 31) && (((char *)ptr)[i] < 126)) {
- fprintf(f, "%c", ((char *)ptr)[i]);
- } else {
- fprintf(f, "~%02x", ((char *)ptr)[i]);
- }
- }
- }
- fprintf(f, "\n");
-#endif
-}
-
-/*
- report on memory usage by all children of a pointer, giving a full tree view
-*/
-void talloc_report_depth_file(const void *ptr, int depth, int max_depth, FILE *f)
-{
- if (f) {
- talloc_report_depth_cb(ptr, depth, max_depth, talloc_report_depth_FILE_helper, f);
- fflush(f);
- }
-}
-
-/*
- report on memory usage by all children of a pointer, giving a full tree view
-*/
-void talloc_report_full(const void *ptr, FILE *f)
-{
- talloc_report_depth_file(ptr, 0, -1, f);
-}
-
-/*
- report on memory usage by all children of a pointer
-*/
-void talloc_report(const void *ptr, FILE *f)
-{
- talloc_report_depth_file(ptr, 0, 1, f);
-}
-
-/*
- report on any memory hanging off the null context
-*/
-static void talloc_report_null(void)
-{
- if (talloc_total_size(null_context) != 0) {
- talloc_report(null_context, stderr);
- }
-}
-
-/*
- report on any memory hanging off the null context
-*/
-static void talloc_report_null_full(void)
-{
- if (talloc_total_size(null_context) != 0) {
- talloc_report_full(null_context, stderr);
- }
-}
-
-/*
- enable tracking of the NULL context
-*/
-void talloc_enable_null_tracking(void)
-{
- if (null_context == NULL) {
- null_context = _talloc_named_const(NULL, 0, "null_context");
- if (autofree_context != NULL) {
- talloc_reparent(NULL, null_context, autofree_context);
- }
- }
-}
-
-/*
- enable tracking of the NULL context, not moving the autofree context
- into the NULL context. This is needed for the talloc testsuite
-*/
-void talloc_enable_null_tracking_no_autofree(void)
-{
- if (null_context == NULL) {
- null_context = _talloc_named_const(NULL, 0, "null_context");
- }
-}
-
-/*
- disable tracking of the NULL context
-*/
-void talloc_disable_null_tracking(void)
-{
- if (null_context != NULL) {
- /* we have to move any children onto the real NULL
- context */
- struct talloc_chunk *tc, *tc2;
- tc = talloc_chunk_from_ptr(null_context);
- for (tc2 = tc->child; tc2; tc2=tc2->next) {
- if (tc2->parent == tc) tc2->parent = NULL;
- if (tc2->prev == tc) tc2->prev = NULL;
- }
- for (tc2 = tc->next; tc2; tc2=tc2->next) {
- if (tc2->parent == tc) tc2->parent = NULL;
- if (tc2->prev == tc) tc2->prev = NULL;
- }
- tc->child = NULL;
- tc->next = NULL;
- }
- talloc_free(null_context);
- null_context = NULL;
-}
-
-/*
- enable leak reporting on exit
-*/
-void talloc_enable_leak_report(void)
-{
- talloc_enable_null_tracking();
- atexit(talloc_report_null);
-}
-
-/*
- enable full leak reporting on exit
-*/
-void talloc_enable_leak_report_full(void)
-{
- talloc_enable_null_tracking();
- atexit(talloc_report_null_full);
-}
-
-/*
- talloc and zero memory.
-*/
-void *_talloc_zero(const void *ctx, size_t size, const char *name)
-{
- void *p = _talloc_named_const(ctx, size, name);
-
- if (p) {
- memset(p, '\0', size);
- }
-
- return p;
-}
-
-/*
- memdup with a talloc.
-*/
-void *_talloc_memdup(const void *t, const void *p, size_t size, const char *name)
-{
- void *newp = _talloc_named_const(t, size, name);
-
- if (likely(newp)) {
- memcpy(newp, p, size);
- }
-
- return newp;
-}
-
-static INLINE char *__talloc_strlendup(const void *t, const char *p, size_t len)
-{
- char *ret;
-
- ret = (char *)__talloc(t, len + 1);
- if (unlikely(!ret)) return NULL;
-
- memcpy(ret, p, len);
- ret[len] = 0;
-
- _talloc_set_name_const(ret, ret);
- return ret;
-}
-
-/*
- strdup with a talloc
-*/
-char *talloc_strdup(const void *t, const char *p)
-{
- if (unlikely(!p)) return NULL;
- return __talloc_strlendup(t, p, strlen(p));
-}
-
-#ifndef HAVE_STRNLEN
-#define strnlen rep_strnlen
-static size_t rep_strnlen(const char* s, size_t n)
-{
- if (unlikely(!s)) return 0;
- int i = 0;
- while (i < n && *s++ != '\0')
- ++i;
- return i;
-}
-#endif
-
-/*
- strndup with a talloc
-*/
-char *talloc_strndup(const void *t, const char *p, size_t n)
-{
- if (unlikely(!p)) return NULL;
- return __talloc_strlendup(t, p, strnlen(p, n));
-}
-
-static INLINE char *__talloc_strlendup_append(char *s, size_t slen,
- const char *a, size_t alen)
-{
- char *ret;
-
- ret = talloc_realloc(NULL, s, char, slen + alen + 1);
- if (unlikely(!ret)) return NULL;
-
- /* append the string and the trailing \0 */
- memcpy(&ret[slen], a, alen);
- ret[slen+alen] = 0;
-
- _talloc_set_name_const(ret, ret);
- return ret;
-}
-
-/*
- * Appends at the end of the string.
- */
-char *talloc_strdup_append(char *s, const char *a)
-{
- if (unlikely(!s)) {
- return talloc_strdup(NULL, a);
- }
-
- if (unlikely(!a)) {
- return s;
- }
-
- return __talloc_strlendup_append(s, strlen(s), a, strlen(a));
-}
-
-/*
- * Appends at the end of the talloc'ed buffer,
- * not the end of the string.
- */
-char *talloc_strdup_append_buffer(char *s, const char *a)
-{
- size_t slen;
-
- if (unlikely(!s)) {
- return talloc_strdup(NULL, a);
- }
-
- if (unlikely(!a)) {
- return s;
- }
-
- slen = talloc_get_size(s);
- if (likely(slen > 0)) {
- slen--;
- }
-
- return __talloc_strlendup_append(s, slen, a, strlen(a));
-}
-
-/*
- * Appends at the end of the string.
- */
-char *talloc_strndup_append(char *s, const char *a, size_t n)
-{
- if (unlikely(!s)) {
- return talloc_strdup(NULL, a);
- }
-
- if (unlikely(!a)) {
- return s;
- }
-
- return __talloc_strlendup_append(s, strlen(s), a, strnlen(a, n));
-}
-
-/*
- * Appends at the end of the talloc'ed buffer,
- * not the end of the string.
- */
-char *talloc_strndup_append_buffer(char *s, const char *a, size_t n)
-{
- size_t slen;
-
- if (unlikely(!s)) {
- return talloc_strdup(NULL, a);
- }
-
- if (unlikely(!a)) {
- return s;
- }
-
- slen = talloc_get_size(s);
- if (likely(slen > 0)) {
- slen--;
- }
-
- return __talloc_strlendup_append(s, slen, a, strnlen(a, n));
-}
-
-#ifndef HAVE_VA_COPY
-#ifdef HAVE___VA_COPY
-#define va_copy(dest, src) __va_copy(dest, src)
-#else
-#define va_copy(dest, src) (dest) = (src)
-#endif
-#endif
-
-char *talloc_vasprintf(const void *t, const char *fmt, va_list ap)
-{
- int len;
- char *ret;
- va_list ap2;
-
- va_copy(ap2, ap);
- len = vsnprintf(NULL, 0, fmt, ap2);
- va_end(ap2);
- if (unlikely(len < 0)) {
- return NULL;
- }
-
- ret = (char *)__talloc(t, len+1);
- if (unlikely(!ret)) return NULL;
-
- va_copy(ap2, ap);
- vsnprintf(ret, len+1, fmt, ap2);
- va_end(ap2);
-
- _talloc_set_name_const(ret, ret);
- return ret;
-}
-
-
-/*
- Perform string formatting, and return a pointer to newly allocated
- memory holding the result, inside a memory pool.
- */
-char *talloc_asprintf(const void *t, const char *fmt, ...)
-{
- va_list ap;
- char *ret;
-
- va_start(ap, fmt);
- ret = talloc_vasprintf(t, fmt, ap);
- va_end(ap);
- return ret;
-}
-
-static INLINE char *__talloc_vaslenprintf_append(char *s, size_t slen,
- const char *fmt, va_list ap)
- PRINTF_ATTRIBUTE(3,0);
-
-static INLINE char *__talloc_vaslenprintf_append(char *s, size_t slen,
- const char *fmt, va_list ap)
-{
- /* ssize_t isn't present on Windows. */
-#ifndef _MSC_VER
- ssize_t alen;
-#else
- size_t alen;
-#endif
- va_list ap2;
-
- va_copy(ap2, ap);
- alen = vsnprintf(NULL, 0, fmt, ap2);
- va_end(ap2);
-
- if (alen <= 0) {
- /* Either the vsnprintf failed or the format resulted in
- * no characters being formatted. In the former case, we
- * ought to return NULL, in the latter we ought to return
- * the original string. Most current callers of this
- * function expect it to never return NULL.
- */
- return s;
- }
-
- s = talloc_realloc(NULL, s, char, slen + alen + 1);
- if (!s) return NULL;
-
- va_copy(ap2, ap);
- vsnprintf(s + slen, alen + 1, fmt, ap2);
- va_end(ap2);
-
- _talloc_set_name_const(s, s);
- return s;
-}
-
-/**
- * Realloc @p s to append the formatted result of @p fmt and @p ap,
- * and return @p s, which may have moved. Good for gradually
- * accumulating output into a string buffer. Appends at the end
- * of the string.
- **/
-char *talloc_vasprintf_append(char *s, const char *fmt, va_list ap)
-{
- if (unlikely(!s)) {
- return talloc_vasprintf(NULL, fmt, ap);
- }
-
- return __talloc_vaslenprintf_append(s, strlen(s), fmt, ap);
-}
-
-/**
- * Realloc @p s to append the formatted result of @p fmt and @p ap,
- * and return @p s, which may have moved. Always appends at the
- * end of the talloc'ed buffer, not the end of the string.
- **/
-char *talloc_vasprintf_append_buffer(char *s, const char *fmt, va_list ap)
-{
- size_t slen;
-
- if (unlikely(!s)) {
- return talloc_vasprintf(NULL, fmt, ap);
- }
-
- slen = talloc_get_size(s);
- if (likely(slen > 0)) {
- slen--;
- }
-
- return __talloc_vaslenprintf_append(s, slen, fmt, ap);
-}
-
-/*
- Realloc @p s to append the formatted result of @p fmt and return @p
- s, which may have moved. Good for gradually accumulating output
- into a string buffer.
- */
-char *talloc_asprintf_append(char *s, const char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- s = talloc_vasprintf_append(s, fmt, ap);
- va_end(ap);
- return s;
-}
-
-/*
- Realloc @p s to append the formatted result of @p fmt and return @p
- s, which may have moved. Good for gradually accumulating output
- into a buffer.
- */
-char *talloc_asprintf_append_buffer(char *s, const char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- s = talloc_vasprintf_append_buffer(s, fmt, ap);
- va_end(ap);
- return s;
-}
-
-/*
- alloc an array, checking for integer overflow in the array size
-*/
-void *_talloc_array(const void *ctx, size_t el_size, unsigned count, const char *name)
-{
- if (count >= MAX_TALLOC_SIZE/el_size) {
- return NULL;
- }
- return _talloc_named_const(ctx, el_size * count, name);
-}
-
-/*
- alloc an zero array, checking for integer overflow in the array size
-*/
-void *_talloc_zero_array(const void *ctx, size_t el_size, unsigned count, const char *name)
-{
- if (count >= MAX_TALLOC_SIZE/el_size) {
- return NULL;
- }
- return _talloc_zero(ctx, el_size * count, name);
-}
-
-/*
- realloc an array, checking for integer overflow in the array size
-*/
-void *_talloc_realloc_array(const void *ctx, void *ptr, size_t el_size, unsigned count, const char *name)
-{
- if (count >= MAX_TALLOC_SIZE/el_size) {
- return NULL;
- }
- return _talloc_realloc(ctx, ptr, el_size * count, name);
-}
-
-/*
- a function version of talloc_realloc(), so it can be passed as a function pointer
- to libraries that want a realloc function (a realloc function encapsulates
- all the basic capabilities of an allocation library, which is why this is useful)
-*/
-void *talloc_realloc_fn(const void *context, void *ptr, size_t size)
-{
- return _talloc_realloc(context, ptr, size, NULL);
-}
-
-
-static int talloc_autofree_destructor(void *ptr)
-{
- autofree_context = NULL;
- return 0;
-}
-
-static void talloc_autofree(void)
-{
- talloc_free(autofree_context);
-}
-
-/*
- return a context which will be auto-freed on exit
- this is useful for reducing the noise in leak reports
-*/
-void *talloc_autofree_context(void)
-{
- if (autofree_context == NULL) {
- autofree_context = _talloc_named_const(NULL, 0, "autofree_context");
- talloc_set_destructor(autofree_context, talloc_autofree_destructor);
- atexit(talloc_autofree);
- }
- return autofree_context;
-}
-
-size_t talloc_get_size(const void *context)
-{
- struct talloc_chunk *tc;
-
- if (context == NULL) {
- context = null_context;
- }
- if (context == NULL) {
- return 0;
- }
-
- tc = talloc_chunk_from_ptr(context);
-
- return tc->size;
-}
-
-/*
- find a parent of this context that has the given name, if any
-*/
-void *talloc_find_parent_byname(const void *context, const char *name)
-{
- struct talloc_chunk *tc;
-
- if (context == NULL) {
- return NULL;
- }
-
- tc = talloc_chunk_from_ptr(context);
- while (tc) {
- if (tc->name && strcmp(tc->name, name) == 0) {
- return TC_PTR_FROM_CHUNK(tc);
- }
- while (tc && tc->prev) tc = tc->prev;
- if (tc) {
- tc = tc->parent;
- }
- }
- return NULL;
-}
-
-/*
- show the parentage of a context
-*/
-void talloc_show_parents(const void *context, FILE *file)
-{
- struct talloc_chunk *tc;
-
- if (context == NULL) {
- fprintf(file, "talloc no parents for NULL\n");
- return;
- }
-
- tc = talloc_chunk_from_ptr(context);
- fprintf(file, "talloc parents of '%s'\n", talloc_get_name(context));
- while (tc) {
- fprintf(file, "\t'%s'\n", talloc_get_name(TC_PTR_FROM_CHUNK(tc)));
- while (tc && tc->prev) tc = tc->prev;
- if (tc) {
- tc = tc->parent;
- }
- }
- fflush(file);
-}
-
-/*
- return 1 if ptr is a parent of context
-*/
-int talloc_is_parent(const void *context, const void *ptr)
-{
- struct talloc_chunk *tc;
-
- if (context == NULL) {
- return 0;
- }
-
- tc = talloc_chunk_from_ptr(context);
- while (tc) {
- if (TC_PTR_FROM_CHUNK(tc) == ptr) return 1;
- while (tc && tc->prev) tc = tc->prev;
- if (tc) {
- tc = tc->parent;
- }
- }
- return 0;
-}
diff --git a/chromium/third_party/talloc/talloc.exports b/chromium/third_party/talloc/talloc.exports
deleted file mode 100644
index 1b8062f4a05..00000000000
--- a/chromium/third_party/talloc/talloc.exports
+++ /dev/null
@@ -1,68 +0,0 @@
-# This file is autogenerated, please DO NOT EDIT
-{
- global:
- _talloc;
- _talloc_array;
- _talloc_free;
- _talloc_get_type_abort;
- _talloc_memdup;
- _talloc_move;
- _talloc_realloc;
- _talloc_realloc_array;
- _talloc_reference_loc;
- _talloc_set_destructor;
- _talloc_steal_loc;
- _talloc_zero;
- _talloc_zero_array;
- talloc_asprintf;
- talloc_asprintf_append;
- talloc_asprintf_append_buffer;
- talloc_autofree_context;
- talloc_check_name;
- talloc_disable_null_tracking;
- talloc_enable_leak_report;
- talloc_enable_leak_report_full;
- talloc_enable_null_tracking;
- talloc_enable_null_tracking_no_autofree;
- talloc_find_parent_byname;
- talloc_free_children;
- talloc_get_name;
- talloc_get_size;
- talloc_increase_ref_count;
- talloc_init;
- talloc_is_parent;
- talloc_named;
- talloc_named_const;
- talloc_parent;
- talloc_parent_name;
- talloc_pool;
- talloc_realloc_fn;
- talloc_reference_count;
- talloc_reparent;
- talloc_report;
- talloc_report_depth_cb;
- talloc_report_depth_file;
- talloc_report_full;
- talloc_set_abort_fn;
- talloc_set_log_fn;
- talloc_set_log_stderr;
- talloc_set_name;
- talloc_set_name_const;
- talloc_show_parents;
- talloc_strdup;
- talloc_strdup_append;
- talloc_strdup_append_buffer;
- talloc_strndup;
- talloc_strndup_append;
- talloc_strndup_append_buffer;
- talloc_total_blocks;
- talloc_total_size;
- talloc_unlink;
- talloc_vasprintf;
- talloc_vasprintf_append;
- talloc_vasprintf_append_buffer;
- talloc_version_major;
- talloc_version_minor;
-
- local: *;
-};
diff --git a/chromium/third_party/talloc/talloc.h b/chromium/third_party/talloc/talloc.h
deleted file mode 100644
index 7747cd6c53e..00000000000
--- a/chromium/third_party/talloc/talloc.h
+++ /dev/null
@@ -1,206 +0,0 @@
-#ifndef _TALLOC_H_
-#define _TALLOC_H_
-/*
- Unix SMB/CIFS implementation.
- Samba temporary memory allocation functions
-
- Copyright (C) Andrew Tridgell 2004-2005
- Copyright (C) Stefan Metzmacher 2006
-
- ** NOTE! The following LGPL license applies to the talloc
- ** library. This does NOT imply that all of Samba is released
- ** under the LGPL
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#ifndef _MSC_VER
-#include <stdint.h>
-#endif
-#include <string.h>
-
-#define TALLOC_VERSION_MAJOR 2
-#define TALLOC_VERSION_MINOR 0
-
-int talloc_version_major(void);
-int talloc_version_minor(void);
-
-/* this is only needed for compatibility with the old talloc */
-typedef void TALLOC_CTX;
-
-/*
- this uses a little trick to allow __LINE__ to be stringified
-*/
-#ifndef __location__
-#define __TALLOC_STRING_LINE1__(s) #s
-#define __TALLOC_STRING_LINE2__(s) __TALLOC_STRING_LINE1__(s)
-#define __TALLOC_STRING_LINE3__ __TALLOC_STRING_LINE2__(__LINE__)
-#define __location__ __FILE__ ":" __TALLOC_STRING_LINE3__
-#endif
-
-#ifndef TALLOC_DEPRECATED
-#define TALLOC_DEPRECATED 0
-#endif
-
-#ifndef PRINTF_ATTRIBUTE
-#if (__GNUC__ >= 3)
-/** Use gcc attribute to check printf fns. a1 is the 1-based index of
- * the parameter containing the format, and a2 the index of the first
- * argument. Note that some gcc 2.x versions don't handle this
- * properly **/
-#define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format (__printf__, a1, a2)))
-#else
-#define PRINTF_ATTRIBUTE(a1, a2)
-#endif
-#endif
-
-/* try to make talloc_set_destructor() and talloc_steal() type safe,
- if we have a recent gcc */
-#if (__GNUC__ >= 3)
-#define _TALLOC_TYPEOF(ptr) __typeof__(ptr)
-#define talloc_set_destructor(ptr, function) \
- do { \
- int (*_talloc_destructor_fn)(_TALLOC_TYPEOF(ptr)) = (function); \
- _talloc_set_destructor((ptr), (int (*)(void *))_talloc_destructor_fn); \
- } while(0)
-/* this extremely strange macro is to avoid some braindamaged warning
- stupidity in gcc 4.1.x */
-#define talloc_steal(ctx, ptr) ({ _TALLOC_TYPEOF(ptr) __talloc_steal_ret = (_TALLOC_TYPEOF(ptr))_talloc_steal_loc((ctx),(ptr), __location__); __talloc_steal_ret; })
-#else
-#define talloc_set_destructor(ptr, function) \
- _talloc_set_destructor((ptr), (int (*)(void *))(function))
-#define _TALLOC_TYPEOF(ptr) void *
-#define talloc_steal(ctx, ptr) (_TALLOC_TYPEOF(ptr))_talloc_steal_loc((ctx),(ptr), __location__)
-#endif
-
-#define talloc_reference(ctx, ptr) (_TALLOC_TYPEOF(ptr))_talloc_reference_loc((ctx),(ptr), __location__)
-#define talloc_move(ctx, ptr) (_TALLOC_TYPEOF(*(ptr)))_talloc_move((ctx),(void *)(ptr))
-
-/* useful macros for creating type checked pointers */
-#define talloc(ctx, type) (type *)talloc_named_const(ctx, sizeof(type), #type)
-#define talloc_size(ctx, size) talloc_named_const(ctx, size, __location__)
-#define talloc_ptrtype(ctx, ptr) (_TALLOC_TYPEOF(ptr))talloc_size(ctx, sizeof(*(ptr)))
-
-#define talloc_new(ctx) talloc_named_const(ctx, 0, "talloc_new: " __location__)
-
-#define talloc_zero(ctx, type) (type *)_talloc_zero(ctx, sizeof(type), #type)
-#define talloc_zero_size(ctx, size) _talloc_zero(ctx, size, __location__)
-
-#define talloc_zero_array(ctx, type, count) (type *)_talloc_zero_array(ctx, sizeof(type), count, #type)
-#define talloc_array(ctx, type, count) (type *)_talloc_array(ctx, sizeof(type), count, #type)
-#define talloc_array_size(ctx, size, count) _talloc_array(ctx, size, count, __location__)
-#define talloc_array_ptrtype(ctx, ptr, count) (_TALLOC_TYPEOF(ptr))talloc_array_size(ctx, sizeof(*(ptr)), count)
-#define talloc_array_length(ctx) (talloc_get_size(ctx)/sizeof(*ctx))
-
-#define talloc_realloc(ctx, p, type, count) (type *)_talloc_realloc_array(ctx, p, sizeof(type), count, #type)
-#define talloc_realloc_size(ctx, ptr, size) _talloc_realloc(ctx, ptr, size, __location__)
-
-#define talloc_memdup(t, p, size) _talloc_memdup(t, p, size, __location__)
-
-#define talloc_set_type(ptr, type) talloc_set_name_const(ptr, #type)
-#define talloc_get_type(ptr, type) (type *)talloc_check_name(ptr, #type)
-#define talloc_get_type_abort(ptr, type) (type *)_talloc_get_type_abort(ptr, #type, __location__)
-
-#define talloc_find_parent_bytype(ptr, type) (type *)talloc_find_parent_byname(ptr, #type)
-#define talloc_free(ctx) _talloc_free(ctx, __location__)
-
-
-#if TALLOC_DEPRECATED
-#define talloc_zero_p(ctx, type) talloc_zero(ctx, type)
-#define talloc_p(ctx, type) talloc(ctx, type)
-#define talloc_array_p(ctx, type, count) talloc_array(ctx, type, count)
-#define talloc_realloc_p(ctx, p, type, count) talloc_realloc(ctx, p, type, count)
-#define talloc_destroy(ctx) talloc_free(ctx)
-#define talloc_append_string(c, s, a) (s?talloc_strdup_append(s,a):talloc_strdup(c, a))
-#endif
-
-#define TALLOC_FREE(ctx) do { talloc_free(ctx); ctx=NULL; } while(0)
-
-/* The following definitions come from talloc.c */
-void *_talloc(const void *context, size_t size);
-void *talloc_pool(const void *context, size_t size);
-void _talloc_set_destructor(const void *ptr, int (*_destructor)(void *));
-int talloc_increase_ref_count(const void *ptr);
-size_t talloc_reference_count(const void *ptr);
-void *_talloc_reference_loc(const void *context, const void *ptr, const char *location);
-int talloc_unlink(const void *context, void *ptr);
-const char *talloc_set_name(const void *ptr, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3);
-void talloc_set_name_const(const void *ptr, const char *name);
-void *talloc_named(const void *context, size_t size,
- const char *fmt, ...) PRINTF_ATTRIBUTE(3,4);
-void *talloc_named_const(const void *context, size_t size, const char *name);
-const char *talloc_get_name(const void *ptr);
-void *talloc_check_name(const void *ptr, const char *name);
-void *_talloc_get_type_abort(const void *ptr, const char *name, const char *location);
-void *talloc_parent(const void *ptr);
-const char *talloc_parent_name(const void *ptr);
-void *talloc_init(const char *fmt, ...) PRINTF_ATTRIBUTE(1,2);
-int _talloc_free(void *ptr, const char *location);
-void talloc_free_children(void *ptr);
-void *_talloc_realloc(const void *context, void *ptr, size_t size, const char *name);
-void *_talloc_steal_loc(const void *new_ctx, const void *ptr, const char *location);
-void *talloc_reparent(const void *old_parent, const void *new_parent, const void *ptr);
-void *_talloc_move(const void *new_ctx, const void *pptr);
-size_t talloc_total_size(const void *ptr);
-size_t talloc_total_blocks(const void *ptr);
-void talloc_report_depth_cb(const void *ptr, int depth, int max_depth,
- void (*callback)(const void *ptr,
- int depth, int max_depth,
- int is_ref,
- void *private_data),
- void *private_data);
-void talloc_report_depth_file(const void *ptr, int depth, int max_depth, FILE *f);
-void talloc_report_full(const void *ptr, FILE *f);
-void talloc_report(const void *ptr, FILE *f);
-void talloc_enable_null_tracking(void);
-void talloc_enable_null_tracking_no_autofree(void);
-void talloc_disable_null_tracking(void);
-void talloc_enable_leak_report(void);
-void talloc_enable_leak_report_full(void);
-void *_talloc_zero(const void *ctx, size_t size, const char *name);
-void *_talloc_memdup(const void *t, const void *p, size_t size, const char *name);
-void *_talloc_array(const void *ctx, size_t el_size, unsigned count, const char *name);
-void *_talloc_zero_array(const void *ctx, size_t el_size, unsigned count, const char *name);
-void *_talloc_realloc_array(const void *ctx, void *ptr, size_t el_size, unsigned count, const char *name);
-void *talloc_realloc_fn(const void *context, void *ptr, size_t size);
-void *talloc_autofree_context(void);
-size_t talloc_get_size(const void *ctx);
-void *talloc_find_parent_byname(const void *ctx, const char *name);
-void talloc_show_parents(const void *context, FILE *file);
-int talloc_is_parent(const void *context, const void *ptr);
-
-char *talloc_strdup(const void *t, const char *p);
-char *talloc_strdup_append(char *s, const char *a);
-char *talloc_strdup_append_buffer(char *s, const char *a);
-
-char *talloc_strndup(const void *t, const char *p, size_t n);
-char *talloc_strndup_append(char *s, const char *a, size_t n);
-char *talloc_strndup_append_buffer(char *s, const char *a, size_t n);
-
-char *talloc_vasprintf(const void *t, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(2,0);
-char *talloc_vasprintf_append(char *s, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(2,0);
-char *talloc_vasprintf_append_buffer(char *s, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(2,0);
-
-char *talloc_asprintf(const void *t, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3);
-char *talloc_asprintf_append(char *s, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3);
-char *talloc_asprintf_append_buffer(char *s, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3);
-
-void talloc_set_abort_fn(void (*abort_fn)(const char *reason));
-void talloc_set_log_fn(void (*log_fn)(const char *message));
-void talloc_set_log_stderr(void);
-
-#endif
diff --git a/chromium/third_party/talloc/talloc.i b/chromium/third_party/talloc/talloc.i
deleted file mode 100644
index a9afb97ed76..00000000000
--- a/chromium/third_party/talloc/talloc.i
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007
-
- 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 <http://www.gnu.org/licenses/>.
-*/
-
-/* Don't expose talloc contexts in Python code. Python does reference
- counting for us, so just create a new top-level talloc context.
- */
-%typemap(in, numinputs=0, noblock=1) TALLOC_CTX * {
- $1 = NULL;
-}
-
-%define %talloctype(TYPE)
-%nodefaultctor TYPE;
-%extend TYPE {
- ~TYPE() { talloc_free($self); }
-}
-%enddef
diff --git a/chromium/third_party/talloc/talloc.pc.in b/chromium/third_party/talloc/talloc.pc.in
deleted file mode 100644
index 5ce2109866c..00000000000
--- a/chromium/third_party/talloc/talloc.pc.in
+++ /dev/null
@@ -1,11 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-
-Name: talloc
-Description: A hierarchical pool based memory system with destructors
-Version: @TALLOC_VERSION@
-Libs: -L${libdir} -ltalloc
-Cflags: -I${includedir}
-URL: http://talloc.samba.org/
diff --git a/chromium/third_party/talloc/talloc.signatures b/chromium/third_party/talloc/talloc.signatures
deleted file mode 100644
index f2868e82698..00000000000
--- a/chromium/third_party/talloc/talloc.signatures
+++ /dev/null
@@ -1,62 +0,0 @@
-char *talloc_asprintf (const void *, const char *, ...);
-char *talloc_asprintf_append (char *, const char *, ...);
-char *talloc_asprintf_append_buffer (char *, const char *, ...);
-char *talloc_strdup (const void *, const char *);
-char *talloc_strdup_append (char *, const char *);
-char *talloc_strdup_append_buffer (char *, const char *);
-char *talloc_strndup (const void *, const char *, size_t);
-char *talloc_strndup_append (char *, const char *, size_t);
-char *talloc_strndup_append_buffer (char *, const char *, size_t);
-char *talloc_vasprintf (const void *, const char *, va_list);
-char *talloc_vasprintf_append (char *, const char *, va_list);
-char *talloc_vasprintf_append_buffer (char *, const char *, va_list);
-const char *talloc_get_name (const void *);
-const char *talloc_parent_name (const void *);
-const char *talloc_set_name (const void *, const char *, ...);
-int _talloc_free (void *, const char *);
-int talloc_increase_ref_count (const void *);
-int talloc_is_parent (const void *, const void *);
-int talloc_unlink (const void *, void *);
-int talloc_version_major (void);
-int talloc_version_minor (void);
-size_t talloc_get_size (const void *);
-size_t talloc_reference_count (const void *);
-size_t talloc_total_blocks (const void *);
-size_t talloc_total_size (const void *);
-void *_talloc (const void *, size_t);
-void *_talloc_array (const void *, size_t, unsigned int, const char *);
-void *_talloc_get_type_abort (const void *, const char *, const char *);
-void *_talloc_memdup (const void *, const void *, size_t, const char *);
-void *_talloc_move (const void *, const void *);
-void *_talloc_realloc (const void *, void *, size_t, const char *);
-void *_talloc_realloc_array (const void *, void *, size_t, unsigned int, const char *);
-void *_talloc_reference_loc (const void *, const void *, const char *);
-void *_talloc_steal_loc (const void *, const void *, const char *);
-void *_talloc_zero (const void *, size_t, const char *);
-void *_talloc_zero_array (const void *, size_t, unsigned int, const char *);
-void *talloc_autofree_context (void);
-void *talloc_check_name (const void *, const char *);
-void *talloc_find_parent_byname (const void *, const char *);
-void *talloc_init (const char *, ...);
-void *talloc_named (const void *, size_t, const char *, ...);
-void *talloc_named_const (const void *, size_t, const char *);
-void *talloc_parent (const void *);
-void *talloc_pool (const void *, size_t);
-void *talloc_realloc_fn (const void *, void *, size_t);
-void *talloc_reparent (const void *, const void *, const void *);
-void _talloc_set_destructor (const void *, int (*) (void *));
-void talloc_disable_null_tracking (void);
-void talloc_enable_leak_report (void);
-void talloc_enable_leak_report_full (void);
-void talloc_enable_null_tracking (void);
-void talloc_enable_null_tracking_no_autofree (void);
-void talloc_free_children (void *);
-void talloc_report (const void *, FILE *);
-void talloc_report_depth_cb (const void *, int, int, void (*) (const void *, int, int, int, void *), void *);
-void talloc_report_depth_file (const void *, int, int, FILE *);
-void talloc_report_full (const void *, FILE *);
-void talloc_set_abort_fn (void (*) (const char *));
-void talloc_set_log_fn (void (*) (const char *));
-void talloc_set_log_stderr (void);
-void talloc_set_name_const (const void *, const char *);
-void talloc_show_parents (const void *, FILE *);
diff --git a/chromium/third_party/talloc/talloc_guide.txt b/chromium/third_party/talloc/talloc_guide.txt
deleted file mode 100644
index 01de806662d..00000000000
--- a/chromium/third_party/talloc/talloc_guide.txt
+++ /dev/null
@@ -1,757 +0,0 @@
-Using talloc in Samba4
-======================
-
-.. contents::
-
-Andrew Tridgell
-August 2009
-
-The most current version of this document is available at
- http://samba.org/ftp/unpacked/talloc/talloc_guide.txt
-
-If you are used to the "old" talloc from Samba3 before 3.0.20 then please read
-this carefully, as talloc has changed a lot. With 3.0.20 (or 3.0.14?) the
-Samba4 talloc has been ported back to Samba3, so this guide applies to both.
-
-The new talloc is a hierarchical, reference counted memory pool system
-with destructors. Quite a mouthful really, but not too bad once you
-get used to it.
-
-Perhaps the biggest change from Samba3 is that there is no distinction
-between a "talloc context" and a "talloc pointer". Any pointer
-returned from talloc() is itself a valid talloc context. This means
-you can do this::
-
- struct foo *X = talloc(mem_ctx, struct foo);
- X->name = talloc_strdup(X, "foo");
-
-and the pointer X->name would be a "child" of the talloc context "X"
-which is itself a child of mem_ctx. So if you do talloc_free(mem_ctx)
-then it is all destroyed, whereas if you do talloc_free(X) then just X
-and X->name are destroyed, and if you do talloc_free(X->name) then
-just the name element of X is destroyed.
-
-If you think about this, then what this effectively gives you is an
-n-ary tree, where you can free any part of the tree with
-talloc_free().
-
-If you find this confusing, then I suggest you run the testsuite to
-watch talloc in action. You may also like to add your own tests to
-testsuite.c to clarify how some particular situation is handled.
-
-
-Performance
------------
-
-All the additional features of talloc() over malloc() do come at a
-price. We have a simple performance test in Samba4 that measures
-talloc() versus malloc() performance, and it seems that talloc() is
-about 4% slower than malloc() on my x86 Debian Linux box. For Samba,
-the great reduction in code complexity that we get by using talloc
-makes this worthwhile, especially as the total overhead of
-talloc/malloc in Samba is already quite small.
-
-
-talloc API
-----------
-
-The following is a complete guide to the talloc API. Read it all at
-least twice.
-
-Multi-threading
----------------
-
-talloc itself does not deal with threads. It is thread-safe (assuming
-the underlying "malloc" is), as long as each thread uses different
-memory contexts.
-If two threads uses the same context then they need to synchronize in
-order to be safe. In particular:
-- when using talloc_enable_leak_report(), giving directly NULL as a
-parent context implicitly refers to a hidden "null context" global
-variable, so this should not be used in a multi-threaded environment
-without proper synchronization ;
-- the context returned by talloc_autofree_context() is also global so
-shouldn't be used by several threads simultaneously without
-synchronization.
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-(type *)talloc(const void *context, type);
-
-The talloc() macro is the core of the talloc library. It takes a
-memory context and a type, and returns a pointer to a new area of
-memory of the given type.
-
-The returned pointer is itself a talloc context, so you can use it as
-the context argument to more calls to talloc if you wish.
-
-The returned pointer is a "child" of the supplied context. This means
-that if you talloc_free() the context then the new child disappears as
-well. Alternatively you can free just the child.
-
-The context argument to talloc() can be NULL, in which case a new top
-level context is created.
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void *talloc_size(const void *context, size_t size);
-
-The function talloc_size() should be used when you don't have a
-convenient type to pass to talloc(). Unlike talloc(), it is not type
-safe (as it returns a void *), so you are on your own for type checking.
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-(typeof(ptr)) talloc_ptrtype(const void *ctx, ptr);
-
-The talloc_ptrtype() macro should be used when you have a pointer and
-want to allocate memory to point at with this pointer. When compiling
-with gcc >= 3 it is typesafe. Note this is a wrapper of talloc_size()
-and talloc_get_name() will return the current location in the source file.
-and not the type.
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-int talloc_free(void *ptr);
-
-The talloc_free() function frees a piece of talloc memory, and all its
-children. You can call talloc_free() on any pointer returned by
-talloc().
-
-The return value of talloc_free() indicates success or failure, with 0
-returned for success and -1 for failure. The only possible failure
-condition is if the pointer had a destructor attached to it and the
-destructor returned -1. See talloc_set_destructor() for details on
-destructors.
-
-If this pointer has an additional parent when talloc_free() is called
-then the memory is not actually released, but instead the most
-recently established parent is destroyed. See talloc_reference() for
-details on establishing additional parents.
-
-For more control on which parent is removed, see talloc_unlink()
-
-talloc_free() operates recursively on its children.
-
-From the 2.0 version of talloc, as a special case, talloc_free() is
-refused on pointers that have more than one parent, as talloc would
-have no way of knowing which parent should be removed. To free a
-pointer that has more than one parent please use talloc_unlink().
-
-To help you find problems in your code caused by this behaviour, if
-you do try and free a pointer with more than one parent then the
-talloc logging function will be called to give output like this:
-
- ERROR: talloc_free with references at some_dir/source/foo.c:123
- reference at some_dir/source/other.c:325
- reference at some_dir/source/third.c:121
-
-Please see the documentation for talloc_set_log_fn() and
-talloc_set_log_stderr() for more information on talloc logging
-functions.
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-int talloc_free_children(void *ptr);
-
-The talloc_free_children() walks along the list of all children of a
-talloc context and talloc_free()s only the children, not the context
-itself.
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void *talloc_reference(const void *context, const void *ptr);
-
-The talloc_reference() function makes "context" an additional parent
-of "ptr".
-
-The return value of talloc_reference() is always the original pointer
-"ptr", unless talloc ran out of memory in creating the reference in
-which case it will return NULL (each additional reference consumes
-around 48 bytes of memory on intel x86 platforms).
-
-If "ptr" is NULL, then the function is a no-op, and simply returns NULL.
-
-After creating a reference you can free it in one of the following
-ways:
-
- - you can talloc_free() any parent of the original pointer. That
- will reduce the number of parents of this pointer by 1, and will
- cause this pointer to be freed if it runs out of parents.
-
- - you can talloc_free() the pointer itself. That will destroy the
- most recently established parent to the pointer and leave the
- pointer as a child of its current parent.
-
-For more control on which parent to remove, see talloc_unlink()
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-int talloc_unlink(const void *context, const void *ptr);
-
-The talloc_unlink() function removes a specific parent from ptr. The
-context passed must either be a context used in talloc_reference()
-with this pointer, or must be a direct parent of ptr.
-
-Note that if the parent has already been removed using talloc_free()
-then this function will fail and will return -1. Likewise, if "ptr"
-is NULL, then the function will make no modifications and return -1.
-
-Usually you can just use talloc_free() instead of talloc_unlink(), but
-sometimes it is useful to have the additional control on which parent
-is removed.
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void talloc_set_destructor(const void *ptr, int (*destructor)(void *));
-
-The function talloc_set_destructor() sets the "destructor" for the
-pointer "ptr". A destructor is a function that is called when the
-memory used by a pointer is about to be released. The destructor
-receives the pointer as an argument, and should return 0 for success
-and -1 for failure.
-
-The destructor can do anything it wants to, including freeing other
-pieces of memory. A common use for destructors is to clean up
-operating system resources (such as open file descriptors) contained
-in the structure the destructor is placed on.
-
-You can only place one destructor on a pointer. If you need more than
-one destructor then you can create a zero-length child of the pointer
-and place an additional destructor on that.
-
-To remove a destructor call talloc_set_destructor() with NULL for the
-destructor.
-
-If your destructor attempts to talloc_free() the pointer that it is
-the destructor for then talloc_free() will return -1 and the free will
-be ignored. This would be a pointless operation anyway, as the
-destructor is only called when the memory is just about to go away.
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-int talloc_increase_ref_count(const void *ptr);
-
-The talloc_increase_ref_count(ptr) function is exactly equivalent to:
-
- talloc_reference(NULL, ptr);
-
-You can use either syntax, depending on which you think is clearer in
-your code.
-
-It returns 0 on success and -1 on failure.
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-size_t talloc_reference_count(const void *ptr);
-
-Return the number of references to the pointer.
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void talloc_set_name(const void *ptr, const char *fmt, ...);
-
-Each talloc pointer has a "name". The name is used principally for
-debugging purposes, although it is also possible to set and get the
-name on a pointer in as a way of "marking" pointers in your code.
-
-The main use for names on pointer is for "talloc reports". See
-talloc_report() and talloc_report_full() for details. Also see
-talloc_enable_leak_report() and talloc_enable_leak_report_full().
-
-The talloc_set_name() function allocates memory as a child of the
-pointer. It is logically equivalent to:
- talloc_set_name_const(ptr, talloc_asprintf(ptr, fmt, ...));
-
-Note that multiple calls to talloc_set_name() will allocate more
-memory without releasing the name. All of the memory is released when
-the ptr is freed using talloc_free().
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void talloc_set_name_const(const void *ptr, const char *name);
-
-The function talloc_set_name_const() is just like talloc_set_name(),
-but it takes a string constant, and is much faster. It is extensively
-used by the "auto naming" macros, such as talloc_p().
-
-This function does not allocate any memory. It just copies the
-supplied pointer into the internal representation of the talloc
-ptr. This means you must not pass a name pointer to memory that will
-disappear before the ptr is freed with talloc_free().
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void *talloc_named(const void *context, size_t size, const char *fmt, ...);
-
-The talloc_named() function creates a named talloc pointer. It is
-equivalent to:
-
- ptr = talloc_size(context, size);
- talloc_set_name(ptr, fmt, ....);
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void *talloc_named_const(const void *context, size_t size, const char *name);
-
-This is equivalent to::
-
- ptr = talloc_size(context, size);
- talloc_set_name_const(ptr, name);
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-const char *talloc_get_name(const void *ptr);
-
-This returns the current name for the given talloc pointer. See
-talloc_set_name() for details.
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void *talloc_init(const char *fmt, ...);
-
-This function creates a zero length named talloc context as a top
-level context. It is equivalent to::
-
- talloc_named(NULL, 0, fmt, ...);
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void *talloc_new(void *ctx);
-
-This is a utility macro that creates a new memory context hanging
-off an exiting context, automatically naming it "talloc_new: __location__"
-where __location__ is the source line it is called from. It is
-particularly useful for creating a new temporary working context.
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-(type *)talloc_realloc(const void *context, void *ptr, type, count);
-
-The talloc_realloc() macro changes the size of a talloc
-pointer. The "count" argument is the number of elements of type "type"
-that you want the resulting pointer to hold.
-
-talloc_realloc() has the following equivalences::
-
- talloc_realloc(context, NULL, type, 1) ==> talloc(context, type);
- talloc_realloc(context, NULL, type, N) ==> talloc_array(context, type, N);
- talloc_realloc(context, ptr, type, 0) ==> talloc_free(ptr);
-
-The "context" argument is only used if "ptr" is NULL, otherwise it is
-ignored.
-
-talloc_realloc() returns the new pointer, or NULL on failure. The call
-will fail either due to a lack of memory, or because the pointer has
-more than one parent (see talloc_reference()).
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void *talloc_realloc_size(const void *context, void *ptr, size_t size);
-
-the talloc_realloc_size() function is useful when the type is not
-known so the typesafe talloc_realloc() cannot be used.
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void *talloc_steal(const void *new_ctx, const void *ptr);
-
-The talloc_steal() function changes the parent context of a talloc
-pointer. It is typically used when the context that the pointer is
-currently a child of is going to be freed and you wish to keep the
-memory for a longer time.
-
-The talloc_steal() function returns the pointer that you pass it. It
-does not have any failure modes.
-
-NOTE: It is possible to produce loops in the parent/child relationship
-if you are not careful with talloc_steal(). No guarantees are provided
-as to your sanity or the safety of your data if you do this.
-
-talloc_steal (new_ctx, NULL) will return NULL with no sideeffects.
-
-Note that if you try and call talloc_steal() on a pointer that has
-more than one parent then the result is ambiguous. Talloc will choose
-to remove the parent that is currently indicated by talloc_parent()
-and replace it with the chosen parent. You will also get a message
-like this via the talloc logging functions:
-
- WARNING: talloc_steal with references at some_dir/source/foo.c:123
- reference at some_dir/source/other.c:325
- reference at some_dir/source/third.c:121
-
-To unambiguously change the parent of a pointer please see the
-function talloc_reparent(). See the talloc_set_log_fn() documentation
-for more information on talloc logging.
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void *talloc_reparent(const void *old_parent, const void *new_parent, const void *ptr);
-
-The talloc_reparent() function changes the parent context of a talloc
-pointer. It is typically used when the context that the pointer is
-currently a child of is going to be freed and you wish to keep the
-memory for a longer time.
-
-The talloc_reparent() function returns the pointer that you pass it. It
-does not have any failure modes.
-
-The difference between talloc_reparent() and talloc_steal() is that
-talloc_reparent() can specify which parent you wish to change. This is
-useful when a pointer has multiple parents via references.
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void *talloc_parent(const void *ptr);
-
-The talloc_parent() function returns the current talloc parent. This
-is usually the pointer under which this memory was originally created,
-but it may have changed due to a talloc_steal() or talloc_reparent()
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-size_t talloc_total_size(const void *ptr);
-
-The talloc_total_size() function returns the total size in bytes used
-by this pointer and all child pointers. Mostly useful for debugging.
-
-Passing NULL is allowed, but it will only give a meaningful result if
-talloc_enable_leak_report() or talloc_enable_leak_report_full() has
-been called.
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-size_t talloc_total_blocks(const void *ptr);
-
-The talloc_total_blocks() function returns the total memory block
-count used by this pointer and all child pointers. Mostly useful for
-debugging.
-
-Passing NULL is allowed, but it will only give a meaningful result if
-talloc_enable_leak_report() or talloc_enable_leak_report_full() has
-been called.
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void talloc_report_depth_cb(const void *ptr, int depth, int max_depth,
- void (*callback)(const void *ptr,
- int depth, int max_depth,
- int is_ref,
- void *priv),
- void *priv);
-
-This provides a more flexible reports than talloc_report(). It
-will recursively call the callback for the entire tree of memory
-referenced by the pointer. References in the tree are passed with
-is_ref = 1 and the pointer that is referenced.
-
-You can pass NULL for the pointer, in which case a report is
-printed for the top level memory context, but only if
-talloc_enable_leak_report() or talloc_enable_leak_report_full()
-has been called.
-
-The recursion is stopped when depth >= max_depth.
-max_depth = -1 means only stop at leaf nodes.
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void talloc_report_depth_file(const void *ptr, int depth, int max_depth, FILE *f);
-
-This provides a more flexible reports than talloc_report(). It
-will let you specify the depth and max_depth.
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void talloc_report(const void *ptr, FILE *f);
-
-The talloc_report() function prints a summary report of all memory
-used by ptr. One line of report is printed for each immediate child of
-ptr, showing the total memory and number of blocks used by that child.
-
-You can pass NULL for the pointer, in which case a report is printed
-for the top level memory context, but only if
-talloc_enable_leak_report() or talloc_enable_leak_report_full() has
-been called.
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void talloc_report_full(const void *ptr, FILE *f);
-
-This provides a more detailed report than talloc_report(). It will
-recursively print the ensire tree of memory referenced by the
-pointer. References in the tree are shown by giving the name of the
-pointer that is referenced.
-
-You can pass NULL for the pointer, in which case a report is printed
-for the top level memory context, but only if
-talloc_enable_leak_report() or talloc_enable_leak_report_full() has
-been called.
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void talloc_enable_leak_report(void);
-
-This enables calling of talloc_report(NULL, stderr) when the program
-exits. In Samba4 this is enabled by using the --leak-report command
-line option.
-
-For it to be useful, this function must be called before any other
-talloc function as it establishes a "null context" that acts as the
-top of the tree. If you don't call this function first then passing
-NULL to talloc_report() or talloc_report_full() won't give you the
-full tree printout.
-
-Here is a typical talloc report:
-
-talloc report on 'null_context' (total 267 bytes in 15 blocks)
- libcli/auth/spnego_parse.c:55 contains 31 bytes in 2 blocks
- libcli/auth/spnego_parse.c:55 contains 31 bytes in 2 blocks
- iconv(UTF8,CP850) contains 42 bytes in 2 blocks
- libcli/auth/spnego_parse.c:55 contains 31 bytes in 2 blocks
- iconv(CP850,UTF8) contains 42 bytes in 2 blocks
- iconv(UTF8,UTF-16LE) contains 45 bytes in 2 blocks
- iconv(UTF-16LE,UTF8) contains 45 bytes in 2 blocks
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void talloc_enable_leak_report_full(void);
-
-This enables calling of talloc_report_full(NULL, stderr) when the
-program exits. In Samba4 this is enabled by using the
---leak-report-full command line option.
-
-For it to be useful, this function must be called before any other
-talloc function as it establishes a "null context" that acts as the
-top of the tree. If you don't call this function first then passing
-NULL to talloc_report() or talloc_report_full() won't give you the
-full tree printout.
-
-Here is a typical full report:
-
-full talloc report on 'root' (total 18 bytes in 8 blocks)
- p1 contains 18 bytes in 7 blocks (ref 0)
- r1 contains 13 bytes in 2 blocks (ref 0)
- reference to: p2
- p2 contains 1 bytes in 1 blocks (ref 1)
- x3 contains 1 bytes in 1 blocks (ref 0)
- x2 contains 1 bytes in 1 blocks (ref 0)
- x1 contains 1 bytes in 1 blocks (ref 0)
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void talloc_enable_null_tracking(void);
-
-This enables tracking of the NULL memory context without enabling leak
-reporting on exit. Useful for when you want to do your own leak
-reporting call via talloc_report_null_full();
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void talloc_disable_null_tracking(void);
-
-This disables tracking of the NULL memory context.
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-(type *)talloc_zero(const void *ctx, type);
-
-The talloc_zero() macro is equivalent to::
-
- ptr = talloc(ctx, type);
- if (ptr) memset(ptr, 0, sizeof(type));
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void *talloc_zero_size(const void *ctx, size_t size)
-
-The talloc_zero_size() function is useful when you don't have a known type
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void *talloc_memdup(const void *ctx, const void *p, size_t size);
-
-The talloc_memdup() function is equivalent to::
-
- ptr = talloc_size(ctx, size);
- if (ptr) memcpy(ptr, p, size);
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-char *talloc_strdup(const void *ctx, const char *p);
-
-The talloc_strdup() function is equivalent to::
-
- ptr = talloc_size(ctx, strlen(p)+1);
- if (ptr) memcpy(ptr, p, strlen(p)+1);
-
-This functions sets the name of the new pointer to the passed
-string. This is equivalent to::
-
- talloc_set_name_const(ptr, ptr)
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-char *talloc_strndup(const void *t, const char *p, size_t n);
-
-The talloc_strndup() function is the talloc equivalent of the C
-library function strndup()
-
-This functions sets the name of the new pointer to the passed
-string. This is equivalent to:
- talloc_set_name_const(ptr, ptr)
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-char *talloc_append_string(const void *t, char *orig, const char *append);
-
-The talloc_append_string() function appends the given formatted
-string to the given string.
-
-This function sets the name of the new pointer to the new
-string. This is equivalent to::
-
- talloc_set_name_const(ptr, ptr)
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-char *talloc_vasprintf(const void *t, const char *fmt, va_list ap);
-
-The talloc_vasprintf() function is the talloc equivalent of the C
-library function vasprintf()
-
-This functions sets the name of the new pointer to the new
-string. This is equivalent to::
-
- talloc_set_name_const(ptr, ptr)
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-char *talloc_asprintf(const void *t, const char *fmt, ...);
-
-The talloc_asprintf() function is the talloc equivalent of the C
-library function asprintf()
-
-This functions sets the name of the new pointer to the new
-string. This is equivalent to::
-
- talloc_set_name_const(ptr, ptr)
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-char *talloc_asprintf_append(char *s, const char *fmt, ...);
-
-The talloc_asprintf_append() function appends the given formatted
-string to the given string.
-Use this varient when the string in the current talloc buffer may
-have been truncated in length.
-
-This functions sets the name of the new pointer to the new
-string. This is equivalent to::
-
- talloc_set_name_const(ptr, ptr)
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-char *talloc_asprintf_append_buffer(char *s, const char *fmt, ...);
-
-The talloc_asprintf_append() function appends the given formatted
-string to the end of the currently allocated talloc buffer.
-Use this varient when the string in the current talloc buffer has
-not been changed.
-
-This functions sets the name of the new pointer to the new
-string. This is equivalent to::
-
- talloc_set_name_const(ptr, ptr)
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-((type *)talloc_array(const void *ctx, type, uint_t count);
-
-The talloc_array() macro is equivalent to::
-
- (type *)talloc_size(ctx, sizeof(type) * count);
-
-except that it provides integer overflow protection for the multiply,
-returning NULL if the multiply overflows.
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void *talloc_array_size(const void *ctx, size_t size, uint_t count);
-
-The talloc_array_size() function is useful when the type is not
-known. It operates in the same way as talloc_array(), but takes a size
-instead of a type.
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-(typeof(ptr)) talloc_array_ptrtype(const void *ctx, ptr, uint_t count);
-
-The talloc_ptrtype() macro should be used when you have a pointer to an array
-and want to allocate memory of an array to point at with this pointer. When compiling
-with gcc >= 3 it is typesafe. Note this is a wrapper of talloc_array_size()
-and talloc_get_name() will return the current location in the source file.
-and not the type.
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void *talloc_realloc_fn(const void *ctx, void *ptr, size_t size);
-
-This is a non-macro version of talloc_realloc(), which is useful
-as libraries sometimes want a ralloc function pointer. A realloc()
-implementation encapsulates the functionality of malloc(), free() and
-realloc() in one call, which is why it is useful to be able to pass
-around a single function pointer.
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void *talloc_autofree_context(void);
-
-This is a handy utility function that returns a talloc context
-which will be automatically freed on program exit. This can be used
-to reduce the noise in memory leak reports.
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void *talloc_check_name(const void *ptr, const char *name);
-
-This function checks if a pointer has the specified name. If it does
-then the pointer is returned. It it doesn't then NULL is returned.
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-(type *)talloc_get_type(const void *ptr, type);
-
-This macro allows you to do type checking on talloc pointers. It is
-particularly useful for void* private pointers. It is equivalent to
-this::
-
- (type *)talloc_check_name(ptr, #type)
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-talloc_set_type(const void *ptr, type);
-
-This macro allows you to force the name of a pointer to be a
-particular type. This can be used in conjunction with
-talloc_get_type() to do type checking on void* pointers.
-
-It is equivalent to this::
-
- talloc_set_name_const(ptr, #type)
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-talloc_get_size(const void *ctx);
-
-This function lets you know the amount of memory alloced so far by
-this context. It does NOT account for subcontext memory.
-This can be used to calculate the size of an array.
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void *talloc_find_parent_byname(const void *ctx, const char *name);
-
-Find a parent memory context of the current context that has the given
-name. This can be very useful in complex programs where it may be
-difficult to pass all information down to the level you need, but you
-know the structure you want is a parent of another context.
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-(type *)talloc_find_parent_bytype(ctx, type);
-
-Like talloc_find_parent_byname() but takes a type, making it typesafe.
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void talloc_set_log_fn(void (*log_fn)(const char *message));
-
-This function sets a logging function that talloc will use for
-warnings and errors. By default talloc will not print any warnings or
-errors.
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void talloc_set_log_stderr(void)
-
-This sets the talloc log function to write log messages to stderr
diff --git a/chromium/third_party/talloc/testsuite.c b/chromium/third_party/talloc/testsuite.c
deleted file mode 100644
index 08aa20863a1..00000000000
--- a/chromium/third_party/talloc/testsuite.c
+++ /dev/null
@@ -1,1199 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- local testing of talloc routines.
-
- Copyright (C) Andrew Tridgell 2004
-
- ** NOTE! The following LGPL license applies to the talloc
- ** library. This does NOT imply that all of Samba is released
- ** under the LGPL
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "replace.h"
-#include "system/time.h"
-#include "talloc.h"
-
-static struct timeval timeval_current(void)
-{
- struct timeval tv;
- gettimeofday(&tv, NULL);
- return tv;
-}
-
-static double timeval_elapsed(struct timeval *tv)
-{
- struct timeval tv2 = timeval_current();
- return (tv2.tv_sec - tv->tv_sec) +
- (tv2.tv_usec - tv->tv_usec)*1.0e-6;
-}
-
-#define torture_assert(test, expr, str) if (!(expr)) { \
- printf("failure: %s [\n%s: Expression %s failed: %s\n]\n", \
- test, __location__, #expr, str); \
- return false; \
-}
-
-#define torture_assert_str_equal(test, arg1, arg2, desc) \
- if (arg1 == NULL && arg2 == NULL) { \
- } else if (strcmp(arg1, arg2)) { \
- printf("failure: %s [\n%s: Expected %s, got %s: %s\n]\n", \
- test, __location__, arg1, arg2, desc); \
- return false; \
- }
-
-#if _SAMBA_BUILD_==3
-#ifdef malloc
-#undef malloc
-#endif
-#ifdef strdup
-#undef strdup
-#endif
-#endif
-
-#define CHECK_SIZE(test, ptr, tsize) do { \
- if (talloc_total_size(ptr) != (tsize)) { \
- printf("failed: %s [\n%s: wrong '%s' tree size: got %u expected %u\n]\n", \
- test, __location__, #ptr, \
- (unsigned)talloc_total_size(ptr), \
- (unsigned)tsize); \
- talloc_report_full(ptr, stdout); \
- return false; \
- } \
-} while (0)
-
-#define CHECK_BLOCKS(test, ptr, tblocks) do { \
- if (talloc_total_blocks(ptr) != (tblocks)) { \
- printf("failed: %s [\n%s: wrong '%s' tree blocks: got %u expected %u\n]\n", \
- test, __location__, #ptr, \
- (unsigned)talloc_total_blocks(ptr), \
- (unsigned)tblocks); \
- talloc_report_full(ptr, stdout); \
- return false; \
- } \
-} while (0)
-
-#define CHECK_PARENT(test, ptr, parent) do { \
- if (talloc_parent(ptr) != (parent)) { \
- printf("failed: %s [\n%s: '%s' has wrong parent: got %p expected %p\n]\n", \
- test, __location__, #ptr, \
- talloc_parent(ptr), \
- (parent)); \
- talloc_report_full(ptr, stdout); \
- talloc_report_full(parent, stdout); \
- talloc_report_full(NULL, stdout); \
- return false; \
- } \
-} while (0)
-
-static unsigned int test_abort_count;
-
-static void test_abort_fn(const char *reason)
-{
- printf("# test_abort_fn(%s)\n", reason);
- test_abort_count++;
-}
-
-static void test_abort_start(void)
-{
- test_abort_count = 0;
- talloc_set_abort_fn(test_abort_fn);
-}
-
-static void test_abort_stop(void)
-{
- test_abort_count = 0;
- talloc_set_abort_fn(NULL);
-}
-
-static void test_log_stdout(const char *message)
-{
- fprintf(stdout, "%s", message);
-}
-
-/*
- test references
-*/
-static bool test_ref1(void)
-{
- void *root, *p1, *p2, *ref, *r1;
-
- printf("test: ref1\n# SINGLE REFERENCE FREE\n");
-
- root = talloc_named_const(NULL, 0, "root");
- p1 = talloc_named_const(root, 1, "p1");
- p2 = talloc_named_const(p1, 1, "p2");
- talloc_named_const(p1, 1, "x1");
- talloc_named_const(p1, 2, "x2");
- talloc_named_const(p1, 3, "x3");
-
- r1 = talloc_named_const(root, 1, "r1");
- ref = talloc_reference(r1, p2);
- talloc_report_full(root, stderr);
-
- CHECK_BLOCKS("ref1", p1, 5);
- CHECK_BLOCKS("ref1", p2, 1);
- CHECK_BLOCKS("ref1", r1, 2);
-
- fprintf(stderr, "Freeing p2\n");
- talloc_unlink(r1, p2);
- talloc_report_full(root, stderr);
-
- CHECK_BLOCKS("ref1", p1, 5);
- CHECK_BLOCKS("ref1", p2, 1);
- CHECK_BLOCKS("ref1", r1, 1);
-
- fprintf(stderr, "Freeing p1\n");
- talloc_free(p1);
- talloc_report_full(root, stderr);
-
- CHECK_BLOCKS("ref1", r1, 1);
-
- fprintf(stderr, "Freeing r1\n");
- talloc_free(r1);
- talloc_report_full(NULL, stderr);
-
- fprintf(stderr, "Testing NULL\n");
- if (talloc_reference(root, NULL)) {
- return false;
- }
-
- CHECK_BLOCKS("ref1", root, 1);
-
- CHECK_SIZE("ref1", root, 0);
-
- talloc_free(root);
- printf("success: ref1\n");
- return true;
-}
-
-/*
- test references
-*/
-static bool test_ref2(void)
-{
- void *root, *p1, *p2, *ref, *r1;
-
- printf("test: ref2\n# DOUBLE REFERENCE FREE\n");
- root = talloc_named_const(NULL, 0, "root");
- p1 = talloc_named_const(root, 1, "p1");
- talloc_named_const(p1, 1, "x1");
- talloc_named_const(p1, 1, "x2");
- talloc_named_const(p1, 1, "x3");
- p2 = talloc_named_const(p1, 1, "p2");
-
- r1 = talloc_named_const(root, 1, "r1");
- ref = talloc_reference(r1, p2);
- talloc_report_full(root, stderr);
-
- CHECK_BLOCKS("ref2", p1, 5);
- CHECK_BLOCKS("ref2", p2, 1);
- CHECK_BLOCKS("ref2", r1, 2);
-
- fprintf(stderr, "Freeing ref\n");
- talloc_unlink(r1, ref);
- talloc_report_full(root, stderr);
-
- CHECK_BLOCKS("ref2", p1, 5);
- CHECK_BLOCKS("ref2", p2, 1);
- CHECK_BLOCKS("ref2", r1, 1);
-
- fprintf(stderr, "Freeing p2\n");
- talloc_free(p2);
- talloc_report_full(root, stderr);
-
- CHECK_BLOCKS("ref2", p1, 4);
- CHECK_BLOCKS("ref2", r1, 1);
-
- fprintf(stderr, "Freeing p1\n");
- talloc_free(p1);
- talloc_report_full(root, stderr);
-
- CHECK_BLOCKS("ref2", r1, 1);
-
- fprintf(stderr, "Freeing r1\n");
- talloc_free(r1);
- talloc_report_full(root, stderr);
-
- CHECK_SIZE("ref2", root, 0);
-
- talloc_free(root);
- printf("success: ref2\n");
- return true;
-}
-
-/*
- test references
-*/
-static bool test_ref3(void)
-{
- void *root, *p1, *p2, *ref, *r1;
-
- printf("test: ref3\n# PARENT REFERENCE FREE\n");
-
- root = talloc_named_const(NULL, 0, "root");
- p1 = talloc_named_const(root, 1, "p1");
- p2 = talloc_named_const(root, 1, "p2");
- r1 = talloc_named_const(p1, 1, "r1");
- ref = talloc_reference(p2, r1);
- talloc_report_full(root, stderr);
-
- CHECK_BLOCKS("ref3", p1, 2);
- CHECK_BLOCKS("ref3", p2, 2);
- CHECK_BLOCKS("ref3", r1, 1);
-
- fprintf(stderr, "Freeing p1\n");
- talloc_free(p1);
- talloc_report_full(root, stderr);
-
- CHECK_BLOCKS("ref3", p2, 2);
- CHECK_BLOCKS("ref3", r1, 1);
-
- fprintf(stderr, "Freeing p2\n");
- talloc_free(p2);
- talloc_report_full(root, stderr);
-
- CHECK_SIZE("ref3", root, 0);
-
- talloc_free(root);
-
- printf("success: ref3\n");
- return true;
-}
-
-/*
- test references
-*/
-static bool test_ref4(void)
-{
- void *root, *p1, *p2, *ref, *r1;
-
- printf("test: ref4\n# REFERRER REFERENCE FREE\n");
-
- root = talloc_named_const(NULL, 0, "root");
- p1 = talloc_named_const(root, 1, "p1");
- talloc_named_const(p1, 1, "x1");
- talloc_named_const(p1, 1, "x2");
- talloc_named_const(p1, 1, "x3");
- p2 = talloc_named_const(p1, 1, "p2");
-
- r1 = talloc_named_const(root, 1, "r1");
- ref = talloc_reference(r1, p2);
- talloc_report_full(root, stderr);
-
- CHECK_BLOCKS("ref4", p1, 5);
- CHECK_BLOCKS("ref4", p2, 1);
- CHECK_BLOCKS("ref4", r1, 2);
-
- fprintf(stderr, "Freeing r1\n");
- talloc_free(r1);
- talloc_report_full(root, stderr);
-
- CHECK_BLOCKS("ref4", p1, 5);
- CHECK_BLOCKS("ref4", p2, 1);
-
- fprintf(stderr, "Freeing p2\n");
- talloc_free(p2);
- talloc_report_full(root, stderr);
-
- CHECK_BLOCKS("ref4", p1, 4);
-
- fprintf(stderr, "Freeing p1\n");
- talloc_free(p1);
- talloc_report_full(root, stderr);
-
- CHECK_SIZE("ref4", root, 0);
-
- talloc_free(root);
-
- printf("success: ref4\n");
- return true;
-}
-
-
-/*
- test references
-*/
-static bool test_unlink1(void)
-{
- void *root, *p1, *p2, *ref, *r1;
-
- printf("test: unlink\n# UNLINK\n");
-
- root = talloc_named_const(NULL, 0, "root");
- p1 = talloc_named_const(root, 1, "p1");
- talloc_named_const(p1, 1, "x1");
- talloc_named_const(p1, 1, "x2");
- talloc_named_const(p1, 1, "x3");
- p2 = talloc_named_const(p1, 1, "p2");
-
- r1 = talloc_named_const(p1, 1, "r1");
- ref = talloc_reference(r1, p2);
- talloc_report_full(root, stderr);
-
- CHECK_BLOCKS("unlink", p1, 7);
- CHECK_BLOCKS("unlink", p2, 1);
- CHECK_BLOCKS("unlink", r1, 2);
-
- fprintf(stderr, "Unreferencing r1\n");
- talloc_unlink(r1, p2);
- talloc_report_full(root, stderr);
-
- CHECK_BLOCKS("unlink", p1, 6);
- CHECK_BLOCKS("unlink", p2, 1);
- CHECK_BLOCKS("unlink", r1, 1);
-
- fprintf(stderr, "Freeing p1\n");
- talloc_free(p1);
- talloc_report_full(root, stderr);
-
- CHECK_SIZE("unlink", root, 0);
-
- talloc_free(root);
-
- printf("success: unlink\n");
- return true;
-}
-
-static int fail_destructor(void *ptr)
-{
- return -1;
-}
-
-/*
- miscellaneous tests to try to get a higher test coverage percentage
-*/
-static bool test_misc(void)
-{
- void *root, *p1;
- char *p2;
- double *d;
- const char *name;
-
- printf("test: misc\n# MISCELLANEOUS\n");
-
- root = talloc_new(NULL);
-
- p1 = talloc_size(root, 0x7fffffff);
- torture_assert("misc", !p1, "failed: large talloc allowed\n");
-
- p1 = talloc_strdup(root, "foo");
- talloc_increase_ref_count(p1);
- talloc_increase_ref_count(p1);
- talloc_increase_ref_count(p1);
- CHECK_BLOCKS("misc", p1, 1);
- CHECK_BLOCKS("misc", root, 2);
- talloc_unlink(NULL, p1);
- CHECK_BLOCKS("misc", p1, 1);
- CHECK_BLOCKS("misc", root, 2);
- talloc_unlink(NULL, p1);
- CHECK_BLOCKS("misc", p1, 1);
- CHECK_BLOCKS("misc", root, 2);
- p2 = talloc_strdup(p1, "foo");
- torture_assert("misc", talloc_unlink(root, p2) == -1,
- "failed: talloc_unlink() of non-reference context should return -1\n");
- torture_assert("misc", talloc_unlink(p1, p2) == 0,
- "failed: talloc_unlink() of parent should succeed\n");
- talloc_unlink(NULL, p1);
- CHECK_BLOCKS("misc", p1, 1);
- CHECK_BLOCKS("misc", root, 2);
-
- name = talloc_set_name(p1, "my name is %s", "foo");
- torture_assert_str_equal("misc", talloc_get_name(p1), "my name is foo",
- "failed: wrong name after talloc_set_name(my name is foo)");
- CHECK_BLOCKS("misc", p1, 2);
- CHECK_BLOCKS("misc", root, 3);
-
- talloc_set_name_const(p1, NULL);
- torture_assert_str_equal ("misc", talloc_get_name(p1), "UNNAMED",
- "failed: wrong name after talloc_set_name(NULL)");
- CHECK_BLOCKS("misc", p1, 2);
- CHECK_BLOCKS("misc", root, 3);
-
- torture_assert("misc", talloc_free(NULL) == -1,
- "talloc_free(NULL) should give -1\n");
-
- talloc_set_destructor(p1, fail_destructor);
- torture_assert("misc", talloc_free(p1) == -1,
- "Failed destructor should cause talloc_free to fail\n");
- talloc_set_destructor(p1, NULL);
-
- talloc_report(root, stderr);
-
-
- p2 = (char *)talloc_zero_size(p1, 20);
- torture_assert("misc", p2[19] == 0, "Failed to give zero memory\n");
- talloc_free(p2);
-
- torture_assert("misc", talloc_strdup(root, NULL) == NULL,
- "failed: strdup on NULL should give NULL\n");
-
- p2 = talloc_strndup(p1, "foo", 2);
- torture_assert("misc", strcmp("fo", p2) == 0,
- "strndup doesn't work\n");
- p2 = talloc_asprintf_append_buffer(p2, "o%c", 'd');
- torture_assert("misc", strcmp("food", p2) == 0,
- "talloc_asprintf_append_buffer doesn't work\n");
- CHECK_BLOCKS("misc", p2, 1);
- CHECK_BLOCKS("misc", p1, 3);
-
- p2 = talloc_asprintf_append_buffer(NULL, "hello %s", "world");
- torture_assert("misc", strcmp("hello world", p2) == 0,
- "talloc_asprintf_append_buffer doesn't work\n");
- CHECK_BLOCKS("misc", p2, 1);
- CHECK_BLOCKS("misc", p1, 3);
- talloc_free(p2);
-
- d = talloc_array(p1, double, 0x20000000);
- torture_assert("misc", !d, "failed: integer overflow not detected\n");
-
- d = talloc_realloc(p1, d, double, 0x20000000);
- torture_assert("misc", !d, "failed: integer overflow not detected\n");
-
- talloc_free(p1);
- CHECK_BLOCKS("misc", root, 1);
-
- p1 = talloc_named(root, 100, "%d bytes", 100);
- CHECK_BLOCKS("misc", p1, 2);
- CHECK_BLOCKS("misc", root, 3);
- talloc_unlink(root, p1);
-
- p1 = talloc_init("%d bytes", 200);
- p2 = talloc_asprintf(p1, "my test '%s'", "string");
- torture_assert_str_equal("misc", p2, "my test 'string'",
- "failed: talloc_asprintf(\"my test '%%s'\", \"string\") gave: \"%s\"");
- CHECK_BLOCKS("misc", p1, 3);
- CHECK_SIZE("misc", p2, 17);
- CHECK_BLOCKS("misc", root, 1);
- talloc_unlink(NULL, p1);
-
- p1 = talloc_named_const(root, 10, "p1");
- p2 = (char *)talloc_named_const(root, 20, "p2");
- (void)talloc_reference(p1, p2);
- talloc_report_full(root, stderr);
- talloc_unlink(root, p2);
- talloc_report_full(root, stderr);
- CHECK_BLOCKS("misc", p2, 1);
- CHECK_BLOCKS("misc", p1, 2);
- CHECK_BLOCKS("misc", root, 3);
- talloc_unlink(p1, p2);
- talloc_unlink(root, p1);
-
- p1 = talloc_named_const(root, 10, "p1");
- p2 = (char *)talloc_named_const(root, 20, "p2");
- (void)talloc_reference(NULL, p2);
- talloc_report_full(root, stderr);
- talloc_unlink(root, p2);
- talloc_report_full(root, stderr);
- CHECK_BLOCKS("misc", p2, 1);
- CHECK_BLOCKS("misc", p1, 1);
- CHECK_BLOCKS("misc", root, 2);
- talloc_unlink(NULL, p2);
- talloc_unlink(root, p1);
-
- /* Test that talloc_unlink is a no-op */
-
- torture_assert("misc", talloc_unlink(root, NULL) == -1,
- "failed: talloc_unlink(root, NULL) == -1\n");
-
- talloc_report(root, stderr);
- talloc_report(NULL, stderr);
-
- CHECK_SIZE("misc", root, 0);
-
- talloc_free(root);
-
- CHECK_SIZE("misc", NULL, 0);
-
- talloc_enable_null_tracking_no_autofree();
- talloc_enable_leak_report();
- talloc_enable_leak_report_full();
-
- printf("success: misc\n");
-
- return true;
-}
-
-
-/*
- test realloc
-*/
-static bool test_realloc(void)
-{
- void *root, *p1, *p2;
-
- printf("test: realloc\n# REALLOC\n");
-
- root = talloc_new(NULL);
-
- p1 = talloc_size(root, 10);
- CHECK_SIZE("realloc", p1, 10);
-
- p1 = talloc_realloc_size(NULL, p1, 20);
- CHECK_SIZE("realloc", p1, 20);
-
- talloc_new(p1);
-
- p2 = talloc_realloc_size(p1, NULL, 30);
-
- talloc_new(p1);
-
- p2 = talloc_realloc_size(p1, p2, 40);
-
- CHECK_SIZE("realloc", p2, 40);
- CHECK_SIZE("realloc", root, 60);
- CHECK_BLOCKS("realloc", p1, 4);
-
- p1 = talloc_realloc_size(NULL, p1, 20);
- CHECK_SIZE("realloc", p1, 60);
-
- talloc_increase_ref_count(p2);
- torture_assert("realloc", talloc_realloc_size(NULL, p2, 5) == NULL,
- "failed: talloc_realloc() on a referenced pointer should fail\n");
- CHECK_BLOCKS("realloc", p1, 4);
-
- talloc_realloc_size(NULL, p2, 0);
- talloc_realloc_size(NULL, p2, 0);
- CHECK_BLOCKS("realloc", p1, 4);
- talloc_realloc_size(p1, p2, 0);
- CHECK_BLOCKS("realloc", p1, 3);
-
- torture_assert("realloc", talloc_realloc_size(NULL, p1, 0x7fffffff) == NULL,
- "failed: oversize talloc should fail\n");
-
- talloc_realloc_size(NULL, p1, 0);
- CHECK_BLOCKS("realloc", root, 4);
- talloc_realloc_size(root, p1, 0);
- CHECK_BLOCKS("realloc", root, 1);
-
- CHECK_SIZE("realloc", root, 0);
-
- talloc_free(root);
-
- printf("success: realloc\n");
-
- return true;
-}
-
-/*
- test realloc with a child
-*/
-static bool test_realloc_child(void)
-{
- void *root;
- struct el2 {
- const char *name;
- } *el2;
- struct el1 {
- int count;
- struct el2 **list, **list2, **list3;
- } *el1;
-
- printf("test: REALLOC WITH CHILD\n");
-
- root = talloc_new(NULL);
-
- el1 = talloc(root, struct el1);
- el1->list = talloc(el1, struct el2 *);
- el1->list[0] = talloc(el1->list, struct el2);
- el1->list[0]->name = talloc_strdup(el1->list[0], "testing");
-
- el1->list2 = talloc(el1, struct el2 *);
- el1->list2[0] = talloc(el1->list2, struct el2);
- el1->list2[0]->name = talloc_strdup(el1->list2[0], "testing2");
-
- el1->list3 = talloc(el1, struct el2 *);
- el1->list3[0] = talloc(el1->list3, struct el2);
- el1->list3[0]->name = talloc_strdup(el1->list3[0], "testing2");
-
- el2 = talloc(el1->list, struct el2);
- el2 = talloc(el1->list2, struct el2);
- el2 = talloc(el1->list3, struct el2);
-
- el1->list = talloc_realloc(el1, el1->list, struct el2 *, 100);
- el1->list2 = talloc_realloc(el1, el1->list2, struct el2 *, 200);
- el1->list3 = talloc_realloc(el1, el1->list3, struct el2 *, 300);
-
- talloc_free(root);
-
- printf("success: REALLOC WITH CHILD\n");
- return true;
-}
-
-/*
- test type checking
-*/
-static bool test_type(void)
-{
- void *root;
- struct el1 {
- int count;
- };
- struct el2 {
- int count;
- };
- struct el1 *el1;
-
- printf("test: type\n# talloc type checking\n");
-
- root = talloc_new(NULL);
-
- el1 = talloc(root, struct el1);
-
- el1->count = 1;
-
- torture_assert("type", talloc_get_type(el1, struct el1) == el1,
- "type check failed on el1\n");
- torture_assert("type", talloc_get_type(el1, struct el2) == NULL,
- "type check failed on el1 with el2\n");
- talloc_set_type(el1, struct el2);
- torture_assert("type", talloc_get_type(el1, struct el2) == (struct el2 *)el1,
- "type set failed on el1 with el2\n");
-
- talloc_free(root);
-
- printf("success: type\n");
- return true;
-}
-
-/*
- test steal
-*/
-static bool test_steal(void)
-{
- void *root, *p1, *p2;
-
- printf("test: steal\n# STEAL\n");
-
- root = talloc_new(NULL);
-
- p1 = talloc_array(root, char, 10);
- CHECK_SIZE("steal", p1, 10);
-
- p2 = talloc_realloc(root, NULL, char, 20);
- CHECK_SIZE("steal", p1, 10);
- CHECK_SIZE("steal", root, 30);
-
- torture_assert("steal", talloc_steal(p1, NULL) == NULL,
- "failed: stealing NULL should give NULL\n");
-
- torture_assert("steal", talloc_steal(p1, p1) == p1,
- "failed: stealing to ourselves is a nop\n");
- CHECK_BLOCKS("steal", root, 3);
- CHECK_SIZE("steal", root, 30);
-
- talloc_steal(NULL, p1);
- talloc_steal(NULL, p2);
- CHECK_BLOCKS("steal", root, 1);
- CHECK_SIZE("steal", root, 0);
-
- talloc_free(p1);
- talloc_steal(root, p2);
- CHECK_BLOCKS("steal", root, 2);
- CHECK_SIZE("steal", root, 20);
-
- talloc_free(p2);
-
- CHECK_BLOCKS("steal", root, 1);
- CHECK_SIZE("steal", root, 0);
-
- talloc_free(root);
-
- p1 = talloc_size(NULL, 3);
- talloc_report_full(NULL, stderr);
- CHECK_SIZE("steal", NULL, 3);
- talloc_free(p1);
-
- printf("success: steal\n");
- return true;
-}
-
-/*
- test move
-*/
-static bool test_move(void)
-{
- void *root;
- struct t_move {
- char *p;
- int *x;
- } *t1, *t2;
-
- printf("test: move\n# MOVE\n");
-
- root = talloc_new(NULL);
-
- t1 = talloc(root, struct t_move);
- t2 = talloc(root, struct t_move);
- t1->p = talloc_strdup(t1, "foo");
- t1->x = talloc(t1, int);
- *t1->x = 42;
-
- t2->p = talloc_move(t2, &t1->p);
- t2->x = talloc_move(t2, &t1->x);
- torture_assert("move", t1->p == NULL && t1->x == NULL &&
- strcmp(t2->p, "foo") == 0 && *t2->x == 42,
- "talloc move failed");
-
- talloc_free(root);
-
- printf("success: move\n");
-
- return true;
-}
-
-/*
- test talloc_realloc_fn
-*/
-static bool test_realloc_fn(void)
-{
- void *root, *p1;
-
- printf("test: realloc_fn\n# talloc_realloc_fn\n");
-
- root = talloc_new(NULL);
-
- p1 = talloc_realloc_fn(root, NULL, 10);
- CHECK_BLOCKS("realloc_fn", root, 2);
- CHECK_SIZE("realloc_fn", root, 10);
- p1 = talloc_realloc_fn(root, p1, 20);
- CHECK_BLOCKS("realloc_fn", root, 2);
- CHECK_SIZE("realloc_fn", root, 20);
- p1 = talloc_realloc_fn(root, p1, 0);
- CHECK_BLOCKS("realloc_fn", root, 1);
- CHECK_SIZE("realloc_fn", root, 0);
-
- talloc_free(root);
-
- printf("success: realloc_fn\n");
- return true;
-}
-
-
-static bool test_unref_reparent(void)
-{
- void *root, *p1, *p2, *c1;
-
- printf("test: unref_reparent\n# UNREFERENCE AFTER PARENT FREED\n");
-
- root = talloc_named_const(NULL, 0, "root");
- p1 = talloc_named_const(root, 1, "orig parent");
- p2 = talloc_named_const(root, 1, "parent by reference");
-
- c1 = talloc_named_const(p1, 1, "child");
- talloc_reference(p2, c1);
-
- CHECK_PARENT("unref_reparent", c1, p1);
-
- talloc_free(p1);
-
- CHECK_PARENT("unref_reparent", c1, p2);
-
- talloc_unlink(p2, c1);
-
- CHECK_SIZE("unref_reparent", root, 1);
-
- talloc_free(p2);
- talloc_free(root);
-
- printf("success: unref_reparent\n");
- return true;
-}
-
-/*
- measure the speed of talloc versus malloc
-*/
-static bool test_speed(void)
-{
- void *ctx = talloc_new(NULL);
- unsigned count;
- const int loop = 1000;
- int i;
- struct timeval tv;
-
- printf("test: speed\n# TALLOC VS MALLOC SPEED\n");
-
- tv = timeval_current();
- count = 0;
- do {
- void *p1, *p2, *p3;
- for (i=0;i<loop;i++) {
- p1 = talloc_size(ctx, loop % 100);
- p2 = talloc_strdup(p1, "foo bar");
- p3 = talloc_size(p1, 300);
- talloc_free(p1);
- }
- count += 3 * loop;
- } while (timeval_elapsed(&tv) < 5.0);
-
- fprintf(stderr, "talloc: %.0f ops/sec\n", count/timeval_elapsed(&tv));
-
- talloc_free(ctx);
-
- ctx = talloc_pool(NULL, 1024);
-
- tv = timeval_current();
- count = 0;
- do {
- void *p1, *p2, *p3;
- for (i=0;i<loop;i++) {
- p1 = talloc_size(ctx, loop % 100);
- p2 = talloc_strdup(p1, "foo bar");
- p3 = talloc_size(p1, 300);
- talloc_free_children(ctx);
- }
- count += 3 * loop;
- } while (timeval_elapsed(&tv) < 5.0);
-
- talloc_free(ctx);
-
- fprintf(stderr, "talloc_pool: %.0f ops/sec\n", count/timeval_elapsed(&tv));
-
- tv = timeval_current();
- count = 0;
- do {
- void *p1, *p2, *p3;
- for (i=0;i<loop;i++) {
- p1 = malloc(loop % 100);
- p2 = strdup("foo bar");
- p3 = malloc(300);
- free(p1);
- free(p2);
- free(p3);
- }
- count += 3 * loop;
- } while (timeval_elapsed(&tv) < 5.0);
- fprintf(stderr, "malloc: %.0f ops/sec\n", count/timeval_elapsed(&tv));
-
- printf("success: speed\n");
-
- return true;
-}
-
-static bool test_lifeless(void)
-{
- void *top = talloc_new(NULL);
- char *parent, *child;
- void *child_owner = talloc_new(NULL);
-
- printf("test: lifeless\n# TALLOC_UNLINK LOOP\n");
-
- parent = talloc_strdup(top, "parent");
- child = talloc_strdup(parent, "child");
- (void)talloc_reference(child, parent);
- (void)talloc_reference(child_owner, child);
- talloc_report_full(top, stderr);
- talloc_unlink(top, parent);
- talloc_unlink(top, child);
- talloc_report_full(top, stderr);
- talloc_free(top);
- talloc_free(child_owner);
- talloc_free(child);
-
- printf("success: lifeless\n");
- return true;
-}
-
-static int loop_destructor_count;
-
-static int test_loop_destructor(char *ptr)
-{
- loop_destructor_count++;
- return 0;
-}
-
-static bool test_loop(void)
-{
- void *top = talloc_new(NULL);
- char *parent;
- struct req1 {
- char *req2, *req3;
- } *req1;
-
- printf("test: loop\n# TALLOC LOOP DESTRUCTION\n");
-
- parent = talloc_strdup(top, "parent");
- req1 = talloc(parent, struct req1);
- req1->req2 = talloc_strdup(req1, "req2");
- talloc_set_destructor(req1->req2, test_loop_destructor);
- req1->req3 = talloc_strdup(req1, "req3");
- (void)talloc_reference(req1->req3, req1);
- talloc_report_full(top, stderr);
- talloc_free(parent);
- talloc_report_full(top, stderr);
- talloc_report_full(NULL, stderr);
- talloc_free(top);
-
- torture_assert("loop", loop_destructor_count == 1,
- "FAILED TO FIRE LOOP DESTRUCTOR\n");
- loop_destructor_count = 0;
-
- printf("success: loop\n");
- return true;
-}
-
-static int fail_destructor_str(char *ptr)
-{
- return -1;
-}
-
-static bool test_free_parent_deny_child(void)
-{
- void *top = talloc_new(NULL);
- char *level1;
- char *level2;
- char *level3;
-
- printf("test: free_parent_deny_child\n# TALLOC FREE PARENT DENY CHILD\n");
-
- level1 = talloc_strdup(top, "level1");
- level2 = talloc_strdup(level1, "level2");
- level3 = talloc_strdup(level2, "level3");
-
- talloc_set_destructor(level3, fail_destructor_str);
- talloc_free(level1);
- talloc_set_destructor(level3, NULL);
-
- CHECK_PARENT("free_parent_deny_child", level3, top);
-
- talloc_free(top);
-
- printf("success: free_parent_deny_child\n");
- return true;
-}
-
-static bool test_talloc_ptrtype(void)
-{
- void *top = talloc_new(NULL);
- struct struct1 {
- int foo;
- int bar;
- } *s1, *s2, **s3, ***s4;
- const char *location1;
- const char *location2;
- const char *location3;
- const char *location4;
-
- printf("test: ptrtype\n# TALLOC PTRTYPE\n");
-
- s1 = talloc_ptrtype(top, s1);location1 = __location__;
-
- if (talloc_get_size(s1) != sizeof(struct struct1)) {
- printf("failure: ptrtype [\n"
- "talloc_ptrtype() allocated the wrong size %lu (should be %lu)\n"
- "]\n", (unsigned long)talloc_get_size(s1),
- (unsigned long)sizeof(struct struct1));
- return false;
- }
-
- if (strcmp(location1, talloc_get_name(s1)) != 0) {
- printf("failure: ptrtype [\n"
- "talloc_ptrtype() sets the wrong name '%s' (should be '%s')\n]\n",
- talloc_get_name(s1), location1);
- return false;
- }
-
- s2 = talloc_array_ptrtype(top, s2, 10);location2 = __location__;
-
- if (talloc_get_size(s2) != (sizeof(struct struct1) * 10)) {
- printf("failure: ptrtype [\n"
- "talloc_array_ptrtype() allocated the wrong size "
- "%lu (should be %lu)\n]\n",
- (unsigned long)talloc_get_size(s2),
- (unsigned long)(sizeof(struct struct1)*10));
- return false;
- }
-
- if (strcmp(location2, talloc_get_name(s2)) != 0) {
- printf("failure: ptrtype [\n"
- "talloc_array_ptrtype() sets the wrong name '%s' (should be '%s')\n]\n",
- talloc_get_name(s2), location2);
- return false;
- }
-
- s3 = talloc_array_ptrtype(top, s3, 10);location3 = __location__;
-
- if (talloc_get_size(s3) != (sizeof(struct struct1 *) * 10)) {
- printf("failure: ptrtype [\n"
- "talloc_array_ptrtype() allocated the wrong size "
- "%lu (should be %lu)\n]\n",
- (unsigned long)talloc_get_size(s3),
- (unsigned long)(sizeof(struct struct1 *)*10));
- return false;
- }
-
- torture_assert_str_equal("ptrtype", location3, talloc_get_name(s3),
- "talloc_array_ptrtype() sets the wrong name");
-
- s4 = talloc_array_ptrtype(top, s4, 10);location4 = __location__;
-
- if (talloc_get_size(s4) != (sizeof(struct struct1 **) * 10)) {
- printf("failure: ptrtype [\n"
- "talloc_array_ptrtype() allocated the wrong size "
- "%lu (should be %lu)\n]\n",
- (unsigned long)talloc_get_size(s4),
- (unsigned long)(sizeof(struct struct1 **)*10));
- return false;
- }
-
- torture_assert_str_equal("ptrtype", location4, talloc_get_name(s4),
- "talloc_array_ptrtype() sets the wrong name");
-
- talloc_free(top);
-
- printf("success: ptrtype\n");
- return true;
-}
-
-static int _test_talloc_free_in_destructor(void **ptr)
-{
- talloc_free(*ptr);
- return 0;
-}
-
-static bool test_talloc_free_in_destructor(void)
-{
- void *level0;
- void *level1;
- void *level2;
- void *level3;
- void *level4;
- void **level5;
-
- printf("test: free_in_destructor\n# TALLOC FREE IN DESTRUCTOR\n");
-
- level0 = talloc_new(NULL);
- level1 = talloc_new(level0);
- level2 = talloc_new(level1);
- level3 = talloc_new(level2);
- level4 = talloc_new(level3);
- level5 = talloc(level4, void *);
-
- *level5 = level3;
- (void)talloc_reference(level0, level3);
- (void)talloc_reference(level3, level3);
- (void)talloc_reference(level5, level3);
-
- talloc_set_destructor(level5, _test_talloc_free_in_destructor);
-
- talloc_free(level1);
-
- talloc_free(level0);
-
- printf("success: free_in_destructor\n");
- return true;
-}
-
-static bool test_autofree(void)
-{
-#if _SAMBA_BUILD_ < 4
- /* autofree test would kill smbtorture */
- void *p;
- printf("test: autofree\n# TALLOC AUTOFREE CONTEXT\n");
-
- p = talloc_autofree_context();
- talloc_free(p);
-
- p = talloc_autofree_context();
- talloc_free(p);
-
- printf("success: autofree\n");
-#endif
- return true;
-}
-
-static bool test_pool(void)
-{
- void *pool;
- void *p1, *p2, *p3, *p4;
-
- pool = talloc_pool(NULL, 1024);
-
- p1 = talloc_size(pool, 80);
- p2 = talloc_size(pool, 20);
- p3 = talloc_size(p1, 50);
- p4 = talloc_size(p3, 1000);
-
- talloc_free(pool);
-
- return true;
-}
-
-static void test_reset(void)
-{
- talloc_set_log_fn(test_log_stdout);
- test_abort_stop();
- talloc_disable_null_tracking();
- talloc_enable_null_tracking_no_autofree();
-}
-
-struct torture_context;
-bool torture_local_talloc(struct torture_context *tctx)
-{
- bool ret = true;
-
- setlinebuf(stdout);
-
- test_reset();
- ret &= test_ref1();
- test_reset();
- ret &= test_ref2();
- test_reset();
- ret &= test_ref3();
- test_reset();
- ret &= test_ref4();
- test_reset();
- ret &= test_unlink1();
- test_reset();
- ret &= test_misc();
- test_reset();
- ret &= test_realloc();
- test_reset();
- ret &= test_realloc_child();
- test_reset();
- ret &= test_steal();
- test_reset();
- ret &= test_move();
- test_reset();
- ret &= test_unref_reparent();
- test_reset();
- ret &= test_realloc_fn();
- test_reset();
- ret &= test_type();
- test_reset();
- ret &= test_lifeless();
- test_reset();
- ret &= test_loop();
- test_reset();
- ret &= test_free_parent_deny_child();
- test_reset();
- ret &= test_talloc_ptrtype();
- test_reset();
- ret &= test_talloc_free_in_destructor();
- test_reset();
- ret &= test_pool();
-
- if (ret) {
- test_reset();
- ret &= test_speed();
- }
- test_reset();
- ret &= test_autofree();
-
- test_reset();
-
- return ret;
-}
diff --git a/chromium/third_party/talloc/testsuite_main.c b/chromium/third_party/talloc/testsuite_main.c
deleted file mode 100644
index 1b513332787..00000000000
--- a/chromium/third_party/talloc/testsuite_main.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- local testing of talloc routines.
-
- Copyright (C) Andrew Tridgell 2004
-
- ** NOTE! The following LGPL license applies to the talloc
- ** library. This does NOT imply that all of Samba is released
- ** under the LGPL
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "replace.h"
-
-struct torture_context;
-bool torture_local_talloc(struct torture_context *tctx);
-
-int main(void)
-{
- bool ret = torture_local_talloc(NULL);
- if (!ret)
- return -1;
- return 0;
-}
diff --git a/chromium/third_party/talloc/web/index.html b/chromium/third_party/talloc/web/index.html
deleted file mode 100644
index 388ec2cde20..00000000000
--- a/chromium/third_party/talloc/web/index.html
+++ /dev/null
@@ -1,51 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
-<HTML>
-<HEAD>
-<TITLE>talloc</TITLE>
-</HEAD>
-<BODY BGCOLOR="#ffffff" TEXT="#000000" VLINK="#292555" LINK="#292555" ALINK="#cc0033">
-
-<h1>talloc</h1>
-
-talloc is a hierarchical pool based memory allocator with
-destructors. It is the core memory allocator used in Samba, and has
-made a huge difference in many aspects of Samba4 development.<p>
-
-To get started with talloc, I would recommend you read the <a
-href="http://samba.org/ftp/unpacked/talloc/talloc_guide.txt">talloc guide</a>.
-
-<h2>Download</h2>
-You can download the latest releases of talloc from the <a
-href="http://samba.org/ftp/talloc">talloc directory</a> on the samba public
-source archive.
-
-<h2>Discussion and bug reports</h2>
-
-talloc does not currently have its own mailing list or bug tracking
-system. For now, please use the <a
-href="https://lists.samba.org/mailman/listinfo/samba-technical">samba-technical</a>
-mailing list, and the <a href="http://bugzilla.samba.org/">Samba
-bugzilla</a> bug tracking system.
-
-<h2>Development</h2>
-
-You can download the latest code either via git or rsync.<br>
-<br>
-To fetch via git see the following guide:<br>
-<a href="http://wiki.samba.org/index.php/Using_Git_for_Samba_Development">Using Git for Samba Development</a><br>
-Once you have cloned the tree switch to the master branch and cd into the lib/talloc directory.<br>
-<br>
-To fetch via rsync use this command:
-
-<pre>
- rsync -Pavz samba.org::ftp/unpacked/standalone_projects/lib/talloc .
-</pre>
-
-<hr>
-<tiny>
-<a href="http://samba.org/~tridge/">Andrew Tridgell</a><br>
-talloc AT tridgell.net
-</tiny>
-
-</BODY>
-</HTML>