diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-10-06 10:30:07 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-10-06 10:32:57 +0900 |
commit | 71d216b90256936a9638f325af9bc69d720e75de (patch) | |
tree | 9c5f682d341c7c88ad0c8e3d4b262e00b6fb691a /tools | |
parent | 733b5d5ae2c5d625211e2985ac25728ac3f54883 (diff) | |
download | boost-71d216b90256936a9638f325af9bc69d720e75de.tar.gz boost-71d216b90256936a9638f325af9bc69d720e75de.tar.bz2 boost-71d216b90256936a9638f325af9bc69d720e75de.zip |
Imported Upstream version 1.59.0
Change-Id: I2dde00f4eca71df3eea9d251dcaecde18a6c90a5
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'tools')
69 files changed, 3698 insertions, 1243 deletions
diff --git a/tools/Jamfile.v2 b/tools/Jamfile.v2 index d69756e701..e1391c7686 100644 --- a/tools/Jamfile.v2 +++ b/tools/Jamfile.v2 @@ -21,7 +21,7 @@ TOOLS = bcp//bcp inspect/build//inspect quickbook//quickbook - wave/build//wave + /boost/libs/wave/tool//wave ; install dist-bin diff --git a/tools/boostdep/doc/Jamfile b/tools/boostdep/doc/Jamfile new file mode 100644 index 0000000000..e3af077882 --- /dev/null +++ b/tools/boostdep/doc/Jamfile @@ -0,0 +1,22 @@ +# Copyright 2015 Peter Dimov. Use, modification, and distribution are +# subject to the Boost Software License, Version 1.0. See accompanying +# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt + +using quickbook ; + +xml boostdep : src/boostdep.qbk ; + +boostbook standalone + : + boostdep + : + <xsl:param>boost.root=../../../.. + + <xsl:param>chunk.section.depth=0 + <xsl:param>chunk.first.sections=0 + <xsl:param>toc.section.depth=2 + <xsl:param>toc.max.depth=2 + <xsl:param>generate.section.toc.level=1 + + <xsl:param>generate.manifest=0 + ; diff --git a/tools/boostdep/doc/html/index.html b/tools/boostdep/doc/html/index.html new file mode 100644 index 0000000000..35f5e7d23c --- /dev/null +++ b/tools/boostdep/doc/html/index.html @@ -0,0 +1,820 @@ +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> +<title>Boostdep</title> +<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css"> +<meta name="generator" content="DocBook XSL Stylesheets V1.78.1"> +<link rel="home" href="index.html" title="Boostdep"> +</head> +<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> +<table cellpadding="2" width="100%"><tr> +<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td> +<td align="center"><a href="../../../../index.html">Home</a></td> +<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td> +<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> +<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> +<td align="center"><a href="../../../../more/index.htm">More</a></td> +</tr></table> +<hr> +<div class="spirit-nav"></div> +<div class="article"> +<div class="titlepage"> +<div> +<div><h2 class="title"> +<a name="boostdep"></a>Boostdep</h2></div> +<div><p class="copyright">Copyright © 2014, 2015 Peter Dimov</p></div> +<div><div class="legalnotice"> +<a name="boostdep.legal"></a><p> + Distributed under the <a href="http://boost.org/LICENSE_1_0.txt" target="_top">Boost + Software License, Version 1.0</a>. + </p> +</div></div> +</div> +<hr> +</div> +<div class="toc"> +<p><b>Table of Contents</b></p> +<dl class="toc"> +<dt><span class="section"><a href="index.html#boostdep.introduction">Introduction</a></span></dt> +<dd><dl> +<dt><span class="section"><a href="index.html#boostdep.introduction.modular_boost">Modular Boost</a></span></dt> +<dt><span class="section"><a href="index.html#boostdep.introduction.building_boostdep">Building Boostdep</a></span></dt> +<dt><span class="section"><a href="index.html#boostdep.introduction.running_boostdep">Running Boostdep</a></span></dt> +</dl></dd> +<dt><span class="section"><a href="index.html#boostdep.usage">Usage</a></span></dt> +<dd><dl> +<dt><span class="section"><a href="index.html#boostdep.usage.simple_queries">Simple Queries</a></span></dt> +<dt><span class="section"><a href="index.html#boostdep.usage.html_reports">HTML reports</a></span></dt> +</dl></dd> +<dt><span class="section"><a href="index.html#boostdep.reference">Reference</a></span></dt> +<dd><dl> +<dt><span class="section"><a href="index.html#boostdep.reference.list_modules">--list-modules</a></span></dt> +<dt><span class="section"><a href="index.html#boostdep.reference.list_buildable">--list-buildable</a></span></dt> +<dt><span class="section"><a href="index.html#boostdep.reference.list_dependencies">--list-dependencies</a></span></dt> +<dt><span class="section"><a href="index.html#boostdep.reference.module_overview">--module-overview</a></span></dt> +<dt><span class="section"><a href="index.html#boostdep.reference.module_levels">--module-levels</a></span></dt> +<dt><span class="section"><a href="index.html#boostdep.reference.module_weights">--module-weights</a></span></dt> +<dt><span class="section"><a href="index.html#boostdep.reference.primary">--primary</a></span></dt> +<dt><span class="section"><a href="index.html#boostdep.reference.secondary">--secondary</a></span></dt> +<dt><span class="section"><a href="index.html#boostdep.reference.reverse">--reverse</a></span></dt> +<dt><span class="section"><a href="index.html#boostdep.reference.header">--header</a></span></dt> +<dt><span class="section"><a href="index.html#boostdep.reference.track_sources">--track-sources</a></span></dt> +<dt><span class="section"><a href="index.html#boostdep.reference.title">--title</a></span></dt> +<dt><span class="section"><a href="index.html#boostdep.reference.footer">--footer</a></span></dt> +<dt><span class="section"><a href="index.html#boostdep.reference.html">--html</a></span></dt> +</dl></dd> +</dl> +</div> +<div class="section"> +<div class="titlepage"><div><div><h2 class="title" style="clear: both"> +<a name="boostdep.introduction"></a><a class="link" href="index.html#boostdep.introduction" title="Introduction">Introduction</a> +</h2></div></div></div> +<div class="toc"><dl class="toc"> +<dt><span class="section"><a href="index.html#boostdep.introduction.modular_boost">Modular Boost</a></span></dt> +<dt><span class="section"><a href="index.html#boostdep.introduction.building_boostdep">Building Boostdep</a></span></dt> +<dt><span class="section"><a href="index.html#boostdep.introduction.running_boostdep">Running Boostdep</a></span></dt> +</dl></div> +<p> + <span class="emphasis"><em>Boostdep</em></span> is a tool for generating Boost dependency reports. + It scans the header or source files of the Boost libraries for <code class="computeroutput"><span class="preprocessor">#include</span></code> directives, builds a dependency + graph from this information and outputs its findings in plain text or HTML. + </p> +<div class="section"> +<div class="titlepage"><div><div><h3 class="title"> +<a name="boostdep.introduction.modular_boost"></a><a class="link" href="index.html#boostdep.introduction.modular_boost" title="Modular Boost">Modular Boost</a> +</h3></div></div></div> +<p> + <span class="emphasis"><em>Boostdep</em></span> requires the so-called "modular Boost" + directory structure. + </p> +<p> + If you already have a <a href="https://svn.boost.org/trac/boost/wiki/ModularBoost" target="_top">modular + Boost installation</a>, you can skip this section. Otherwise, read on. + </p> +<p> + Boost libraries reside in subdirectories under the <code class="literal">libs</code> + directory. For example, the contents of the Boost.Filesystem library are + in <code class="literal">libs/filesystem</code>. This includes the build scripts (in + <code class="literal">libs/filesystem/build</code>), the source files (in <code class="literal">libs/filesystem/src</code>), + the tests (in <code class="literal">libs/filesystem/test</code>), the documentation + (in <code class="literal">libs/filesystem/doc</code>), and so on. + </p> +<p> + In the past, when Boost used SVN as its version control system, the header + files were an exception. The header files of all libraries resided in the + <code class="literal">boost</code> subdirectory, and it wasn't possible to accurately + determine which header belonged to which library. + </p> +<p> + When Boost moved to Git for version control, header files were moved to their + corresponding libraries, into an <code class="literal">include</code> subdirectory. + The header files of Boost.Filesystem are now in <code class="literal">libs/filesystem/include</code>. + </p> +<p> + For compatibility, <code class="literal">boost</code> is now a "virtual" + directory, containing links to the headers. It's maintained automatically + by Boost.Build. (The command <code class="literal">b2 headers</code> creates or recreates + the contents of the <code class="literal">boost</code> directory.) + </p> +<p> + This new structure allows <span class="emphasis"><em>Boostdep</em></span> to determine that, + when faced with an <code class="computeroutput"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">filesystem</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code> + directive, that this header is part of Boost.Filesystem, and that therefore, + the current library being scanned depends on Boost.Filesystem. + </p> +<p> + Unfortunately, Boost releases do not have this structure. For backward compatibility, + they have an old-style <code class="literal">boost</code> directory containing all + header files, whereas the per-library <code class="literal">include</code> subdirectories + are missing. Therefore, <span class="emphasis"><em>Boostdep</em></span> will not work with + a downloaded Boost release. + </p> +<p> + To use <span class="emphasis"><em>Boostdep</em></span>, you will have to clone the Boost Git + repository instead. To do that, execute the following command: + </p> +<pre class="programlisting">git clone https://github.com/boostorg/boost.git boost +</pre> +<p> + This will download the Boost "superproject" (the master project, + without any libraries) and place it into the subdirectory <code class="literal">boost</code> + of the current directory. To override the directory name, pass it as a second + argument instead of <code class="literal">boost</code>: + </p> +<pre class="programlisting">git clone https://github.com/boostorg/boost.git <span class="emphasis"><em>mydir</em></span> +</pre> +<p> + You can now <code class="literal">cd</code> into the newly created directory with + </p> +<pre class="programlisting">cd <span class="emphasis"><em>mydir</em></span> +</pre> +<p> + This directory is called the "Boost root". All of the commands + below assume that it is the current directory. + </p> +<p> + The above <code class="literal">git clone</code> commands download the default branch + of the Boost Git repository, which is <code class="literal">master</code>. This is + the current more-or-less stable version of Boost. + </p> +<p> + To verify this, issue the command + </p> +<pre class="programlisting">git status +</pre> +<p> + from the Boost root. This will output + </p> +<pre class="programlisting"># On branch master +nothing to commit, working directory clean +</pre> +<p> + To download a specific release instead, such as 1.58.0, issue the following + command after <code class="literal">git clone</code>, from the Boost root: + </p> +<pre class="programlisting">git checkout boost-1.58.0 +</pre> +<p> + <code class="literal">git status</code> will now say + </p> +<pre class="programlisting"># HEAD detached at boost-1.58.0 +nothing to commit, working directory clean +</pre> +<p> + Then, download all the libraries: + </p> +<pre class="programlisting">git submodule update --init +</pre> +<p> + This step will take a while. + </p> +<p> + If all goes well, you will now have the complete contents of Boost's latest + <code class="literal">master</code> branch (if you didn't <code class="literal">checkout</code> + a specific release by name) or the corresponding Boost release (if you did). + </p> +<p> + You can switch between the <code class="literal">master</code> branch, the <code class="literal">develop</code> + (unstable) branch, and a release, by issuing the following commands: + </p> +<div class="blockquote"><blockquote class="blockquote"><p> + For the <code class="literal">master</code> branch: + </p></blockquote></div> +<pre class="programlisting">git checkout master +git pull +git submodule update --init +</pre> +<div class="blockquote"><blockquote class="blockquote"><p> + (<code class="literal">git pull</code> updates your local copy of the <code class="literal">master</code> + branch from the server, in case it has changed since your initial checkout.) + </p></blockquote></div> +<div class="blockquote"><blockquote class="blockquote"><p> + For the <code class="literal">develop</code> branch: + </p></blockquote></div> +<pre class="programlisting">git checkout develop +git pull +git submodule update --init +</pre> +<div class="blockquote"><blockquote class="blockquote"><p> + For the <code class="literal">boost-1.58.0</code> release: + </p></blockquote></div> +<pre class="programlisting">git checkout boost-1.58.0 +git submodule update --init +</pre> +<div class="blockquote"><blockquote class="blockquote"><p> + For the <code class="literal">boost-1.57.0</code> release: + </p></blockquote></div> +<pre class="programlisting">git checkout boost-1.57.0 +git submodule update --init +</pre> +<p> + Note that, while the initial <code class="literal">git submodule update</code> is quite + slow, as it needs to download all the libraries, the subsequent invocations + are a lot faster. + </p> +<p> + Also note that if a new Boost library (<code class="literal">libs/convert</code>, for + example) is present in, say, <code class="literal">master</code>, and you have it checked + out, when you later switch to <code class="literal">boost-1.58.0</code>, where this + library doesn't exist, Git will not delete <code class="literal">libs/convert</code>. + In this case, <code class="literal">git status</code> will output + </p> +<pre class="programlisting"># HEAD detached at boost-1.58.0 +# Untracked files: +# (use "git add <file>..." to include in what will be committed) +# +# libs/convert/ +nothing added to commit but untracked files present (use "git add" to track) +</pre> +<p> + and you will have to remove <code class="literal">libs/convert</code> by hand. + </p> +<p> + Once you have the Boost contents which you want to analyze for dependencies, + proceed with the next step, building <span class="emphasis"><em>Boostdep</em></span>. + </p> +</div> +<div class="section"> +<div class="titlepage"><div><div><h3 class="title"> +<a name="boostdep.introduction.building_boostdep"></a><a class="link" href="index.html#boostdep.introduction.building_boostdep" title="Building Boostdep">Building Boostdep</a> +</h3></div></div></div> +<p> + To build <span class="emphasis"><em>Boostdep</em></span>, issue the following command from + the Boost root: + </p> +<pre class="programlisting">b2 tools/boostdep/build//install +</pre> +<p> + This will build <span class="emphasis"><em>Boostdep</em></span> from source using the default + "toolset" (a Boost.Build term meaning "compiler") and + if successful, place it into the <code class="literal">dist/bin</code> subdirectory. + The command assumes that <code class="literal">b2</code> (the Boost.Build executable) + is somewhere in your path. If you don't have <code class="literal">b2</code>, execute + </p> +<pre class="programlisting">.\bootstrap +</pre> +<p> + under Windows or + </p> +<pre class="programlisting">./bootstrap.sh +</pre> +<p> + under Unix-like systems, which should build <code class="literal">b2</code> and place + it into the current directory. You can then use <code class="literal">./b2</code> instead + of <code class="literal">b2</code>. + </p> +</div> +<div class="section"> +<div class="titlepage"><div><div><h3 class="title"> +<a name="boostdep.introduction.running_boostdep"></a><a class="link" href="index.html#boostdep.introduction.running_boostdep" title="Running Boostdep">Running Boostdep</a> +</h3></div></div></div> +<p> + Once you have built <span class="emphasis"><em>Boostdep</em></span>, execute it with the following + command: + </p> +<pre class="programlisting">dist/bin/boostdep +</pre> +<p> + or + </p> +<pre class="programlisting">dist\bin\boostdep +</pre> +<p> + on Windows. The commands below are given as using <code class="literal">dist/bin/boostdep</code>; + if you're using Windows, use <code class="literal">dist\bin\boostdep</code> instead. + </p> +<p> + This will print out the following help message: + </p> +<pre class="programlisting">Usage: + + boostdep --list-modules + boostdep --list-buildable + boostdep [--track-sources] --list-dependencies + + boostdep [options] --module-overview + boostdep [options] --module-levels + boostdep [options] --module-weights + + boostdep [options] [--primary] <module> + boostdep [options] --secondary <module> + boostdep [options] --reverse <module> + boostdep [options] [--header] <header> + + [options]: [--track-sources] [--title <title>] [--footer <footer>] [--html] +</pre> +<p> + (The 1.58.0 version of <span class="emphasis"><em>Boostdep</em></span> has an unfortunate bug + that causes the above output to be truncated after <code class="literal">boostdep --list-modules</code>. + The rest of the functionality is intact though, so you can still use it as + described.) + </p> +</div> +</div> +<div class="section"> +<div class="titlepage"><div><div><h2 class="title" style="clear: both"> +<a name="boostdep.usage"></a><a class="link" href="index.html#boostdep.usage" title="Usage">Usage</a> +</h2></div></div></div> +<div class="toc"><dl class="toc"> +<dt><span class="section"><a href="index.html#boostdep.usage.simple_queries">Simple Queries</a></span></dt> +<dt><span class="section"><a href="index.html#boostdep.usage.html_reports">HTML reports</a></span></dt> +</dl></div> +<div class="section"> +<div class="titlepage"><div><div><h3 class="title"> +<a name="boostdep.usage.simple_queries"></a><a class="link" href="index.html#boostdep.usage.simple_queries" title="Simple Queries">Simple Queries</a> +</h3></div></div></div> +<p> + To list the dependencies of a specific library, use the command + </p> +<pre class="programlisting">dist/bin/boostdep <span class="emphasis"><em>library</em></span> +</pre> +<p> + For Boost.Filesystem, for example, type + </p> +<pre class="programlisting">dist/bin/boostdep filesystem +</pre> +<p> + This will print out something similar to the following: + </p> +<pre class="programlisting">Primary dependencies for filesystem: + +assert: + <boost/assert.hpp> + from <boost/filesystem/operations.hpp> + from <boost/filesystem/path_traits.hpp> + +config: + <boost/config.hpp> + from <boost/filesystem/config.hpp> + from <boost/filesystem/convenience.hpp> + from <boost/filesystem/fstream.hpp> + from <boost/filesystem/operations.hpp> + from <boost/filesystem/path.hpp> + from <boost/filesystem/path_traits.hpp> + <span class="emphasis"><em>...</em></span> + +functional: + <boost/functional/hash_fwd.hpp> + from <boost/filesystem/path.hpp> + +io: + <boost/io/detail/quoted_manip.hpp> + from <boost/filesystem/path.hpp> + +iterator: + <boost/iterator/iterator_facade.hpp> + from <boost/filesystem/path.hpp> + <span class="emphasis"><em>...</em></span> +</pre> +<p> + This lists the immediate dependencies of Boost.Filesystem. <code class="literal">assert:</code> + is the library, <code class="literal"><boost/assert.hpp></code> is the file that + is being included, and <code class="literal">from <boost/filesystem/config.hpp></code> + shows where <code class="literal"><boost/assert.hpp></code> is being included. + </p> +<p> + <span class="emphasis"><em>Boostdep</em></span> names libraries (or modules) after their directory + name. The <code class="literal">libs/filesystem</code> directory, for example, is the + <code class="literal">filesystem</code> module. The <code class="literal">libs/numeric/conversion</code> + directory is the <code class="literal">numeric~conversion</code> module, according + to the <span class="emphasis"><em>Boostdep</em></span> naming convention. + </p> +<p> + The reason forward slashes are replaced with tildes is that <code class="literal">numeric~conversion</code> + is a valid file name, which makes generating HTML reports a bit easier. + </p> +<p> + To see where a given header resides and who includes it, type + </p> +<pre class="programlisting">dist/bin/boostdep <span class="emphasis"><em>header</em></span> +</pre> +<p> + For <code class="literal">boost/filesystem.hpp</code>, for example, type + </p> +<pre class="programlisting">dist/bin/boostdep boost/filesystem.hpp +</pre> +<p> + This will print something along the lines of + </p> +<pre class="programlisting">Inclusion report for <boost/filesystem.hpp> (in module filesystem): + + from spirit: + <boost/spirit/home/x3/support/utility/testing.hpp> +</pre> +<p> + What this tells you is that <code class="literal">boost/filesystem.hpp</code> is part + of Boost.Filesystem and is only included once, from <code class="literal"><boost/spirit/home/x3/support/utility/testing.hpp></code>. + Other headers, such as <code class="literal">boost/shared_ptr.hpp</code>, are more + widely used, as you can see if you try + </p> +<pre class="programlisting">dist/bin/boostdep boost/shared_ptr.hpp +</pre> +<p> + To print the reverse dependencies of a library, use + </p> +<pre class="programlisting">dist/bin/boostdep --reverse <span class="emphasis"><em>library</em></span> +</pre> +<p> + For example, + </p> +<pre class="programlisting">dist/bin/boostdep --reverse filesystem +</pre> +<p> + will list which libraries depend on Boost.Filesystem: + </p> +<pre class="programlisting">Reverse dependencies for filesystem: + +graph_parallel: + <boost/filesystem/operations.hpp> + from <boost/graph/distributed/adjlist/serialization.hpp> + <boost/filesystem/path.hpp> + from <boost/graph/distributed/adjlist/serialization.hpp> + +log: + <boost/filesystem/config.hpp> + from <boost/log/detail/config.hpp> + <boost/filesystem/path.hpp> + from <boost/log/sinks/event_log_backend.hpp> + from <boost/log/sinks/text_file_backend.hpp> + from <boost/log/sinks/text_multifile_backend.hpp> + +spirit: + <boost/filesystem.hpp> + from <boost/spirit/home/x3/support/utility/testing.hpp> + <boost/filesystem/fstream.hpp> + from <boost/spirit/home/x3/support/utility/testing.hpp> + <boost/filesystem/path.hpp> + from <boost/spirit/home/x3/support/utility/error_reporting.hpp> + +wave: + <boost/filesystem/operations.hpp> + from <boost/wave/util/cpp_include_paths.hpp> + from <boost/wave/util/cpp_iterator.hpp> + from <boost/wave/util/filesystem_compatibility.hpp> + <boost/filesystem/path.hpp> + from <boost/wave/cpp_context.hpp> + from <boost/wave/util/cpp_include_paths.hpp> + from <boost/wave/util/cpp_iterator.hpp> + from <boost/wave/util/cpp_macromap.hpp> + from <boost/wave/util/filesystem_compatibility.hpp> +</pre> +</div> +<div class="section"> +<div class="titlepage"><div><div><h3 class="title"> +<a name="boostdep.usage.html_reports"></a><a class="link" href="index.html#boostdep.usage.html_reports" title="HTML reports">HTML reports</a> +</h3></div></div></div> +<p> + The primary purpose of <span class="emphasis"><em>Boostdep</em></span> is to generate HTML + dependency reports. In the typical case, two types of reports are generated: + overviews that contain information for all modules, and per-module ones that + list information for a specific library. + </p> +<p> + <span class="emphasis"><em>Boostdep</em></span> can generate three types of the first kind + of report: module overview, module levels and module weights. To generate + a module overview, use the command + </p> +<pre class="programlisting">dist/bin/boostdep --html --module-overview > module-overview.html +</pre> +<p> + For a module level report, use + </p> +<pre class="programlisting">dist/bin/boostdep --html --module-levels > module-levels.html +</pre> +<p> + For a module weight report, use + </p> +<pre class="programlisting">dist/bin/boostdep --html --module-weights > module-weights.html +</pre> +<p> + In these reports, module names such as <span class="emphasis"><em>module</em></span> are HTML + links to <code class="literal"><span class="emphasis"><em>module</em></span>.html</code>. + </p> +<p> + To make these links work as expected, you can generate HTML reports for each + module as follows: + </p> +<pre class="programlisting">dist/bin/boostdep --title "Dependency Report for <span class="emphasis"><em>module</em></span>" --html --primary <span class="emphasis"><em>module</em></span> --secondary <span class="emphasis"><em>module</em></span> --reverse <span class="emphasis"><em>module</em></span> > <span class="emphasis"><em>module</em></span>.html +</pre> +<p> + This step can be automated if you generate a module list first with + </p> +<pre class="programlisting">dist/bin/boostdep --list-modules > list-modules.txt +</pre> +<p> + that will contain one module name per line, and then use a script to issue + the previous command for each module name. + </p> +<p> + For more information about the <span class="emphasis"><em>Boostdep</em></span> options and + commands, see the <a class="link" href="index.html#boostdep.reference" title="Reference">Reference</a> section. + </p> +<p> + For an example of a report generation script, see the file <code class="literal">tools/boostdep/examples/report.bat</code>. + This is a Windows batch file, but translating it to a Unix-style shell script + should be straightforward. + </p> +<p> + For convenience, the contents of <code class="literal">tools/boostdep/examples/report.bat</code> + are given below: + </p> +<pre class="programlisting">SET BOOSTDEP=dist\bin\boostdep.exe + +FOR /f %%i IN ('git rev-parse HEAD') DO @SET REV=%%i + +FOR /f %%i IN ('git rev-parse --short HEAD') DO @SET SHREV=%%i + +FOR /f %%i IN ('git rev-parse --abbrev-ref HEAD') DO @SET BRANCH=%%i + +SET FOOTER=Generated on %DATE% %TIME% from revision %REV% on branch '%BRANCH%' + +SET OUTDIR=..\report-%BRANCH%-%SHREV% + +mkdir %OUTDIR% + +%BOOSTDEP% --list-modules > %OUTDIR%\list-modules.txt + +%BOOSTDEP% --footer "%FOOTER%" --html --module-overview > %OUTDIR%\module-overview.html +%BOOSTDEP% --footer "%FOOTER%" --html --module-levels > %OUTDIR%\module-levels.html +%BOOSTDEP% --footer "%FOOTER%" --html --module-weights > %OUTDIR%\module-weights.html + +FOR /f %%i IN (%OUTDIR%\list-modules.txt) DO %BOOSTDEP% --title "Dependency Report for %%i" --footer "%FOOTER%" --html --primary %%i --secondary %%i --reverse %%i > %OUTDIR%%%i.html +</pre> +</div> +</div> +<div class="section"> +<div class="titlepage"><div><div><h2 class="title" style="clear: both"> +<a name="boostdep.reference"></a><a class="link" href="index.html#boostdep.reference" title="Reference">Reference</a> +</h2></div></div></div> +<div class="toc"><dl class="toc"> +<dt><span class="section"><a href="index.html#boostdep.reference.list_modules">--list-modules</a></span></dt> +<dt><span class="section"><a href="index.html#boostdep.reference.list_buildable">--list-buildable</a></span></dt> +<dt><span class="section"><a href="index.html#boostdep.reference.list_dependencies">--list-dependencies</a></span></dt> +<dt><span class="section"><a href="index.html#boostdep.reference.module_overview">--module-overview</a></span></dt> +<dt><span class="section"><a href="index.html#boostdep.reference.module_levels">--module-levels</a></span></dt> +<dt><span class="section"><a href="index.html#boostdep.reference.module_weights">--module-weights</a></span></dt> +<dt><span class="section"><a href="index.html#boostdep.reference.primary">--primary</a></span></dt> +<dt><span class="section"><a href="index.html#boostdep.reference.secondary">--secondary</a></span></dt> +<dt><span class="section"><a href="index.html#boostdep.reference.reverse">--reverse</a></span></dt> +<dt><span class="section"><a href="index.html#boostdep.reference.header">--header</a></span></dt> +<dt><span class="section"><a href="index.html#boostdep.reference.track_sources">--track-sources</a></span></dt> +<dt><span class="section"><a href="index.html#boostdep.reference.title">--title</a></span></dt> +<dt><span class="section"><a href="index.html#boostdep.reference.footer">--footer</a></span></dt> +<dt><span class="section"><a href="index.html#boostdep.reference.html">--html</a></span></dt> +</dl></div> +<div class="section"> +<div class="titlepage"><div><div><h3 class="title"> +<a name="boostdep.reference.list_modules"></a><a class="link" href="index.html#boostdep.reference.list_modules" title="--list-modules">--list-modules</a> +</h3></div></div></div> +<p> + <code class="literal">boostdep --list-modules</code> prints the module list. <span class="emphasis"><em>Boostdep</em></span> + considers a subdirectory of <code class="literal">libs</code> a module if it contains + an <code class="literal">include</code> subdirectory. + </p> +<p> + This command is typically used from scripts which then use the list to execute + a command for each module. + </p> +</div> +<div class="section"> +<div class="titlepage"><div><div><h3 class="title"> +<a name="boostdep.reference.list_buildable"></a><a class="link" href="index.html#boostdep.reference.list_buildable" title="--list-buildable">--list-buildable</a> +</h3></div></div></div> +<p> + <code class="literal">boostdep --list-modules</code> prints a list of the modules that + require building. <span class="emphasis"><em>Boostdep</em></span> considers a module to require + building if it contains subdirectories named <code class="literal">build</code> and + <code class="literal">src</code>. + </p> +<p> + This command is typically used from scripts. + </p> +</div> +<div class="section"> +<div class="titlepage"><div><div><h3 class="title"> +<a name="boostdep.reference.list_dependencies"></a><a class="link" href="index.html#boostdep.reference.list_dependencies" title="--list-dependencies">--list-dependencies</a> +</h3></div></div></div> +<p> + <code class="literal">boostdep --list-dependencies</code> prints a module list in which + each line is of the form + </p> +<pre class="programlisting">module -> dependency1 dependency2 <span class="emphasis"><em>...</em></span> +</pre> +<p> + By default, only the <code class="literal">include</code> directory is scanned for + <code class="computeroutput"><span class="preprocessor">#include</span></code> directives. If + the option <code class="literal">--track-sources</code> is given, the <code class="literal">src</code> + directory is also scanned. + </p> +<p> + This command is typically used from scripts. The output is virtually identical + to <code class="literal">--module-overview</code> in plain text, but slightly more + machine-friendly. + </p> +</div> +<div class="section"> +<div class="titlepage"><div><div><h3 class="title"> +<a name="boostdep.reference.module_overview"></a><a class="link" href="index.html#boostdep.reference.module_overview" title="--module-overview">--module-overview</a> +</h3></div></div></div> +<p> + <code class="literal">boostdep --module-overview</code> generates a module overview, + in plain text or HTML. The plain text output is of the form + </p> +<pre class="programlisting">Module Overview: + +accumulators -> array assert circular_buffer concept_check config core fusion iterator mpl numeric~conversion numeric~ublas parameter preprocessor range static_assert throw_exception tuple type_traits typeof +algorithm -> array assert bind concept_check config core exception function iterator mpl range regex static_assert tuple type_traits unordered +align -> assert config core static_assert throw_exception +</pre> +<p> + whereas the HTML output is similar to + </p> +<div class="blockquote"><blockquote class="blockquote"> +<p> + <span class="bold"><strong>Module Overview</strong></span> + </p> +<p> + <span class="bold"><strong><span class="emphasis"><em>accumulators</em></span></strong></span> + </p> +<p> + ⇢ array assert circular_buffer concept_check config core fusion + iterator mpl numeric~conversion numeric~ublas parameter preprocessor range + static_assert throw_exception tuple type_traits typeof + </p> +</blockquote></div> +<p> + where <span class="emphasis"><em>accumulators</em></span> is a link to <code class="literal">accumulators.html</code>. + </p> +<p> + As before, if <code class="literal">--track-sources</code> is given, the <code class="literal">src</code> + subdirectory is scanned for <code class="computeroutput"><span class="preprocessor">#include</span></code> + directives. + </p> +<p> + HTML output is enabled by the <code class="literal">--html</code> option. The <code class="literal">--title</code> + and <code class="literal">--footer</code> options set the HTML <code class="literal"><title></code> + and the page footer and need to precede <code class="literal">--html</code>, like in + the following example: + </p> +<pre class="programlisting">dist/bin/boostdep --title "Module Overview" --footer "Generated on 21.05.2015 20:53:11" --html --module-overview > module-overview.html +</pre> +</div> +<div class="section"> +<div class="titlepage"><div><div><h3 class="title"> +<a name="boostdep.reference.module_levels"></a><a class="link" href="index.html#boostdep.reference.module_levels" title="--module-levels">--module-levels</a> +</h3></div></div></div> +<p> + <code class="literal">boostdep --module-levels</code> generates a report that groups + modules by level. Levels are determined in such a way so that a module of + level <code class="literal">N</code> never depends on modules of levels greater than + <code class="literal">N</code>, and in the absence of cyclical dependencies, doesn't + depend on other modules of level <code class="literal">N</code>. It takes the same + options as <code class="literal">--module-overview</code>. + </p> +<pre class="programlisting">dist/bin/boostdep --title "Module Levels" --footer "Generated on 21.05.2015 20:53:11" --html --module-levels > module-levels.html +</pre> +</div> +<div class="section"> +<div class="titlepage"><div><div><h3 class="title"> +<a name="boostdep.reference.module_weights"></a><a class="link" href="index.html#boostdep.reference.module_weights" title="--module-weights">--module-weights</a> +</h3></div></div></div> +<p> + <code class="literal">boostdep --module-weights</code> generates a report that lists + modules by weight. A module weight is the total number of its dependencies. + This includes the indirect dependencies. + </p> +<p> + <code class="literal">--module-weights</code> takes the same options as <code class="literal">--module-overview</code>. + </p> +<pre class="programlisting">dist/bin/boostdep --title "Module Weights" --footer "Generated on 21.05.2015 20:53:11" --html --module-weights > module-weights.html +</pre> +</div> +<div class="section"> +<div class="titlepage"><div><div><h3 class="title"> +<a name="boostdep.reference.primary"></a><a class="link" href="index.html#boostdep.reference.primary" title="--primary">--primary</a> +</h3></div></div></div> +<p> + <code class="literal">boostdep --primary <span class="emphasis"><em>module</em></span></code> lists the + primary (direct) dependencies of <span class="emphasis"><em>module</em></span>. It takes the + same options as <code class="literal">--module-overview</code>. + </p> +<pre class="programlisting">dist/bin/boostdep --title "Primary Dependencies of filesystem" --footer "Generated on 21.05.2015 20:53:11" --html --primary filesystem > filesystem-primary.html +</pre> +</div> +<div class="section"> +<div class="titlepage"><div><div><h3 class="title"> +<a name="boostdep.reference.secondary"></a><a class="link" href="index.html#boostdep.reference.secondary" title="--secondary">--secondary</a> +</h3></div></div></div> +<p> + <code class="literal">boostdep --secondary <span class="emphasis"><em>module</em></span></code> lists + the secondary (indirect) dependencies of <span class="emphasis"><em>module</em></span>. It + takes the same options as <code class="literal">--module-overview</code>. + </p> +<pre class="programlisting">dist/bin/boostdep --title "Secondary Dependencies of filesystem" --footer "Generated on 21.05.2015 20:53:11" --html --secondary filesystem > filesystem-secondary.html +</pre> +<p> + You can combine <code class="literal">--primary</code> and <code class="literal">--secondary</code> + in one invocation. + </p> +<pre class="programlisting">dist/bin/boostdep --title "Dependencies of filesystem" --footer "Generated on 21.05.2015 20:53:11" --html --primary filesystem --secondary filesystem > filesystem.html +</pre> +</div> +<div class="section"> +<div class="titlepage"><div><div><h3 class="title"> +<a name="boostdep.reference.reverse"></a><a class="link" href="index.html#boostdep.reference.reverse" title="--reverse">--reverse</a> +</h3></div></div></div> +<p> + <code class="literal">boostdep --reverse <span class="emphasis"><em>module</em></span></code> lists the + reverse dependencies of <span class="emphasis"><em>module</em></span>, that is, it lists which + modules depend on <span class="emphasis"><em>module</em></span>. It takes the same options + as <code class="literal">--module-overview</code>. + </p> +<pre class="programlisting">dist/bin/boostdep --title "Reverse Dependencies of filesystem" --footer "Generated on 21.05.2015 20:53:11" --html --reverse filesystem > filesystem-reverse.html +</pre> +<p> + You can combine <code class="literal">--reverse</code> with <code class="literal">--primary</code> + and <code class="literal">--secondary</code> for a complete module report. + </p> +<pre class="programlisting">dist/bin/boostdep --title "Dependency Report for filesystem" --footer "Generated on 21.05.2015 20:53:11" --html --primary filesystem --secondary filesystem --reverse filesystem > filesystem.html +</pre> +</div> +<div class="section"> +<div class="titlepage"><div><div><h3 class="title"> +<a name="boostdep.reference.header"></a><a class="link" href="index.html#boostdep.reference.header" title="--header">--header</a> +</h3></div></div></div> +<p> + <code class="literal">boostdep --header <span class="emphasis"><em>header</em></span></code> creates + an inclusion report for <span class="emphasis"><em>header</em></span>. It takes the same options + as <code class="literal">--module-overview</code>. + </p> +<pre class="programlisting">dist/bin/boostdep --title "Inclusion Report for <boost/shared_ptr.hpp>" --footer "Generated on 21.05.2015 20:53:11" --html --header boost/shared_ptr.hpp > header-boost-shared_ptr.html +</pre> +</div> +<div class="section"> +<div class="titlepage"><div><div><h3 class="title"> +<a name="boostdep.reference.track_sources"></a><a class="link" href="index.html#boostdep.reference.track_sources" title="--track-sources">--track-sources</a> +</h3></div></div></div> +<p> + The <code class="literal">--track-sources</code> option instructs <span class="emphasis"><em>Boostdep</em></span> + to scan the <code class="literal">src</code> library subdirectory for <code class="computeroutput"><span class="preprocessor">#include</span></code> directives. By default, only + the <code class="literal">include</code> subdirectory is scanned. + </p> +</div> +<div class="section"> +<div class="titlepage"><div><div><h3 class="title"> +<a name="boostdep.reference.title"></a><a class="link" href="index.html#boostdep.reference.title" title="--title">--title</a> +</h3></div></div></div> +<p> + <code class="literal">--title <span class="emphasis"><em>title</em></span></code> sets the contents of + the HTML <code class="literal"><title></code> tag. It must precede <code class="literal">--html</code> + to have an effect. + </p> +</div> +<div class="section"> +<div class="titlepage"><div><div><h3 class="title"> +<a name="boostdep.reference.footer"></a><a class="link" href="index.html#boostdep.reference.footer" title="--footer">--footer</a> +</h3></div></div></div> +<p> + <code class="literal">--footer <span class="emphasis"><em>footer</em></span></code> sets the page footer + text. It has no effect if <code class="literal">--html</code> is not given. + </p> +</div> +<div class="section"> +<div class="titlepage"><div><div><h3 class="title"> +<a name="boostdep.reference.html"></a><a class="link" href="index.html#boostdep.reference.html" title="--html">--html</a> +</h3></div></div></div> +<p> + <code class="literal">--html</code> switches to HTML output mode (the default is plain + text). It must precede the commands that generate output. + </p> +</div> +</div> +</div> +<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> +<td align="left"><p><small>Last revised: May 21, 2015 at 22:05:36 GMT</small></p></td> +<td align="right"><div class="copyright-footer"></div></td> +</tr></table> +<hr> +<div class="spirit-nav"></div> +</body> +</html> diff --git a/tools/boostdep/doc/src/boostdep.qbk b/tools/boostdep/doc/src/boostdep.qbk new file mode 100644 index 0000000000..cbae0781ba --- /dev/null +++ b/tools/boostdep/doc/src/boostdep.qbk @@ -0,0 +1,653 @@ +[/ + Copyright 2015 Peter Dimov + + Distributed under the Boost Software License, Version 1.0. + + See accompanying file LICENSE_1_0.txt or copy at + http://boost.org/LICENSE_1_0.txt +] + +[article Boostdep + [quickbook 1.6] + [id boostdep] + [copyright 2014, 2015 Peter Dimov] + [license Distributed under the + [@http://boost.org/LICENSE_1_0.txt Boost Software License, Version 1.0]. + ] +] + +[template simplesect[title] +[block '''<simplesect><title>'''[title]'''</title>''']] + +[template endsimplesect[] +[block '''</simplesect>''']] + +[section Introduction] + +/Boostdep/ is a tool for generating Boost dependency reports. It scans +the header or source files of the Boost libraries for `#include` +directives, builds a dependency graph from this information and outputs +its findings in plain text or HTML. + +[section Modular Boost] + +/Boostdep/ requires the so-called "modular Boost" directory structure. + +If you already have a [@https://svn.boost.org/trac/boost/wiki/ModularBoost +modular Boost installation], you can skip this section. Otherwise, read on. + +Boost libraries reside in subdirectories under the =libs= directory. For +example, the contents of the Boost.Filesystem library are in =libs/filesystem=. +This includes the build scripts (in =libs/filesystem/build=), the source files +(in =libs/filesystem/src=), the tests (in =libs/filesystem/test=), the documentation +(in =libs/filesystem/doc=), and so on. + +In the past, when Boost used SVN as its version control system, the header files +were an exception. The header files of all libraries resided in the =boost= subdirectory, +and it wasn't possible to accurately determine which header belonged to which library. + +When Boost moved to Git for version control, header files were moved to their corresponding +libraries, into an =include= subdirectory. The header files of Boost.Filesystem are now in +=libs/filesystem/include=. + +For compatibility, =boost= is now a "virtual" directory, containing links to the headers. +It's maintained automatically by Boost.Build. (The command =b2 headers= creates or recreates +the contents of the =boost= directory.) + +This new structure allows /Boostdep/ to determine that, when faced with an +`#include <boost/filesystem.hpp>` directive, that this header is part of Boost.Filesystem, and +that therefore, the current library being scanned depends on Boost.Filesystem. + +Unfortunately, Boost releases do not have this structure. For backward compatibility, they +have an old-style =boost= directory containing all header files, whereas the per-library =include= +subdirectories are missing. Therefore, /Boostdep/ will not work with a downloaded Boost release. + +To use /Boostdep/, you will have to clone the Boost Git repository instead. To do that, execute the +following command: + +[pre +git clone https://github.com/boostorg/boost.git boost +] + +This will download the Boost "superproject" (the master project, without any libraries) and place it +into the subdirectory =boost= of the current directory. To override the directory name, pass it as a +second argument instead of =boost=: + +[pre +git clone https://github.com/boostorg/boost.git /mydir/ +] + +You can now =cd= into the newly created directory with + +[pre +cd /mydir/ +] + +This directory is called the "Boost root". All of the commands below assume that it is the current directory. + +The above =git clone= commands download the default branch of the Boost Git repository, which is =master=. +This is the current more-or-less stable version of Boost. + +To verify this, issue the command + +[pre +git status +] + +from the Boost root. This will output + +[pre +# On branch master +nothing to commit, working directory clean +] + +To download a specific release instead, such as 1.58.0, issue the following command after =git clone=, from +the Boost root: + +[pre +git checkout boost-1.58.0 +] + +=git status= will now say + +[pre +# HEAD detached at boost-1.58.0 +nothing to commit, working directory clean +] + +Then, download all the libraries: + +[pre +git submodule update --init +] + +This step will take a while. + +If all goes well, you will now have the complete contents of Boost's latest =master= branch (if you didn't =checkout= +a specific release by name) or the corresponding Boost release (if you did). + +You can switch between the =master= branch, the =develop= (unstable) branch, and a release, by issuing the following +commands: + +[:For the =master= branch:] + +[pre +git checkout master +git pull +git submodule update --init +] + +[:(=git pull= updates your local copy of the =master= branch from the server, in case it has changed since your initial +checkout.)] + +[:For the =develop= branch:] + +[pre +git checkout develop +git pull +git submodule update --init +] + +[:For the =boost-1.58.0= release:] + +[pre +git checkout boost-1.58.0 +git submodule update --init +] + +[:For the =boost-1.57.0= release:] + +[pre +git checkout boost-1.57.0 +git submodule update --init +] + +Note that, while the initial =git submodule update= is quite slow, as it needs to download all the libraries, the +subsequent invocations are a lot faster. + +Also note that if a new Boost library (=libs/convert=, for example) is present in, say, =master=, and you have it checked out, +when you later switch to =boost-1.58.0=, where this library doesn't exist, Git will not delete =libs/convert=. In this case, +=git status= will output + +[pre +# HEAD detached at boost-1.58.0 +# Untracked files: +# (use "git add <file>..." to include in what will be committed) +# +# libs/convert/ +nothing added to commit but untracked files present (use "git add" to track) +] + +and you will have to remove =libs/convert= by hand. + +Once you have the Boost contents which you want to analyze for dependencies, proceed with the next step, building /Boostdep/. + +[endsect] + +[section Building Boostdep] + +To build /Boostdep/, issue the following command from the Boost root: + +[pre +b2 tools/boostdep/build//install +] + +This will build /Boostdep/ from source using the default "toolset" (a Boost.Build term meaning "compiler") and if successful, +place it into the =dist/bin= subdirectory. The command assumes that =b2= (the Boost.Build executable) is somewhere in your path. +If you don't have =b2=, execute + +[pre +.\bootstrap +] + +under Windows or + +[pre +./bootstrap.sh +] + +under Unix-like systems, which should build =b2= and place it into the current directory. You can then use =./b2= instead of =b2=. + +[endsect] + +[section Running Boostdep] + +Once you have built /Boostdep/, execute it with the following command: + +[pre +dist/bin/boostdep +] + +or + +[pre +dist\bin\boostdep +] + +on Windows. The commands below are given as using =dist/bin/boostdep=; if you're using Windows, use =dist\bin\boostdep= instead. + +This will print out the following help message: + +[pre +Usage: + + boostdep --list-modules + boostdep --list-buildable + boostdep \[--track-sources\] --list-dependencies + + boostdep \[options\] --module-overview + boostdep \[options\] --module-levels + boostdep \[options\] --module-weights + + boostdep \[options\] \[--primary\] <module> + boostdep \[options\] --secondary <module> + boostdep \[options\] --reverse <module> + boostdep \[options\] \[--header\] <header> + + \[options\]: \[--track-sources\] \[--title <title>\] \[--footer <footer>\] \[--html\] +] + +(The 1.58.0 version of /Boostdep/ has an unfortunate bug that causes the above output to be truncated after =boostdep --list-modules=. +The rest of the functionality is intact though, so you can still use it as described.) + +[endsect] + +[endsect] + +[section Usage] + +[section Simple Queries] + +To list the dependencies of a specific library, use the command + +[pre +dist/bin/boostdep /library/ +] + +For Boost.Filesystem, for example, type + +[pre +dist/bin/boostdep filesystem +] + +This will print out something similar to the following: + +[pre +Primary dependencies for filesystem: + +assert: + <boost/assert.hpp> + from <boost/filesystem/operations.hpp> + from <boost/filesystem/path_traits.hpp> + +config: + <boost/config.hpp> + from <boost/filesystem/config.hpp> + from <boost/filesystem/convenience.hpp> + from <boost/filesystem/fstream.hpp> + from <boost/filesystem/operations.hpp> + from <boost/filesystem/path.hpp> + from <boost/filesystem/path_traits.hpp> + /.../ + +functional: + <boost/functional/hash_fwd.hpp> + from <boost/filesystem/path.hpp> + +io: + <boost/io/detail/quoted_manip.hpp> + from <boost/filesystem/path.hpp> + +iterator: + <boost/iterator/iterator_facade.hpp> + from <boost/filesystem/path.hpp> + /.../ +] + +This lists the immediate dependencies of Boost.Filesystem. =assert:= is the library, +=<boost/assert.hpp>= is the file that is being included, and =from <boost/filesystem/config.hpp>= +shows where =<boost/assert.hpp>= is being included. + +/Boostdep/ names libraries (or modules) after their directory name. The =libs/filesystem= +directory, for example, is the =filesystem= module. The =libs/numeric/conversion= directory +is the =numeric~conversion= module, according to the /Boostdep/ naming convention. + +The reason forward slashes are replaced with tildes is that =numeric~conversion= is a valid +file name, which makes generating HTML reports a bit easier. + +To see where a given header resides and who includes it, type + +[pre +dist/bin/boostdep /header/ +] + +For =boost/filesystem.hpp=, for example, type + +[pre +dist/bin/boostdep boost/filesystem.hpp +] + +This will print something along the lines of + +[pre +Inclusion report for <boost/filesystem.hpp> (in module filesystem): + + from spirit: + <boost/spirit/home/x3/support/utility/testing.hpp> +] + +What this tells you is that =boost/filesystem.hpp= is part of Boost.Filesystem and is only +included once, from =<boost/spirit/home/x3/support/utility/testing.hpp>=. Other headers, +such as =boost/shared_ptr.hpp=, are more widely used, as you can see if you try + +[pre +dist/bin/boostdep boost/shared_ptr.hpp +] + +To print the reverse dependencies of a library, use + +[pre +dist/bin/boostdep --reverse /library/ +] + +For example, + +[pre +dist/bin/boostdep --reverse filesystem +] + +will list which libraries depend on Boost.Filesystem: + +[pre +Reverse dependencies for filesystem: + +graph_parallel: + <boost/filesystem/operations.hpp> + from <boost/graph/distributed/adjlist/serialization.hpp> + <boost/filesystem/path.hpp> + from <boost/graph/distributed/adjlist/serialization.hpp> + +log: + <boost/filesystem/config.hpp> + from <boost/log/detail/config.hpp> + <boost/filesystem/path.hpp> + from <boost/log/sinks/event_log_backend.hpp> + from <boost/log/sinks/text_file_backend.hpp> + from <boost/log/sinks/text_multifile_backend.hpp> + +spirit: + <boost/filesystem.hpp> + from <boost/spirit/home/x3/support/utility/testing.hpp> + <boost/filesystem/fstream.hpp> + from <boost/spirit/home/x3/support/utility/testing.hpp> + <boost/filesystem/path.hpp> + from <boost/spirit/home/x3/support/utility/error_reporting.hpp> + +wave: + <boost/filesystem/operations.hpp> + from <boost/wave/util/cpp_include_paths.hpp> + from <boost/wave/util/cpp_iterator.hpp> + from <boost/wave/util/filesystem_compatibility.hpp> + <boost/filesystem/path.hpp> + from <boost/wave/cpp_context.hpp> + from <boost/wave/util/cpp_include_paths.hpp> + from <boost/wave/util/cpp_iterator.hpp> + from <boost/wave/util/cpp_macromap.hpp> + from <boost/wave/util/filesystem_compatibility.hpp> +] + +[endsect] + +[section HTML reports] + +The primary purpose of /Boostdep/ is to generate HTML dependency reports. In +the typical case, two types of reports are generated: overviews that contain +information for all modules, and per-module ones that list information for a +specific library. + +/Boostdep/ can generate three types of the first kind of report: module overview, +module levels and module weights. To generate a module overview, use the command + +[pre +dist/bin/boostdep --html --module-overview > module-overview.html +] + +For a module level report, use + +[pre +dist/bin/boostdep --html --module-levels > module-levels.html +] + +For a module weight report, use + +[pre +dist/bin/boostdep --html --module-weights > module-weights.html +] + +In these reports, module names such as /module/ are HTML links to [^/module/.html]. + +To make these links work as expected, you can generate HTML reports for each module +as follows: + +[pre +dist/bin/boostdep --title "Dependency Report for /module/" --html --primary /module/ --secondary /module/ --reverse /module/ > /module/.html +] + +This step can be automated if you generate a module list first with + +[pre +dist/bin/boostdep --list-modules > list-modules.txt +] + +that will contain one module name per line, and then use a script to issue the previous +command for each module name. + +For more information about the /Boostdep/ options and commands, see the [link boostdep.reference Reference] section. + +For an example of a report generation script, see the file =tools/boostdep/examples/report.bat=. +This is a Windows batch file, but translating it to a Unix-style shell script should be +straightforward. + +For convenience, the contents of =tools/boostdep/examples/report.bat= are given below: + +[pre +SET BOOSTDEP=dist\bin\boostdep.exe + +FOR /f %%i IN ('git rev-parse HEAD') DO @SET REV=%%i + +FOR /f %%i IN ('git rev-parse --short HEAD') DO @SET SHREV=%%i + +FOR /f %%i IN ('git rev-parse --abbrev-ref HEAD') DO @SET BRANCH=%%i + +SET FOOTER=Generated on %DATE% %TIME% from revision %REV% on branch '%BRANCH%' + +SET OUTDIR=..\report-%BRANCH%-%SHREV% + +mkdir %OUTDIR% + +%BOOSTDEP% --list-modules > %OUTDIR%\list-modules.txt + +%BOOSTDEP% --footer "%FOOTER%" --html --module-overview > %OUTDIR%\module-overview.html +%BOOSTDEP% --footer "%FOOTER%" --html --module-levels > %OUTDIR%\module-levels.html +%BOOSTDEP% --footer "%FOOTER%" --html --module-weights > %OUTDIR%\module-weights.html + +FOR /f %%i IN (%OUTDIR%\list-modules.txt) DO %BOOSTDEP% --title "Dependency Report for %%i" --footer "%FOOTER%" --html --primary %%i --secondary %%i --reverse %%i > %OUTDIR%\%%i.html +] + +[endsect] + +[endsect] + +[section Reference] + +[section --list-modules] +=boostdep --list-modules= prints the module list. /Boostdep/ considers a +subdirectory of =libs= a module if it contains an =include= subdirectory. + +This command is typically used from scripts which then use the list to execute +a command for each module. +[endsect] + +[section --list-buildable] +=boostdep --list-modules= prints a list of the modules that require building. +/Boostdep/ considers a module to require building if it contains subdirectories +named =build= and =src=. + +This command is typically used from scripts. + +[endsect] + +[section --list-dependencies] +=boostdep --list-dependencies= prints a module list in which each line is of the +form + +[pre +module -> dependency1 dependency2 /.../ +] + +By default, only the =include= directory is scanned for `#include` directives. If +the option =--track-sources= is given, the =src= directory is also scanned. + +This command is typically used from scripts. The output is virtually identical to +=--module-overview= in plain text, but slightly more machine-friendly. +[endsect] + +[section --module-overview] +=boostdep --module-overview= generates a module overview, in plain text or HTML. The +plain text output is of the form + +[pre +Module Overview: + +accumulators -> array assert circular_buffer concept_check config core fusion iterator mpl numeric~conversion numeric~ublas parameter preprocessor range static_assert throw_exception tuple type_traits typeof +algorithm -> array assert bind concept_check config core exception function iterator mpl range regex static_assert tuple type_traits unordered +align -> assert config core static_assert throw_exception +] + +whereas the HTML output is similar to + +[: +*Module Overview* + +[*/accumulators/] + +\u21E2 array assert circular_buffer concept_check config core fusion iterator mpl numeric~conversion numeric~ublas parameter preprocessor range static_assert throw_exception tuple type_traits typeof +] + +where /accumulators/ is a link to =accumulators.html=. + +As before, if =--track-sources= is given, the =src= subdirectory is scanned for `#include` directives. + +HTML output is enabled by the =--html= option. The =--title= and =--footer= options set the HTML =<title>= +and the page footer and need to precede =--html=, like in the following example: + +[pre +dist/bin/boostdep --title "Module Overview" --footer "Generated on 21.05.2015 20:53:11" --html --module-overview > module-overview.html +] + +[endsect] + +[section --module-levels] + +=boostdep --module-levels= generates a report that groups modules by level. Levels are determined in such +a way so that a module of level =N= never depends on modules of levels greater than =N=, and in the absence +of cyclical dependencies, doesn't depend on other modules of level =N=. It takes the same options as +=--module-overview=. + +[pre +dist/bin/boostdep --title "Module Levels" --footer "Generated on 21.05.2015 20:53:11" --html --module-levels > module-levels.html +] + +[endsect] + +[section --module-weights] + +=boostdep --module-weights= generates a report that lists modules by weight. A module weight is the total number of +its dependencies. This includes the indirect dependencies. + +=--module-weights= takes the same options as =--module-overview=. + +[pre +dist/bin/boostdep --title "Module Weights" --footer "Generated on 21.05.2015 20:53:11" --html --module-weights > module-weights.html +] + +[endsect] + +[section --primary] + +[^boostdep --primary /module/] lists the primary (direct) dependencies of /module/. It takes the same options as =--module-overview=. + +[pre +dist/bin/boostdep --title "Primary Dependencies of filesystem" --footer "Generated on 21.05.2015 20:53:11" --html --primary filesystem > filesystem-primary.html +] + +[endsect] + +[section --secondary] + +[^boostdep --secondary /module/] lists the secondary (indirect) dependencies of /module/. It takes the same options as =--module-overview=. + +[pre +dist/bin/boostdep --title "Secondary Dependencies of filesystem" --footer "Generated on 21.05.2015 20:53:11" --html --secondary filesystem > filesystem-secondary.html +] + +You can combine =--primary= and =--secondary= in one invocation. + +[pre +dist/bin/boostdep --title "Dependencies of filesystem" --footer "Generated on 21.05.2015 20:53:11" --html --primary filesystem --secondary filesystem > filesystem.html +] + +[endsect] + +[section --reverse] + +[^boostdep --reverse /module/] lists the reverse dependencies of /module/, that is, it lists which modules depend on /module/. It takes the same options as =--module-overview=. + +[pre +dist/bin/boostdep --title "Reverse Dependencies of filesystem" --footer "Generated on 21.05.2015 20:53:11" --html --reverse filesystem > filesystem-reverse.html +] + +You can combine =--reverse= with =--primary= and =--secondary= for a complete module report. + +[pre +dist/bin/boostdep --title "Dependency Report for filesystem" --footer "Generated on 21.05.2015 20:53:11" --html --primary filesystem --secondary filesystem --reverse filesystem > filesystem.html +] + +[endsect] + +[section --header] + +[^boostdep --header /header/] creates an inclusion report for /header/. It takes the same options as =--module-overview=. + +[pre +dist/bin/boostdep --title "Inclusion Report for <boost/shared_ptr.hpp>" --footer "Generated on 21.05.2015 20:53:11" --html --header boost/shared_ptr.hpp > header-boost-shared_ptr.html +] + +[endsect] + +[section --track-sources] + +The =--track-sources= option instructs /Boostdep/ to scan the =src= library subdirectory for `#include` directives. By default, +only the =include= subdirectory is scanned. + +[endsect] + +[section --title] + +[^--title /title/] sets the contents of the HTML =<title>= tag. It must precede =--html= to have an effect. + +[endsect] + +[section --footer] + +[^--footer /footer/] sets the page footer text. It has no effect if =--html= is not given. + +[endsect] + +[section --html] + +=--html= switches to HTML output mode (the default is plain text). It must precede the commands that generate output. + +[endsect] + +[endsect] diff --git a/tools/boostdep/src/boostdep.cpp b/tools/boostdep/src/boostdep.cpp index 2f42e37af5..34797487d7 100644 --- a/tools/boostdep/src/boostdep.cpp +++ b/tools/boostdep/src/boostdep.cpp @@ -1588,19 +1588,19 @@ int main( int argc, char const* argv[] ) "Usage:\n" "\n" - " boostdep --list-modules\n"; - " boostdep --list-buildable\n"; - " boostdep [--track-sources] --list-dependencies\n"; - "\n"; - " boostdep [options] --module-overview\n"; - " boostdep [options] --module-levels\n"; - " boostdep [options] --module-weights\n"; - "\n"; - " boostdep [options] [--primary] <module>\n"; - " boostdep [options] --secondary <module>\n"; - " boostdep [options] --reverse <module>\n"; - " boostdep [options] [--header] <header>\n"; - "\n"; + " boostdep --list-modules\n" + " boostdep --list-buildable\n" + " boostdep [--track-sources] --list-dependencies\n" + "\n" + " boostdep [options] --module-overview\n" + " boostdep [options] --module-levels\n" + " boostdep [options] --module-weights\n" + "\n" + " boostdep [options] [--primary] <module>\n" + " boostdep [options] --secondary <module>\n" + " boostdep [options] --reverse <module>\n" + " boostdep [options] [--header] <header>\n" + "\n" " [options]: [--track-sources] [--title <title>] [--footer <footer>] [--html]\n"; return -1; diff --git a/tools/build/bootstrap.sh b/tools/build/bootstrap.sh index 8523c3db3e..c99242ee86 100755 --- a/tools/build/bootstrap.sh +++ b/tools/build/bootstrap.sh @@ -57,7 +57,7 @@ my_dir="." if test "x$TOOLSET" = x; then guessed_toolset=`$my_dir/src/engine/build.sh --guess-toolset` case $guessed_toolset in - acc | darwin | gcc | como | mipspro | pathscale | pgi | qcc | vacpp ) + acc | darwin | gcc | como | mipspro | pathscale | pgi | qcc | vacpp | xlcpp ) TOOLSET=$guessed_toolset ;; diff --git a/tools/build/doc/bjam.qbk b/tools/build/doc/bjam.qbk index a57a44021e..d54839182c 100644 --- a/tools/build/doc/bjam.qbk +++ b/tools/build/doc/bjam.qbk @@ -421,7 +421,7 @@ This facility is useful for correct header file scanning, since many compilers w The basic =b2= language entity is called a rule. A rule is defined in two parts: the procedure and the actions. The procedure is a body of jam statements to be run when the rule is invoked; the actions are the OS shell commands to execute when updating the built targets of the rule. -Rules can return values, which can be expanded into a list with "[ /rule/ /args/ ... ]". A rule's value is the value of its last statement, though only the following statements have values: 'if' (value of the leg chosen), 'switch' (value of the case chosen), set (value of the resulting variable), and 'return' (value of its arguments). Note that 'return' doesn't actually cause a return, i.e., is a no-op unless it is the last statement of the last block executed within rule body. +Rules can return values, which can be expanded into a list with "[ /rule/ /args/ ... ]". A rule's value is the value of its last statement, though only the following statements have values: 'if' (value of the leg chosen), 'switch' (value of the case chosen), set (value of the resulting variable), and 'return' (value of its arguments). The =b2= statements for defining and invoking rules are as follows: @@ -1000,7 +1000,7 @@ Creates new /vars/ inside to the enclosing ={}= block, obscuring any previous va return /values/ ; ] -Within a rule body, the return statement sets the return value for an invocation of the rule. It does *not* cause the rule to return; a rule's value is actually the value of the last statement executed, so a return should be the last statement executed before the rule "naturally" returns. +Within a rule body, the return statement sets the return value for an invocation of the rule and returns to the caller. [pre switch /value/ @@ -1038,6 +1038,18 @@ while /cond/ { /statements/ } Repeatedly execute /statements/ while /cond/ remains true upon entry. (See the description of /cond/ expression syntax under if, above). +[pre +break ; +] + +Immediately exits the nearest enclosing while or for loop. + +[pre +continue ; +] + +Jumps to the top of the nearest enclosing while or for loop. + [endsect] [section Variables] diff --git a/tools/build/doc/src/overview.xml b/tools/build/doc/src/overview.xml index da128efb93..1c2310b966 100644 --- a/tools/build/doc/src/overview.xml +++ b/tools/build/doc/src/overview.xml @@ -728,7 +728,7 @@ b2 toolset=gcc variant=debug optimization=space <varlistentry> <term><option>-n</option></term> <listitem> - <para>Do no execute the commands, only print them.</para> + <para>Do not execute the commands, only print them.</para> </listitem> </varlistentry> diff --git a/tools/build/doc/src/reference.xml b/tools/build/doc/src/reference.xml index 9ac0bfa4de..072b28af0b 100644 --- a/tools/build/doc/src/reference.xml +++ b/tools/build/doc/src/reference.xml @@ -725,6 +725,25 @@ path-constant DATA : data/a.txt ; <varlistentry><term><literal>architecture</literal></term> <listitem> + <para> + <emphasis role="bold">Allowed values:</emphasis> + <literal>x86</literal>, + <literal>ia64</literal>, + <literal>sparc</literal>, + <literal>power</literal>, + <literal>mips1</literal>, + <literal>mips2</literal>, + <literal>mips3</literal>, + <literal>mips4</literal>, + <literal>mips32</literal>, + <literal>mips32r2</literal>, + <literal>mips64</literal>, + <literal>parisc</literal>, + <literal>arm</literal>, + <literal>combined</literal>, + <literal>combined-x86-power</literal>. + </para> + <para>The <literal>architecture</literal> features specifies the general processor familty to generate code for.</para> diff --git a/tools/build/doc/src/tutorial.xml b/tools/build/doc/src/tutorial.xml index e3cb41879e..3227a67184 100644 --- a/tools/build/doc/src/tutorial.xml +++ b/tools/build/doc/src/tutorial.xml @@ -520,8 +520,8 @@ lib utils : utils.cpp /boost/filesystem//fs ; lib core : core.cpp utils ; exe app : app.cpp core ;</programlisting> This works no matter what kind of linking is used. When <filename>core - </filename> is built as a shared library, it is linked directly into - <filename>utils</filename>. Static libraries can't link to other + </filename> is built as a shared library, links <filename>utils + </filename> directly into it. Static libraries can't link to other libraries, so when <filename>core</filename> is built as a static library, its dependency on <filename>utils</filename> is passed along to <filename>core</filename>'s dependents, causing <filename>app</filename> diff --git a/tools/build/src/build/project.jam b/tools/build/src/build/project.jam index 83d0377e4d..b66d50e656 100644 --- a/tools/build/src/build/project.jam +++ b/tools/build/src/build/project.jam @@ -1001,6 +1001,32 @@ rule glob-internal ( project : wildcards + : excludes * : rule-name ) } +rule glob-path-root ( root path ) +{ + return [ path.root $(path) $(root) ] ; +} + +rule glob-internal-ex ( project : paths + : wildcards + : excludes * : rule-name ) +{ + # Make the paths we search in absolute, if they aren't already absolute. + # If the given paths are relative, they will be relative to the source + # directory. So that's what we root against. + local source-location + = [ path.root [ $(project).get source-location ] [ path.pwd ] ] ; + local search-paths + = [ sequence.transform project.glob-path-root $(source-location) : $(paths) ] ; + paths + = [ path.$(rule-name) $(search-paths) : $(wildcards) : $(excludes) ] ; + # The paths we have found are absolute, but the names specified in the + # sources list are assumed to be relative to the source directory of the + # corresponding project. Make the results relative to the source again. + local result + = [ sequence.transform path.relative-to $(source-location) : $(paths) ] ; + + return $(result) ; +} + + # This module defines rules common to all projects. # module project-rules @@ -1211,6 +1237,20 @@ module project-rules $(excludes) : glob-tree ] ; } + rule glob-ex ( paths + : wildcards + : excludes * ) + { + import project ; + return [ project.glob-internal-ex [ project.current ] + : $(paths) : $(wildcards) : $(excludes) : glob ] ; + } + + rule glob-tree-ex ( paths + : wildcards + : excludes * ) + { + import project ; + return [ project.glob-internal-ex [ project.current ] + : $(paths) : $(wildcards) : $(excludes) : glob-tree ] ; + } + # Calculates conditional requirements for multiple requirements at once. # This is a shorthand to reduce duplication and to keep an inline # declarative syntax. For example: diff --git a/tools/build/src/build/scanner.py b/tools/build/src/build/scanner.py index 19f1431d47..2a6bd66d74 100644 --- a/tools/build/src/build/scanner.py +++ b/tools/build/src/build/scanner.py @@ -76,11 +76,11 @@ def get(scanner_class, properties): r = property.select(relevant_properties, properties) scanner_id = scanner_name + '.' + '-'.join(r) - - if not __scanner_cache.has_key(scanner_name): - __scanner_cache[scanner_name] = scanner_class(r) - return __scanner_cache[scanner_name] + if not __scanner_cache.has_key(scanner_id): + __scanner_cache[scanner_id] = scanner_class(r) + + return __scanner_cache[scanner_id] class Scanner: """ Base scanner class. diff --git a/tools/build/src/build/targets.jam b/tools/build/src/build/targets.jam index 44c8fc9e45..2cfe08e05b 100644 --- a/tools/build/src/build/targets.jam +++ b/tools/build/src/build/targets.jam @@ -336,6 +336,23 @@ class project-target : abstract-target created. : in project [ full-name ] ; } self.alternatives += $(target-instance) ; + if ! ( [ $(target-instance).name ] in $(self.alternative-names) ) + { + self.alternative-names += [ $(target-instance).name ] ; + } + } + + # Checks if an alternative was declared for the target. + # Unlike checking for a main target this does not require + # building the main targets. And hence can be used in/directly + # while loading a project. + # + rule has-alternative-for-target ( target-name ) + { + if $(target-name) in $(self.alternative-names) + { + return 1 ; + } } # Returns a 'main-target' class instance corresponding to 'name'. diff --git a/tools/build/src/build/version.jam b/tools/build/src/build/version.jam index fa8fb3a568..8a1a957a14 100644 --- a/tools/build/src/build/version.jam +++ b/tools/build/src/build/version.jam @@ -6,13 +6,13 @@ import numbers ; -.major = "2014" ; -.minor = "03" ; +.major = "2015" ; +.minor = "07" ; rule boost-build ( ) { - return "$(.major).$(.minor)-svn" ; + return "$(.major).$(.minor)-git" ; } diff --git a/tools/build/src/contrib/boost.jam b/tools/build/src/contrib/boost.jam index 7daefd0c7a..00ea634c04 100644 --- a/tools/build/src/contrib/boost.jam +++ b/tools/build/src/contrib/boost.jam @@ -213,27 +213,30 @@ rule boost_std ( inc ? lib ? ) boost_lib_std graph_parallel : BOOST_GRAPH_DYN_LINK ; boost_lib_std iostreams : BOOST_IOSTREAMS_DYN_LINK ; boost_lib_std locale : BOOST_LOCALE_DYN_LINK ; - boost_lib_std math_tr1 : BOOST_MATH_TR1_DYN_LINK ; - boost_lib_std math_tr1f : BOOST_MATH_TR1_DYN_LINK ; - boost_lib_std math_tr1l : BOOST_MATH_TR1_DYN_LINK ; + boost_lib_std log : BOOST_LOG_DYN_LINK ; + boost_lib_std log_setup : BOOST_LOG_SETUP_DYN_LINK ; boost_lib_std math_c99 : BOOST_MATH_TR1_DYN_LINK ; boost_lib_std math_c99f : BOOST_MATH_TR1_DYN_LINK ; boost_lib_std math_c99l : BOOST_MATH_TR1_DYN_LINK ; + boost_lib_std math_tr1 : BOOST_MATH_TR1_DYN_LINK ; + boost_lib_std math_tr1f : BOOST_MATH_TR1_DYN_LINK ; + boost_lib_std math_tr1l : BOOST_MATH_TR1_DYN_LINK ; boost_lib_std mpi : BOOST_MPI_DYN_LINK ; + boost_lib_std prg_exec_monitor : BOOST_TEST_DYN_LINK ; boost_lib_std program_options : BOOST_PROGRAM_OPTIONS_DYN_LINK ; boost_lib_std python : BOOST_PYTHON_DYN_LINK ; boost_lib_std python3 : BOOST_PYTHON_DYN_LINK ; boost_lib_std random : BOOST_RANDOM_DYN_LINK ; boost_lib_std regex : BOOST_REGEX_DYN_LINK ; boost_lib_std serialization : BOOST_SERIALIZATION_DYN_LINK ; - boost_lib_std wserialization : BOOST_SERIALIZATION_DYN_LINK ; boost_lib_std signals : BOOST_SIGNALS_DYN_LINK ; boost_lib_std system : BOOST_SYSTEM_DYN_LINK ; - boost_lib_std unit_test_framework : BOOST_TEST_DYN_LINK ; - boost_lib_std prg_exec_monitor : BOOST_TEST_DYN_LINK ; boost_lib_std test_exec_monitor : BOOST_TEST_DYN_LINK ; boost_lib_std thread : BOOST_THREAD_DYN_DLL ; + boost_lib_std timer : BOOST_TIMER_DYN_DLL ; + boost_lib_std unit_test_framework : BOOST_TEST_DYN_LINK ; boost_lib_std wave : BOOST_WAVE_DYN_LINK ; + boost_lib_std wserialization : BOOST_SERIALIZATION_DYN_LINK ; } # Example placeholder for rules defining Boost library project & library targets diff --git a/tools/build/src/contrib/modular.jam b/tools/build/src/contrib/modular.jam index 917dfbaa52..cba517048f 100644 --- a/tools/build/src/contrib/modular.jam +++ b/tools/build/src/contrib/modular.jam @@ -3,16 +3,49 @@ # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) -#alias library -# : -# : : : <include>include -# ; - import path ; import project ; import modules ; import regex ; +import type ; + +# Add a location, i.e. directory, where to search for libraries. +# The optional 'prefix' indicates which rooted-prefixes the new +# search dir applies to. The prefix defaults to '/'. +rule add-location ( dir prefix ? : base-dir ? ) +{ + process-args ; + + prefix ?= "/" ; + + # Dir path of caller to base paths from. + caller-module ?= [ CALLER_MODULE ] ; + local caller-dir = [ modules.peek $(caller-module) : __file__ ] ; + caller-dir = $(caller-dir:D) ; + + base-dir ?= $(caller-dir) ; + + .search-path-prefix += $(prefix) ; + .search-path.$(prefix) += [ path.root [ path.root $(dir) $(base-dir) ] [ path.pwd ] ] ; +} + +# Declares additional definitions of a modular library target external +# to the modular library build itself. This makes it possible to externally +# define modular libraries without modifying the library. The passed in +# values are added on demand when the named library is first declared. +rule external ( + name : sources * : requirements * : default-build * : + usage-requirements * ) +{ + .external.($(name)).sources = $(sources) ; + .external.($(name)).requirements = $(requirements) ; + .external.($(name)).default-build = $(default-build) ; + .external.($(name)).usage-requirements = $(usage-requirements) ; +} +# Find, and declare, any modular libraries referenced in the target-refs. +# This will both load the modular libraries, and declare/manufacture +# the modular libraries as needed. rule find ( target-refs + ) { process-args ; @@ -22,9 +55,32 @@ rule find ( target-refs + ) caller-dir = $(caller-dir:D) ; caller-dir = [ path.root $(caller-dir) [ path.pwd ] ] ; + local result-refs ; for local target-ref in $(target-refs) { - local ref = [ MATCH ^(.*)//.* : $(target-ref:G=) ] ; + result-refs += [ resolve-reference $(target-ref) + : $(caller-mod) $(caller-dir) ] ; + } + + return $(result-refs) ; +} + +############################################################################## + +local rule resolve-reference ( target-ref : caller-mod caller-dir ? ) +{ + # ECHO %%% modular.resolve-target-ref $(target-ref) :: $(caller-mod) $(caller-dir) ; + if ! $(caller-dir) + { + caller-dir = [ modules.peek $(caller-mod) : __file__ ] ; + caller-dir = $(caller-dir:D) ; + caller-dir = [ path.root $(caller-dir) [ path.pwd ] ] ; + } + local result-ref = $(target-ref) ; + local ref = [ MATCH ^(.*)//.* : $(target-ref:G=) ] ; + # if ! ( $(ref) in $(.target-refs) ) + { + # .target-refs += $(ref) ; local search-prefix ; local search-sub ; for local prefix in $(.search-path-prefix) @@ -36,22 +92,27 @@ rule find ( target-refs + ) search-sub = $(search-match[2]) ; } } - local found = [ path.glob $(.search-path.$(search-prefix)) : $(search-sub) ] ; - found = $(found[1]) ; - if $(found) + + if $(search-prefix) { - local lib-ref = [ regex.split $(search-sub) / ] ; - lib-ref = $(search-prefix)/$(lib-ref[1]) ; - local lib-path = [ path.relative-to $(caller-dir) $(found) ] ; - library $(lib-ref) $(caller-mod) : $(lib-path) ; + local found = [ path.glob $(.search-path.$(search-prefix)) : $(search-sub) ] ; + found = $(found[1]) ; + if $(found) + { + local lib-ref = [ regex.split $(search-sub) / ] ; + lib-ref = $(search-prefix)/$(lib-ref[1]) ; + local lib-path = [ path.relative-to $(caller-dir) $(found) ] ; + define-library $(lib-ref) $(caller-mod) : $(lib-path) ; + } } } - - return $(target-refs) ; + return $(result-ref) ; } -rule library ( name caller-module ? : root ) +local rule define-library ( name caller-module ? : root ) { + # ECHO ~~~ modular.library $(name) $(caller-module) :: $(root) :: $(depends) ; + process-args ; # Dir path of caller to base paths from. @@ -63,67 +124,70 @@ rule library ( name caller-module ? : root ) local lib-dir = [ path.root [ path.root $(root) $(caller-dir) ] [ path.pwd ] ] ; local lib-contents = [ path.glob $(lib-dir) : "include" "build" ] ; lib-contents = $(lib-contents:D=) ; + # "include" dir for library.. local include-dir ; if "include" in $(lib-contents) { - include-dir = include ; + include-dir = $(root)/include ; } - # Does it look like a library? - if $(include-dir) + # If it has a build dir, i.e. it has targets to build, + # we root the project at the build dir to make it easy + # to refer to the build targets. This mirrors the regular + # Boost organization of the project aliases. + if "build" in $(lib-contents) { - # Load/create/declare library project. - local lib-module = [ project.find $(root) : $(caller-dir) ] ; - if ! $(lib-module) - { - lib-module = [ project.load - [ path.root [ path.make $(root) ] $(caller-dir) ] : synthesize ] ; - } - local lib-target = [ project.target $(lib-module) ] ; - - # We move to the library project module to define the various - # targets others use for the library. - if ! [ modules.peek $(lib-module) : __library__ ] - { - modules.poke $(lib-module) : __library__ : $(name) ; - project.push-current $(lib-target) ; - - # Declare the library alias. - modules.call-in $(lib-module) : alias library - : # Sources - : # Requirements - : # Default Build - : # Usage Requirements - <include>$(include-dir) - ; - - project.pop-current ; - } - - # Declare project alternate ID. - modules.call-in $(caller-module) : use-project $(name) : $(root) ; + root = $(root)/build ; + build-dir = "." ; } -} - -# Add a location, i.e. directory, where to search for libraries. -# The optional 'prefix' indicates which rooted-prefixes the new -# search dir applies to. The prefix defaults to '/'. -rule add-location ( dir prefix ? : base-dir ? ) -{ - process-args ; - prefix ?= "/" ; + # Shadow target declarations so that we can alter build targets + # to work in the standalone modular structure. + local lib-location = [ path.root [ path.make $(root) ] $(caller-dir) ] ; + local lib-module-name = [ project.module-name $(lib-location) ] ; + local modular-rules = [ RULENAMES modular-rules ] ; + IMPORT modular-rules : $(modular-rules) : $(lib-module-name) : $(modular-rules) ; - # Dir path of caller to base paths from. - caller-module ?= [ CALLER_MODULE ] ; - local caller-dir = [ modules.peek $(caller-module) : __file__ ] ; - caller-dir = $(caller-dir:D) ; + # Load/create/declare library project. + local lib-module = [ project.find $(root) : $(caller-dir) ] ; + if ! $(lib-module) + { + # If the find was unable to load the project we synthesize it. + lib-module = [ project.load $(lib-location) : synthesize ] ; + } + local lib-target = [ project.target $(lib-module) ] ; + if ! [ modules.peek $(lib-module) : __library__ ] + { + modules.poke $(lib-module) : __library__ : $(name) ; + for local type in [ modules.peek type : .types ] + { + main-rule-name = [ type.type-to-rule-name $(type) ] ; + IMPORT modular-rules : main-target-rule : $(lib-module-name) : $(main-rule-name) ; + } + } - base-dir ?= $(caller-dir) ; + # Declare project alternate ID. + modules.call-in $(caller-module) : use-project $(name) : $(root) ; - .search-path-prefix += $(prefix) ; - .search-path.$(prefix) += [ path.root [ path.root $(dir) $(base-dir) ] [ path.pwd ] ] ; + # Create a "library" target that has basic usage info if needed. + if ! [ $(lib-target).has-alternative-for-target library ] + { + include-dir = [ path.relative-to $(root) $(include-dir) ] ; + + project.push-current $(lib-target) ; + + # Declare the library alias. + modules.call-in $(lib-module) : library + : # Sources + : # Requirements + : # Default Build + : # Usage Requirements + <include>$(include-dir) + ; + + project.pop-current ; + } } local rule process-args ( ) @@ -139,3 +203,86 @@ local rule process-args ( ) } } } + +rule apply-external ( + mod : field : values * ) +{ + local result ; + local name = [ modules.peek $(mod) : __library__ ] ; + values += $(.external.($(name)).$(field)) ; + for local value in $(values) + { + result += [ resolve-reference $(value) : $(mod) ] ; + } + return $(result) ; +} + +module modular-rules +{ + import type ; + import targets ; + import builtin ; + import alias ; + + # Avoids any form of installation for Boost modules. + rule boost-install ( libraries * ) { } + + # Generic typed target rule to pre-process main target + # declarations to make them work within the standalone + # modular structure. + rule main-target-rule ( + name : sources * : requirements * : default-build * : + usage-requirements * ) + { + local mod = [ CALLER_MODULE ] ; + + # ECHO @@@ [[$(mod)]] modular-rules.main-target-rule $(name) :: $(sources) :: $(requirements) :: $(default-build) :: $(usage-requirements) ; + + # First discover the required target type based on the exact alias used to + # invoke this rule. + local bt = [ BACKTRACE 1 ] ; + local rulename = $(bt[4]) ; + local target-type = [ type.type-from-rule-name $(rulename) ] ; + return [ targets.create-typed-target $(target-type) : [ project.current ] : + $(name) : $(sources) : $(requirements) : $(default-build) : + $(usage-requirements) ] ; + } + + rule lib ( names + : sources * : requirements * : default-build * : + usage-requirements * ) + { + local mod = [ CALLER_MODULE ] ; + requirements += <use>library ; + usage-requirements += <use>library ; + + # ECHO @@@ [[$(mod)]] modular-rules.lib $(names) :: $(sources) :: $(requirements) :: $(default-build) :: $(usage-requirements) ; + return [ builtin.lib $(names) : $(sources) : $(requirements) : $(default-build) : $(usage-requirements) ] ; + } + + rule alias ( name : sources * : requirements * : default-build * : + usage-requirements * ) + { + local mod = [ CALLER_MODULE ] ; + + # ECHO @@@ [[$(mod)]] modular-rules.alias $(name) :: $(sources) :: $(requirements) :: $(default-build) :: $(usage-requirements) ; + return [ alias.alias $(name) : $(sources) : $(requirements) : $(default-build) : $(usage-requirements) ] ; + } + + rule library ( name ? : sources * : requirements * : default-build * : + usage-requirements * ) + { + import modular ; + + local mod = [ CALLER_MODULE ] ; + sources = [ modular.apply-external $(mod) : sources : $(sources) ] ; + requirements = [ modular.apply-external $(mod) : requirements : $(requirements) ] ; + default-build = [ modular.apply-external $(mod) : default-build : $(default-build) ] ; + usage-requirements = [ modular.apply-external $(mod) : usage-requirements : $(usage-requirements) ] ; + + name ?= library ; + + # ECHO @@@ [[$(mod)]] modular-rules.library $(name) :: $(sources) :: $(requirements) :: $(default-build) :: $(usage-requirements) ; + return [ alias.alias $(name) : $(sources) : $(requirements) : $(default-build) : $(usage-requirements) ] ; + } +} + diff --git a/tools/build/src/engine/build.jam b/tools/build/src/engine/build.jam index 0263d4637b..8e48ecae45 100644 --- a/tools/build/src/engine/build.jam +++ b/tools/build/src/engine/build.jam @@ -336,13 +336,22 @@ toolset tru64cxx cc : "-o " : -D [ opt --debug : -g -O0 -pg ] -I$(--python-include) -I$(--extra-include) : -L$(--python-lib[1]) -l$(--python-lib[2]) ; -## IBM VisualAge C++ +## IBM VisualAge C++ or IBM XL C/C++ for Aix or IBM XL C/C++ for Linux (Big endian) toolset vacpp xlc : "-o " : -D : [ opt --release : -s -O3 -qstrict -qinline ] [ opt --debug : -g -qNOOPTimize -qnoinline -pg ] -I$(--python-include) -I$(--extra-include) : -L$(--python-lib[1]) -l$(--python-lib[2]) [ if-os AIX : -bmaxdata:0x40000000 ] ; + +## IBM XL C/C++ for Linux (little endian) +toolset xlcpp xlC : "-o " : -D + : -Wno-unused -Wno-format + [ opt --release : -s ] + [ opt --debug : -g -qNOOPTimize -qnoinline -pg ] + -I$(--python-include) -I$(--extra-include) + : -L$(--python-lib[1]) -l$(--python-lib[2]) ; + ## Microsoft Visual C++ .NET 7.x toolset vc7 cl : /Fe /Fe /Fd /Fo : -D : /nologo diff --git a/tools/build/src/engine/build.sh b/tools/build/src/engine/build.sh index 6dbc70633c..bf3c695d70 100755 --- a/tools/build/src/engine/build.sh +++ b/tools/build/src/engine/build.sh @@ -70,6 +70,15 @@ Guess_Toolset () elif test_uname IRIX64 ; then BOOST_JAM_TOOLSET=mipspro elif test_uname OSF1 ; then BOOST_JAM_TOOLSET=tru64cxx elif test_uname QNX && test_path qcc ; then BOOST_JAM_TOOLSET=qcc + elif test_uname Linux && test_path xlc; then + if /usr/bin/lscpu | grep Byte | grep Little > /dev/null 2>&1 ; then + # Little endian linux + BOOST_JAM_TOOLSET=xlcpp + else + #Big endian linux + BOOST_JAM_TOOLSET=vacpp + fi + elif test_uname AIX && test_path xlc; then BOOST_JAM_TOOLSET=vacpp elif test_path gcc ; then BOOST_JAM_TOOLSET=gcc elif test_path icc ; then BOOST_JAM_TOOLSET=intel-linux elif test -r /opt/intel/cc/9.0/bin/iccvars.sh ; then @@ -89,7 +98,6 @@ Guess_Toolset () BOOST_JAM_TOOLSET_ROOT=/opt/intel/compiler50/ia32/ elif test_path pgcc ; then BOOST_JAM_TOOLSET=pgi elif test_path pathcc ; then BOOST_JAM_TOOLSET=pathscale - elif test_path xlc ; then BOOST_JAM_TOOLSET=vacpp elif test_path como ; then BOOST_JAM_TOOLSET=como elif test_path KCC ; then BOOST_JAM_TOOLSET=kcc elif test_path bc++ ; then BOOST_JAM_TOOLSET=kylix @@ -142,11 +150,11 @@ case $BOOST_JAM_TOOLSET in ;; intel-linux) - which icc >/dev/null 2>&1 + test_path icc >/dev/null 2>&1 if test $? ; then - BOOST_JAM_CC=$(which icc) + BOOST_JAM_CC=`test_path icc` echo "Found $BOOST_JAM_CC in environment" - BOOST_JAM_TOOLSET_ROOT=$(echo $BOOST_JAM_CC | sed -e 's/bin.*\/icc//') + BOOST_JAM_TOOLSET_ROOT=`echo $BOOST_JAM_CC | sed -e 's/bin.*\/icc//'` # probably the most widespread ARCH=intel64 else @@ -185,6 +193,10 @@ case $BOOST_JAM_TOOLSET in vacpp) BOOST_JAM_CC=xlc ;; + + xlcpp) + BOOST_JAM_CC=xlc + ;; como) BOOST_JAM_CC="como --c" diff --git a/tools/build/src/engine/builtins.c b/tools/build/src/engine/builtins.c index 162c3d2953..8ccd083fd2 100644 --- a/tools/build/src/engine/builtins.c +++ b/tools/build/src/engine/builtins.c @@ -26,6 +26,7 @@ #include "subst.h" #include "timestamp.h" #include "variable.h" +#include "output.h" #include <ctype.h> @@ -577,8 +578,8 @@ LIST * builtin_rebuilds( FRAME * frame, int flags ) LIST * builtin_echo( FRAME * frame, int flags ) { list_print( lol_get( frame->args, 0 ) ); - printf( "\n" ); - fflush( stdout ); + out_printf( "\n" ); + out_flush(); return L0; } @@ -593,7 +594,7 @@ LIST * builtin_exit( FRAME * frame, int flags ) { LIST * const code = lol_get( frame->args, 1 ); list_print( lol_get( frame->args, 0 ) ); - printf( "\n" ); + out_printf( "\n" ); if ( !list_empty( code ) ) exit( atoi( object_str( list_front( code ) ) ) ); else @@ -1014,7 +1015,7 @@ LIST * builtin_hdrmacro( FRAME * frame, int flags ) /* Scan file for header filename macro definitions. */ if ( DEBUG_HEADER ) - printf( "scanning '%s' for header file macro definitions\n", + out_printf( "scanning '%s' for header file macro definitions\n", object_str( list_item( iter ) ) ); macro_headers( t ); @@ -1111,14 +1112,14 @@ void unknown_rule( FRAME * frame, char const * key, module_t * module, { backtrace_line( frame->prev ); if ( key ) - printf("%s error", key); + out_printf("%s error", key); else - printf("ERROR"); - printf( ": rule \"%s\" unknown in ", object_str( rule_name ) ); + out_printf("ERROR"); + out_printf( ": rule \"%s\" unknown in ", object_str( rule_name ) ); if ( module->name ) - printf( "module \"%s\".\n", object_str( module->name ) ); + out_printf( "module \"%s\".\n", object_str( module->name ) ); else - printf( "root module.\n" ); + out_printf( "root module.\n" ); backtrace( frame->prev ); exit( 1 ); } @@ -1192,13 +1193,13 @@ LIST * builtin_import( FRAME * frame, int flags ) if ( source_iter != source_end || target_iter != target_end ) { backtrace_line( frame->prev ); - printf( "import error: length of source and target rule name lists " + out_printf( "import error: length of source and target rule name lists " "don't match!\n" ); - printf( " source: " ); + out_printf( " source: " ); list_print( source_rules ); - printf( "\n target: " ); + out_printf( "\n target: " ); list_print( target_rules ); - printf( "\n" ); + out_printf( "\n" ); backtrace( frame->prev ); exit( 1 ); } @@ -1271,9 +1272,9 @@ void print_source_line( FRAME * frame ) int line; get_source_line( frame, &file, &line ); if ( line < 0 ) - printf( "(builtin):" ); + out_printf( "(builtin):" ); else - printf( "%s:%d:", file, line ); + out_printf( "%s:%d:", file, line ); } @@ -1286,12 +1287,12 @@ void backtrace_line( FRAME * frame ) { if ( frame == 0 ) { - printf( "(no frame):" ); + out_printf( "(no frame):" ); } else { print_source_line( frame ); - printf( " in %s\n", frame->rulename ); + out_printf( " in %s\n", frame->rulename ); } } @@ -1469,8 +1470,8 @@ LIST * builtin_update_now( FRAME * frame, int flags ) /* Flush whatever stdio might have buffered, while descriptions 0 and 1 * still refer to the log file. */ - fflush( stdout ); - fflush( stderr ); + out_flush( ); + err_flush( ); dup2( original_stdout, 0 ); dup2( original_stderr, 1 ); close( original_stdout ); @@ -1669,7 +1670,7 @@ LIST * builtin_native_rule( FRAME * frame, int flags ) else { backtrace_line( frame->prev ); - printf( "error: no native rule \"%s\" defined in module \"%s.\"\n", + out_printf( "error: no native rule \"%s\" defined in module \"%s.\"\n", object_str( list_front( rule_name ) ), object_str( module->name ) ); backtrace( frame->prev ); exit( 1 ); @@ -2015,14 +2016,14 @@ LIST * builtin_python_import_rule( FRAME * frame, int flags ) { if ( PyErr_Occurred() ) PyErr_Print(); - fprintf( stderr, "Cannot find function \"%s\"\n", python_function ); + err_printf( "Cannot find function \"%s\"\n", python_function ); } Py_DECREF( pModule ); } else { PyErr_Print(); - fprintf( stderr, "Failed to load \"%s\"\n", python_module ); + err_printf( "Failed to load \"%s\"\n", python_module ); } return L0; @@ -2103,7 +2104,7 @@ PyObject * bjam_call( PyObject * self, PyObject * args ) char * s = PyString_AsString( e ); if ( !s ) { - printf( "Invalid parameter type passed from Python\n" ); + err_printf( "Invalid parameter type passed from Python\n" ); exit( 1 ); } l = list_push_back( l, object_new( s ) ); diff --git a/tools/build/src/engine/class.c b/tools/build/src/engine/class.c index a4abfaac88..1a06deb3e2 100644 --- a/tools/build/src/engine/class.c +++ b/tools/build/src/engine/class.c @@ -15,6 +15,7 @@ #include "rules.h" #include "strings.h" #include "variable.h" +#include "output.h" #include <stdio.h> #include <stdlib.h> @@ -31,7 +32,7 @@ static void check_defined( LIST * class_names ) { if ( !hash_find( classes, list_item( iter ) ) ) { - printf( "Class %s is not defined\n", object_str( list_item( iter ) ) + out_printf( "Class %s is not defined\n", object_str( list_item( iter ) ) ); abort(); } @@ -141,7 +142,7 @@ OBJECT * make_class_module( LIST * xname, LIST * bases, FRAME * frame ) } else { - printf( "Class %s already defined\n", object_str( list_front( xname ) ) + out_printf( "Class %s already defined\n", object_str( list_front( xname ) ) ); abort(); } diff --git a/tools/build/src/engine/compile.c b/tools/build/src/engine/compile.c index a690b9fa5e..6adb83fa24 100644 --- a/tools/build/src/engine/compile.c +++ b/tools/build/src/engine/compile.c @@ -35,6 +35,7 @@ #include "search.h" #include "strings.h" #include "variable.h" +#include "output.h" #include <assert.h> #include <stdarg.h> @@ -78,7 +79,7 @@ LIST * evaluate_rule( RULE * rule, OBJECT * rulename, FRAME * frame ) debug_compile( 1, buf, frame ); lol_print( frame->args ); - printf( "\n" ); + out_printf( "\n" ); } if ( rule->procedure && rule->module != prev_module ) @@ -218,15 +219,15 @@ static void debug_compile( int which, char const * s, FRAME * frame ) i = ( level + 1 ) * 2; while ( i > 35 ) { - fputs( indent, stdout ); + out_puts( indent ); i -= 35; } - printf( "%*.*s ", i, i, indent ); + out_printf( "%*.*s ", i, i, indent ); } if ( s ) - printf( "%s ", s ); + out_printf( "%s ", s ); level += which; } diff --git a/tools/build/src/engine/debug.c b/tools/build/src/engine/debug.c index 2a656551bf..b4601066f8 100644 --- a/tools/build/src/engine/debug.c +++ b/tools/build/src/engine/debug.c @@ -7,7 +7,7 @@ #include "jam.h" #include "debug.h" - +#include "output.h" #include "hash.h" @@ -125,7 +125,7 @@ static void dump_profile_entry( void * p_, void * ignored ) profile_total.cumulative += p->net; profile_total.memory += p->memory; } - printf( "%10ld %12.6f %12.6f %12.8f %10ld %10ld %s\n", p->num_entries, + out_printf( "%10ld %12.6f %12.6f %12.8f %10ld %10ld %s\n", p->num_entries, cumulative, net, q, p->memory, mem_each, object_str( p->name ) ); } @@ -134,7 +134,7 @@ void profile_dump() { if ( profile_hash ) { - printf( "%10s %12s %12s %12s %10s %10s %s\n", "--count--", "--gross--", + out_printf( "%10s %12s %12s %12s %10s %10s %s\n", "--count--", "--gross--", "--net--", "--each--", "--mem--", "--each--", "--name--" ); hashenumerate( profile_hash, dump_profile_entry, 0 ); profile_other.name = constant_other; diff --git a/tools/build/src/engine/execcmd.c b/tools/build/src/engine/execcmd.c index f751cbff33..193c90611f 100644 --- a/tools/build/src/engine/execcmd.c +++ b/tools/build/src/engine/execcmd.c @@ -117,5 +117,5 @@ int interrupted( void ) void onintr( int disp ) { ++intr; - printf( "...interrupted\n" ); + out_printf( "...interrupted\n" ); } diff --git a/tools/build/src/engine/execnt.c b/tools/build/src/engine/execnt.c index d75aab0aef..7e350d902e 100644 --- a/tools/build/src/engine/execnt.c +++ b/tools/build/src/engine/execnt.c @@ -37,6 +37,7 @@ */ #include "jam.h" +#include "output.h" #ifdef USE_EXECNT #include "execcmd.h" @@ -290,12 +291,12 @@ void exec_cmd if ( DEBUG_EXECCMD ) if ( is_raw_cmd ) - printf( "Executing raw command directly\n" ); + out_printf( "Executing raw command directly\n" ); else { - printf( "Executing using a command file and the shell: " ); + out_printf( "Executing using a command file and the shell: " ); list_print( shell ); - printf( "\n" ); + out_printf( "\n" ); } /* If we are running a raw command directly - trim its leading whitespaces @@ -480,7 +481,7 @@ static void invoke_cmd( char const * const command, int const slot ) si.hStdInput = GetStdHandle( STD_INPUT_HANDLE ); if ( DEBUG_EXECCMD ) - printf( "Command string for CreateProcessA(): '%s'\n", command ); + out_printf( "Command string for CreateProcessA(): '%s'\n", command ); /* Run the command by creating a sub-process for it. */ if ( !CreateProcessA( @@ -1289,7 +1290,7 @@ static char const * prepare_command_file( string const * command, int slot ) FILE * const f = open_command_file( slot ); if ( !f ) { - printf( "failed to write command file!\n" ); + err_printf( "failed to write command file!\n" ); exit( EXITBAD ); } fputs( command->value, f ); @@ -1308,7 +1309,7 @@ static int get_free_cmdtab_slot() for ( slot = 0; slot < MAXJOBS; ++slot ) if ( !cmdtab[ slot ].pi.hProcess ) return slot; - printf( "no slots for child!\n" ); + err_printf( "no slots for child!\n" ); exit( EXITBAD ); } diff --git a/tools/build/src/engine/execunix.c b/tools/build/src/engine/execunix.c index 297c003772..8ee4d9dbf2 100644 --- a/tools/build/src/engine/execunix.c +++ b/tools/build/src/engine/execunix.c @@ -164,11 +164,11 @@ void exec_cmd if ( DEBUG_EXECCMD ) { int i; - printf( "Using shell: " ); + out_printf( "Using shell: " ); list_print( shell ); - printf( "\n" ); + out_printf( "\n" ); for ( i = 0; argv[ i ]; ++i ) - printf( " argv[%d] = '%s'\n", i, argv[ i ] ); + out_printf( " argv[%d] = '%s'\n", i, argv[ i ] ); } /* Create pipes for collecting child output. */ @@ -528,7 +528,7 @@ void exec_wait() break; if ( pid != cmdtab[ i ].pid ) { - printf( "unknown pid %d with errno = %d\n", pid, errno ); + err_printf( "unknown pid %d with errno = %d\n", pid, errno ); exit( EXITBAD ); } @@ -592,7 +592,7 @@ static int get_free_cmdtab_slot() for ( slot = 0; slot < MAXJOBS; ++slot ) if ( !cmdtab[ slot ].pid ) return slot; - printf( "no slots for child!\n" ); + err_printf( "no slots for child!\n" ); exit( EXITBAD ); } diff --git a/tools/build/src/engine/filent.c b/tools/build/src/engine/filent.c index 00dcc49b36..db4d2be1b4 100644 --- a/tools/build/src/engine/filent.c +++ b/tools/build/src/engine/filent.c @@ -33,6 +33,7 @@ #include "object.h" #include "pathsys.h" #include "strings.h" +#include "output.h" #ifdef __BORLANDC__ # undef FILENAME /* cpp namespace collision */ @@ -368,7 +369,7 @@ void file_archscan( char const * archive, scanback func, void * closure ) offset = SARMAG; if ( DEBUG_BINDSCAN ) - printf( "scan archive %s\n", archive ); + out_printf( "scan archive %s\n", archive ); while ( ( read( fd, &ar_hdr, SARHDR ) == SARHDR ) && !memcmp( ar_hdr.ar_fmag, ARFMAG, SARFMAG ) ) @@ -391,7 +392,7 @@ void file_archscan( char const * archive, scanback func, void * closure ) */ string_table = BJAM_MALLOC_ATOMIC( lar_size + 1 ); if ( read( fd, string_table, lar_size ) != lar_size ) - printf( "error reading string table\n" ); + out_printf( "error reading string table\n" ); string_table[ lar_size ] = '\0'; offset += SARHDR + lar_size; continue; diff --git a/tools/build/src/engine/filesys.c b/tools/build/src/engine/filesys.c index dadaef82ed..1975dd99a2 100644 --- a/tools/build/src/engine/filesys.c +++ b/tools/build/src/engine/filesys.c @@ -34,6 +34,7 @@ #include "object.h" #include "pathsys.h" #include "strings.h" +#include "output.h" #include <assert.h> #include <sys/stat.h> @@ -63,14 +64,14 @@ void file_build1( PATHNAME * const f, string * file ) { if ( DEBUG_SEARCH ) { - printf( "build file: " ); + out_printf( "build file: " ); if ( f->f_root.len ) - printf( "root = '%.*s' ", f->f_root.len, f->f_root.ptr ); + out_printf( "root = '%.*s' ", f->f_root.len, f->f_root.ptr ); if ( f->f_dir.len ) - printf( "dir = '%.*s' ", f->f_dir.len, f->f_dir.ptr ); + out_printf( "dir = '%.*s' ", f->f_dir.len, f->f_dir.ptr ); if ( f->f_base.len ) - printf( "base = '%.*s' ", f->f_base.len, f->f_base.ptr ); - printf( "\n" ); + out_printf( "base = '%.*s' ", f->f_base.len, f->f_base.ptr ); + out_printf( "\n" ); } /* Start with the grist. If the current grist is not surrounded by <>'s, add @@ -273,7 +274,7 @@ static void file_dirscan_impl( OBJECT * dir, scanback func, void * closure ) if ( list_empty( d->files ) ) { if ( DEBUG_BINDSCAN ) - printf( "scan directory %s\n", object_str( d->name ) ); + out_printf( "scan directory %s\n", object_str( d->name ) ); if ( file_collect_dir_content_( d ) < 0 ) return; } diff --git a/tools/build/src/engine/fileunix.c b/tools/build/src/engine/fileunix.c index e8ea515075..b5835c1a74 100644 --- a/tools/build/src/engine/fileunix.c +++ b/tools/build/src/engine/fileunix.c @@ -32,6 +32,7 @@ #include "object.h" #include "pathsys.h" #include "strings.h" +#include "output.h" #include <assert.h> #include <stdio.h> @@ -248,7 +249,7 @@ void file_archscan( char const * archive, scanback func, void * closure ) offset = SARMAG; if ( DEBUG_BINDSCAN ) - printf( "scan archive %s\n", archive ); + out_printf( "scan archive %s\n", archive ); while ( ( read( fd, &ar_hdr, SARHDR ) == SARHDR ) && !( memcmp( ar_hdr.ar_fmag, ARFMAG, SARFMAG ) @@ -283,7 +284,7 @@ void file_archscan( char const * archive, scanback func, void * closure ) string_table = (char *)BJAM_MALLOC_ATOMIC( lar_size ); lseek( fd, offset + SARHDR, 0 ); if ( read( fd, string_table, lar_size ) != lar_size ) - printf("error reading string table\n"); + out_printf("error reading string table\n"); } else if ( string_table && ar_hdr.ar_name[ 1 ] != ' ' ) { @@ -305,7 +306,7 @@ void file_archscan( char const * archive, scanback func, void * closure ) *c = '\0'; if ( DEBUG_BINDSCAN ) - printf( "archive name %s found\n", lar_name ); + out_printf( "archive name %s found\n", lar_name ); sprintf( buf, "%s(%s)", archive, lar_name ); @@ -349,7 +350,7 @@ static void file_archscan_small( int fd, char const * archive, scanback func, sscanf( fl_hdr.fl_fstmoff, "%ld", &offset ); if ( DEBUG_BINDSCAN ) - printf( "scan archive %s\n", archive ); + out_printf( "scan archive %s\n", archive ); while ( offset > 0 && lseek( fd, offset, 0 ) >= 0 && read( fd, &ar_hdr, sizeof( ar_hdr ) ) >= (int)sizeof( ar_hdr.hdr ) ) @@ -400,7 +401,7 @@ static void file_archscan_big( int fd, char const * archive, scanback func, sscanf( fl_hdr.fl_fstmoff, "%lld", &offset ); if ( DEBUG_BINDSCAN ) - printf( "scan archive %s\n", archive ); + out_printf( "scan archive %s\n", archive ); while ( offset > 0 && lseek( fd, offset, 0 ) >= 0 && read( fd, &ar_hdr, sizeof( ar_hdr ) ) >= sizeof( ar_hdr.hdr ) ) diff --git a/tools/build/src/engine/function.c b/tools/build/src/engine/function.c index d9ad754e43..9cb1718867 100644 --- a/tools/build/src/engine/function.c +++ b/tools/build/src/engine/function.c @@ -19,6 +19,7 @@ #include "rules.h" #include "search.h" #include "variable.h" +#include "output.h" #include <assert.h> #include <stdio.h> @@ -119,6 +120,8 @@ void backtrace_line( FRAME * ); #define INSTR_WRITE_FILE 54 #define INSTR_OUTPUT_STRINGS 55 +#define INSTR_FOR_POP 70 + typedef struct instruction { unsigned int op_code; @@ -449,7 +452,7 @@ static LIST * function_call_rule( JAM_FUNCTION * function, FRAME * frame, if ( list_empty( first ) ) { backtrace_line( frame ); - printf( "warning: rulename %s expands to empty string\n", unexpanded ); + out_printf( "warning: rulename %s expands to empty string\n", unexpanded ); backtrace( frame ); list_free( first ); for ( i = 0; i < n_args; ++i ) @@ -505,7 +508,7 @@ static LIST * function_call_member_rule( JAM_FUNCTION * function, FRAME * frame, if ( list_empty( first ) ) { backtrace_line( frame ); - printf( "warning: object is empty\n" ); + out_printf( "warning: object is empty\n" ); backtrace( frame ); list_free( first ); @@ -1313,7 +1316,7 @@ static void dynamic_array_push_impl( struct dynamic_array * const array, #define dynamic_array_push( array, value ) (dynamic_array_push_impl(array, &value, sizeof(value))) #define dynamic_array_at( type, array, idx ) (((type *)(array)->data)[idx]) - +#define dynamic_array_pop( array ) (--(array)->size) /* * struct compiler @@ -1325,6 +1328,16 @@ struct label_info struct dynamic_array uses[ 1 ]; }; +#define LOOP_INFO_BREAK 0 +#define LOOP_INFO_CONTINUE 1 + +struct loop_info +{ + int type; + int label; + int cleanup_depth; +}; + struct stored_rule { OBJECT * name; @@ -1341,6 +1354,8 @@ typedef struct compiler struct dynamic_array labels[ 1 ]; struct dynamic_array rules[ 1 ]; struct dynamic_array actions[ 1 ]; + struct dynamic_array cleanups[ 1 ]; + struct dynamic_array loop_scopes[ 1 ]; } compiler; static void compiler_init( compiler * c ) @@ -1350,6 +1365,8 @@ static void compiler_init( compiler * c ) dynamic_array_init( c->labels ); dynamic_array_init( c->rules ); dynamic_array_init( c->actions ); + dynamic_array_init( c->cleanups ); + dynamic_array_init( c->loop_scopes ); } static void compiler_free( compiler * c ) @@ -1363,6 +1380,8 @@ static void compiler_free( compiler * c ) dynamic_array_free( c->labels ); dynamic_array_free( c->constants ); dynamic_array_free( c->code ); + dynamic_array_free( c->cleanups ); + dynamic_array_free( c->loop_scopes ); } static void compile_emit_instruction( compiler * c, instruction instr ) @@ -1428,6 +1447,82 @@ static int compile_emit_constant( compiler * c, OBJECT * value ) return c->constants->size - 1; } +static void compile_push_cleanup( compiler * c, unsigned int op_code, int arg ) +{ + instruction instr; + instr.op_code = op_code; + instr.arg = arg; + dynamic_array_push( c->cleanups, instr ); +} + +static void compile_pop_cleanup( compiler * c ) +{ + dynamic_array_pop( c->cleanups ); +} + +static void compile_emit_cleanups( compiler * c, int end ) +{ + int i; + for ( i = c->cleanups->size; --i >= end; ) + { + compile_emit_instruction( c, dynamic_array_at( instruction, c->cleanups, i ) ); + } +} + +static void compile_emit_loop_jump( compiler * c, int type ) +{ + struct loop_info * info = NULL; + int i; + for ( i = c->loop_scopes->size; --i >= 0; ) + { + struct loop_info * elem = &dynamic_array_at( struct loop_info, c->loop_scopes, i ); + if ( elem->type == type ) + { + info = elem; + break; + } + } + if ( info == NULL ) + { + printf( "warning: ignoring break statement used outside of loop\n" ); + return; + } + compile_emit_cleanups( c, info->cleanup_depth ); + compile_emit_branch( c, INSTR_JUMP, info->label ); +} + +static void compile_push_break_scope( compiler * c, int label ) +{ + struct loop_info info; + info.type = LOOP_INFO_BREAK; + info.label = label; + info.cleanup_depth = c->cleanups->size; + dynamic_array_push( c->loop_scopes, info ); +} + +static void compile_push_continue_scope( compiler * c, int label ) +{ + struct loop_info info; + info.type = LOOP_INFO_CONTINUE; + info.label = label; + info.cleanup_depth = c->cleanups->size; + dynamic_array_push( c->loop_scopes, info ); +} + +static void compile_pop_break_scope( compiler * c ) +{ + assert( c->loop_scopes->size > 0 ); + assert( dynamic_array_at( struct loop_info, c->loop_scopes, c->loop_scopes->size - 1 ).type == LOOP_INFO_BREAK ); + dynamic_array_pop( c->loop_scopes ); +} + +static void compile_pop_continue_scope( compiler * c ) +{ + assert( c->loop_scopes->size > 0 ); + assert( dynamic_array_at( struct loop_info, c->loop_scopes, c->loop_scopes->size - 1 ).type == LOOP_INFO_CONTINUE ); + dynamic_array_pop( c->loop_scopes ); +} + static int compile_emit_rule( compiler * c, OBJECT * name, PARSE * parse, int num_arguments, struct arg_list * arguments, int local ) { @@ -1991,7 +2086,7 @@ static int current_line; static void parse_error( char const * message ) { - printf( "%s:%d: %s\n", current_file, current_line, message ); + out_printf( "%s:%d: %s\n", current_file, current_line, message ); } @@ -2397,7 +2492,7 @@ static void compile_parse( PARSE * parse, compiler * c, int result_location ) int f = compile_new_label( c ); int end = compile_new_label( c ); - printf( "%s:%d: Conditional used as list (check operator " + out_printf( "%s:%d: Conditional used as list (check operator " "precedence).\n", object_str( parse->file ), parse->line ); /* Emit the condition */ @@ -2416,6 +2511,7 @@ static void compile_parse( PARSE * parse, compiler * c, int result_location ) int var = compile_emit_constant( c, parse->string ); int top = compile_new_label( c ); int end = compile_new_label( c ); + int continue_ = compile_new_label( c ); /* * Evaluate the list. @@ -2428,6 +2524,7 @@ static void compile_parse( PARSE * parse, compiler * c, int result_location ) compile_emit( c, INSTR_PUSH_EMPTY, 0 ); compile_emit( c, INSTR_PUSH_LOCAL, var ); compile_emit( c, INSTR_SWAP, 1 ); + compile_push_cleanup( c, INSTR_POP_LOCAL, var ); } compile_emit( c, INSTR_FOR_INIT, 0 ); @@ -2435,14 +2532,26 @@ static void compile_parse( PARSE * parse, compiler * c, int result_location ) compile_emit_branch( c, INSTR_FOR_LOOP, end ); compile_emit( c, INSTR_SET, var ); + compile_push_break_scope( c, end ); + compile_push_cleanup( c, INSTR_FOR_POP, 0 ); + compile_push_continue_scope( c, continue_ ); + /* Run the loop body */ compile_parse( parse->right, c, RESULT_NONE ); + compile_pop_continue_scope( c ); + compile_pop_cleanup( c ); + compile_pop_break_scope( c ); + + compile_set_label( c, continue_ ); compile_emit_branch( c, INSTR_JUMP, top ); compile_set_label( c, end ); if ( parse->num ) + { + compile_pop_cleanup( c ); compile_emit( c, INSTR_POP_LOCAL, var ); + } adjust_result( c, RESULT_NONE, result_location); } @@ -2473,6 +2582,7 @@ static void compile_parse( PARSE * parse, compiler * c, int result_location ) : RESULT_RETURN; int test = compile_new_label( c ); int top = compile_new_label( c ); + int end = compile_new_label( c ); /* Make sure that we return an empty list if the loop runs zero times. */ adjust_result( c, RESULT_NONE, nested_result ); @@ -2480,10 +2590,15 @@ static void compile_parse( PARSE * parse, compiler * c, int result_location ) compile_emit_branch( c, INSTR_JUMP, test ); compile_set_label( c, top ); /* Emit the loop body. */ + compile_push_break_scope( c, end ); + compile_push_continue_scope( c, test ); compile_parse( parse->right, c, nested_result ); + compile_pop_continue_scope( c ); + compile_pop_break_scope( c ); /* Emit the condition. */ compile_set_label( c, test ); compile_condition( parse->left, c, 1, top ); + compile_set_label( c, end ); adjust_result( c, nested_result, result_location ); } @@ -2501,7 +2616,9 @@ static void compile_parse( PARSE * parse, compiler * c, int result_location ) : RESULT_RETURN; compile_parse( parse->left, c, RESULT_STACK ); compile_emit( c, INSTR_PUSH_MODULE, 0 ); + compile_push_cleanup( c, INSTR_POP_MODULE, 0 ); compile_parse( parse->right, c, nested_result ); + compile_pop_cleanup( c ); compile_emit( c, INSTR_POP_MODULE, 0 ); adjust_result( c, nested_result, result_location ); } @@ -2515,8 +2632,10 @@ static void compile_parse( PARSE * parse, compiler * c, int result_location ) else compile_emit( c, INSTR_PUSH_EMPTY, 0 ); compile_emit( c, INSTR_CLASS, 0 ); + compile_push_cleanup( c, INSTR_POP_MODULE, 0 ); compile_parse( parse->right, c, RESULT_NONE ); compile_emit( c, INSTR_BIND_MODULE_VARIABLES, 0 ); + compile_pop_cleanup( c ); compile_emit( c, INSTR_POP_MODULE, 0 ); adjust_result( c, RESULT_NONE, result_location ); @@ -2566,7 +2685,9 @@ static void compile_parse( PARSE * parse, compiler * c, int result_location ) var_parse_group_free( group ); compile_parse( parse->right, c, RESULT_STACK ); compile_emit( c, INSTR_PUSH_LOCAL, name ); + compile_push_cleanup( c, INSTR_POP_LOCAL, name ); compile_parse( parse->third, c, nested_result ); + compile_pop_cleanup( c ); compile_emit( c, INSTR_POP_LOCAL, name ); } else @@ -2575,7 +2696,9 @@ static void compile_parse( PARSE * parse, compiler * c, int result_location ) var_parse_group_free( group ); compile_parse( parse->right, c, RESULT_STACK ); compile_emit( c, INSTR_PUSH_LOCAL_GROUP, 0 ); + compile_push_cleanup( c, INSTR_POP_LOCAL_GROUP, 0 ); compile_parse( parse->third, c, nested_result ); + compile_pop_cleanup( c ); compile_emit( c, INSTR_POP_LOCAL_GROUP, 0 ); } } @@ -2584,7 +2707,9 @@ static void compile_parse( PARSE * parse, compiler * c, int result_location ) compile_parse( parse->left, c, RESULT_STACK ); compile_parse( parse->right, c, RESULT_STACK ); compile_emit( c, INSTR_PUSH_LOCAL_GROUP, 0 ); + compile_push_cleanup( c, INSTR_POP_LOCAL_GROUP, 0 ); compile_parse( parse->third, c, nested_result ); + compile_pop_cleanup( c ); compile_emit( c, INSTR_POP_LOCAL_GROUP, 0 ); } adjust_result( c, nested_result, result_location ); @@ -2632,7 +2757,9 @@ static void compile_parse( PARSE * parse, compiler * c, int result_location ) int end = compile_new_label( c ); compile_parse( parse->left, c, RESULT_STACK ); compile_emit_branch( c, INSTR_PUSH_ON, end ); + compile_push_cleanup( c, INSTR_POP_ON, 0 ); var_parse_group_compile( group, c ); + compile_pop_cleanup( c ); compile_emit( c, INSTR_POP_ON, 0 ); compile_set_label( c, end ); } @@ -2643,7 +2770,9 @@ static void compile_parse( PARSE * parse, compiler * c, int result_location ) int end = compile_new_label( c ); compile_parse( parse->left, c, RESULT_STACK ); compile_emit_branch( c, INSTR_PUSH_ON, end ); + compile_push_cleanup( c, INSTR_POP_ON, 0 ); compile_parse( parse->right, c, RESULT_STACK ); + compile_pop_cleanup( c ); compile_emit( c, INSTR_POP_ON, 0 ); compile_set_label( c, end ); } @@ -2809,6 +2938,20 @@ static void compile_parse( PARSE * parse, compiler * c, int result_location ) adjust_result( c, RESULT_NONE, result_location ); compile_set_label( c, switch_end ); } + else if ( parse->type == PARSE_RETURN ) + { + compile_parse( parse->left, c, RESULT_RETURN ); + compile_emit_cleanups( c, 0 ); + compile_emit( c, INSTR_RETURN, 0 ); + } + else if ( parse->type == PARSE_BREAK ) + { + compile_emit_loop_jump( c, LOOP_INFO_BREAK ); + } + else if ( parse->type == PARSE_CONTINUE ) + { + compile_emit_loop_jump( c, LOOP_INFO_CONTINUE ); + } else if ( parse->type == PARSE_NULL ) adjust_result( c, RESULT_NONE, result_location ); else @@ -2925,15 +3068,15 @@ static void argument_error( char const * message, FUNCTION * procedure, extern void print_source_line( FRAME * ); LOL * actual = frame->args; backtrace_line( frame->prev ); - printf( "*** argument error\n* rule %s ( ", frame->rulename ); + out_printf( "*** argument error\n* rule %s ( ", frame->rulename ); argument_list_print( procedure->formal_arguments, procedure->num_formal_arguments ); - printf( " )\n* called with: ( " ); + out_printf( " )\n* called with: ( " ); lol_print( actual ); - printf( " )\n* %s %s\n", message, arg ? object_str ( arg ) : "" ); + out_printf( " )\n* %s %s\n", message, arg ? object_str ( arg ) : "" ); function_location( procedure, &frame->file, &frame->line ); print_source_line( frame ); - printf( "see definition of rule '%s' being called\n", frame->rulename ); + out_printf( "see definition of rule '%s' being called\n", frame->rulename ); backtrace( frame->prev ); exit( 1 ); } @@ -3226,7 +3369,7 @@ static void argument_compiler_add( struct argument_compiler * c, OBJECT * arg, if ( is_type_name( object_str( arg ) ) ) { - printf( "%s:%d: missing argument name before type name: %s\n", + err_printf( "%s:%d: missing argument name before type name: %s\n", object_str( file ), line, object_str( arg ) ); exit( 1 ); } @@ -3274,7 +3417,7 @@ static struct arg_list arg_compile_impl( struct argument_compiler * c, case ARGUMENT_COMPILER_DONE: break; case ARGUMENT_COMPILER_FOUND_TYPE: - printf( "%s:%d: missing argument name after type name: %s\n", + err_printf( "%s:%d: missing argument name after type name: %s\n", object_str( file ), line, object_str( c->arg.type_name ) ); exit( 1 ); case ARGUMENT_COMPILER_FOUND_OBJECT: @@ -3398,19 +3541,19 @@ static void argument_list_print( struct arg_list * args, int num_args ) for ( i = 0; i < num_args; ++i ) { int j; - if ( i ) printf( " : " ); + if ( i ) out_printf( " : " ); for ( j = 0; j < args[ i ].size; ++j ) { struct argument * formal_arg = &args[ i ].args[ j ]; - if ( j ) printf( " " ); + if ( j ) out_printf( " " ); if ( formal_arg->type_name ) - printf( "%s ", object_str( formal_arg->type_name ) ); - printf( "%s", object_str( formal_arg->arg_name ) ); + out_printf( "%s ", object_str( formal_arg->type_name ) ); + out_printf( "%s", object_str( formal_arg->arg_name ) ); switch ( formal_arg->flags ) { - case ARG_OPTIONAL: printf( " ?" ); break; - case ARG_PLUS: printf( " +" ); break; - case ARG_STAR: printf( " *" ); break; + case ARG_OPTIONAL: out_printf( " ?" ); break; + case ARG_PLUS: out_printf( " +" ); break; + case ARG_STAR: out_printf( " *" ); break; } } } @@ -3877,6 +4020,13 @@ LIST * function_run( FUNCTION * function_, FRAME * frame, STACK * s ) break; } + case INSTR_FOR_POP: + { + stack_deallocate( s, sizeof( LISTITER ) ); + list_free( stack_pop( s ) ); + break; + } + /* * Switch */ @@ -3925,7 +4075,7 @@ LIST * function_run( FUNCTION * function_, FRAME * frame, STACK * s ) frame->file = function->file; frame->line = function->line; backtrace_line( frame ); - printf( "error: stack check failed.\n" ); + out_printf( "error: stack check failed.\n" ); backtrace( frame ); assert( saved_stack == s->data ); } @@ -4566,16 +4716,16 @@ LIST * function_run( FUNCTION * function_, FRAME * frame, STACK * s ) if ( !out_file ) { - printf( "failed to write output file '%s'!\n", + err_printf( "failed to write output file '%s'!\n", out_name->value ); exit( EXITBAD ); } string_free( out_name ); } - if ( out_debug ) printf( "\nfile %s\n", out ); + if ( out_debug ) out_printf( "\nfile %s\n", out ); if ( out_file ) fputs( buf->value, out_file ); - if ( out_debug ) fputs( buf->value, stdout ); + if ( out_debug ) out_puts( buf->value ); if ( out_file ) { fflush( out_file ); @@ -4585,7 +4735,7 @@ LIST * function_run( FUNCTION * function_, FRAME * frame, STACK * s ) if ( tmp_filename ) object_free( tmp_filename ); - if ( out_debug ) fputc( '\n', stdout ); + if ( out_debug ) out_putc( '\n' ); break; } @@ -4833,7 +4983,7 @@ static LIST * call_python_function( PYTHON_FUNCTION * function, FRAME * frame ) { OBJECT * s = python_to_string( PyList_GetItem( py_result, i ) ); if ( !s ) - fprintf( stderr, + err_printf( "Non-string object returned by Python call.\n" ); else result = list_push_back( result, s ); @@ -4864,7 +5014,7 @@ static LIST * call_python_function( PYTHON_FUNCTION * function, FRAME * frame ) else { PyErr_Print(); - fprintf( stderr, "Call failed\n" ); + err_printf( "Call failed\n" ); } return result; diff --git a/tools/build/src/engine/hash.c b/tools/build/src/engine/hash.c index 36f8366685..772087a228 100644 --- a/tools/build/src/engine/hash.c +++ b/tools/build/src/engine/hash.c @@ -20,6 +20,7 @@ #include "hash.h" #include "compile.h" +#include "output.h" #include <assert.h> @@ -365,7 +366,7 @@ void hashstats_add( struct hashstats * stats, struct hash * hp ) void hashstats_print( struct hashstats * stats, char const * name ) { - printf( "%s table: %d+%d+%d (%dK+%luK+%luK) items+table+hash, %f density\n", + out_printf( "%s table: %d+%d+%d (%dK+%luK+%luK) items+table+hash, %f density\n", name, stats->count, stats->num_items, diff --git a/tools/build/src/engine/hcache.c b/tools/build/src/engine/hcache.c index 3cf15f7766..d440d5c025 100644 --- a/tools/build/src/engine/hcache.c +++ b/tools/build/src/engine/hcache.c @@ -41,6 +41,7 @@ #include "search.h" #include "timestamp.h" #include "variable.h" +#include "output.h" typedef struct hcachedata HCACHEDATA ; @@ -218,7 +219,7 @@ void hcache_init() record_type = read_netstring( f ); if ( !record_type ) { - fprintf( stderr, "invalid %s\n", hcachename ); + err_printf( "invalid %s\n", hcachename ); goto cleanup; } if ( !strcmp( object_str( record_type ), CACHE_RECORD_END ) ) @@ -228,7 +229,7 @@ void hcache_init() } if ( strcmp( object_str( record_type ), CACHE_RECORD_HEADER ) ) { - fprintf( stderr, "invalid %s with record separator <%s>\n", + err_printf( "invalid %s with record separator <%s>\n", hcachename, record_type ? object_str( record_type ) : "<null>" ); goto cleanup; } @@ -242,7 +243,7 @@ void hcache_init() if ( !cachedata.boundname || !time_secs_str || !time_nsecs_str || !age_str || !includes_count_str ) { - fprintf( stderr, "invalid %s\n", hcachename ); + err_printf( "invalid %s\n", hcachename ); goto cleanup; } @@ -256,7 +257,7 @@ void hcache_init() OBJECT * const s = read_netstring( f ); if ( !s ) { - fprintf( stderr, "invalid %s\n", hcachename ); + err_printf( "invalid %s\n", hcachename ); list_free( l ); goto cleanup; } @@ -267,7 +268,7 @@ void hcache_init() hdrscan_count_str = read_netstring( f ); if ( !hdrscan_count_str ) { - fprintf( stderr, "invalid %s\n", hcachename ); + err_printf( "invalid %s\n", hcachename ); goto cleanup; } @@ -277,7 +278,7 @@ void hcache_init() OBJECT * const s = read_netstring( f ); if ( !s ) { - fprintf( stderr, "invalid %s\n", hcachename ); + err_printf( "invalid %s\n", hcachename ); list_free( l ); goto cleanup; } @@ -297,7 +298,7 @@ void hcache_init() } else { - fprintf( stderr, "can not insert header cache item, bailing on %s" + err_printf( "can not insert header cache item, bailing on %s" "\n", hcachename ); goto cleanup; } @@ -332,7 +333,7 @@ cleanup: } if ( DEBUG_HEADER ) - printf( "hcache read from file %s\n", hcachename ); + out_printf( "hcache read from file %s\n", hcachename ); bail: if ( version ) @@ -406,7 +407,7 @@ void hcache_done() write_netstring( f, CACHE_RECORD_END ); if ( DEBUG_HEADER ) - printf( "hcache written to %s. %d dependencies, %.0f%% hit rate\n", + out_printf( "hcache written to %s. %d dependencies, %.0f%% hit rate\n", hcachename, header_count, queries ? 100.0 * hits / queries : 0 ); fclose ( f ); @@ -456,13 +457,13 @@ LIST * hcache( TARGET * t, int rec, regexp * re[], LIST * hdrscan ) { if ( DEBUG_HEADER ) { - printf( "HDRSCAN out of date in cache for %s\n", + out_printf( "HDRSCAN out of date in cache for %s\n", object_str( t->boundname ) ); - printf(" real : "); + out_printf(" real : "); list_print( hdrscan ); - printf( "\n cached: " ); + out_printf( "\n cached: " ); list_print( c->hdrscan ); - printf( "\n" ); + out_printf( "\n" ); } list_free( c->includes ); @@ -473,7 +474,7 @@ LIST * hcache( TARGET * t, int rec, regexp * re[], LIST * hdrscan ) else { if ( DEBUG_HEADER ) - printf( "using header cache for %s\n", object_str( + out_printf( "using header cache for %s\n", object_str( t->boundname ) ); c->age = 0; ++hits; @@ -483,7 +484,7 @@ LIST * hcache( TARGET * t, int rec, regexp * re[], LIST * hdrscan ) else { if ( DEBUG_HEADER ) - printf ("header cache out of date for %s\n", object_str( + out_printf ("header cache out of date for %s\n", object_str( t->boundname ) ); list_free( c->includes ); list_free( c->hdrscan ); diff --git a/tools/build/src/engine/hdrmacro.c b/tools/build/src/engine/hdrmacro.c index eb4fe90f4b..a8be7787dc 100644 --- a/tools/build/src/engine/hdrmacro.c +++ b/tools/build/src/engine/hdrmacro.c @@ -39,6 +39,7 @@ #include "strings.h" #include "subst.h" #include "variable.h" +#include "output.h" /* this type is used to store a dictionary of file header macros */ @@ -64,7 +65,7 @@ void macro_headers( TARGET * t ) char buf[ 1024 ]; if ( DEBUG_HEADER ) - printf( "macro header scan for %s\n", object_str( t->name ) ); + out_printf( "macro header scan for %s\n", object_str( t->name ) ); /* This regexp is used to detect lines of the form * "#define MACRO <....>" or "#define MACRO "....." @@ -96,7 +97,7 @@ void macro_headers( TARGET * t ) ( (char *)re->endp[ 2 ] )[ 0 ] = '\0'; if ( DEBUG_HEADER ) - printf( "macro '%s' used to define filename '%s' in '%s'\n", + out_printf( "macro '%s' used to define filename '%s' in '%s'\n", re->startp[ 1 ], re->startp[ 2 ], object_str( t->boundname ) ); @@ -131,7 +132,7 @@ OBJECT * macro_header_get( OBJECT * macro_name ) header_macros_hash, macro_name ) ) ) { if ( DEBUG_HEADER ) - printf( "### macro '%s' evaluated to '%s'\n", object_str( macro_name + out_printf( "### macro '%s' evaluated to '%s'\n", object_str( macro_name ), object_str( v->filename ) ); return v->filename; } diff --git a/tools/build/src/engine/headers.c b/tools/build/src/engine/headers.c index 0d9558d5da..e653abcfa3 100644 --- a/tools/build/src/engine/headers.c +++ b/tools/build/src/engine/headers.c @@ -35,6 +35,7 @@ #include "rules.h" #include "subst.h" #include "variable.h" +#include "output.h" #ifdef OPT_HEADER_CACHE_EXT # include "hcache.h" @@ -72,7 +73,7 @@ void headers( TARGET * t ) return; if ( DEBUG_HEADER ) - printf( "header scan %s\n", object_str( t->name ) ); + out_printf( "header scan %s\n", object_str( t->name ) ); /* Compile all regular expressions in HDRSCAN */ iter = list_begin( hdrscan ); @@ -127,8 +128,8 @@ LIST * headers1( LIST * l, OBJECT * file, int rec, regexp * re[] ) ++count; if ( ( ( count == 100 ) || !( count % 1000 ) ) && DEBUG_MAKE ) { - printf( "...patience...\n" ); - fflush( stdout ); + out_printf( "...patience...\n" ); + out_flush(); } #endif @@ -153,7 +154,7 @@ LIST * headers1( LIST * l, OBJECT * file, int rec, regexp * re[] ) { ( (char *)re[ i ]->endp[ 1 ] )[ 0 ] = '\0'; if ( DEBUG_HEADER ) - printf( "header found: %s\n", re[ i ]->startp[ 1 ] ); + out_printf( "header found: %s\n", re[ i ]->startp[ 1 ] ); l = list_push_back( l, object_new( re[ i ]->startp[ 1 ] ) ); } @@ -166,7 +167,7 @@ LIST * headers1( LIST * l, OBJECT * file, int rec, regexp * re[] ) ( (char *)re_macros->endp[ 1 ] )[ 0 ] = '\0'; if ( DEBUG_HEADER ) - printf( "macro header found: %s", re_macros->startp[ 1 ] ); + out_printf( "macro header found: %s", re_macros->startp[ 1 ] ); macro_name = object_new( re_macros->startp[ 1 ] ); header_filename = macro_header_get( macro_name ); @@ -174,14 +175,14 @@ LIST * headers1( LIST * l, OBJECT * file, int rec, regexp * re[] ) if ( header_filename ) { if ( DEBUG_HEADER ) - printf( " resolved to '%s'\n", object_str( header_filename ) + out_printf( " resolved to '%s'\n", object_str( header_filename ) ); l = list_push_back( l, object_copy( header_filename ) ); } else { if ( DEBUG_HEADER ) - printf( " ignored !!\n" ); + out_printf( " ignored !!\n" ); } } } @@ -193,5 +194,5 @@ LIST * headers1( LIST * l, OBJECT * file, int rec, regexp * re[] ) void regerror( char const * s ) { - printf( "re error %s\n", s ); + out_printf( "re error %s\n", s ); } diff --git a/tools/build/src/engine/jam.c b/tools/build/src/engine/jam.c index 890d7672c9..debfee9cc6 100644 --- a/tools/build/src/engine/jam.c +++ b/tools/build/src/engine/jam.c @@ -237,23 +237,23 @@ int main( int argc, char * * argv, char * * arg_environ ) if ( getoptions( argc, argv, "-:l:m:d:j:p:f:gs:t:ano:qv", optv ) < 0 ) { - printf( "\nusage: %s [ options ] targets...\n\n", progname ); - - printf( "-a Build all targets, even if they are current.\n" ); - printf( "-dx Set the debug level to x (0-9).\n" ); - printf( "-fx Read x instead of Jambase.\n" ); - /* printf( "-g Build from newest sources first.\n" ); */ - printf( "-jx Run up to x shell commands concurrently.\n" ); - printf( "-lx Limit actions to x number of seconds after which they are stopped.\n" ); - printf( "-mx Maximum target output saved (kb), default is to save all output.\n" ); - printf( "-n Don't actually execute the updating actions.\n" ); - printf( "-ox Write the updating actions to file x.\n" ); - printf( "-px x=0, pipes action stdout and stderr merged into action output.\n" ); - printf( "-q Quit quickly as soon as a target fails.\n" ); - printf( "-sx=y Set variable x=y, overriding environment.\n" ); - printf( "-tx Rebuild x, even if it is up-to-date.\n" ); - printf( "-v Print the version of jam and exit.\n" ); - printf( "--x Option is ignored.\n\n" ); + err_printf( "\nusage: %s [ options ] targets...\n\n", progname ); + + err_printf( "-a Build all targets, even if they are current.\n" ); + err_printf( "-dx Set the debug level to x (0-9).\n" ); + err_printf( "-fx Read x instead of Jambase.\n" ); + /* err_printf( "-g Build from newest sources first.\n" ); */ + err_printf( "-jx Run up to x shell commands concurrently.\n" ); + err_printf( "-lx Limit actions to x number of seconds after which they are stopped.\n" ); + err_printf( "-mx Maximum target output saved (kb), default is to save all output.\n" ); + err_printf( "-n Don't actually execute the updating actions.\n" ); + err_printf( "-ox Mirror all output to file x.\n" ); + err_printf( "-px x=0, pipes action stdout and stderr merged into action output.\n" ); + err_printf( "-q Quit quickly as soon as a target fails.\n" ); + err_printf( "-sx=y Set variable x=y, overriding environment.\n" ); + err_printf( "-tx Rebuild x, even if it is up-to-date.\n" ); + err_printf( "-v Print the version of jam and exit.\n" ); + err_printf( "--x Option is ignored.\n\n" ); exit( EXITBAD ); } @@ -261,13 +261,13 @@ int main( int argc, char * * argv, char * * arg_environ ) /* Version info. */ if ( ( s = getoptval( optv, 'v', 0 ) ) ) { - printf( "Boost.Jam Version %s. %s.\n", VERSION, OSMINOR ); - printf( " Copyright 1993-2002 Christopher Seiwald and Perforce " + out_printf( "Boost.Jam Version %s. %s.\n", VERSION, OSMINOR ); + out_printf( " Copyright 1993-2002 Christopher Seiwald and Perforce " "Software, Inc.\n" ); - printf( " Copyright 2001 David Turner.\n" ); - printf( " Copyright 2001-2004 David Abrahams.\n" ); - printf( " Copyright 2002-2008 Rene Rivera.\n" ); - printf( " Copyright 2003-2008 Vladimir Prus.\n" ); + out_printf( " Copyright 2001 David Turner.\n" ); + out_printf( " Copyright 2001-2004 David Abrahams.\n" ); + out_printf( " Copyright 2002-2015 Rene Rivera.\n" ); + out_printf( " Copyright 2003-2015 Vladimir Prus.\n" ); return EXITOK; } @@ -286,7 +286,7 @@ int main( int argc, char * * argv, char * * arg_environ ) globs.pipe_action = atoi( s ); if ( globs.pipe_action < 0 || 3 < globs.pipe_action ) { - printf( "Invalid pipe descriptor '%d', valid values are -p[0..3]." + err_printf( "Invalid pipe descriptor '%d', valid values are -p[0..3]." "\n", globs.pipe_action ); exit( EXITBAD ); } @@ -303,7 +303,7 @@ int main( int argc, char * * argv, char * * arg_environ ) globs.jobs = atoi( s ); if ( globs.jobs < 1 || globs.jobs > MAXJOBS ) { - printf( "Invalid value for the '-j' option, valid values are 1 " + err_printf( "Invalid value for the '-j' option, valid values are 1 " "through %d.\n", MAXJOBS ); exit( EXITBAD ); } @@ -332,7 +332,7 @@ int main( int argc, char * * argv, char * * arg_environ ) if ( ( i < 0 ) || ( i >= DEBUG_MAX ) ) { - printf( "Invalid debug level '%s'.\n", s ); + out_printf( "Invalid debug level '%s'.\n", s ); continue; } @@ -344,6 +344,17 @@ int main( int argc, char * * argv, char * * arg_environ ) globs.debug[ i-- ] = 1; } + /* If an output file is specified, set globs.out to that. */ + if ( ( s = getoptval( optv, 'o', 0 ) ) ) + { + if ( !( globs.out = fopen( s, "w" ) ) ) + { + err_printf( "Failed to write to '%s'\n", s ); + exit( EXITBAD ); + } + /* ++globs.noexec; */ + } + constants_init(); cwd_init(); @@ -513,17 +524,6 @@ int main( int argc, char * * argv, char * * arg_environ ) object_free( target ); } - /* If an output file is specified, set globs.cmdout to that. */ - if ( ( s = getoptval( optv, 'o', 0 ) ) ) - { - if ( !( globs.cmdout = fopen( s, "w" ) ) ) - { - printf( "Failed to write to '%s'\n", s ); - exit( EXITBAD ); - } - ++globs.noexec; - } - /* The build system may set the PARALLELISM variable to override -j * options. */ @@ -533,7 +533,7 @@ int main( int argc, char * * argv, char * * arg_environ ) { int const j = atoi( object_str( list_front( p ) ) ); if ( j < 1 || j > MAXJOBS ) - printf( "Invalid value of PARALLELISM: %s. Valid values " + out_printf( "Invalid value of PARALLELISM: %s. Valid values " "are 1 through %d.\n", object_str( list_front( p ) ), MAXJOBS ); else @@ -588,9 +588,9 @@ int main( int argc, char * * argv, char * * arg_environ ) constants_done(); object_done(); - /* Close cmdout. */ - if ( globs.cmdout ) - fclose( globs.cmdout ); + /* Close log out. */ + if ( globs.out ) + fclose( globs.out ); #ifdef HAVE_PYTHON Py_Finalize(); diff --git a/tools/build/src/engine/jam.h b/tools/build/src/engine/jam.h index 2895906af5..b9d415ef6c 100644 --- a/tools/build/src/engine/jam.h +++ b/tools/build/src/engine/jam.h @@ -431,7 +431,7 @@ struct globs int newestfirst; /* build newest sources first */ int pipe_action; char debug[ DEBUG_MAX ]; - FILE * cmdout; /* print cmds, not run them */ + FILE * out; /* mirror output here */ long timeout; /* number of seconds to limit actions to, * default 0 for no limit. */ diff --git a/tools/build/src/engine/jamgram.c b/tools/build/src/engine/jamgram.c index 48c85228e8..916b08d3ea 100644 --- a/tools/build/src/engine/jamgram.c +++ b/tools/build/src/engine/jamgram.c @@ -1,9 +1,8 @@ -/* A Bison parser, made by GNU Bison 2.4.3. */ +/* A Bison parser, made by GNU Bison 2.6.4. */ -/* Skeleton implementation for Bison's Yacc-like parsers in C +/* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -45,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.4.3" +#define YYBISON_VERSION "2.6.4" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -59,15 +58,12 @@ /* Pull parsers. */ #define YYPULL 1 -/* Using locations. */ -#define YYLSP_NEEDED 0 /* Copy the first part of user declarations. */ - -/* Line 189 of yacc.c */ -#line 96 "jamgram.y" +/* Line 358 of yacc.c */ +#line 98 "jamgram.y" #include "jam.h" @@ -103,19 +99,24 @@ # define psete( s,l,s1,f ) parse_make( PARSE_SETEXEC,l,P0,P0,s,s1,f ) # define pswitch( l,r ) parse_make( PARSE_SWITCH,l,r,P0,S0,S0,0 ) # define pwhile( l,r ) parse_make( PARSE_WHILE,l,r,P0,S0,S0,0 ) +# define preturn( l ) parse_make( PARSE_RETURN,l,P0,P0,S0,S0,0 ) +# define pbreak() parse_make( PARSE_BREAK,P0,P0,P0,S0,S0,0 ) +# define pcontinue() parse_make( PARSE_CONTINUE,P0,P0,P0,S0,S0,0 ) # define pnode( l,r ) parse_make( F0,l,r,P0,S0,S0,0 ) # define psnode( s,l ) parse_make( F0,l,P0,P0,s,S0,0 ) +/* Line 358 of yacc.c */ +#line 112 "y.tab.c" -/* Line 189 of yacc.c */ -#line 114 "y.tab.c" - -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif +# ifndef YY_NULL +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULL nullptr +# else +# define YY_NULL 0 +# endif +# endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE @@ -125,11 +126,17 @@ # define YYERROR_VERBOSE 0 #endif -/* Enabling the token table. */ -#ifndef YYTOKEN_TABLE -# define YYTOKEN_TABLE 0 +/* In a future release of Bison, this section will be replaced + by #include "y.tab.h". */ +#ifndef YY_YY_Y_TAB_H_INCLUDED +# define YY_YY_Y_TAB_H_INCLUDED +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 1 +#endif +#if YYDEBUG +extern int yydebug; #endif - /* Tokens. */ #ifndef YYTOKENTYPE @@ -156,33 +163,35 @@ _RBRACKET_t = 274, ACTIONS_t = 275, BIND_t = 276, - CASE_t = 277, - CLASS_t = 278, - DEFAULT_t = 279, - ELSE_t = 280, - EXISTING_t = 281, - FOR_t = 282, - IF_t = 283, - IGNORE_t = 284, - IN_t = 285, - INCLUDE_t = 286, - LOCAL_t = 287, - MODULE_t = 288, - ON_t = 289, - PIECEMEAL_t = 290, - QUIETLY_t = 291, - RETURN_t = 292, - RULE_t = 293, - SWITCH_t = 294, - TOGETHER_t = 295, - UPDATED_t = 296, - WHILE_t = 297, - _LBRACE_t = 298, - _BAR_t = 299, - _BARBAR_t = 300, - _RBRACE_t = 301, - ARG = 302, - STRING = 303 + BREAK_t = 277, + CASE_t = 278, + CLASS_t = 279, + CONTINUE_t = 280, + DEFAULT_t = 281, + ELSE_t = 282, + EXISTING_t = 283, + FOR_t = 284, + IF_t = 285, + IGNORE_t = 286, + IN_t = 287, + INCLUDE_t = 288, + LOCAL_t = 289, + MODULE_t = 290, + ON_t = 291, + PIECEMEAL_t = 292, + QUIETLY_t = 293, + RETURN_t = 294, + RULE_t = 295, + SWITCH_t = 296, + TOGETHER_t = 297, + UPDATED_t = 298, + WHILE_t = 299, + _LBRACE_t = 300, + _BAR_t = 301, + _BARBAR_t = 302, + _RBRACE_t = 303, + ARG = 304, + STRING = 305 }; #endif /* Tokens. */ @@ -205,34 +214,35 @@ #define _RBRACKET_t 274 #define ACTIONS_t 275 #define BIND_t 276 -#define CASE_t 277 -#define CLASS_t 278 -#define DEFAULT_t 279 -#define ELSE_t 280 -#define EXISTING_t 281 -#define FOR_t 282 -#define IF_t 283 -#define IGNORE_t 284 -#define IN_t 285 -#define INCLUDE_t 286 -#define LOCAL_t 287 -#define MODULE_t 288 -#define ON_t 289 -#define PIECEMEAL_t 290 -#define QUIETLY_t 291 -#define RETURN_t 292 -#define RULE_t 293 -#define SWITCH_t 294 -#define TOGETHER_t 295 -#define UPDATED_t 296 -#define WHILE_t 297 -#define _LBRACE_t 298 -#define _BAR_t 299 -#define _BARBAR_t 300 -#define _RBRACE_t 301 -#define ARG 302 -#define STRING 303 - +#define BREAK_t 277 +#define CASE_t 278 +#define CLASS_t 279 +#define CONTINUE_t 280 +#define DEFAULT_t 281 +#define ELSE_t 282 +#define EXISTING_t 283 +#define FOR_t 284 +#define IF_t 285 +#define IGNORE_t 286 +#define IN_t 287 +#define INCLUDE_t 288 +#define LOCAL_t 289 +#define MODULE_t 290 +#define ON_t 291 +#define PIECEMEAL_t 292 +#define QUIETLY_t 293 +#define RETURN_t 294 +#define RULE_t 295 +#define SWITCH_t 296 +#define TOGETHER_t 297 +#define UPDATED_t 298 +#define WHILE_t 299 +#define _LBRACE_t 300 +#define _BAR_t 301 +#define _BARBAR_t 302 +#define _RBRACE_t 303 +#define ARG 304 +#define STRING 305 @@ -243,12 +253,28 @@ typedef int YYSTYPE; # define YYSTYPE_IS_DECLARED 1 #endif +extern YYSTYPE yylval; -/* Copy the second part of user declarations. */ +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +int yyparse (void *YYPARSE_PARAM); +#else +int yyparse (); +#endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +int yyparse (void); +#else +int yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ +#endif /* !YY_YY_Y_TAB_H_INCLUDED */ -/* Line 264 of yacc.c */ -#line 252 "y.tab.c" +/* Copy the second part of user declarations. */ + +/* Line 377 of yacc.c */ +#line 278 "y.tab.c" #ifdef short # undef short @@ -301,24 +327,24 @@ typedef short int yytype_int16; # if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ -# define YY_(msgid) dgettext ("bison-runtime", msgid) +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) # endif # endif # ifndef YY_ -# define YY_(msgid) msgid +# define YY_(Msgid) Msgid # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ -# define YYUSE(e) ((void) (e)) +# define YYUSE(E) ((void) (E)) #else -# define YYUSE(e) /* empty */ +# define YYUSE(E) /* empty */ #endif /* Identity function, used to suppress warnings about constant conditions. */ #ifndef lint -# define YYID(n) (n) +# define YYID(N) (N) #else #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) @@ -351,11 +377,12 @@ YYID (yyi) # define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 # endif # endif # endif @@ -378,24 +405,24 @@ YYID (yyi) # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif -# if (defined __cplusplus && ! defined _STDLIB_H \ +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ +# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free -# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ +# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif @@ -424,23 +451,7 @@ union yyalloc ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) -/* Copy COUNT objects from FROM to TO. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) -# else -# define YYCOPY(To, From, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ - while (YYID (0)) -# endif -# endif +# define YYCOPY_NEEDED 1 /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of @@ -460,23 +471,43 @@ union yyalloc #endif +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED +/* Copy COUNT objects from SRC to DST. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(Dst, Src, Count) \ + __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) +# else +# define YYCOPY(Dst, Src, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (Dst)[yyi] = (Src)[yyi]; \ + } \ + while (YYID (0)) +# endif +# endif +#endif /* !YYCOPY_NEEDED */ + /* YYFINAL -- State number of the termination state. */ -#define YYFINAL 43 +#define YYFINAL 47 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 243 +#define YYLAST 238 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 49 +#define YYNTOKENS 51 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 24 /* YYNRULES -- Number of rules. */ -#define YYNRULES 75 +#define YYNRULES 77 /* YYNRULES -- Number of states. */ -#define YYNSTATES 159 +#define YYNSTATES 163 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 303 +#define YYMAXUTOK 305 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -514,70 +545,71 @@ static const yytype_uint8 yytranslate[] = 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48 + 45, 46, 47, 48, 49, 50 }; #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ -static const yytype_uint8 yyprhs[] = +static const yytype_uint16 yyprhs[] = { 0, 0, 3, 4, 6, 8, 10, 12, 15, 21, 22, 25, 27, 31, 32, 34, 35, 39, 43, 47, - 52, 59, 63, 72, 78, 84, 90, 96, 102, 110, - 116, 120, 121, 122, 132, 134, 136, 138, 141, 143, - 147, 151, 155, 159, 163, 167, 171, 175, 179, 183, - 187, 190, 194, 195, 198, 203, 205, 209, 211, 212, - 215, 217, 218, 223, 226, 231, 236, 237, 240, 242, - 244, 246, 248, 250, 252, 253 + 52, 59, 63, 66, 69, 78, 84, 90, 96, 102, + 108, 116, 122, 126, 127, 128, 138, 140, 142, 144, + 147, 149, 153, 157, 161, 165, 169, 173, 177, 181, + 185, 189, 193, 196, 200, 201, 204, 209, 211, 215, + 217, 218, 221, 223, 224, 229, 232, 237, 242, 243, + 246, 248, 250, 252, 254, 256, 258, 259 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int8 yyrhs[] = { - 50, 0, -1, -1, 52, -1, 53, -1, 52, -1, - 57, -1, 57, 52, -1, 32, 65, 54, 11, 51, - -1, -1, 14, 65, -1, 53, -1, 7, 64, 8, - -1, -1, 32, -1, -1, 43, 51, 46, -1, 31, - 65, 11, -1, 47, 64, 11, -1, 67, 60, 65, - 11, -1, 67, 34, 65, 60, 65, 11, -1, 37, - 65, 11, -1, 27, 56, 47, 30, 65, 43, 51, - 46, -1, 39, 65, 43, 62, 46, -1, 28, 61, - 43, 51, 46, -1, 33, 65, 43, 51, 46, -1, - 23, 64, 43, 51, 46, -1, 42, 61, 43, 51, - 46, -1, 28, 61, 43, 51, 46, 25, 57, -1, - 56, 38, 47, 55, 57, -1, 34, 67, 57, -1, - -1, -1, 20, 70, 47, 72, 43, 58, 48, 59, - 46, -1, 14, -1, 9, -1, 17, -1, 24, 14, - -1, 67, -1, 61, 14, 61, -1, 61, 4, 61, - -1, 61, 12, 61, -1, 61, 13, 61, -1, 61, - 15, 61, -1, 61, 16, 61, -1, 61, 5, 61, - -1, 61, 6, 61, -1, 61, 44, 61, -1, 61, - 45, 61, -1, 67, 30, 65, -1, 3, 61, -1, - 7, 61, 8, -1, -1, 63, 62, -1, 22, 47, - 10, 51, -1, 65, -1, 65, 10, 64, -1, 66, - -1, -1, 66, 67, -1, 47, -1, -1, 18, 68, - 69, 19, -1, 47, 64, -1, 34, 67, 47, 64, - -1, 34, 67, 37, 65, -1, -1, 70, 71, -1, - 41, -1, 40, -1, 29, -1, 36, -1, 35, -1, - 26, -1, -1, 21, 65, -1 + 52, 0, -1, -1, 54, -1, 55, -1, 54, -1, + 59, -1, 59, 54, -1, 34, 67, 56, 11, 53, + -1, -1, 14, 67, -1, 55, -1, 7, 66, 8, + -1, -1, 34, -1, -1, 45, 53, 48, -1, 33, + 67, 11, -1, 49, 66, 11, -1, 69, 62, 67, + 11, -1, 69, 36, 67, 62, 67, 11, -1, 39, + 67, 11, -1, 22, 11, -1, 25, 11, -1, 29, + 58, 49, 32, 67, 45, 53, 48, -1, 41, 67, + 45, 64, 48, -1, 30, 63, 45, 53, 48, -1, + 35, 67, 45, 53, 48, -1, 24, 66, 45, 53, + 48, -1, 44, 63, 45, 53, 48, -1, 30, 63, + 45, 53, 48, 27, 59, -1, 58, 40, 49, 57, + 59, -1, 36, 69, 59, -1, -1, -1, 20, 72, + 49, 74, 45, 60, 50, 61, 48, -1, 14, -1, + 9, -1, 17, -1, 26, 14, -1, 69, -1, 63, + 14, 63, -1, 63, 4, 63, -1, 63, 12, 63, + -1, 63, 13, 63, -1, 63, 15, 63, -1, 63, + 16, 63, -1, 63, 5, 63, -1, 63, 6, 63, + -1, 63, 46, 63, -1, 63, 47, 63, -1, 69, + 32, 67, -1, 3, 63, -1, 7, 63, 8, -1, + -1, 65, 64, -1, 23, 49, 10, 53, -1, 67, + -1, 67, 10, 66, -1, 68, -1, -1, 68, 69, + -1, 49, -1, -1, 18, 70, 71, 19, -1, 49, + 66, -1, 36, 69, 49, 66, -1, 36, 69, 39, + 67, -1, -1, 72, 73, -1, 43, -1, 42, -1, + 31, -1, 38, -1, 37, -1, 28, -1, -1, 21, + 67, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 139, 139, 141, 152, 154, 158, 160, 162, 167, - 170, 172, 176, 179, 182, 185, 188, 190, 192, 194, - 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, - 216, 219, 221, 218, 230, 232, 234, 236, 243, 245, - 247, 249, 251, 253, 255, 257, 259, 261, 263, 265, - 267, 269, 281, 282, 286, 295, 297, 307, 312, 313, - 317, 319, 319, 328, 330, 332, 343, 344, 348, 350, - 352, 354, 356, 358, 368, 369 + 0, 144, 144, 146, 157, 159, 163, 165, 167, 172, + 175, 177, 181, 184, 187, 190, 193, 195, 197, 199, + 201, 203, 205, 207, 209, 211, 213, 215, 217, 219, + 221, 223, 225, 228, 230, 227, 239, 241, 243, 245, + 252, 254, 256, 258, 260, 262, 264, 266, 268, 270, + 272, 274, 276, 278, 290, 291, 295, 304, 306, 316, + 321, 322, 326, 328, 328, 337, 339, 341, 352, 353, + 357, 359, 361, 363, 365, 367, 377, 378 }; #endif -#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +#if YYDEBUG || YYERROR_VERBOSE || 0 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = @@ -586,14 +618,15 @@ static const char *const yytname[] = "_AMPERAMPER_t", "_LPAREN_t", "_RPAREN_t", "_PLUS_EQUALS_t", "_COLON_t", "_SEMIC_t", "_LANGLE_t", "_LANGLE_EQUALS_t", "_EQUALS_t", "_RANGLE_t", "_RANGLE_EQUALS_t", "_QUESTION_EQUALS_t", "_LBRACKET_t", "_RBRACKET_t", - "ACTIONS_t", "BIND_t", "CASE_t", "CLASS_t", "DEFAULT_t", "ELSE_t", - "EXISTING_t", "FOR_t", "IF_t", "IGNORE_t", "IN_t", "INCLUDE_t", - "LOCAL_t", "MODULE_t", "ON_t", "PIECEMEAL_t", "QUIETLY_t", "RETURN_t", - "RULE_t", "SWITCH_t", "TOGETHER_t", "UPDATED_t", "WHILE_t", "_LBRACE_t", - "_BAR_t", "_BARBAR_t", "_RBRACE_t", "ARG", "STRING", "$accept", "run", - "block", "rules", "null", "assign_list_opt", "arglist_opt", "local_opt", - "rule", "$@1", "$@2", "assign", "expr", "cases", "case", "lol", "list", - "listp", "arg", "$@3", "func", "eflags", "eflag", "bindlist", 0 + "ACTIONS_t", "BIND_t", "BREAK_t", "CASE_t", "CLASS_t", "CONTINUE_t", + "DEFAULT_t", "ELSE_t", "EXISTING_t", "FOR_t", "IF_t", "IGNORE_t", "IN_t", + "INCLUDE_t", "LOCAL_t", "MODULE_t", "ON_t", "PIECEMEAL_t", "QUIETLY_t", + "RETURN_t", "RULE_t", "SWITCH_t", "TOGETHER_t", "UPDATED_t", "WHILE_t", + "_LBRACE_t", "_BAR_t", "_BARBAR_t", "_RBRACE_t", "ARG", "STRING", + "$accept", "run", "block", "rules", "null", "assign_list_opt", + "arglist_opt", "local_opt", "rule", "$@1", "$@2", "assign", "expr", + "cases", "case", "lol", "list", "listp", "arg", "$@3", "func", "eflags", + "eflag", "bindlist", YY_NULL }; #endif @@ -606,21 +639,22 @@ static const yytype_uint16 yytoknum[] = 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303 + 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, + 305 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 49, 50, 50, 51, 51, 52, 52, 52, 53, - 54, 54, 55, 55, 56, 56, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 58, 59, 57, 60, 60, 60, 60, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 62, 62, 63, 64, 64, 65, 66, 66, - 67, 68, 67, 69, 69, 69, 70, 70, 71, 71, - 71, 71, 71, 71, 72, 72 + 0, 51, 52, 52, 53, 53, 54, 54, 54, 55, + 56, 56, 57, 57, 58, 58, 59, 59, 59, 59, + 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, + 59, 59, 59, 60, 61, 59, 62, 62, 62, 62, + 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, + 63, 63, 63, 63, 64, 64, 65, 66, 66, 67, + 68, 68, 69, 70, 69, 71, 71, 71, 72, 72, + 73, 73, 73, 73, 73, 73, 74, 74 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -628,159 +662,165 @@ static const yytype_uint8 yyr2[] = { 0, 2, 0, 1, 1, 1, 1, 2, 5, 0, 2, 1, 3, 0, 1, 0, 3, 3, 3, 4, - 6, 3, 8, 5, 5, 5, 5, 5, 7, 5, - 3, 0, 0, 9, 1, 1, 1, 2, 1, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 2, 3, 0, 2, 4, 1, 3, 1, 0, 2, - 1, 0, 4, 2, 4, 4, 0, 2, 1, 1, - 1, 1, 1, 1, 0, 2 + 6, 3, 2, 2, 8, 5, 5, 5, 5, 5, + 7, 5, 3, 0, 0, 9, 1, 1, 1, 2, + 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 2, 3, 0, 2, 4, 1, 3, 1, + 0, 2, 1, 0, 4, 2, 4, 4, 0, 2, + 1, 1, 1, 1, 1, 1, 0, 2 }; -/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state - STATE-NUM when YYTABLE doesn't specify something else to do. Zero +/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const yytype_uint8 yydefact[] = { - 2, 61, 66, 58, 15, 0, 58, 58, 58, 0, - 58, 58, 0, 9, 60, 0, 3, 0, 6, 0, - 0, 0, 0, 55, 57, 14, 0, 0, 0, 60, - 0, 38, 0, 9, 0, 15, 0, 0, 0, 0, - 5, 4, 0, 1, 0, 7, 35, 34, 36, 0, - 58, 58, 0, 58, 0, 73, 70, 72, 71, 69, - 68, 74, 67, 9, 58, 59, 0, 50, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, - 58, 17, 58, 11, 0, 9, 30, 21, 52, 9, - 16, 18, 13, 37, 0, 0, 0, 63, 62, 58, - 0, 0, 56, 58, 51, 40, 45, 46, 41, 42, - 39, 43, 44, 0, 47, 48, 49, 10, 9, 0, - 0, 0, 52, 0, 58, 15, 58, 19, 58, 58, - 75, 31, 26, 0, 24, 8, 25, 0, 23, 53, - 27, 0, 29, 0, 65, 64, 0, 9, 15, 9, - 12, 20, 32, 0, 28, 54, 0, 22, 33 + 2, 63, 68, 0, 60, 0, 15, 0, 60, 60, + 60, 0, 60, 60, 0, 9, 62, 0, 3, 0, + 6, 0, 0, 0, 22, 0, 57, 59, 23, 14, + 0, 0, 0, 62, 0, 40, 0, 9, 0, 15, + 0, 0, 0, 0, 5, 4, 0, 1, 0, 7, + 37, 36, 38, 0, 60, 60, 0, 60, 0, 75, + 72, 74, 73, 71, 70, 76, 69, 9, 60, 61, + 0, 52, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 9, 0, 0, 60, 17, 60, 11, 0, 9, + 32, 21, 54, 9, 16, 18, 13, 39, 0, 0, + 0, 65, 64, 60, 0, 0, 58, 60, 53, 42, + 47, 48, 43, 44, 41, 45, 46, 0, 49, 50, + 51, 10, 9, 0, 0, 0, 54, 0, 60, 15, + 60, 19, 60, 60, 77, 33, 28, 0, 26, 8, + 27, 0, 25, 55, 29, 0, 31, 0, 67, 66, + 0, 9, 15, 9, 12, 20, 34, 0, 30, 56, + 0, 24, 35 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 15, 39, 40, 41, 84, 125, 17, 18, 146, - 156, 51, 30, 121, 122, 22, 23, 24, 31, 20, - 54, 21, 62, 100 + -1, 17, 43, 44, 45, 88, 129, 19, 20, 150, + 160, 55, 34, 125, 126, 25, 26, 27, 35, 22, + 58, 23, 66, 104 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -48 +#define YYPACT_NINF -50 static const yytype_int16 yypact[] = { - 170, -48, -48, -48, -12, 7, -48, -17, -48, -3, - -48, -48, 7, 170, 1, 22, -48, -9, 170, 19, - -2, 79, -6, 29, -3, -48, 2, 7, 7, -48, - 138, 20, 44, 45, 18, 196, 51, 26, 151, 24, - -48, -48, 62, -48, 27, -48, -48, -48, -48, 61, - -48, -48, -3, -48, 67, -48, -48, -48, -48, -48, - -48, 58, -48, 170, -48, -48, 50, -48, 52, 7, - 7, 7, 7, 7, 7, 7, 7, 170, 7, 7, - -48, -48, -48, -48, 70, 170, -48, -48, 87, 170, - -48, -48, 94, -48, 17, 99, -20, -48, -48, -48, - 69, 71, -48, -48, -48, 91, 156, 156, -48, -48, - 91, -48, -48, 77, 78, 78, -48, -48, 170, 81, - 66, 82, 87, 95, -48, 196, -48, -48, -48, -48, - -48, -48, -48, 97, 112, -48, -48, 135, -48, -48, - -48, 150, -48, 148, -48, -48, 98, 170, 196, 170, - -48, -48, -48, 115, -48, -48, 116, -48, -48 + 161, -50, -50, -1, -50, 6, -25, 5, -50, -5, + -50, -11, -50, -50, 5, 161, 11, 28, -50, -4, + 161, 61, 9, -12, -50, 14, 51, -11, -50, -50, + 27, 5, 5, -50, 37, 53, 69, 72, 43, 189, + 79, 46, 128, 44, -50, -50, 84, -50, 49, -50, + -50, -50, -50, 85, -50, -50, -11, -50, 82, -50, + -50, -50, -50, -50, -50, 92, -50, 161, -50, -50, + 71, -50, 142, 5, 5, 5, 5, 5, 5, 5, + 5, 161, 5, 5, -50, -50, -50, -50, 105, 161, + -50, -50, 95, 161, -50, -50, 112, -50, 48, 109, + -15, -50, -50, -50, 76, 80, -50, -50, -50, 56, + 123, 123, -50, -50, 56, -50, -50, 97, 155, 155, + -50, -50, 161, 101, 75, 114, 95, 115, -50, 189, + -50, -50, -50, -50, -50, -50, -50, 119, 103, -50, + -50, 156, -50, -50, -50, 157, -50, 165, -50, -50, + 122, 161, 189, 161, -50, -50, -50, 129, -50, -50, + 130, -50, -50 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -48, -48, -47, 5, 140, -48, -48, 171, -27, -48, - -48, 80, 60, 54, -48, -13, -4, -48, 0, -48, - -48, -48, -48, -48 + -50, -50, -49, 13, 143, -50, -50, 176, -35, -50, + -50, 86, 32, 66, -50, -2, -7, -50, 0, -50, + -50, -50, -50, -50 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which - number is the opposite. If zero, do what YYDEFACT says. - If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -59 + number is the opposite. If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF -61 static const yytype_int16 yytable[] = { - 19, 42, 32, 33, 34, 16, 36, 37, 86, 35, - 27, -58, -58, 19, 28, 1, 101, 128, 19, -58, - 25, -14, 43, 45, 65, 1, 46, 129, 46, 44, - 113, 47, 52, 47, 48, 19, 48, 63, 119, 64, - 97, 49, 123, 49, 29, 53, 94, 95, -58, 66, - 80, 102, 96, 50, 29, 81, 69, 70, 71, 82, - 104, 85, 87, 19, 72, 73, 74, 75, 76, 88, - 90, 135, 38, 91, 92, 93, 116, 19, 117, 99, - 103, 118, 69, 70, 71, 19, 98, 67, 68, 19, - 72, 73, 74, 75, 76, 130, 78, 79, 142, 133, - 153, 124, 155, 72, 73, 55, 75, 76, 56, 120, - 127, 141, 131, 137, 57, 58, 145, 132, 19, 59, - 60, 154, 143, 134, 144, 19, 61, 136, 138, 105, - 106, 107, 108, 109, 110, 111, 112, 148, 114, 115, - 147, 140, 69, 70, 71, 149, 152, 19, 19, 19, - 72, 73, 74, 75, 76, 69, 70, 71, 150, 151, - 69, 157, 158, 72, 73, 74, 75, 76, 72, 73, - 74, 75, 76, 83, 126, 26, 139, 0, 0, 0, - 0, 77, 78, 79, 0, 0, 0, 0, 1, 0, - 2, 0, 0, 3, 89, 78, 79, 4, 5, 0, - 0, 6, 7, 8, 9, 0, 0, 10, -15, 11, - 0, 0, 12, 13, 1, 0, 2, 14, 0, 3, - 0, 0, 0, 4, 5, 0, 0, 6, 25, 8, - 9, 0, 0, 10, 0, 11, 0, 0, 12, 13, - 0, 0, 0, 14 + 21, 36, 37, 38, 90, 40, 41, 1, 31, 29, + 24, 39, 32, 18, 46, 21, 59, 28, 105, 60, + 21, -60, -60, 1, 132, 61, 62, 69, 47, -60, + 63, 64, 117, 49, 133, -14, 48, 65, 33, 21, + 123, 73, 74, 75, 127, 56, 42, 98, 99, 76, + 77, 78, 79, 80, 33, 101, 100, 50, 57, 67, + -60, 68, 51, 71, 72, 52, 106, 21, 76, 77, + 50, 79, 80, 139, 53, 51, 70, 120, 52, 121, + 85, 21, 81, 82, 83, 84, 86, 53, 89, 21, + 91, 92, 94, 21, 146, 95, 134, 54, 96, 97, + 137, 102, 157, 107, 159, 109, 110, 111, 112, 113, + 114, 115, 116, 103, 118, 119, 122, 158, 124, 128, + 131, 135, 21, 147, 141, 148, 145, 73, 136, 21, + 152, 149, 73, 74, 75, 76, 77, 78, 79, 80, + 76, 77, 78, 79, 80, 138, 73, 74, 75, 140, + 108, 21, 21, 21, 76, 77, 78, 79, 80, 73, + 74, 75, 142, 144, 151, 154, 153, 76, 77, 78, + 79, 80, 156, 93, 82, 83, 155, 161, 162, 1, + 87, 2, 30, 3, 130, 4, 5, 0, 82, 83, + 6, 7, 143, 0, 8, 9, 10, 11, 0, 0, + 12, -15, 13, 0, 0, 14, 15, 1, 0, 2, + 16, 3, 0, 4, 5, 0, 0, 0, 6, 7, + 0, 0, 8, 29, 10, 11, 0, 0, 12, 0, + 13, 0, 0, 14, 15, 0, 0, 0, 16 }; +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-50))) + +#define yytable_value_is_error(Yytable_value) \ + YYID (0) + static const yytype_int16 yycheck[] = { - 0, 14, 6, 7, 8, 0, 10, 11, 35, 9, - 3, 10, 11, 13, 7, 18, 63, 37, 18, 18, - 32, 38, 0, 18, 24, 18, 9, 47, 9, 38, - 77, 14, 34, 14, 17, 35, 17, 43, 85, 10, - 53, 24, 89, 24, 47, 47, 50, 51, 47, 47, - 30, 64, 52, 34, 47, 11, 4, 5, 6, 14, - 8, 43, 11, 63, 12, 13, 14, 15, 16, 43, - 46, 118, 12, 11, 47, 14, 80, 77, 82, 21, - 30, 11, 4, 5, 6, 85, 19, 27, 28, 89, - 12, 13, 14, 15, 16, 99, 44, 45, 125, 103, - 147, 7, 149, 12, 13, 26, 15, 16, 29, 22, - 11, 124, 43, 47, 35, 36, 129, 46, 118, 40, - 41, 148, 126, 46, 128, 125, 47, 46, 46, 69, - 70, 71, 72, 73, 74, 75, 76, 25, 78, 79, - 43, 46, 4, 5, 6, 10, 48, 147, 148, 149, - 12, 13, 14, 15, 16, 4, 5, 6, 8, 11, - 4, 46, 46, 12, 13, 14, 15, 16, 12, 13, - 14, 15, 16, 33, 94, 4, 122, -1, -1, -1, - -1, 43, 44, 45, -1, -1, -1, -1, 18, -1, - 20, -1, -1, 23, 43, 44, 45, 27, 28, -1, - -1, 31, 32, 33, 34, -1, -1, 37, 38, 39, - -1, -1, 42, 43, 18, -1, 20, 47, -1, 23, - -1, -1, -1, 27, 28, -1, -1, 31, 32, 33, - 34, -1, -1, 37, -1, 39, -1, -1, 42, 43, - -1, -1, -1, 47 + 0, 8, 9, 10, 39, 12, 13, 18, 3, 34, + 11, 11, 7, 0, 16, 15, 28, 11, 67, 31, + 20, 10, 11, 18, 39, 37, 38, 27, 0, 18, + 42, 43, 81, 20, 49, 40, 40, 49, 49, 39, + 89, 4, 5, 6, 93, 36, 14, 54, 55, 12, + 13, 14, 15, 16, 49, 57, 56, 9, 49, 45, + 49, 10, 14, 31, 32, 17, 68, 67, 12, 13, + 9, 15, 16, 122, 26, 14, 49, 84, 17, 86, + 11, 81, 45, 46, 47, 32, 14, 26, 45, 89, + 11, 45, 48, 93, 129, 11, 103, 36, 49, 14, + 107, 19, 151, 32, 153, 73, 74, 75, 76, 77, + 78, 79, 80, 21, 82, 83, 11, 152, 23, 7, + 11, 45, 122, 130, 49, 132, 128, 4, 48, 129, + 27, 133, 4, 5, 6, 12, 13, 14, 15, 16, + 12, 13, 14, 15, 16, 48, 4, 5, 6, 48, + 8, 151, 152, 153, 12, 13, 14, 15, 16, 4, + 5, 6, 48, 48, 45, 8, 10, 12, 13, 14, + 15, 16, 50, 45, 46, 47, 11, 48, 48, 18, + 37, 20, 6, 22, 98, 24, 25, -1, 46, 47, + 29, 30, 126, -1, 33, 34, 35, 36, -1, -1, + 39, 40, 41, -1, -1, 44, 45, 18, -1, 20, + 49, 22, -1, 24, 25, -1, -1, -1, 29, 30, + -1, -1, 33, 34, 35, 36, -1, -1, 39, -1, + 41, -1, -1, 44, 45, -1, -1, -1, 49 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 18, 20, 23, 27, 28, 31, 32, 33, 34, - 37, 39, 42, 43, 47, 50, 52, 56, 57, 67, - 68, 70, 64, 65, 66, 32, 56, 3, 7, 47, - 61, 67, 65, 65, 65, 67, 65, 65, 61, 51, - 52, 53, 64, 0, 38, 52, 9, 14, 17, 24, - 34, 60, 34, 47, 69, 26, 29, 35, 36, 40, - 41, 47, 71, 43, 10, 67, 47, 61, 61, 4, - 5, 6, 12, 13, 14, 15, 16, 43, 44, 45, - 30, 11, 14, 53, 54, 43, 57, 11, 43, 43, - 46, 11, 47, 14, 65, 65, 67, 64, 19, 21, - 72, 51, 64, 30, 8, 61, 61, 61, 61, 61, - 61, 61, 61, 51, 61, 61, 65, 65, 11, 51, - 22, 62, 63, 51, 7, 55, 60, 11, 37, 47, - 65, 43, 46, 65, 46, 51, 46, 47, 46, 62, - 46, 64, 57, 65, 65, 64, 58, 43, 25, 10, - 8, 11, 48, 51, 57, 51, 59, 46, 46 + 0, 18, 20, 22, 24, 25, 29, 30, 33, 34, + 35, 36, 39, 41, 44, 45, 49, 52, 54, 58, + 59, 69, 70, 72, 11, 66, 67, 68, 11, 34, + 58, 3, 7, 49, 63, 69, 67, 67, 67, 69, + 67, 67, 63, 53, 54, 55, 66, 0, 40, 54, + 9, 14, 17, 26, 36, 62, 36, 49, 71, 28, + 31, 37, 38, 42, 43, 49, 73, 45, 10, 69, + 49, 63, 63, 4, 5, 6, 12, 13, 14, 15, + 16, 45, 46, 47, 32, 11, 14, 55, 56, 45, + 59, 11, 45, 45, 48, 11, 49, 14, 67, 67, + 69, 66, 19, 21, 74, 53, 66, 32, 8, 63, + 63, 63, 63, 63, 63, 63, 63, 53, 63, 63, + 67, 67, 11, 53, 23, 64, 65, 53, 7, 57, + 62, 11, 39, 49, 67, 45, 48, 67, 48, 53, + 48, 49, 48, 64, 48, 66, 59, 67, 67, 66, + 60, 45, 27, 10, 8, 11, 50, 53, 59, 53, + 61, 48, 48 }; #define yyerrok (yyerrstatus = 0) @@ -810,18 +850,18 @@ static const yytype_uint8 yystos[] = #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - yytoken = YYTRANSLATE (yychar); \ - YYPOPSTACK (1); \ - goto yybackup; \ - } \ - else \ - { \ +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ @@ -831,46 +871,38 @@ while (YYID (0)) #define YYTERROR 1 #define YYERRCODE 256 - /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. If N is 0, then set CURRENT to the empty location which ends the previous symbol: RHS[0] (always defined). */ -#define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (YYID (N)) \ - { \ - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - YYRHSLOC (Rhs, 0).last_column; \ - } \ +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (YYID (N)) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ while (YYID (0)) #endif +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) -/* YY_LOCATION_PRINT -- Print the location on the stream. - This macro was not mandated originally: define only if we know - we won't break user code: when these are the locations we know. */ + + +/* This macro is provided for backward compatibility. */ #ifndef YY_LOCATION_PRINT -# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL -# define YY_LOCATION_PRINT(File, Loc) \ - fprintf (File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) -# else -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -# endif +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) #endif @@ -925,6 +957,8 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep) YYSTYPE const * const yyvaluep; #endif { + FILE *yyo = yyoutput; + YYUSE (yyo); if (!yyvaluep) return; # ifdef YYPRINT @@ -1062,7 +1096,6 @@ int yydebug; # define YYMAXDEPTH 10000 #endif - #if YYERROR_VERBOSE @@ -1165,115 +1198,142 @@ yytnamerr (char *yyres, const char *yystr) } # endif -/* Copy into YYRESULT an error message about the unexpected token - YYCHAR while in state YYSTATE. Return the number of bytes copied, - including the terminating null byte. If YYRESULT is null, do not - copy anything; just return the number of bytes that would be - copied. As a special case, return 0 if an ordinary "syntax error" - message will do. Return YYSIZE_MAXIMUM if overflow occurs during - size calculation. */ -static YYSIZE_T -yysyntax_error (char *yyresult, int yystate, int yychar) -{ - int yyn = yypact[yystate]; +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP. - if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) - return 0; - else + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return 2 if the + required number of bytes is too large to store. */ +static int +yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, + yytype_int16 *yyssp, int yytoken) +{ + YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + /* Internationalized format string. */ + const char *yyformat = YY_NULL; + /* Arguments of yyformat. */ + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + /* Number of reported tokens (one for the "unexpected", one per + "expected"). */ + int yycount = 0; + + /* There are many possibilities here to consider: + - Assume YYFAIL is not used. It's too flawed to consider. See + <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html> + for details. YYERROR is fine as it does not invoke this + function. + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yychar) is if + this state is a consistent state with a default action. Thus, + detecting the absence of a lookahead is sufficient to determine + that there is no unexpected or expected token to report. In that + case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is a + consistent state with a default action. There might have been a + previous inconsistent state, consistent state with a non-default + action, or user semantic action that manipulated yychar. + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state merging + (from LALR or IELR) and default reductions corrupt the expected + token list. However, the list is correct for canonical LR with + one exception: it will still contain any token that will not be + accepted due to an error action in a later state. + */ + if (yytoken != YYEMPTY) { - int yytype = YYTRANSLATE (yychar); - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); - YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; - int yysize_overflow = 0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - int yyx; - -# if 0 - /* This is so xgettext sees the translatable formats that are - constructed on the fly. */ - YY_("syntax error, unexpected %s"); - YY_("syntax error, unexpected %s, expecting %s"); - YY_("syntax error, unexpected %s, expecting %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); -# endif - char *yyfmt; - char const *yyf; - static char const yyunexpected[] = "syntax error, unexpected %s"; - static char const yyexpecting[] = ", expecting %s"; - static char const yyor[] = " or %s"; - char yyformat[sizeof yyunexpected - + sizeof yyexpecting - 1 - + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) - * (sizeof yyor - 1))]; - char const *yyprefix = yyexpecting; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 1; - - yyarg[0] = yytname[yytype]; - yyfmt = yystpcpy (yyformat, yyunexpected); - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - yyformat[sizeof yyunexpected - 1] = '\0'; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - yyfmt = yystpcpy (yyfmt, yyprefix); - yyprefix = yyor; - } + int yyn = yypact[*yyssp]; + yyarg[yycount++] = yytname[yytoken]; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + } + } - yyf = YY_(yyformat); - yysize1 = yysize + yystrlen (yyf); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; + switch (yycount) + { +# define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + YYCASE_(0, YY_("syntax error")); + YYCASE_(1, YY_("syntax error, unexpected %s")); + YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +# undef YYCASE_ + } - if (yysize_overflow) - return YYSIZE_MAXIMUM; + yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; - if (yyresult) - { - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - char *yyp = yyresult; - int yyi = 0; - while ((*yyp = *yyf) != '\0') - { - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyf += 2; - } - else - { - yyp++; - yyf++; - } - } - } - return yysize; + if (*yymsg_alloc < yysize) + { + *yymsg_alloc = 2 * yysize; + if (! (yysize <= *yymsg_alloc + && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; + return 1; } + + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + { + char *yyp = *yymsg; + int yyi = 0; + while ((*yyp = *yyformat) != '\0') + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyformat += 2; + } + else + { + yyp++; + yyformat++; + } + } + return 0; } #endif /* YYERROR_VERBOSE */ - /*-----------------------------------------------. | Release the memory associated to this symbol. | @@ -1306,25 +1366,21 @@ yydestruct (yymsg, yytype, yyvaluep) } } -/* Prevent warnings from -Wmissing-prototypes. */ -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int yyparse (void *YYPARSE_PARAM); -#else -int yyparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus -int yyparse (void); -#else -int yyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ + /* The lookahead symbol. */ int yychar; + +#ifndef YYLVAL_INITIALIZE +# define YYLVAL_INITIALIZE() +#endif +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif + /* The semantic value of the lookahead symbol. */ YYSTYPE yylval; @@ -1332,10 +1388,9 @@ YYSTYPE yylval; int yynerrs; - -/*-------------------------. -| yyparse or yypush_parse. | -`-------------------------*/ +/*----------. +| yyparse. | +`----------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -1359,8 +1414,6 @@ yyparse () #endif #endif { - - int yystate; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; @@ -1369,7 +1422,7 @@ yyparse () `yyss': related to states. `yyvs': related to semantic values. - Refer to the stacks thru separate pointers, to allow yyoverflow + Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ @@ -1387,7 +1440,7 @@ yyparse () int yyn; int yyresult; /* Lookahead token as an internal (translated) token number. */ - int yytoken; + int yytoken = 0; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; @@ -1405,7 +1458,6 @@ yyparse () Keep to zero when no symbol should be popped. */ int yylen = 0; - yytoken = 0; yyss = yyssa; yyvs = yyvsa; yystacksize = YYINITDEPTH; @@ -1424,6 +1476,7 @@ yyparse () yyssp = yyss; yyvsp = yyvs; + YYLVAL_INITIALIZE (); goto yysetstate; /*------------------------------------------------------------. @@ -1515,7 +1568,7 @@ yybackup: /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; - if (yyn == YYPACT_NINF) + if (yypact_value_is_default (yyn)) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ @@ -1546,8 +1599,8 @@ yybackup: yyn = yytable[yyn]; if (yyn <= 0) { - if (yyn == 0 || yyn == YYTABLE_NINF) - goto yyerrlab; + if (yytable_value_is_error (yyn)) + goto yyerrlab; yyn = -yyn; goto yyreduce; } @@ -1564,7 +1617,9 @@ yybackup: yychar = YYEMPTY; yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END goto yynewstate; @@ -1601,522 +1656,471 @@ yyreduce: switch (yyn) { case 3: - -/* Line 1464 of yacc.c */ -#line 142 "jamgram.y" +/* Line 1813 of yacc.c */ +#line 147 "jamgram.y" { parse_save( (yyvsp[(1) - (1)]).parse ); } break; case 4: - -/* Line 1464 of yacc.c */ -#line 153 "jamgram.y" +/* Line 1813 of yacc.c */ +#line 158 "jamgram.y" { (yyval).parse = (yyvsp[(1) - (1)]).parse; } break; case 5: - -/* Line 1464 of yacc.c */ -#line 155 "jamgram.y" +/* Line 1813 of yacc.c */ +#line 160 "jamgram.y" { (yyval).parse = (yyvsp[(1) - (1)]).parse; } break; case 6: - -/* Line 1464 of yacc.c */ -#line 159 "jamgram.y" +/* Line 1813 of yacc.c */ +#line 164 "jamgram.y" { (yyval).parse = (yyvsp[(1) - (1)]).parse; } break; case 7: - -/* Line 1464 of yacc.c */ -#line 161 "jamgram.y" +/* Line 1813 of yacc.c */ +#line 166 "jamgram.y" { (yyval).parse = prules( (yyvsp[(1) - (2)]).parse, (yyvsp[(2) - (2)]).parse ); } break; case 8: - -/* Line 1464 of yacc.c */ -#line 163 "jamgram.y" +/* Line 1813 of yacc.c */ +#line 168 "jamgram.y" { (yyval).parse = plocal( (yyvsp[(2) - (5)]).parse, (yyvsp[(3) - (5)]).parse, (yyvsp[(5) - (5)]).parse ); } break; case 9: - -/* Line 1464 of yacc.c */ -#line 167 "jamgram.y" +/* Line 1813 of yacc.c */ +#line 172 "jamgram.y" { (yyval).parse = pnull(); } break; case 10: - -/* Line 1464 of yacc.c */ -#line 171 "jamgram.y" +/* Line 1813 of yacc.c */ +#line 176 "jamgram.y" { (yyval).parse = (yyvsp[(2) - (2)]).parse; (yyval).number = ASSIGN_SET; } break; case 11: - -/* Line 1464 of yacc.c */ -#line 173 "jamgram.y" +/* Line 1813 of yacc.c */ +#line 178 "jamgram.y" { (yyval).parse = (yyvsp[(1) - (1)]).parse; (yyval).number = ASSIGN_APPEND; } break; case 12: - -/* Line 1464 of yacc.c */ -#line 177 "jamgram.y" +/* Line 1813 of yacc.c */ +#line 182 "jamgram.y" { (yyval).parse = (yyvsp[(2) - (3)]).parse; } break; case 13: - -/* Line 1464 of yacc.c */ -#line 179 "jamgram.y" +/* Line 1813 of yacc.c */ +#line 184 "jamgram.y" { (yyval).parse = P0; } break; case 14: - -/* Line 1464 of yacc.c */ -#line 183 "jamgram.y" +/* Line 1813 of yacc.c */ +#line 188 "jamgram.y" { (yyval).number = 1; } break; case 15: - -/* Line 1464 of yacc.c */ -#line 185 "jamgram.y" +/* Line 1813 of yacc.c */ +#line 190 "jamgram.y" { (yyval).number = 0; } break; case 16: - -/* Line 1464 of yacc.c */ -#line 189 "jamgram.y" +/* Line 1813 of yacc.c */ +#line 194 "jamgram.y" { (yyval).parse = (yyvsp[(2) - (3)]).parse; } break; case 17: - -/* Line 1464 of yacc.c */ -#line 191 "jamgram.y" +/* Line 1813 of yacc.c */ +#line 196 "jamgram.y" { (yyval).parse = pincl( (yyvsp[(2) - (3)]).parse ); } break; case 18: - -/* Line 1464 of yacc.c */ -#line 193 "jamgram.y" +/* Line 1813 of yacc.c */ +#line 198 "jamgram.y" { (yyval).parse = prule( (yyvsp[(1) - (3)]).string, (yyvsp[(2) - (3)]).parse ); } break; case 19: - -/* Line 1464 of yacc.c */ -#line 195 "jamgram.y" +/* Line 1813 of yacc.c */ +#line 200 "jamgram.y" { (yyval).parse = pset( (yyvsp[(1) - (4)]).parse, (yyvsp[(3) - (4)]).parse, (yyvsp[(2) - (4)]).number ); } break; case 20: - -/* Line 1464 of yacc.c */ -#line 197 "jamgram.y" +/* Line 1813 of yacc.c */ +#line 202 "jamgram.y" { (yyval).parse = pset1( (yyvsp[(1) - (6)]).parse, (yyvsp[(3) - (6)]).parse, (yyvsp[(5) - (6)]).parse, (yyvsp[(4) - (6)]).number ); } break; case 21: - -/* Line 1464 of yacc.c */ -#line 199 "jamgram.y" - { (yyval).parse = (yyvsp[(2) - (3)]).parse; } +/* Line 1813 of yacc.c */ +#line 204 "jamgram.y" + { (yyval).parse = preturn( (yyvsp[(2) - (3)]).parse ); } break; case 22: - -/* Line 1464 of yacc.c */ -#line 201 "jamgram.y" - { (yyval).parse = pfor( (yyvsp[(3) - (8)]).string, (yyvsp[(5) - (8)]).parse, (yyvsp[(7) - (8)]).parse, (yyvsp[(2) - (8)]).number ); } +/* Line 1813 of yacc.c */ +#line 206 "jamgram.y" + { (yyval).parse = pbreak(); } break; case 23: - -/* Line 1464 of yacc.c */ -#line 203 "jamgram.y" - { (yyval).parse = pswitch( (yyvsp[(2) - (5)]).parse, (yyvsp[(4) - (5)]).parse ); } +/* Line 1813 of yacc.c */ +#line 208 "jamgram.y" + { (yyval).parse = pcontinue(); } break; case 24: - -/* Line 1464 of yacc.c */ -#line 205 "jamgram.y" - { (yyval).parse = pif( (yyvsp[(2) - (5)]).parse, (yyvsp[(4) - (5)]).parse, pnull() ); } +/* Line 1813 of yacc.c */ +#line 210 "jamgram.y" + { (yyval).parse = pfor( (yyvsp[(3) - (8)]).string, (yyvsp[(5) - (8)]).parse, (yyvsp[(7) - (8)]).parse, (yyvsp[(2) - (8)]).number ); } break; case 25: - -/* Line 1464 of yacc.c */ -#line 207 "jamgram.y" - { (yyval).parse = pmodule( (yyvsp[(2) - (5)]).parse, (yyvsp[(4) - (5)]).parse ); } +/* Line 1813 of yacc.c */ +#line 212 "jamgram.y" + { (yyval).parse = pswitch( (yyvsp[(2) - (5)]).parse, (yyvsp[(4) - (5)]).parse ); } break; case 26: - -/* Line 1464 of yacc.c */ -#line 209 "jamgram.y" - { (yyval).parse = pclass( (yyvsp[(2) - (5)]).parse, (yyvsp[(4) - (5)]).parse ); } +/* Line 1813 of yacc.c */ +#line 214 "jamgram.y" + { (yyval).parse = pif( (yyvsp[(2) - (5)]).parse, (yyvsp[(4) - (5)]).parse, pnull() ); } break; case 27: - -/* Line 1464 of yacc.c */ -#line 211 "jamgram.y" - { (yyval).parse = pwhile( (yyvsp[(2) - (5)]).parse, (yyvsp[(4) - (5)]).parse ); } +/* Line 1813 of yacc.c */ +#line 216 "jamgram.y" + { (yyval).parse = pmodule( (yyvsp[(2) - (5)]).parse, (yyvsp[(4) - (5)]).parse ); } break; case 28: - -/* Line 1464 of yacc.c */ -#line 213 "jamgram.y" - { (yyval).parse = pif( (yyvsp[(2) - (7)]).parse, (yyvsp[(4) - (7)]).parse, (yyvsp[(7) - (7)]).parse ); } +/* Line 1813 of yacc.c */ +#line 218 "jamgram.y" + { (yyval).parse = pclass( (yyvsp[(2) - (5)]).parse, (yyvsp[(4) - (5)]).parse ); } break; case 29: - -/* Line 1464 of yacc.c */ -#line 215 "jamgram.y" - { (yyval).parse = psetc( (yyvsp[(3) - (5)]).string, (yyvsp[(5) - (5)]).parse, (yyvsp[(4) - (5)]).parse, (yyvsp[(1) - (5)]).number ); } +/* Line 1813 of yacc.c */ +#line 220 "jamgram.y" + { (yyval).parse = pwhile( (yyvsp[(2) - (5)]).parse, (yyvsp[(4) - (5)]).parse ); } break; case 30: - -/* Line 1464 of yacc.c */ -#line 217 "jamgram.y" - { (yyval).parse = pon( (yyvsp[(2) - (3)]).parse, (yyvsp[(3) - (3)]).parse ); } +/* Line 1813 of yacc.c */ +#line 222 "jamgram.y" + { (yyval).parse = pif( (yyvsp[(2) - (7)]).parse, (yyvsp[(4) - (7)]).parse, (yyvsp[(7) - (7)]).parse ); } break; case 31: - -/* Line 1464 of yacc.c */ -#line 219 "jamgram.y" - { yymode( SCAN_STRING ); } +/* Line 1813 of yacc.c */ +#line 224 "jamgram.y" + { (yyval).parse = psetc( (yyvsp[(3) - (5)]).string, (yyvsp[(5) - (5)]).parse, (yyvsp[(4) - (5)]).parse, (yyvsp[(1) - (5)]).number ); } break; case 32: - -/* Line 1464 of yacc.c */ -#line 221 "jamgram.y" - { yymode( SCAN_NORMAL ); } +/* Line 1813 of yacc.c */ +#line 226 "jamgram.y" + { (yyval).parse = pon( (yyvsp[(2) - (3)]).parse, (yyvsp[(3) - (3)]).parse ); } break; case 33: - -/* Line 1464 of yacc.c */ -#line 223 "jamgram.y" - { (yyval).parse = psete( (yyvsp[(3) - (9)]).string,(yyvsp[(4) - (9)]).parse,(yyvsp[(7) - (9)]).string,(yyvsp[(2) - (9)]).number ); } +/* Line 1813 of yacc.c */ +#line 228 "jamgram.y" + { yymode( SCAN_STRING ); } break; case 34: - -/* Line 1464 of yacc.c */ -#line 231 "jamgram.y" - { (yyval).number = ASSIGN_SET; } +/* Line 1813 of yacc.c */ +#line 230 "jamgram.y" + { yymode( SCAN_NORMAL ); } break; case 35: - -/* Line 1464 of yacc.c */ -#line 233 "jamgram.y" - { (yyval).number = ASSIGN_APPEND; } +/* Line 1813 of yacc.c */ +#line 232 "jamgram.y" + { (yyval).parse = psete( (yyvsp[(3) - (9)]).string,(yyvsp[(4) - (9)]).parse,(yyvsp[(7) - (9)]).string,(yyvsp[(2) - (9)]).number ); } break; case 36: - -/* Line 1464 of yacc.c */ -#line 235 "jamgram.y" - { (yyval).number = ASSIGN_DEFAULT; } +/* Line 1813 of yacc.c */ +#line 240 "jamgram.y" + { (yyval).number = ASSIGN_SET; } break; case 37: - -/* Line 1464 of yacc.c */ -#line 237 "jamgram.y" - { (yyval).number = ASSIGN_DEFAULT; } +/* Line 1813 of yacc.c */ +#line 242 "jamgram.y" + { (yyval).number = ASSIGN_APPEND; } break; case 38: - -/* Line 1464 of yacc.c */ +/* Line 1813 of yacc.c */ #line 244 "jamgram.y" - { (yyval).parse = peval( EXPR_EXISTS, (yyvsp[(1) - (1)]).parse, pnull() ); } + { (yyval).number = ASSIGN_DEFAULT; } break; case 39: - -/* Line 1464 of yacc.c */ +/* Line 1813 of yacc.c */ #line 246 "jamgram.y" - { (yyval).parse = peval( EXPR_EQUALS, (yyvsp[(1) - (3)]).parse, (yyvsp[(3) - (3)]).parse ); } + { (yyval).number = ASSIGN_DEFAULT; } break; case 40: - -/* Line 1464 of yacc.c */ -#line 248 "jamgram.y" - { (yyval).parse = peval( EXPR_NOTEQ, (yyvsp[(1) - (3)]).parse, (yyvsp[(3) - (3)]).parse ); } +/* Line 1813 of yacc.c */ +#line 253 "jamgram.y" + { (yyval).parse = peval( EXPR_EXISTS, (yyvsp[(1) - (1)]).parse, pnull() ); } break; case 41: - -/* Line 1464 of yacc.c */ -#line 250 "jamgram.y" - { (yyval).parse = peval( EXPR_LESS, (yyvsp[(1) - (3)]).parse, (yyvsp[(3) - (3)]).parse ); } +/* Line 1813 of yacc.c */ +#line 255 "jamgram.y" + { (yyval).parse = peval( EXPR_EQUALS, (yyvsp[(1) - (3)]).parse, (yyvsp[(3) - (3)]).parse ); } break; case 42: - -/* Line 1464 of yacc.c */ -#line 252 "jamgram.y" - { (yyval).parse = peval( EXPR_LESSEQ, (yyvsp[(1) - (3)]).parse, (yyvsp[(3) - (3)]).parse ); } +/* Line 1813 of yacc.c */ +#line 257 "jamgram.y" + { (yyval).parse = peval( EXPR_NOTEQ, (yyvsp[(1) - (3)]).parse, (yyvsp[(3) - (3)]).parse ); } break; case 43: - -/* Line 1464 of yacc.c */ -#line 254 "jamgram.y" - { (yyval).parse = peval( EXPR_MORE, (yyvsp[(1) - (3)]).parse, (yyvsp[(3) - (3)]).parse ); } +/* Line 1813 of yacc.c */ +#line 259 "jamgram.y" + { (yyval).parse = peval( EXPR_LESS, (yyvsp[(1) - (3)]).parse, (yyvsp[(3) - (3)]).parse ); } break; case 44: - -/* Line 1464 of yacc.c */ -#line 256 "jamgram.y" - { (yyval).parse = peval( EXPR_MOREEQ, (yyvsp[(1) - (3)]).parse, (yyvsp[(3) - (3)]).parse ); } +/* Line 1813 of yacc.c */ +#line 261 "jamgram.y" + { (yyval).parse = peval( EXPR_LESSEQ, (yyvsp[(1) - (3)]).parse, (yyvsp[(3) - (3)]).parse ); } break; case 45: - -/* Line 1464 of yacc.c */ -#line 258 "jamgram.y" - { (yyval).parse = peval( EXPR_AND, (yyvsp[(1) - (3)]).parse, (yyvsp[(3) - (3)]).parse ); } +/* Line 1813 of yacc.c */ +#line 263 "jamgram.y" + { (yyval).parse = peval( EXPR_MORE, (yyvsp[(1) - (3)]).parse, (yyvsp[(3) - (3)]).parse ); } break; case 46: - -/* Line 1464 of yacc.c */ -#line 260 "jamgram.y" - { (yyval).parse = peval( EXPR_AND, (yyvsp[(1) - (3)]).parse, (yyvsp[(3) - (3)]).parse ); } +/* Line 1813 of yacc.c */ +#line 265 "jamgram.y" + { (yyval).parse = peval( EXPR_MOREEQ, (yyvsp[(1) - (3)]).parse, (yyvsp[(3) - (3)]).parse ); } break; case 47: - -/* Line 1464 of yacc.c */ -#line 262 "jamgram.y" - { (yyval).parse = peval( EXPR_OR, (yyvsp[(1) - (3)]).parse, (yyvsp[(3) - (3)]).parse ); } +/* Line 1813 of yacc.c */ +#line 267 "jamgram.y" + { (yyval).parse = peval( EXPR_AND, (yyvsp[(1) - (3)]).parse, (yyvsp[(3) - (3)]).parse ); } break; case 48: - -/* Line 1464 of yacc.c */ -#line 264 "jamgram.y" - { (yyval).parse = peval( EXPR_OR, (yyvsp[(1) - (3)]).parse, (yyvsp[(3) - (3)]).parse ); } +/* Line 1813 of yacc.c */ +#line 269 "jamgram.y" + { (yyval).parse = peval( EXPR_AND, (yyvsp[(1) - (3)]).parse, (yyvsp[(3) - (3)]).parse ); } break; case 49: - -/* Line 1464 of yacc.c */ -#line 266 "jamgram.y" - { (yyval).parse = peval( EXPR_IN, (yyvsp[(1) - (3)]).parse, (yyvsp[(3) - (3)]).parse ); } +/* Line 1813 of yacc.c */ +#line 271 "jamgram.y" + { (yyval).parse = peval( EXPR_OR, (yyvsp[(1) - (3)]).parse, (yyvsp[(3) - (3)]).parse ); } break; case 50: - -/* Line 1464 of yacc.c */ -#line 268 "jamgram.y" - { (yyval).parse = peval( EXPR_NOT, (yyvsp[(2) - (2)]).parse, pnull() ); } +/* Line 1813 of yacc.c */ +#line 273 "jamgram.y" + { (yyval).parse = peval( EXPR_OR, (yyvsp[(1) - (3)]).parse, (yyvsp[(3) - (3)]).parse ); } break; case 51: - -/* Line 1464 of yacc.c */ -#line 270 "jamgram.y" - { (yyval).parse = (yyvsp[(2) - (3)]).parse; } +/* Line 1813 of yacc.c */ +#line 275 "jamgram.y" + { (yyval).parse = peval( EXPR_IN, (yyvsp[(1) - (3)]).parse, (yyvsp[(3) - (3)]).parse ); } break; case 52: - -/* Line 1464 of yacc.c */ -#line 281 "jamgram.y" - { (yyval).parse = P0; } +/* Line 1813 of yacc.c */ +#line 277 "jamgram.y" + { (yyval).parse = peval( EXPR_NOT, (yyvsp[(2) - (2)]).parse, pnull() ); } break; case 53: - -/* Line 1464 of yacc.c */ -#line 283 "jamgram.y" - { (yyval).parse = pnode( (yyvsp[(1) - (2)]).parse, (yyvsp[(2) - (2)]).parse ); } +/* Line 1813 of yacc.c */ +#line 279 "jamgram.y" + { (yyval).parse = (yyvsp[(2) - (3)]).parse; } break; case 54: - -/* Line 1464 of yacc.c */ -#line 287 "jamgram.y" - { (yyval).parse = psnode( (yyvsp[(2) - (4)]).string, (yyvsp[(4) - (4)]).parse ); } +/* Line 1813 of yacc.c */ +#line 290 "jamgram.y" + { (yyval).parse = P0; } break; case 55: - -/* Line 1464 of yacc.c */ -#line 296 "jamgram.y" - { (yyval).parse = pnode( P0, (yyvsp[(1) - (1)]).parse ); } +/* Line 1813 of yacc.c */ +#line 292 "jamgram.y" + { (yyval).parse = pnode( (yyvsp[(1) - (2)]).parse, (yyvsp[(2) - (2)]).parse ); } break; case 56: - -/* Line 1464 of yacc.c */ -#line 298 "jamgram.y" - { (yyval).parse = pnode( (yyvsp[(3) - (3)]).parse, (yyvsp[(1) - (3)]).parse ); } +/* Line 1813 of yacc.c */ +#line 296 "jamgram.y" + { (yyval).parse = psnode( (yyvsp[(2) - (4)]).string, (yyvsp[(4) - (4)]).parse ); } break; case 57: - -/* Line 1464 of yacc.c */ -#line 308 "jamgram.y" - { (yyval).parse = (yyvsp[(1) - (1)]).parse; yymode( SCAN_NORMAL ); } +/* Line 1813 of yacc.c */ +#line 305 "jamgram.y" + { (yyval).parse = pnode( P0, (yyvsp[(1) - (1)]).parse ); } break; case 58: - -/* Line 1464 of yacc.c */ -#line 312 "jamgram.y" - { (yyval).parse = pnull(); yymode( SCAN_PUNCT ); } +/* Line 1813 of yacc.c */ +#line 307 "jamgram.y" + { (yyval).parse = pnode( (yyvsp[(3) - (3)]).parse, (yyvsp[(1) - (3)]).parse ); } break; case 59: - -/* Line 1464 of yacc.c */ -#line 314 "jamgram.y" - { (yyval).parse = pappend( (yyvsp[(1) - (2)]).parse, (yyvsp[(2) - (2)]).parse ); } +/* Line 1813 of yacc.c */ +#line 317 "jamgram.y" + { (yyval).parse = (yyvsp[(1) - (1)]).parse; yymode( SCAN_NORMAL ); } break; case 60: - -/* Line 1464 of yacc.c */ -#line 318 "jamgram.y" - { (yyval).parse = plist( (yyvsp[(1) - (1)]).string ); } +/* Line 1813 of yacc.c */ +#line 321 "jamgram.y" + { (yyval).parse = pnull(); yymode( SCAN_PUNCT ); } break; case 61: - -/* Line 1464 of yacc.c */ -#line 319 "jamgram.y" - { yymode( SCAN_NORMAL ); } +/* Line 1813 of yacc.c */ +#line 323 "jamgram.y" + { (yyval).parse = pappend( (yyvsp[(1) - (2)]).parse, (yyvsp[(2) - (2)]).parse ); } break; case 62: - -/* Line 1464 of yacc.c */ -#line 320 "jamgram.y" - { (yyval).parse = (yyvsp[(3) - (4)]).parse; } +/* Line 1813 of yacc.c */ +#line 327 "jamgram.y" + { (yyval).parse = plist( (yyvsp[(1) - (1)]).string ); } break; case 63: - -/* Line 1464 of yacc.c */ -#line 329 "jamgram.y" - { (yyval).parse = prule( (yyvsp[(1) - (2)]).string, (yyvsp[(2) - (2)]).parse ); } +/* Line 1813 of yacc.c */ +#line 328 "jamgram.y" + { yymode( SCAN_NORMAL ); } break; case 64: - -/* Line 1464 of yacc.c */ -#line 331 "jamgram.y" - { (yyval).parse = pon( (yyvsp[(2) - (4)]).parse, prule( (yyvsp[(3) - (4)]).string, (yyvsp[(4) - (4)]).parse ) ); } +/* Line 1813 of yacc.c */ +#line 329 "jamgram.y" + { (yyval).parse = (yyvsp[(3) - (4)]).parse; } break; case 65: - -/* Line 1464 of yacc.c */ -#line 333 "jamgram.y" - { (yyval).parse = pon( (yyvsp[(2) - (4)]).parse, (yyvsp[(4) - (4)]).parse ); } +/* Line 1813 of yacc.c */ +#line 338 "jamgram.y" + { (yyval).parse = prule( (yyvsp[(1) - (2)]).string, (yyvsp[(2) - (2)]).parse ); } break; case 66: - -/* Line 1464 of yacc.c */ -#line 343 "jamgram.y" - { (yyval).number = 0; } +/* Line 1813 of yacc.c */ +#line 340 "jamgram.y" + { (yyval).parse = pon( (yyvsp[(2) - (4)]).parse, prule( (yyvsp[(3) - (4)]).string, (yyvsp[(4) - (4)]).parse ) ); } break; case 67: - -/* Line 1464 of yacc.c */ -#line 345 "jamgram.y" - { (yyval).number = (yyvsp[(1) - (2)]).number | (yyvsp[(2) - (2)]).number; } +/* Line 1813 of yacc.c */ +#line 342 "jamgram.y" + { (yyval).parse = pon( (yyvsp[(2) - (4)]).parse, (yyvsp[(4) - (4)]).parse ); } break; case 68: - -/* Line 1464 of yacc.c */ -#line 349 "jamgram.y" - { (yyval).number = EXEC_UPDATED; } +/* Line 1813 of yacc.c */ +#line 352 "jamgram.y" + { (yyval).number = 0; } break; case 69: - -/* Line 1464 of yacc.c */ -#line 351 "jamgram.y" - { (yyval).number = EXEC_TOGETHER; } +/* Line 1813 of yacc.c */ +#line 354 "jamgram.y" + { (yyval).number = (yyvsp[(1) - (2)]).number | (yyvsp[(2) - (2)]).number; } break; case 70: - -/* Line 1464 of yacc.c */ -#line 353 "jamgram.y" - { (yyval).number = EXEC_IGNORE; } +/* Line 1813 of yacc.c */ +#line 358 "jamgram.y" + { (yyval).number = EXEC_UPDATED; } break; case 71: - -/* Line 1464 of yacc.c */ -#line 355 "jamgram.y" - { (yyval).number = EXEC_QUIETLY; } +/* Line 1813 of yacc.c */ +#line 360 "jamgram.y" + { (yyval).number = EXEC_TOGETHER; } break; case 72: - -/* Line 1464 of yacc.c */ -#line 357 "jamgram.y" - { (yyval).number = EXEC_PIECEMEAL; } +/* Line 1813 of yacc.c */ +#line 362 "jamgram.y" + { (yyval).number = EXEC_IGNORE; } break; case 73: - -/* Line 1464 of yacc.c */ -#line 359 "jamgram.y" - { (yyval).number = EXEC_EXISTING; } +/* Line 1813 of yacc.c */ +#line 364 "jamgram.y" + { (yyval).number = EXEC_QUIETLY; } break; case 74: +/* Line 1813 of yacc.c */ +#line 366 "jamgram.y" + { (yyval).number = EXEC_PIECEMEAL; } + break; -/* Line 1464 of yacc.c */ + case 75: +/* Line 1813 of yacc.c */ #line 368 "jamgram.y" - { (yyval).parse = pnull(); } + { (yyval).number = EXEC_EXISTING; } break; - case 75: + case 76: +/* Line 1813 of yacc.c */ +#line 377 "jamgram.y" + { (yyval).parse = pnull(); } + break; -/* Line 1464 of yacc.c */ -#line 370 "jamgram.y" + case 77: +/* Line 1813 of yacc.c */ +#line 379 "jamgram.y" { (yyval).parse = (yyvsp[(2) - (2)]).parse; } break; - -/* Line 1464 of yacc.c */ -#line 2118 "y.tab.c" +/* Line 1813 of yacc.c */ +#line 2111 "y.tab.c" default: break; } + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action invokes + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or + if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an + incorrect destructor might then be invoked immediately. In the + case of YYERROR or YYBACKUP, subsequent parser actions might lead + to an incorrect destructor call or verbose syntax error message + before the lookahead is translated. */ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); @@ -2144,6 +2148,10 @@ yyreduce: | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { @@ -2151,37 +2159,36 @@ yyerrlab: #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ + yyssp, yytoken) { - YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); - if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) - { - YYSIZE_T yyalloc = 2 * yysize; - if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) - yyalloc = YYSTACK_ALLOC_MAXIMUM; - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yyalloc); - if (yymsg) - yymsg_alloc = yyalloc; - else - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - } - } - - if (0 < yysize && yysize <= yymsg_alloc) - { - (void) yysyntax_error (yymsg, yystate, yychar); - yyerror (yymsg); - } - else - { - yyerror (YY_("syntax error")); - if (yysize != 0) - goto yyexhaustedlab; - } + char const *yymsgp = YY_("syntax error"); + int yysyntax_error_status; + yysyntax_error_status = YYSYNTAX_ERROR; + if (yysyntax_error_status == 0) + yymsgp = yymsg; + else if (yysyntax_error_status == 1) + { + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + if (!yymsg) + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = 2; + } + else + { + yysyntax_error_status = YYSYNTAX_ERROR; + yymsgp = yymsg; + } + } + yyerror (yymsgp); + if (yysyntax_error_status == 2) + goto yyexhaustedlab; } +# undef YYSYNTAX_ERROR #endif } @@ -2240,7 +2247,7 @@ yyerrlab1: for (;;) { yyn = yypact[yystate]; - if (yyn != YYPACT_NINF) + if (!yypact_value_is_default (yyn)) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) @@ -2263,7 +2270,9 @@ yyerrlab1: YY_STACK_PRINT (yyss, yyssp); } + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END /* Shift the error token. */ @@ -2287,7 +2296,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#if !defined(yyoverflow) || YYERROR_VERBOSE +#if !defined yyoverflow || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -2299,8 +2308,13 @@ yyexhaustedlab: yyreturn: if (yychar != YYEMPTY) - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval); + { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + } /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); @@ -2324,4 +2338,3 @@ yyreturn: } - diff --git a/tools/build/src/engine/jamgram.h b/tools/build/src/engine/jamgram.h index 97f117535d..23111972c4 100644 --- a/tools/build/src/engine/jamgram.h +++ b/tools/build/src/engine/jamgram.h @@ -1,9 +1,8 @@ -/* A Bison parser, made by GNU Bison 2.4.3. */ +/* A Bison parser, made by GNU Bison 2.6.4. */ -/* Skeleton interface for Bison's Yacc-like parsers in C +/* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -31,6 +30,15 @@ This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ +#ifndef YY_YY_Y_TAB_H_INCLUDED +# define YY_YY_Y_TAB_H_INCLUDED +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 1 +#endif +#if YYDEBUG +extern int yydebug; +#endif /* Tokens. */ #ifndef YYTOKENTYPE @@ -57,33 +65,35 @@ _RBRACKET_t = 274, ACTIONS_t = 275, BIND_t = 276, - CASE_t = 277, - CLASS_t = 278, - DEFAULT_t = 279, - ELSE_t = 280, - EXISTING_t = 281, - FOR_t = 282, - IF_t = 283, - IGNORE_t = 284, - IN_t = 285, - INCLUDE_t = 286, - LOCAL_t = 287, - MODULE_t = 288, - ON_t = 289, - PIECEMEAL_t = 290, - QUIETLY_t = 291, - RETURN_t = 292, - RULE_t = 293, - SWITCH_t = 294, - TOGETHER_t = 295, - UPDATED_t = 296, - WHILE_t = 297, - _LBRACE_t = 298, - _BAR_t = 299, - _BARBAR_t = 300, - _RBRACE_t = 301, - ARG = 302, - STRING = 303 + BREAK_t = 277, + CASE_t = 278, + CLASS_t = 279, + CONTINUE_t = 280, + DEFAULT_t = 281, + ELSE_t = 282, + EXISTING_t = 283, + FOR_t = 284, + IF_t = 285, + IGNORE_t = 286, + IN_t = 287, + INCLUDE_t = 288, + LOCAL_t = 289, + MODULE_t = 290, + ON_t = 291, + PIECEMEAL_t = 292, + QUIETLY_t = 293, + RETURN_t = 294, + RULE_t = 295, + SWITCH_t = 296, + TOGETHER_t = 297, + UPDATED_t = 298, + WHILE_t = 299, + _LBRACE_t = 300, + _BAR_t = 301, + _BARBAR_t = 302, + _RBRACE_t = 303, + ARG = 304, + STRING = 305 }; #endif /* Tokens. */ @@ -106,34 +116,35 @@ #define _RBRACKET_t 274 #define ACTIONS_t 275 #define BIND_t 276 -#define CASE_t 277 -#define CLASS_t 278 -#define DEFAULT_t 279 -#define ELSE_t 280 -#define EXISTING_t 281 -#define FOR_t 282 -#define IF_t 283 -#define IGNORE_t 284 -#define IN_t 285 -#define INCLUDE_t 286 -#define LOCAL_t 287 -#define MODULE_t 288 -#define ON_t 289 -#define PIECEMEAL_t 290 -#define QUIETLY_t 291 -#define RETURN_t 292 -#define RULE_t 293 -#define SWITCH_t 294 -#define TOGETHER_t 295 -#define UPDATED_t 296 -#define WHILE_t 297 -#define _LBRACE_t 298 -#define _BAR_t 299 -#define _BARBAR_t 300 -#define _RBRACE_t 301 -#define ARG 302 -#define STRING 303 - +#define BREAK_t 277 +#define CASE_t 278 +#define CLASS_t 279 +#define CONTINUE_t 280 +#define DEFAULT_t 281 +#define ELSE_t 282 +#define EXISTING_t 283 +#define FOR_t 284 +#define IF_t 285 +#define IGNORE_t 286 +#define IN_t 287 +#define INCLUDE_t 288 +#define LOCAL_t 289 +#define MODULE_t 290 +#define ON_t 291 +#define PIECEMEAL_t 292 +#define QUIETLY_t 293 +#define RETURN_t 294 +#define RULE_t 295 +#define SWITCH_t 296 +#define TOGETHER_t 297 +#define UPDATED_t 298 +#define WHILE_t 299 +#define _LBRACE_t 300 +#define _BAR_t 301 +#define _BARBAR_t 302 +#define _RBRACE_t 303 +#define ARG 304 +#define STRING 305 @@ -146,4 +157,18 @@ typedef int YYSTYPE; extern YYSTYPE yylval; +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +int yyparse (void *YYPARSE_PARAM); +#else +int yyparse (); +#endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +int yyparse (void); +#else +int yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ +#endif /* !YY_YY_Y_TAB_H_INCLUDED */ diff --git a/tools/build/src/engine/jamgram.y b/tools/build/src/engine/jamgram.y index 543f1561a4..2e980b8f74 100644 --- a/tools/build/src/engine/jamgram.y +++ b/tools/build/src/engine/jamgram.y @@ -17,8 +17,10 @@ %token _RBRACKET_t %token ACTIONS_t %token BIND_t +%token BREAK_t %token CASE_t %token CLASS_t +%token CONTINUE_t %token DEFAULT_t %token ELSE_t %token EXISTING_t @@ -128,6 +130,9 @@ # define psete( s,l,s1,f ) parse_make( PARSE_SETEXEC,l,P0,P0,s,s1,f ) # define pswitch( l,r ) parse_make( PARSE_SWITCH,l,r,P0,S0,S0,0 ) # define pwhile( l,r ) parse_make( PARSE_WHILE,l,r,P0,S0,S0,0 ) +# define preturn( l ) parse_make( PARSE_RETURN,l,P0,P0,S0,S0,0 ) +# define pbreak() parse_make( PARSE_BREAK,P0,P0,P0,S0,S0,0 ) +# define pcontinue() parse_make( PARSE_CONTINUE,P0,P0,P0,S0,S0,0 ) # define pnode( l,r ) parse_make( F0,l,r,P0,S0,S0,0 ) # define psnode( s,l ) parse_make( F0,l,P0,P0,s,S0,0 ) @@ -196,7 +201,11 @@ rule : _LBRACE_t block _RBRACE_t | arg ON_t list assign list _SEMIC_t { $$.parse = pset1( $1.parse, $3.parse, $5.parse, $4.number ); } | RETURN_t list _SEMIC_t - { $$.parse = $2.parse; } + { $$.parse = preturn( $2.parse ); } + | BREAK_t _SEMIC_t + { $$.parse = pbreak(); } + | CONTINUE_t _SEMIC_t + { $$.parse = pcontinue(); } | FOR_t local_opt ARG IN_t list _LBRACE_t block _RBRACE_t { $$.parse = pfor( $3.string, $5.parse, $7.parse, $2.number ); } | SWITCH_t list _LBRACE_t cases _RBRACE_t diff --git a/tools/build/src/engine/jamgram.yy b/tools/build/src/engine/jamgram.yy index 8d20e3896e..a11556b522 100644 --- a/tools/build/src/engine/jamgram.yy +++ b/tools/build/src/engine/jamgram.yy @@ -84,6 +84,9 @@ # define psete( s,l,s1,f ) parse_make( PARSE_SETEXEC,l,P0,P0,s,s1,f ) # define pswitch( l,r ) parse_make( PARSE_SWITCH,l,r,P0,S0,S0,0 ) # define pwhile( l,r ) parse_make( PARSE_WHILE,l,r,P0,S0,S0,0 ) +# define preturn( l ) parse_make( PARSE_RETURN,l,P0,P0,S0,S0,0 ) +# define pbreak() parse_make( PARSE_BREAK,P0,P0,P0,S0,S0,0 ) +# define pcontinue() parse_make( PARSE_CONTINUE,P0,P0,P0,S0,S0,0 ) # define pnode( l,r ) parse_make( F0,l,r,P0,S0,S0,0 ) # define psnode( s,l ) parse_make( F0,l,P0,P0,s,S0,0 ) @@ -152,7 +155,11 @@ rule : `{` block `}` | arg `on` list assign list `;` { $$.parse = pset1( $1.parse, $3.parse, $5.parse, $4.number ); } | `return` list `;` - { $$.parse = $2.parse; } + { $$.parse = preturn( $2.parse ); } + | `break` `;` + { $$.parse = pbreak(); } + | `continue` `;` + { $$.parse = pcontinue(); } | `for` local_opt ARG `in` list `{` block `}` { $$.parse = pfor( $3.string, $5.parse, $7.parse, $2.number ); } | `switch` list `{` cases `}` diff --git a/tools/build/src/engine/jamgramtab.h b/tools/build/src/engine/jamgramtab.h index a0fd43f6aa..38a810871a 100644 --- a/tools/build/src/engine/jamgramtab.h +++ b/tools/build/src/engine/jamgramtab.h @@ -17,8 +17,10 @@ { "]", _RBRACKET_t }, { "actions", ACTIONS_t }, { "bind", BIND_t }, + { "break", BREAK_t }, { "case", CASE_t }, { "class", CLASS_t }, + { "continue", CONTINUE_t }, { "default", DEFAULT_t }, { "else", ELSE_t }, { "existing", EXISTING_t }, diff --git a/tools/build/src/engine/lists.c b/tools/build/src/engine/lists.c index 3f2309b05e..065145e009 100644 --- a/tools/build/src/engine/lists.c +++ b/tools/build/src/engine/lists.c @@ -10,6 +10,7 @@ #include "jam.h" #include "lists.h" +#include "output.h" #include <assert.h> @@ -114,7 +115,7 @@ LIST * list_push_back( LIST * head, OBJECT * value ) unsigned int i; if ( DEBUG_LISTS ) - printf( "list > %s <\n", object_str( value ) ); + out_printf( "list > %s <\n", object_str( value ) ); /* If the size is a power of 2, reallocate. */ if ( size == 0 ) @@ -318,10 +319,10 @@ void list_print( LIST * l ) LISTITER iter = list_begin( l ), end = list_end( l ); if ( iter != end ) { - printf( "%s", object_str( list_item( iter ) ) ); + out_printf( "%s", object_str( list_item( iter ) ) ); iter = list_next( iter ); for ( ; iter != end; iter = list_next( iter ) ) - printf( " %s", object_str( list_item( iter ) ) ); + out_printf( " %s", object_str( list_item( iter ) ) ); } } @@ -434,7 +435,7 @@ void lol_print( LOL * lol ) for ( i = 0; i < lol->count; ++i ) { if ( i ) - printf( " : " ); + out_printf( " : " ); list_print( lol->list[ i ] ); } } diff --git a/tools/build/src/engine/make.c b/tools/build/src/engine/make.c index c83f525c83..56a6745037 100644 --- a/tools/build/src/engine/make.c +++ b/tools/build/src/engine/make.c @@ -129,19 +129,19 @@ int make( LIST * targets, int anyhow ) if ( DEBUG_MAKE ) { if ( counts->targets ) - printf( "...found %d target%s...\n", counts->targets, + out_printf( "...found %d target%s...\n", counts->targets, counts->targets > 1 ? "s" : "" ); if ( counts->temp ) - printf( "...using %d temp target%s...\n", counts->temp, + out_printf( "...using %d temp target%s...\n", counts->temp, counts->temp > 1 ? "s" : "" ); if ( counts->updating ) - printf( "...updating %d target%s...\n", counts->updating, + out_printf( "...updating %d target%s...\n", counts->updating, counts->updating > 1 ? "s" : "" ); if ( counts->cantfind ) - printf( "...can't find %d target%s...\n", counts->cantfind, + out_printf( "...can't find %d target%s...\n", counts->cantfind, counts->cantfind > 1 ? "s" : "" ); if ( counts->cantmake ) - printf( "...can't make %d target%s...\n", counts->cantmake, + out_printf( "...can't make %d target%s...\n", counts->cantmake, counts->cantmake > 1 ? "s" : "" ); } @@ -181,7 +181,7 @@ static void update_dependants( TARGET * t ) if ( DEBUG_FATE ) { - printf( "fate change %s from %s to %s (as dependant of %s)\n", + out_printf( "fate change %s from %s to %s (as dependant of %s)\n", object_str( p->name ), target_fate[ (int) fate0 ], target_fate[ (int) p->fate ], object_str( t->name ) ); } @@ -212,7 +212,7 @@ static void force_rebuilds( TARGET * t ) if ( r->fate < T_FATE_BUILD ) { if ( DEBUG_FATE ) - printf( "fate change %s from %s to %s (by rebuild)\n", + out_printf( "fate change %s from %s to %s (by rebuild)\n", object_str( r->name ), target_fate[ (int) r->fate ], target_fate[ T_FATE_REBUILD ] ); /* Force rebuild it. */ @@ -297,14 +297,14 @@ void make0 #endif if ( DEBUG_MAKEPROG ) - printf( "make\t--\t%s%s\n", spaces( depth ), object_str( t->name ) ); + out_printf( "make\t--\t%s%s\n", spaces( depth ), object_str( t->name ) ); /* * Step 1: Initialize. */ if ( DEBUG_MAKEPROG ) - printf( "make\t--\t%s%s\n", spaces( depth ), object_str( t->name ) ); + out_printf( "make\t--\t%s%s\n", spaces( depth ), object_str( t->name ) ); t->fate = T_FATE_MAKING; t->depth = depth; @@ -377,7 +377,7 @@ void make0 if ( DEBUG_BIND ) { if ( !object_equal( t->name, t->boundname ) ) - printf( "bind\t--\t%s%s: %s\n", spaces( depth ), + out_printf( "bind\t--\t%s%s: %s\n", spaces( depth ), object_str( t->name ), object_str( t->boundname ) ); switch ( t->binding ) @@ -385,12 +385,12 @@ void make0 case T_BIND_UNBOUND: case T_BIND_MISSING: case T_BIND_PARENTS: - printf( "time\t--\t%s%s: %s\n", spaces( depth ), + out_printf( "time\t--\t%s%s: %s\n", spaces( depth ), object_str( t->name ), target_bind[ (int)t->binding ] ); break; case T_BIND_EXISTS: - printf( "time\t--\t%s%s: %s\n", spaces( depth ), + out_printf( "time\t--\t%s%s: %s\n", spaces( depth ), object_str( t->name ), timestamp_str( &t->time ) ); break; } @@ -411,7 +411,7 @@ void make0 if ( c->target->fate == T_FATE_INIT ) make0( c->target, ptime, depth + 1, counts, anyhow, rescanning ); else if ( c->target->fate == T_FATE_MAKING && !internal ) - printf( "warning: %s depends on itself\n", object_str( + out_printf( "warning: %s depends on itself\n", object_str( c->target->name ) ); else if ( c->target->fate != T_FATE_MAKING && rescanning ) make0rescan( c->target, rescanning ); @@ -505,7 +505,7 @@ void make0 #ifdef OPT_GRAPH_DEBUG_EXT if ( DEBUG_FATE ) if ( fate < c->target->fate ) - printf( "fate change %s from %s to %s by dependency %s\n", + out_printf( "fate change %s from %s to %s by dependency %s\n", object_str( t->name ), target_fate[ (int)fate ], target_fate[ (int)c->target->fate ], object_str( c->target->name ) ); @@ -534,7 +534,7 @@ void make0 #ifdef OPT_GRAPH_DEBUG_EXT if ( DEBUG_FATE ) if ( fate != T_FATE_STABLE ) - printf( "fate change %s back to stable, NOUPDATE.\n", + out_printf( "fate change %s back to stable, NOUPDATE.\n", object_str( t->name ) ); #endif @@ -632,10 +632,10 @@ void make0 if ( DEBUG_FATE && ( fate != savedFate ) ) { if ( savedFate == T_FATE_STABLE ) - printf( "fate change %s set to %s%s\n", object_str( t->name ), + out_printf( "fate change %s set to %s%s\n", object_str( t->name ), target_fate[ fate ], oldTimeStamp ? " (by timestamp)" : "" ); else - printf( "fate change %s from %s to %s%s\n", object_str( t->name ), + out_printf( "fate change %s from %s to %s%s\n", object_str( t->name ), target_fate[ savedFate ], target_fate[ fate ], oldTimeStamp ? " (by timestamp)" : "" ); } @@ -653,7 +653,7 @@ void make0 { #ifdef OPT_GRAPH_DEBUG_EXT if ( DEBUG_FATE ) - printf( "fate change %s to STABLE from %s, " + out_printf( "fate change %s to STABLE from %s, " "no actions, no dependencies and do not care\n", object_str( t->name ), target_fate[ fate ] ); #endif @@ -661,7 +661,7 @@ void make0 } else { - printf( "don't know how to make %s\n", object_str( t->name ) ); + out_printf( "don't know how to make %s\n", object_str( t->name ) ); fate = T_FATE_CANTFIND; } } @@ -731,8 +731,8 @@ void make0 #else if ( !( ++counts->targets % 1000 ) && DEBUG_MAKE ) { - printf( "...patience...\n" ); - fflush(stdout); + out_printf( "...patience...\n" ); + out_flush(); } #endif @@ -754,7 +754,7 @@ void make0 flag = "*"; if ( DEBUG_MAKEPROG ) - printf( "made%s\t%s\t%s%s\n", flag, target_fate[ (int)t->fate ], + out_printf( "made%s\t%s\t%s%s\n", flag, target_fate[ (int)t->fate ], spaces( depth ), object_str( t->name ) ); } @@ -792,76 +792,76 @@ static void dependGraphOutput( TARGET * t, int depth ) case T_FATE_MISSING: case T_FATE_OUTDATED: case T_FATE_UPDATE: - printf( "->%s%2d Name: %s\n", spaces( depth ), depth, target_name( t + out_printf( "->%s%2d Name: %s\n", spaces( depth ), depth, target_name( t ) ); break; default: - printf( " %s%2d Name: %s\n", spaces( depth ), depth, target_name( t + out_printf( " %s%2d Name: %s\n", spaces( depth ), depth, target_name( t ) ); break; } if ( !object_equal( t->name, t->boundname ) ) - printf( " %s Loc: %s\n", spaces( depth ), object_str( t->boundname ) + out_printf( " %s Loc: %s\n", spaces( depth ), object_str( t->boundname ) ); switch ( t->fate ) { case T_FATE_STABLE: - printf( " %s : Stable\n", spaces( depth ) ); + out_printf( " %s : Stable\n", spaces( depth ) ); break; case T_FATE_NEWER: - printf( " %s : Newer\n", spaces( depth ) ); + out_printf( " %s : Newer\n", spaces( depth ) ); break; case T_FATE_ISTMP: - printf( " %s : Up to date temp file\n", spaces( depth ) ); + out_printf( " %s : Up to date temp file\n", spaces( depth ) ); break; case T_FATE_NEEDTMP: - printf( " %s : Temporary file, to be updated\n", spaces( depth ) + out_printf( " %s : Temporary file, to be updated\n", spaces( depth ) ); break; case T_FATE_TOUCHED: - printf( " %s : Been touched, updating it\n", spaces( depth ) ); + out_printf( " %s : Been touched, updating it\n", spaces( depth ) ); break; case T_FATE_MISSING: - printf( " %s : Missing, creating it\n", spaces( depth ) ); + out_printf( " %s : Missing, creating it\n", spaces( depth ) ); break; case T_FATE_OUTDATED: - printf( " %s : Outdated, updating it\n", spaces( depth ) ); + out_printf( " %s : Outdated, updating it\n", spaces( depth ) ); break; case T_FATE_REBUILD: - printf( " %s : Rebuild, updating it\n", spaces( depth ) ); + out_printf( " %s : Rebuild, updating it\n", spaces( depth ) ); break; case T_FATE_UPDATE: - printf( " %s : Updating it\n", spaces( depth ) ); + out_printf( " %s : Updating it\n", spaces( depth ) ); break; case T_FATE_CANTFIND: - printf( " %s : Can not find it\n", spaces( depth ) ); + out_printf( " %s : Can not find it\n", spaces( depth ) ); break; case T_FATE_CANTMAKE: - printf( " %s : Can make it\n", spaces( depth ) ); + out_printf( " %s : Can make it\n", spaces( depth ) ); break; } if ( t->flags & ~T_FLAG_VISITED ) { - printf( " %s : ", spaces( depth ) ); - if ( t->flags & T_FLAG_TEMP ) printf( "TEMPORARY " ); - if ( t->flags & T_FLAG_NOCARE ) printf( "NOCARE " ); - if ( t->flags & T_FLAG_NOTFILE ) printf( "NOTFILE " ); - if ( t->flags & T_FLAG_TOUCHED ) printf( "TOUCHED " ); - if ( t->flags & T_FLAG_LEAVES ) printf( "LEAVES " ); - if ( t->flags & T_FLAG_NOUPDATE ) printf( "NOUPDATE " ); - printf( "\n" ); + out_printf( " %s : ", spaces( depth ) ); + if ( t->flags & T_FLAG_TEMP ) out_printf( "TEMPORARY " ); + if ( t->flags & T_FLAG_NOCARE ) out_printf( "NOCARE " ); + if ( t->flags & T_FLAG_NOTFILE ) out_printf( "NOTFILE " ); + if ( t->flags & T_FLAG_TOUCHED ) out_printf( "TOUCHED " ); + if ( t->flags & T_FLAG_LEAVES ) out_printf( "LEAVES " ); + if ( t->flags & T_FLAG_NOUPDATE ) out_printf( "NOUPDATE " ); + out_printf( "\n" ); } for ( c = t->depends; c; c = c->next ) { - printf( " %s : Depends on %s (%s)", spaces( depth ), + out_printf( " %s : Depends on %s (%s)", spaces( depth ), target_name( c->target ), target_fate[ (int)c->target->fate ] ); if ( !timestamp_cmp( &c->target->time, &t->time ) ) - printf( " (max time)"); - printf( "\n" ); + out_printf( " (max time)"); + out_printf( "\n" ); } for ( c = t->depends; c; c = c->next ) diff --git a/tools/build/src/engine/make1.c b/tools/build/src/engine/make1.c index 390b4ccbe2..1109c1a96f 100644 --- a/tools/build/src/engine/make1.c +++ b/tools/build/src/engine/make1.c @@ -49,6 +49,7 @@ #include "rules.h" #include "search.h" #include "variable.h" +#include "output.h" #include <assert.h> #include <stdlib.h> @@ -245,13 +246,13 @@ int make1( LIST * targets ) /* Talk about it. */ if ( counts->failed ) - printf( "...failed updating %d target%s...\n", counts->failed, + out_printf( "...failed updating %d target%s...\n", counts->failed, counts->failed > 1 ? "s" : "" ); if ( DEBUG_MAKE && counts->skipped ) - printf( "...skipped %d target%s...\n", counts->skipped, + out_printf( "...skipped %d target%s...\n", counts->skipped, counts->skipped > 1 ? "s" : "" ); if ( DEBUG_MAKE && counts->made ) - printf( "...updated %d target%s...\n", counts->made, + out_printf( "...updated %d target%s...\n", counts->made, counts->made > 1 ? "s" : "" ); /* If we were interrupted, exit now that all child processes @@ -425,11 +426,11 @@ static void make1b( state * const pState ) if ( ( t->flags & ( T_FLAG_RMOLD | T_FLAG_NOTFILE ) ) == T_FLAG_RMOLD ) { if ( !unlink( object_str( t->boundname ) ) ) - printf( "...removing outdated %s\n", object_str( t->boundname ) + out_printf( "...removing outdated %s\n", object_str( t->boundname ) ); } else - printf( "...skipped %s for lack of %s...\n", object_str( t->name ), + out_printf( "...skipped %s for lack of %s...\n", object_str( t->name ), failed_name ); } @@ -447,7 +448,7 @@ static void make1b( state * const pState ) case T_FATE_ISTMP: if ( DEBUG_MAKE ) - printf( "...using %s...\n", object_str( t->name ) ); + out_printf( "...using %s...\n", object_str( t->name ) ); break; case T_FATE_TOUCHED: @@ -464,7 +465,7 @@ static void make1b( state * const pState ) { ++counts->total; if ( DEBUG_MAKE && !( counts->total % 100 ) ) - printf( "...on %dth target...\n", counts->total ); + out_printf( "...on %dth target...\n", counts->total ); t->cmds = (char *)make1cmds( t ); /* Update the target's "progress" so MAKE1C processing counts it @@ -476,7 +477,7 @@ static void make1b( state * const pState ) /* All valid fates should have been accounted for by now. */ default: - printf( "ERROR: %s has bad fate %d", object_str( t->name ), + err_printf( "ERROR: %s has bad fate %d", object_str( t->name ), t->fate ); abort(); } @@ -492,7 +493,7 @@ static void make1b( state * const pState ) else if ( DEBUG_EXECCMD ) { CMD * cmd = ( CMD * )t->cmds; - printf( "Delaying %s %s: %d targets not ready\n", object_str( cmd->rule->name ), object_str( t->boundname ), cmd->asynccnt ); + out_printf( "Delaying %s %s: %d targets not ready\n", object_str( cmd->rule->name ), object_str( t->boundname ), cmd->asynccnt ); } } @@ -853,7 +854,7 @@ static void make1c_closure { call_timing_rule( t, time ); if ( DEBUG_EXECCMD ) - printf( "%f sec system; %f sec user\n", time->system, time->user ); + out_printf( "%f sec system; %f sec user\n", time->system, time->user ); /* Assume -p0 is in effect, i.e. cmd_stdout contains merged output. */ call_action_rule( t, status_orig, time, cmd->buf->value, cmd_stdout ); @@ -863,11 +864,11 @@ static void make1c_closure if ( t->status == EXEC_CMD_FAIL && DEBUG_MAKE ) { if ( !DEBUG_EXEC ) - printf( "%s\n", cmd->buf->value ); + out_printf( "%s\n", cmd->buf->value ); - printf( "...failed %s ", object_str( cmd->rule->name ) ); + out_printf( "...failed %s ", object_str( cmd->rule->name ) ); list_print( lol_get( (LOL *)&cmd->args, 0 ) ); - printf( "...\n" ); + out_printf( "...\n" ); } /* On interrupt, set quit so _everything_ fails. Do the same for failed @@ -894,7 +895,7 @@ static void make1c_closure char const * const filename = object_str( list_item( iter ) ); TARGET const * const t = bindtarget( list_item( iter ) ); if ( !( t->flags & T_FLAG_PRECIOUS ) && !unlink( filename ) ) - printf( "...removing %s\n", filename ); + out_printf( "...removing %s\n", filename ); } } @@ -936,7 +937,7 @@ static void push_cmds( CMDLIST * cmds, int status ) else if ( DEBUG_EXECCMD ) { TARGET * first_target = bindtarget( list_front( lol_get( &next_cmd->args, 0 ) ) ); - printf( "Delaying %s %s: %d targets not ready\n", object_str( next_cmd->rule->name ), object_str( first_target->boundname ), next_cmd->asynccnt ); + out_printf( "Delaying %s %s: %d targets not ready\n", object_str( next_cmd->rule->name ), object_str( first_target->boundname ), next_cmd->asynccnt ); } } else @@ -1151,12 +1152,12 @@ static CMD * make1cmds( TARGET * t ) : "contains a line that is too long"; assert( cmd_check_result == EXEC_CHECK_TOO_LONG || cmd_check_result == EXEC_CHECK_LINE_TOO_LONG ); - printf( "%s action %s (%d, max %d):\n", object_str( + out_printf( "%s action %s (%d, max %d):\n", object_str( rule->name ), error_message, cmd_error_length, cmd_error_max_length ); /* Tell the user what did not fit. */ - fputs( cmd->buf->value, stdout ); + out_puts( cmd->buf->value ); exit( EXITBAD ); } @@ -1397,7 +1398,7 @@ static int cmd_sem_lock( TARGET * t ) if ( iter->target->asynccnt > 0 ) { if ( DEBUG_EXECCMD ) - printf( "SEM: %s is busy, delaying launch of %s\n", + out_printf( "SEM: %s is busy, delaying launch of %s\n", object_str( iter->target->name ), object_str( t->name ) ); iter->target->parents = targetentry( iter->target->parents, t ); return 0; @@ -1408,7 +1409,7 @@ static int cmd_sem_lock( TARGET * t ) { ++iter->target->asynccnt; if ( DEBUG_EXECCMD ) - printf( "SEM: %s now used by %s\n", object_str( iter->target->name + out_printf( "SEM: %s now used by %s\n", object_str( iter->target->name ), object_str( t->name ) ); } /* A cmd only needs to be locked around its execution. @@ -1427,7 +1428,7 @@ static void cmd_sem_unlock( TARGET * t ) for ( iter = cmd->unlock; iter; iter = iter->next ) { if ( DEBUG_EXECCMD ) - printf( "SEM: %s is now free\n", object_str( + out_printf( "SEM: %s is now free\n", object_str( iter->target->name ) ); --iter->target->asynccnt; assert( iter->target->asynccnt <= 0 ); diff --git a/tools/build/src/engine/object.c b/tools/build/src/engine/object.c index ef46e4ae46..02440d2d18 100644 --- a/tools/build/src/engine/object.c +++ b/tools/build/src/engine/object.c @@ -23,6 +23,7 @@ #include "jam.h" #include "object.h" +#include "output.h" #include <assert.h> #include <stddef.h> @@ -386,9 +387,9 @@ void object_done() if ( DEBUG_MEM ) { - printf( "%dK in strings\n", strtotal / 1024 ); + out_printf( "%dK in strings\n", strtotal / 1024 ); if ( strcount_in != strcount_out ) - printf( "--- %d strings of %d dangling\n", strcount_in - + out_printf( "--- %d strings of %d dangling\n", strcount_in - strcount_out, strcount_in ); } } diff --git a/tools/build/src/engine/output.c b/tools/build/src/engine/output.c index eaaee434bd..2d9f413823 100644 --- a/tools/build/src/engine/output.c +++ b/tools/build/src/engine/output.c @@ -8,6 +8,7 @@ #include "output.h" #include <stdio.h> +#include <stdarg.h> #define bjam_out (stdout) @@ -24,13 +25,87 @@ static void out_( char const * data, FILE * const io ) } +void out_flush() +{ + fflush( bjam_out ); + if ( globs.out ) fflush( globs.out ); +} +void err_flush() +{ + fflush( bjam_err ); + if ( globs.out ) fflush( globs.out ); +} +void out_puts(char const * const s) +{ + fputs( s, bjam_out ); + if ( globs.out ) fputs( s, globs.out ); +} +void err_puts(char const * const s) +{ + fputs( s, bjam_err ); + if ( globs.out ) fputs( s, globs.out ); +} +void out_putc(const char c) +{ + fputc( c, bjam_out ); + if ( globs.out ) fputc( c, globs.out ); +} +void err_putc(const char c) +{ + fputc( c, bjam_err ); + if ( globs.out ) fputc( c, globs.out ); +} +void out_data(char const * const s) +{ + out_( s, bjam_out ); + if ( globs.out ) out_( s, globs.out ); +} +void err_data(char const * const s) +{ + out_( s, bjam_err ); + if ( globs.out ) out_( s, globs.out ); +} +void out_printf(char const * const f, ...) +{ + { + va_list args; + va_start( args, f ); + vfprintf( bjam_out, f, args ); + va_end( args ); + } + if ( globs.out ) + { + va_list args; + va_start( args, f ); + vfprintf( globs.out, f, args ); + va_end( args ); + } +} +void err_printf(char const * const f, ...) +{ + { + va_list args; + va_start( args, f ); + vfprintf( bjam_err, f, args ); + va_end( args ); + } + if ( globs.out ) + { + va_list args; + va_start( args, f ); + vfprintf( globs.out, f, args ); + va_end( args ); + } +} + + void out_action ( char const * const action, char const * const target, char const * const command, - char const * const out_data, - char const * const err_data, + char const * const out_d, + char const * const err_d, int const exit_reason ) { @@ -38,41 +113,36 @@ void out_action * should be null. */ if ( action ) - fprintf( bjam_out, "%s %s\n", action, target ); + out_printf( "%s %s\n", action, target ); /* Print out the command executed if given -d+2. */ if ( DEBUG_EXEC ) { - fputs( command, bjam_out ); - fputc( '\n', bjam_out ); + out_puts( command ); + out_putc( '\n' ); } - /* Print out the command executed to the command stream. */ - if ( globs.cmdout ) - fputs( command, globs.cmdout ); - /* If the process expired, make user aware with an explicit message, but do * this only for non-quiet actions. */ if ( exit_reason == EXIT_TIMEOUT && action ) - fprintf( bjam_out, "%ld second time limit exceeded\n", globs.timeout ); + out_printf( "%ld second time limit exceeded\n", globs.timeout ); /* Print out the command output, if requested, or if the program failed, but * only output for non-quiet actions. */ if ( action || exit_reason != EXIT_OK ) { - if ( out_data && + if ( out_d && ( ( globs.pipe_action & 1 /* STDOUT_FILENO */ ) || ( globs.pipe_action == 0 ) ) ) - out_( out_data, bjam_out ); - if ( err_data && ( globs.pipe_action & 2 /* STDERR_FILENO */ ) ) - out_( err_data, bjam_err ); + out_data( out_d ); + if ( err_d && ( globs.pipe_action & 2 /* STDERR_FILENO */ ) ) + err_data( err_d ); } - fflush( bjam_out ); - fflush( bjam_err ); - fflush( globs.cmdout ); + out_flush(); + err_flush(); } diff --git a/tools/build/src/engine/output.h b/tools/build/src/engine/output.h index 186e867f69..b6a98ff79b 100644 --- a/tools/build/src/engine/output.h +++ b/tools/build/src/engine/output.h @@ -23,6 +23,17 @@ void out_action( int const exit_reason ); +void out_flush(); +void err_flush(); +void out_puts(char const * const s); +void err_puts(char const * const s); +void out_putc(const char c); +void err_putc(const char c); +void out_data(char const * const s); +void err_data(char const * const s); +void out_printf(char const * const f, ...); +void err_printf(char const * const f, ...); + OBJECT * outf_int( int const value ); OBJECT * outf_double( double const value ); OBJECT * outf_time( timestamp const * const value ); diff --git a/tools/build/src/engine/parse.h b/tools/build/src/engine/parse.h index bb47af6d36..c726e16f48 100644 --- a/tools/build/src/engine/parse.h +++ b/tools/build/src/engine/parse.h @@ -41,6 +41,9 @@ #define PARSE_SETTINGS 16 #define PARSE_SWITCH 17 #define PARSE_WHILE 18 +#define PARSE_RETURN 19 +#define PARSE_BREAK 20 +#define PARSE_CONTINUE 21 /* diff --git a/tools/build/src/engine/patchlevel.h b/tools/build/src/engine/patchlevel.h index 4da43e1ff8..0f345ea94d 100644 --- a/tools/build/src/engine/patchlevel.h +++ b/tools/build/src/engine/patchlevel.h @@ -7,11 +7,11 @@ /* Keep JAMVERSYM in sync with VERSION. */ /* It can be accessed as $(JAMVERSION) in the Jamfile. */ -#define VERSION_MAJOR 2014 -#define VERSION_MINOR 3 +#define VERSION_MAJOR 2015 +#define VERSION_MINOR 7 #define VERSION_PATCH 0 -#define VERSION_MAJOR_SYM "2014" -#define VERSION_MINOR_SYM "03" +#define VERSION_MAJOR_SYM "2015" +#define VERSION_MINOR_SYM "07" #define VERSION_PATCH_SYM "00" -#define VERSION "2014.03" -#define JAMVERSYM "JAMVERSION=2014.03" +#define VERSION "2015.07" +#define JAMVERSYM "JAMVERSION=2015.07" diff --git a/tools/build/src/engine/regexp.c b/tools/build/src/engine/regexp.c index c64201b90b..80084e25c5 100644 --- a/tools/build/src/engine/regexp.c +++ b/tools/build/src/engine/regexp.c @@ -45,6 +45,7 @@ #include "jam.h" #include "regexp.h" +#include "output.h" #include <stdio.h> #include <ctype.h> @@ -907,12 +908,12 @@ regmatch( char * prog ) scan = prog; #ifdef DEBUG if (scan != NULL && regnarrate) - fprintf(stderr, "%s(\n", regprop(scan)); + err_printf("%s(\n", regprop(scan)); #endif while (scan != NULL) { #ifdef DEBUG if (regnarrate) - fprintf(stderr, "%s...\n", regprop(scan)); + err_printf("%s...\n", regprop(scan)); #endif next = regnext(scan); @@ -1180,32 +1181,32 @@ regdump( regexp *r ) s = r->program + 1; while (op != END) { /* While that wasn't END last time... */ op = OP(s); - printf("%2d%s", s-r->program, regprop(s)); /* Where, what. */ + out_printf("%2d%s", s-r->program, regprop(s)); /* Where, what. */ next = regnext(s); if (next == NULL) /* Next ptr. */ - printf("(0)"); + out_printf("(0)"); else - printf("(%d)", (s-r->program)+(next-s)); + out_printf("(%d)", (s-r->program)+(next-s)); s += 3; if (op == ANYOF || op == ANYBUT || op == EXACTLY) { /* Literal string, where present. */ while (*s != '\0') { - putchar(*s); + out_putc(*s); s++; } s++; } - putchar('\n'); + out_putc('\n'); } /* Header fields of interest. */ if (r->regstart != '\0') - printf("start `%c' ", r->regstart); + out_printf("start `%c' ", r->regstart); if (r->reganch) - printf("anchored "); + out_printf("anchored "); if (r->regmust != NULL) - printf("must have \"%s\"", r->regmust); - printf("\n"); + out_printf("must have \"%s\"", r->regmust); + out_printf("\n"); } /* diff --git a/tools/build/src/engine/scan.c b/tools/build/src/engine/scan.c index d92fdca145..324be0c728 100644 --- a/tools/build/src/engine/scan.c +++ b/tools/build/src/engine/scan.c @@ -11,6 +11,7 @@ #include "jam.h" #include "scan.h" +#include "output.h" #include "constants.h" #include "jambase.h" @@ -72,7 +73,7 @@ void yyerror( char const * s ) * will hold the information about where the token started while incp will * hold the information about where reading it broke. */ - printf( "%s:%d: %s at %s\n", object_str( yylval.file ), yylval.line, s, + out_printf( "%s:%d: %s at %s\n", object_str( yylval.file ), yylval.line, s, symdump( &yylval ) ); ++anyerrors; } @@ -361,7 +362,7 @@ int yylex() } if ( DEBUG_SCAN ) - printf( "scan %s\n", symdump( &yylval ) ); + out_printf( "scan %s\n", symdump( &yylval ) ); return yylval.type; diff --git a/tools/build/src/engine/search.c b/tools/build/src/engine/search.c index b2beadaaa4..e21ae3687e 100644 --- a/tools/build/src/engine/search.c +++ b/tools/build/src/engine/search.c @@ -23,6 +23,7 @@ #include "strings.h" #include "timestamp.h" #include "variable.h" +#include "output.h" #include <string.h> @@ -102,7 +103,7 @@ void set_explicit_binding( OBJECT * target, OBJECT * locate ) path_build( f, buf ); boundname = object_new( buf->value ); if ( DEBUG_SEARCH ) - printf( "explicit locate %s: %s\n", object_str( target ), buf->value ); + out_printf( "explicit locate %s: %s\n", object_str( target ), buf->value ); string_free( buf ); key = path_as_key( boundname ); object_free( boundname ); @@ -168,7 +169,7 @@ OBJECT * search( OBJECT * target, timestamp * const time, path_build( f, buf ); if ( DEBUG_SEARCH ) - printf( "locate %s: %s\n", object_str( target ), buf->value ); + out_printf( "locate %s: %s\n", object_str( target ), buf->value ); key = object_new( buf->value ); timestamp_from_path( time, key ); @@ -194,7 +195,7 @@ OBJECT * search( OBJECT * target, timestamp * const time, path_build( f, buf ); if ( DEBUG_SEARCH ) - printf( "search %s: %s\n", object_str( target ), buf->value ); + out_printf( "search %s: %s\n", object_str( target ), buf->value ); test_path = object_new( buf->value ); key = path_as_key( test_path ); @@ -205,7 +206,7 @@ OBJECT * search( OBJECT * target, timestamp * const time, if ( ( ba = (BINDING *)hash_find( explicit_bindings, key ) ) ) { if ( DEBUG_SEARCH ) - printf(" search %s: found explicitly located target %s\n", + out_printf(" search %s: found explicitly located target %s\n", object_str( target ), object_str( ba->target ) ); if ( another_target ) *another_target = ba->target; @@ -241,7 +242,7 @@ OBJECT * search( OBJECT * target, timestamp * const time, path_build( f, buf ); if ( DEBUG_SEARCH ) - printf( "search %s: %s\n", object_str( target ), buf->value ); + out_printf( "search %s: %s\n", object_str( target ), buf->value ); key = object_new( buf->value ); timestamp_from_path( time, key ); diff --git a/tools/build/src/engine/timestamp.c b/tools/build/src/engine/timestamp.c index 0d016985e0..17510bcd06 100644 --- a/tools/build/src/engine/timestamp.c +++ b/tools/build/src/engine/timestamp.c @@ -32,6 +32,7 @@ #include "object.h" #include "pathsys.h" #include "strings.h" +#include "output.h" /* @@ -231,7 +232,7 @@ static void time_enter( void * closure, OBJECT * target, int const found, b->progress = found ? BIND_FOUND : BIND_SPOTTED; if ( DEBUG_BINDSCAN ) - printf( "time ( %s ) : %s\n", object_str( target ), time_progress[ + out_printf( "time ( %s ) : %s\n", object_str( target ), time_progress[ b->progress ] ); object_free( target ); diff --git a/tools/build/src/engine/variable.c b/tools/build/src/engine/variable.c index 2c292fbc8b..cdeb8b3727 100644 --- a/tools/build/src/engine/variable.c +++ b/tools/build/src/engine/variable.c @@ -39,6 +39,7 @@ #include "parse.h" #include "pathsys.h" #include "strings.h" +#include "output.h" #include <stdio.h> #include <stdlib.h> @@ -319,9 +320,9 @@ static LIST * * var_enter( struct module_t * module, OBJECT * symbol ) static void var_dump( OBJECT * symbol, LIST * value, char * what ) { - printf( "%s %s = ", what, object_str( symbol ) ); + out_printf( "%s %s = ", what, object_str( symbol ) ); list_print( value ); - printf( "\n" ); + out_printf( "\n" ); } diff --git a/tools/build/src/kernel/modules.jam b/tools/build/src/kernel/modules.jam index 4258225320..251bdf1918 100644 --- a/tools/build/src/kernel/modules.jam +++ b/tools/build/src/kernel/modules.jam @@ -144,7 +144,7 @@ rule load ( filename ?= $(module-name).jam ; # Mark the module loaded so we do not try to load it recursively. - .loaded += $(module-name) ; + .loaded += $(module-name:B) ; # Suppress tests if any module loads are already in progress. local suppress-test = $(.loading[1]) ; @@ -263,7 +263,8 @@ rule import ( module-names + : rules-opt * : rename-opt * ) # Import each specified module for local m in $(module-names) { - if ! $(m) in $(.loaded) + local module-name = $(m:B) ; + if ! $(module-name) in $(.loaded) { # If the importing module is not already in the BOOST_BUILD_PATH, # prepend it to the path. We do not want to invert the search order @@ -285,18 +286,23 @@ rule import ( module-names + : rules-opt * : rename-opt * ) { search = $(caller-location) $(search) ; } + + if $(m:D) + { + search = $(caller-location)/$(m:D) $(search)/$(m:D) $(search) ; + } - load $(m) : : $(search) ; + load $(module-name) : : $(search) ; } - IMPORT_MODULE $(m) : $(caller) ; + IMPORT_MODULE $(module-name) : $(caller) ; if $(rules-opt) { local source-names ; if $(rules-opt) = * { - local all-rules = [ RULENAMES $(m) ] ; + local all-rules = [ RULENAMES $(module-name) ] ; source-names = $(all-rules) ; } else @@ -305,7 +311,7 @@ rule import ( module-names + : rules-opt * : rename-opt * ) } local target-names = $(rename-opt) ; target-names ?= $(source-names) ; - IMPORT $(m) : $(source-names) : $(caller) : $(target-names) ; + IMPORT $(module-name) : $(source-names) : $(caller) : $(target-names) ; } } } diff --git a/tools/build/src/tools/builtin.jam b/tools/build/src/tools/builtin.jam index 92959afc07..46f5fa5f89 100644 --- a/tools/build/src/tools/builtin.jam +++ b/tools/build/src/tools/builtin.jam @@ -140,6 +140,8 @@ feature.feature asmflags : : free ; feature.feature linkflags : : free ; feature.feature archiveflags : : free ; feature.feature version : : free ; +feature.feature mflags : : free ; +feature.feature mmflags : : free ; # Generic, i.e. non-language specific, flags for tools. feature.feature flags : : free ; diff --git a/tools/build/src/tools/clang-darwin.jam b/tools/build/src/tools/clang-darwin.jam index 51e5fad754..6b6e198577 100644 --- a/tools/build/src/tools/clang-darwin.jam +++ b/tools/build/src/tools/clang-darwin.jam @@ -28,6 +28,9 @@ generators.override clang-darwin.prebuilt : builtin.lib-generator ; generators.override clang-darwin.prebuilt : builtin.prebuilt ; generators.override clang-darwin.searched-lib-generator : searched-lib-generator ; +generators.register-c-compiler clang-darwin.compile.m : OBJECTIVE_C : OBJ : <toolset>clang <toolset-clang:platform>darwin ; +generators.register-c-compiler clang-darwin.compile.mm : OBJECTIVE_CPP : OBJ : <toolset>clang <toolset-clang:platform>darwin ; + toolset.inherit-rules clang-darwin : gcc ; toolset.inherit-flags clang-darwin : gcc : <inlining>off <inlining>on <inlining>full <optimization>space @@ -72,18 +75,22 @@ rule init ( version ? : command * : options * ) SPACE = " " ; -flags clang-darwin.compile OPTIONS <cflags> ; -flags clang-darwin.compile.c++ OPTIONS <cxxflags> ; -# flags clang-darwin.compile INCLUDES <include> ; +toolset.flags clang-darwin.compile OPTIONS <cflags> ; +toolset.flags clang-darwin.compile.c++ OPTIONS <cxxflags> ; +toolset.flags clang-darwin.compile.m OPTIONS <mflags> ; +toolset.flags clang-darwin.compile.mm OPTIONS <mflags> ; +toolset.flags clang-darwin.compile.mm OPTIONS <mmflags> ; +# toolset.flags clang-darwin.compile INCLUDES <include> ; # Declare flags and action for compilation. toolset.flags clang-darwin.compile OPTIONS <optimization>off : -O0 ; toolset.flags clang-darwin.compile OPTIONS <optimization>speed : -O3 ; toolset.flags clang-darwin.compile OPTIONS <optimization>space : -Os ; +# For clang, 'on' and 'full' are identical toolset.flags clang-darwin.compile OPTIONS <inlining>off : -fno-inline ; toolset.flags clang-darwin.compile OPTIONS <inlining>on : -Wno-inline ; -toolset.flags clang-darwin.compile OPTIONS <inlining>full : -finline-functions -Wno-inline ; +toolset.flags clang-darwin.compile OPTIONS <inlining>full : -Wno-inline ; toolset.flags clang-darwin.compile OPTIONS <warnings>off : -w ; toolset.flags clang-darwin.compile OPTIONS <warnings>on : -Wall ; @@ -94,6 +101,8 @@ toolset.flags clang-darwin.compile OPTIONS <debug-symbols>on : -g ; toolset.flags clang-darwin.compile OPTIONS <profiling>on : -pg ; toolset.flags clang-darwin.compile OPTIONS <rtti>off : -fno-rtti ; +toolset.flags clang-darwin.compile OPTIONS <flags> ; + actions compile.c { "$(CONFIG_COMMAND)" -x c $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" @@ -104,6 +113,16 @@ actions compile.c++ "$(CONFIG_COMMAND)" -x c++ $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" } +actions compile.m +{ + "$(CONFIG_COMMAND)" -x objective-c $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" +} + +actions compile.mm +{ + "$(CONFIG_COMMAND)" -x objective-c++ $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" +} + flags clang-darwin ARFLAGS <archiveflags> ; # Default value. Mostly for the sake of clang-linux @@ -166,5 +185,5 @@ actions link bind LIBRARIES actions link.dll bind LIBRARIES { - "$(CONFIG_COMMAND)" $(USER_OPTIONS) -L"$(LINKPATH)" -o "$(<)" -single_module -dynamiclib -install_name "$(<[1]:D=)" "$(>)" "$(LIBRARIES)" $(START-GROUP) $(FINDLIBS-ST-PFX) -l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) $(OPTIONS) + "$(CONFIG_COMMAND)" $(USER_OPTIONS) -L"$(LINKPATH)" -o "$(<)" -single_module -dynamiclib -install_name "@rpath/$(<[1]:D=)" "$(>)" "$(LIBRARIES)" $(START-GROUP) $(FINDLIBS-ST-PFX) -l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) $(OPTIONS) } diff --git a/tools/build/src/tools/gcc.jam b/tools/build/src/tools/gcc.jam index db0453461b..e94eced204 100644 --- a/tools/build/src/tools/gcc.jam +++ b/tools/build/src/tools/gcc.jam @@ -96,7 +96,8 @@ rule init ( version ? : command * : options * ) ; if $(tool-command) { - local tool-command-string = $(tool-command:J=" ") ; + local tool-command-string = \"$(tool-command)\" ; + tool-command-string = $(tool-command-string:J=" ") ; local tool-version = [ MATCH "^([0-9.]+)" : [ SHELL "$(tool-command-string) -dumpversion" ] ] ; if $(tool-version) != $(version) @@ -153,9 +154,11 @@ rule init ( version ? : command * : options * ) # Information about the gcc command... # The command. local command = $(tool-command) ; - # The 'command' variable can have multiple elements but when calling the - # SHELL builtin we need a single string. - local command-string = $(command:J=" ") ; + # The 'command' variable can have multiple elements but when calling the + # SHELL builtin we need a single string, and we need to quote elements + # with spaces. + local command-string = \"$(command)\" ; + command-string = $(command-string:J=" ") ; # The root directory of the tool install. local root = [ feature.get-values <root> : $(options) ] ; # The bin directory where to find the command to execute. @@ -451,7 +454,7 @@ rule setup-address-model ( targets * : sources * : properties * ) else { local arch = [ feature.get-values architecture : $(properties) ] ; - if $(arch) != arm + if $(arch) = power || $(arch) = sparc || $(arch) = x86 { if $(model) = 32 { @@ -1138,8 +1141,7 @@ cpu-flags gcc OPTIONS : x86 : c3-2 : -march=c3-2 ; ## cpu-flags gcc OPTIONS : x86 : atom : -march=atom ; # Sparc -cpu-flags gcc OPTIONS : sparc : c3 : -mcpu=c3 : default ; -cpu-flags gcc OPTIONS : sparc : v7 : -mcpu=v7 ; +cpu-flags gcc OPTIONS : sparc : v7 : -mcpu=v7 : default ; cpu-flags gcc OPTIONS : sparc : cypress : -mcpu=cypress ; cpu-flags gcc OPTIONS : sparc : v8 : -mcpu=v8 ; cpu-flags gcc OPTIONS : sparc : supersparc : -mcpu=supersparc ; diff --git a/tools/build/src/tools/gcc.py b/tools/build/src/tools/gcc.py index a13ce7ad2e..d2d3294380 100644 --- a/tools/build/src/tools/gcc.py +++ b/tools/build/src/tools/gcc.py @@ -789,8 +789,7 @@ cpu_flags('gcc', 'OPTIONS', 'x86', 'atom', ['-march=atom']) # Sparc flags('gcc', 'OPTIONS', ['<architecture>sparc/<address-model>32'], ['-m32']) flags('gcc', 'OPTIONS', ['<architecture>sparc/<address-model>64'], ['-m64']) -cpu_flags('gcc', 'OPTIONS', 'sparc', 'c3', ['-mcpu=c3'], default=True) -cpu_flags('gcc', 'OPTIONS', 'sparc', 'v7', ['-mcpu=v7']) +cpu_flags('gcc', 'OPTIONS', 'sparc', 'v7', ['-mcpu=v7'], default=True) cpu_flags('gcc', 'OPTIONS', 'sparc', 'cypress', ['-mcpu=cypress']) cpu_flags('gcc', 'OPTIONS', 'sparc', 'v8', ['-mcpu=v8']) cpu_flags('gcc', 'OPTIONS', 'sparc', 'supersparc', ['-mcpu=supersparc']) diff --git a/tools/build/src/tools/msvc.jam b/tools/build/src/tools/msvc.jam index 7fbe0f2e11..09d7edbc33 100644 --- a/tools/build/src/tools/msvc.jam +++ b/tools/build/src/tools/msvc.jam @@ -281,18 +281,7 @@ rule configure-version-specific ( toolset : version : conditions ) # dependencies to put there. toolset.flags $(toolset).link LINKFLAGS $(conditions) : /MANIFEST ; } - - # Starting with Visual Studio 2013 the CRT is split into a desktop and app dll. - #If targeting WinRT and 12.0 set lib path to link against app CRT. - if [ MATCH "(12)" : $(version) ] - { - local VCPath = [ path.parent [ path.make [ default-path $(version) ] ] ] ; - local storeLibPath = [ path.join [ path.join $(VCPath) "lib" ] "store" ] ; - toolset.flags $(toolset).link LINKPATH $(conditions)/<windows-api>store/$(.cpu-arch-i386) : [ path.native $(storeLibPath) ] ; - toolset.flags $(toolset).link LINKPATH $(conditions)/<windows-api>store/$(.cpu-arch-amd64) : [ path.native [ path.join $(storeLibPath) "amd64" ] ] ; - toolset.flags $(toolset).link LINKPATH $(conditions)/<windows-api>store/$(.cpu-arch-arm) : [ path.native [ path.join $(storeLibPath) "arm" ] ] ; - } - + toolset.pop-checking-for-flags-module ; } @@ -1061,6 +1050,14 @@ local rule configure-really ( version ? : options * ) { default-global-setup-options-amd64 = amd64 ; } + # When Boost.Build itself is running as a 32-bit process on 64-bit + # Windows, the above test will fail (since WOW64 simulates a 32-bit + # environment, including environment values). So check the WOW64 + # variable PROCESSOR_ARCHITEW6432 as well. + if [ MATCH ^(AMD64) : [ os.environ PROCESSOR_ARCHITEW6432 ] ] + { + default-global-setup-options-amd64 = amd64 ; + } # TODO: The same 'native compiler usage' should be implemented for # the Itanium platform by using the "ia64" parameter. For this # though we need someone with access to this platform who can find @@ -1176,6 +1173,16 @@ local rule configure-really ( version ? : options * ) } } + # Starting with Visual Studio 2013 the CRT is split into a desktop and app dll. + # If targeting WinRT and 12.0 set lib path to link against app CRT. + if [ MATCH "(12)" : $(version) ] + { + local storeLibPath = [ path.join $(parent) "lib/store" ] ; + toolset.flags msvc.link LINKPATH $(conditions)/<windows-api>store/$(.cpu-arch-i386) : [ path.native $(storeLibPath) ] ; + toolset.flags msvc.link LINKPATH $(conditions)/<windows-api>store/$(.cpu-arch-amd64) : [ path.native [ path.join $(storeLibPath) "amd64" ] ] ; + toolset.flags msvc.link LINKPATH $(conditions)/<windows-api>store/$(.cpu-arch-arm) : [ path.native [ path.join $(storeLibPath) "arm" ] ] ; + } + # Set version-specific flags. configure-version-specific msvc : $(version) : $(conditions) ; } diff --git a/tools/build/src/tools/package.jam b/tools/build/src/tools/package.jam index 198c223151..c703580fcd 100644 --- a/tools/build/src/tools/package.jam +++ b/tools/build/src/tools/package.jam @@ -71,7 +71,7 @@ rule install ( name package-name ? : requirements * : binaries * : libraries * : # First, figure out all locations. Use the default if no prefix option # given. - local prefix = [ get-prefix $(name) : $(requirements) ] ; + local prefix = [ get-prefix $(package-name) : $(requirements) ] ; # Architecture dependent files. local exec-locate = [ option.get exec-prefix : $(prefix) ] ; diff --git a/tools/build/src/tools/python.jam b/tools/build/src/tools/python.jam index 1a41a1e865..90377eaae1 100644 --- a/tools/build/src/tools/python.jam +++ b/tools/build/src/tools/python.jam @@ -962,16 +962,18 @@ local rule configure ( version ? : cmd-or-prefix ? : includes * : libraries ? : # symbols. If we linked to libpython, we would get duplicate symbols. So # declare two targets -- one for building extensions and another for # embedding. - # - # Unlike most *nix systems, Mac OS X's linker does not permit undefined - # symbols when linking a shared library. So, we still need to link against - # the Python framework, even when building extensions. Note that framework - # builds of Python always use shared libraries, so we do not need to worry - # about duplicate Python symbols. - if $(target-os) in windows cygwin darwin + if $(target-os) in windows cygwin { alias python_for_extensions : python : $(target-requirements) ; } + else if $(target-os) = darwin { + alias python_for_extensions + : + : $(target-requirements) + : + : $(usage-requirements) <linkflags>"-undefined dynamic_lookup" + ; + } # On AIX we need Python extensions and Boost.Python to import symbols from # the Python interpreter. Dynamic libraries opened with dlopen() do not # inherit the symbols from the Python interpreter. diff --git a/tools/build/src/tools/qt5.jam b/tools/build/src/tools/qt5.jam index 46a753019b..4110a759b8 100644 --- a/tools/build/src/tools/qt5.jam +++ b/tools/build/src/tools/qt5.jam @@ -435,6 +435,8 @@ rule init ( prefix : version ? : condition * : namespace ? : infix ? : full_bin add-shared-library QtPrintSupport : QtGui : QT_PRINTSUPPORT_LIB : $(target-requirements) ; add-shared-library QtConcurrent : QtCore : QT_CONCURRENT_LIB : $(target-requirements) ; + add-shared-library QtPositioning : QtCore : QT_POSITIONING_LIB : $(target-requirements) ; + add-shared-library QtOpenGL : QtGui : QT_OPENGL_LIB : $(target-requirements) ; add-shared-library QtSvg : QtXml QtOpenGL : QT_SVG_LIB : $(target-requirements) ; @@ -473,6 +475,9 @@ rule init ( prefix : version ? : condition * : namespace ? : infix ? : full_bin add-shared-library QtQuickParticles : QtQml : : $(target-requirements) ; add-shared-library QtQuickTest : QtQml : : $(target-requirements) ; + # QtLocation (since 5.4) + add-shared-library QtLocation : QtQuick QtPositioning : QT_LOCATION_LIB : $(target-requirements) ; + # Regular expression support add-shared-library QtV8 : QtCore : : $(target-requirements) ; diff --git a/tools/build/src/tools/types/register.jam b/tools/build/src/tools/types/register.jam index 203992ca92..daedfb7010 100644 --- a/tools/build/src/tools/types/register.jam +++ b/tools/build/src/tools/types/register.jam @@ -21,7 +21,7 @@ local rule type ( type : suffixes * : base-type ? : os * ) } .this-module's-file = [ modules.binding $(__name__) ] ; -.this-module's-dir = [ path.parent $(.this-module's-file) ] ; +.this-module's-dir = [ path.parent [ path.make $(.this-module's-file) ] ] ; .sibling-jamfiles = [ path.glob $(.this-module's-dir) : *.jam ] ; .sibling-modules = [ MATCH ^(.*)\.jam$ : $(.sibling-jamfiles) ] ; @@ -32,7 +32,7 @@ for m in $(.sibling-modules) m = types/$(m) ; # Inject the type rule into the new module - IMPORT $(__name__) : type : $(m) : type ; + IMPORT $(__name__) : type : $(m:B) : type ; import $(m) ; } diff --git a/tools/build/src/tools/xlcpp.jam b/tools/build/src/tools/xlcpp.jam new file mode 100644 index 0000000000..0d6e80cf56 --- /dev/null +++ b/tools/build/src/tools/xlcpp.jam @@ -0,0 +1,151 @@ +# Copyright Vladimir Prus 2004. +# Copyright Toon Knapen 2004. +# Copyright Catherine Morton 2015. +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt +# or copy at http://www.boost.org/LICENSE_1_0.txt) + +# +# Boost.Build V2 toolset for the IBM XL C++ compiler +# + +import toolset : flags ; +import feature ; +import common ; +import generators ; +import os ; + +feature.extend toolset : xlcpp ; +toolset.inherit xlcpp : unix ; +generators.override xlcpp.prebuilt : builtin.prebuilt ; +generators.override xlcpp.searched-lib-generator : searched-lib-generator ; + +# Configure the xlcpp toolset +rule init ( version ? : command * : options * ) +{ + local condition = [ + common.check-init-parameters xlcpp : version $(version) ] ; + + command = [ common.get-invocation-command xlcpp : xlC + : $(command) : "/usr/xlcpp/bin/xlC" ] ; + + common.handle-options xlcpp : $(condition) : $(command) : $(options) ; +} + +# Declare generators +generators.register-c-compiler xlcpp.compile.c : C : OBJ : <toolset>xlcpp ; +generators.register-c-compiler xlcpp.compile.c++ : CPP : OBJ : <toolset>xlcpp ; + +# Allow C++ style comments in C files +flags xlcpp CFLAGS : -qnoxlcompatmacros ; + +# Declare flags +flags xlcpp CFLAGS <optimization>off : -qNOOPTimize ; +flags xlcpp CFLAGS <optimization>speed : ; +flags xlcpp CFLAGS <optimization>space : -O2 -qcompact ; + +# Discretionary inlining (not recommended) +flags xlcpp CFLAGS <inlining>off : -qnoinline ; +flags xlcpp CFLAGS <inlining>on : -qinline ; +#flags xlcpp CFLAGS <inlining>full : -qinline ; +flags xlcpp CFLAGS <inlining>full : ; + +# Exception handling +flags xlcpp C++FLAGS <exception-handling>off : -qnoeh ; +flags xlcpp C++FLAGS <exception-handling>on : -qeh ; + +# Run-time Type Identification +flags xlcpp C++FLAGS <rtti>off : -qnortti ; +flags xlcpp C++FLAGS <rtti>on : -qrtti ; + +# Enable 64-bit memory addressing model +flags xlcpp CFLAGS <address-model>64 : -q64 ; +flags xlcpp LINKFLAGS <address-model>64 : -q64 ; +flags xlcpp ARFLAGS <target-os>aix/<address-model>64 : -X 64 ; + +# Use absolute path when generating debug information +flags xlcpp CFLAGS <debug-symbols>on : -g -qfullpath ; +flags xlcpp LINKFLAGS <debug-symbols>on : -g -qfullpath ; +flags xlcpp LINKFLAGS <debug-symbols>off : -s ; + +if [ os.name ] = AIX +{ + flags xlcpp.compile C++FLAGS : -qfuncsect ; + + # The -bnoipath strips the prepending (relative) path of libraries from + # the loader section in the target library or executable. Hence, during + # load-time LIBPATH (identical to LD_LIBRARY_PATH) or a hard-coded + # -blibpath (*similar* to -lrpath/-lrpath-link) is searched. Without + # this option, the prepending (relative) path + library name is + # hard-coded in the loader section, causing *only* this path to be + # searched during load-time. Note that the AIX linker does not have an + # -soname equivalent, this is as close as it gets. + # + # The above options are definately for AIX 5.x, and most likely also for + # AIX 4.x and AIX 6.x. For details about the AIX linker see: + # http://download.boulder.ibm.com/ibmdl/pub/software/dw/aix/es-aix_ll.pdf + # + flags xlcpp.link LINKFLAGS <link>shared : -bnoipath ; + + # Run-time linking + flags xlcpp.link EXE-LINKFLAGS <link>shared : -brtl ; +} +else +{ + # Linux PPC + flags xlcpp.compile CFLAGS <link>shared : -qpic=large ; + flags xlcpp FINDLIBS : rt ; +} + +# Profiling +flags xlcpp CFLAGS <profiling>on : -pg ; +flags xlcpp LINKFLAGS <profiling>on : -pg ; + +flags xlcpp.compile OPTIONS <cflags> ; +flags xlcpp.compile.c++ OPTIONS <cxxflags> ; +flags xlcpp DEFINES <define> ; +flags xlcpp UNDEFS <undef> ; +flags xlcpp HDRS <include> ; +flags xlcpp STDHDRS <sysinclude> ; +flags xlcpp.link OPTIONS <linkflags> ; +flags xlcpp ARFLAGS <arflags> ; + +flags xlcpp LIBPATH <library-path> ; +flags xlcpp NEEDLIBS <library-file> ; +flags xlcpp FINDLIBS <find-shared-library> ; +flags xlcpp FINDLIBS <find-static-library> ; + +# Select the compiler name according to the threading model. +flags xlcpp VA_C_COMPILER <threading>single : xlc ; +flags xlcpp VA_C_COMPILER <threading>multi : xlc ; +flags xlcpp VA_CXX_COMPILER <threading>single : xlC ; +flags xlcpp VA_CXX_COMPILER <threading>multi : xlC ; + +SPACE = " " ; + +flags xlcpp.link.dll HAVE_SONAME <target-os>linux : "" ; + +actions xlcpp.link bind NEEDLIBS +{ + $(VA_CXX_COMPILER) $(EXE-LINKFLAGS) $(LINKFLAGS) -o "$(<[1])" -L$(LIBPATH) -L$(STDLIBPATH) "$(>)" "$(NEEDLIBS)" "$(NEEDLIBS)" -l$(FINDLIBS) $(OPTIONS) $(USER_OPTIONS) +} + +actions xlcpp.link.dll bind NEEDLIBS +{ + xlC -G $(LINKFLAGS) -o "$(<[1])" $(HAVE_SONAME)-Wl,-soname$(SPACE)-Wl,$(<[-1]:D=) -L$(LIBPATH) -L$(STDLIBPATH) "$(>)" "$(NEEDLIBS)" "$(NEEDLIBS)" -l$(FINDLIBS) $(OPTIONS) $(USER_OPTIONS) +} + +actions xlcpp.compile.c +{ + $(VA_C_COMPILER) -c $(OPTIONS) $(USER_OPTIONS) -I$(BOOST_ROOT) -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) -I"$(HDRS)" -I"$(STDHDRS)" -o "$(<)" "$(>)" +} + +actions xlcpp.compile.c++ +{ + $(VA_CXX_COMPILER) -c $(OPTIONS) $(USER_OPTIONS) -I$(BOOST_ROOT) -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) $(C++FLAGS) -I"$(HDRS)" -I"$(STDHDRS)" -o "$(<)" "$(>)" +} + +actions updated together piecemeal xlcpp.archive +{ + ar $(ARFLAGS) ru "$(<)" "$(>)" +} diff --git a/tools/build/test/BoostBuild.py b/tools/build/test/BoostBuild.py index 540830e346..8c51cf05fb 100644 --- a/tools/build/test/BoostBuild.py +++ b/tools/build/test/BoostBuild.py @@ -253,6 +253,8 @@ class Tester(TestCmd.TestCmd): elif os.uname()[0] == "Darwin": if os.uname()[4] == "i386": jam_build_dir = "bin.macosxx86" + elif os.uname()[4] == "x86_64": + jam_build_dir = "bin.macosxx86_64" else: jam_build_dir = "bin.macosxppc" elif os.uname()[0] == "AIX": diff --git a/tools/build/test/core-language/test.jam b/tools/build/test/core-language/test.jam index 4198dd7204..4f9c7a52bc 100644 --- a/tools/build/test/core-language/test.jam +++ b/tools/build/test/core-language/test.jam @@ -317,7 +317,7 @@ rule call-foreach ( values * ) } } -check-equal foreach-result : [ call-foreach 1 2 3 ] : ; +check-equal foreach-result : [ call-foreach 1 2 3 ] : 1 ; result = ; local varname = x ; @@ -406,7 +406,7 @@ rule test-rule } } -check-equal if-false-result : [ test-rule ] : ; +check-equal if-false-result : [ test-rule ] : result ; rule test-rule { @@ -1203,7 +1203,147 @@ rule test-rule } } -check-equal while-result-2 : [ test-rule ] : ; +check-equal while-result-2 : [ test-rule ] : x ; + +} + + +# +# test break +# + +{ + +local z = original ; +local done ; +while ! $(done) +{ + local z = inner ; + mark-order r1 ; + break ; + mark-order r2 ; + done = true ; +} + +check-order break-while-exec : r1 ; +check-equal break-while-cleanup : $(z) : original ; + +local values = v1 v2 ; + +for y in $(values) +{ + local z = inner ; + mark-order r1-$(y) ; + break ; + mark-order r2-$(y) ; +} + +check-order break-for-exec : r1-v1 ; +check-equal break-for-cleanup : $(z) : original ; + +for local y in $(values) +{ + local z = inner ; + mark-order r1-$(y) ; + break ; + mark-order r2-$(y) ; +} + +check-order break-for-local-exec : r1-v1 ; +check-equal break-for-local-cleanup : $(z) : original ; + +local z1 = z1val ; +local z2 = z2val ; +done = ; +while ! $(done) +{ + local z1 = z1new ; + mark-order r1 ; + for local y in $(values) + { + local z2 = z2new ; + mark-order r2 ; + break ; + mark-order r3 ; + } + mark-order r4 ; + break ; + mark-order r5 ; + done = true ; +} + +check-order break-nested-exec : r1 r2 r4 ; +check-equal break-nested-cleanup1 : $(z1) : z1val ; +check-equal break-nested-cleanup2 : $(z2) : z2val ; + +} + +# +# test continue +# + +{ + +local z = original ; +local done ; +while ! [ mark-order r1 : $(done) ] +{ + local z = inner ; + done = true ; + mark-order r2 ; + continue ; + mark-order r3 ; +} + +check-order continue-while-exec : r1 r2 r1 ; +check-equal continue-while-cleanup : $(z) : original ; + +local values = v1 v2 ; +for y in $(values) +{ + local z = inner ; + mark-order r1-$(y) ; + continue ; + mark-order r2-$(y) ; +} + +check-order continue-for-exec : r1-v1 r1-v2 ; +check-equal continue-for-cleanup : $(z) : original ; + +for local y in $(values) +{ + local z = inner ; + mark-order r1-$(y) ; + continue ; + mark-order r2-$(y) ; +} + +check-order continue-for-local-exec : r1-v1 r1-v2 ; +check-equal continue-for-local-cleanup : $(z) : original ; + +local z1 = z1val ; +local z2 = z2val ; +done = ; +while ! [ mark-order r1 : $(done) ] +{ + local z1 = z1new ; + done = true ; + mark-order r2 ; + for local y in $(values) + { + local z2 = z2new ; + mark-order r3-$(y) ; + continue ; + mark-order r4-$(y) ; + } + mark-order r5 ; + continue ; + mark-order r6 ; +} + +check-order continue-nested-exec : r1 r2 r3-v1 r3-v2 r5 r1 ; +check-equal continue-nested-cleanup1 : $(z1) : z1val ; +check-equal continue-nested-cleanup2 : $(z2) : z2val ; } diff --git a/tools/build/test/qt5/jamroot.jam b/tools/build/test/qt5/jamroot.jam index 90da392edb..199e9d50b8 100644 --- a/tools/build/test/qt5/jamroot.jam +++ b/tools/build/test/qt5/jamroot.jam @@ -31,6 +31,8 @@ if [ qt5.initialized ] [ run qtscripttools.cpp /qt5//QtScriptTools ] [ run qtxmlpatterns.cpp /qt5//QtXmlPatterns ] + [ run qtpositioning.cpp /qt5//QtPositioning ] + # ToDo: runable example code [ link qtsvg.cpp /qt5//QtSvg ] [ link qtwidgets.cpp /qt5//QtWidgets ] @@ -46,6 +48,8 @@ if [ qt5.initialized ] # QtQuick version2 [ run qtquick.cpp /qt5//QtQuick : -platform offscreen : $(CWD)/qtquick.qml ] + [ run qtlocation.cpp /qt5//QtLocation ] + # Help systems. [ link qthelp.cpp /qt5//QtHelp ] diff --git a/tools/build/test/qt5/qtlocation.cpp b/tools/build/test/qt5/qtlocation.cpp new file mode 100644 index 0000000000..9806dca93e --- /dev/null +++ b/tools/build/test/qt5/qtlocation.cpp @@ -0,0 +1,30 @@ +// (c) Copyright Juergen Hunold 2012 +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#define BOOST_TEST_MODULE QtPositioning + +#include <QGeoAddress> +#include <QGeoLocation> + +#include <boost/test/unit_test.hpp> + +BOOST_AUTO_TEST_CASE (defines) +{ + BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_CORE_LIB), true); + BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_POSITIONING_LIB), true); + BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_NETWORK_LIB), true); + BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_LOCATION_LIB), true); +} + +BOOST_TEST_DONT_PRINT_LOG_VALUE(QGeoAddress) + +BOOST_AUTO_TEST_CASE( geo_location ) +{ + QGeoLocation geolocation; + + QGeoAddress address; + + BOOST_CHECK_EQUAL(geolocation.address(), address); +} diff --git a/tools/build/test/qt5/qtpositioning.cpp b/tools/build/test/qt5/qtpositioning.cpp new file mode 100644 index 0000000000..427b41ba93 --- /dev/null +++ b/tools/build/test/qt5/qtpositioning.cpp @@ -0,0 +1,23 @@ +// (c) Copyright Juergen Hunold 2012 +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#define BOOST_TEST_MODULE QtPositioning + +#include <QGeoCoordinate> + +#include <boost/test/unit_test.hpp> + +BOOST_AUTO_TEST_CASE (defines) +{ + BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_CORE_LIB), true); + BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_POSITIONING_LIB), true); +} + +BOOST_AUTO_TEST_CASE( geo_coordinate ) +{ + QGeoCoordinate geocoordinate; + + BOOST_CHECK_EQUAL(geocoordinate.type(), QGeoCoordinate::InvalidCoordinate); +} |