l4re-base-25.08.0

This commit is contained in:
2025-09-12 15:55:45 +02:00
commit d959eaab98
37938 changed files with 9382688 additions and 0 deletions

View File

@@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View File

@@ -0,0 +1,2 @@
mailaddr hohmuth@sax.de

View File

@@ -0,0 +1,7 @@
PKGIDR ?= .
L4DIR ?= ../..
include $(L4DIR)/mk/Makeconf
TARGET = src test doc
include $(L4DIR)/mk/subdir.mk

View File

@@ -0,0 +1,38 @@
`preprocess' -- A C++ preprocessor.
-----------------------------------
This program is a preprocessor for C++ modules. With this tool, you
write unit-style single-source-file modules in C++ (e.g., foo.cpp),
from which the tool extracts three C++ source files that can then be
processed using the standard C++ compiler toolchain:
- A public header file (foo.h)
- A private header file containing all non-public type definitions
(foo_i.h). This facilitates debugging modules that need access to
implementation-specific data structures.
- An implementation file (foo.cc)
Features:
- Modules contain two sections. The "INTERFACE:" section contains
the public interface to the module; the "IMPLEMENTATION:" section
contains everything else. The preprocessor puts "INTERFACE:"
declarations into the public header file and tries to hide
everything else.
- The preprocessor automatically expands class declarations using
member-function definitions found in the file. Function labelled
PUBLIC, PROTECTED and PRIVATE are put into the corresponding section
of the class. This feature saves typing effort and reduces
duplication.
- Functions declared "inline" are exported automatically, along with
all the functions and types they need (these dependencies must be
declared in the module file). This feature can be turned off so that
all functions labeled "inline" are hidded and generated out-of-line.
For more documentation, please refer to the documentation (manpage,
webpage) in directory "doc" (requires Doxygen), or go to the online
documentation at <http://os.inf.tu-dresden.de/~hohmuth/prj/preprocess/>.

View File

@@ -0,0 +1,44 @@
BUGS:
- Namespace declarations are unsupported.
- Forward-declared, out-of-line defined nested classes are
unsupported.
- Preprocess does not automatically export declarations of public
variables and static class data to the generated header file.
- Conditional compilation (preprocessor) is unsupported on file
top-level (preprocessor expressions inside blocks are OK), with the
exception that code commented out using "#if 0" is detected
correctly and deleted.
IDEAS:
- Preprocess' source code should be modularized so that the parser can
be used independently from the output generator. This would enable
us writing other interesting applications based on the parsed source
code:
. Enforce naming conventions
. Rewrite .cpp files according to user-specified rules; this could
eventually be extented so that Preprocess can support a
refactoring browser.
. Aspect weaving (aspect-oriented programming)
. Automatically generate insulation (wrappers, protocol classes,
procedural interface) for a specified class
. Support class invariants, and pre- and postconditions
- When should we backdate newly-generated files? Obviously, if the
newly generated file and its previous version are the same. There
are circumstances, however, when clients using a generated header
file do not have to be recompiled:
. Only line-number changes
. "friend" additions
. Relaxation of protection rules
. (and a number of other circumstances; see [Lakos])
- Preprocess should be configurable not only via command-line
arguments, but also using a config file.

View File

@@ -0,0 +1,192 @@
# Doxyfile 1.2.18
#---------------------------------------------------------------------------
# General configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = Preprocess
PROJECT_NUMBER =
OUTPUT_DIRECTORY =
OUTPUT_LANGUAGE = English
EXTRACT_ALL = NO
EXTRACT_PRIVATE = NO
EXTRACT_STATIC = NO
EXTRACT_LOCAL_CLASSES = YES
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = NO
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = NO
STRIP_FROM_PATH =
INTERNAL_DOCS = NO
STRIP_CODE_COMMENTS = YES
CASE_SENSE_NAMES = YES
SHORT_NAMES = NO
HIDE_SCOPE_NAMES = NO
VERBATIM_HEADERS = YES
SHOW_INCLUDE_FILES = YES
JAVADOC_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP = NO
INHERIT_DOCS = YES
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
DISTRIBUTE_GROUP_DOC = NO
TAB_SIZE = 8
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ALIASES =
#ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_JAVA = NO
SHOW_USED_FILES = YES
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_FORMAT =
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = manpage.dox
FILE_PATTERNS =
RECURSIVE = NO
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
INPUT_FILTER =
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = NO
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
#GENERATE_HTML = YES
HTML_OUTPUT =
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
BINARY_TOC = NO
TOC_EXPAND = NO
DISABLE_INDEX = YES
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = NO
TREEVIEW_WIDTH = 250
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
#GENERATE_LATEX = NO
LATEX_OUTPUT =
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
EXTRA_PACKAGES =
LATEX_HEADER =
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
#GENERATE_RTF = NO
RTF_OUTPUT =
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
#GENERATE_MAN = YES
MAN_OUTPUT =
MAN_EXTENSION = .1
MAN_LINKS = YES
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
#GENERATE_XML = NO
XML_SCHEMA =
XML_DTD =
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED =
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::addtions related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH =
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = YES
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = NO
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
TEMPLATE_RELATIONS = YES
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
GRAPHICAL_HIERARCHY = YES
DOT_IMAGE_FORMAT = png
DOT_PATH =
DOTFILE_DIRS =
MAX_DOT_GRAPH_WIDTH = 1024
MAX_DOT_GRAPH_HEIGHT = 1024
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Configuration::addtions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = YES
CGI_NAME =
CGI_URL =
DOC_URL =
DOC_ABSPATH =
BIN_ABSPATH =
EXT_DOC_PATHS =

View File

@@ -0,0 +1,34 @@
L4DIR ?= ../../..
include $(L4DIR)/mk/Makeconf
ALL = html man
all:: $(foreach d, $(ALL), stamp-$(d))
DIRS = html man latex
.PHONY: $(DIRS)
$(DIRS) : % : stamp-%
stamp-%: Doxyfile manpage.dox
( echo "ENABLED_SECTIONS = $*"; \
for format in latex html man; do \
echo "GENERATE_$$(echo $$format | tr a-z A-Z) = \
$$(if [ $$format = $* ]; then echo YES; else echo NO; fi)"; \
done; \
cat $<) | doxygen -
if [ "$*" = html ]; then \
perl -p -i -e 's/preprocess.html#/#/g' html/preprocess.html; \
fi
if [ "$*" = man ]; then \
perl -p -i -e 's/preprocess \\- Preprocess - /preprocess \\- /g' \
man/man1/preprocess.1; \
fi
touch $@
install: stamp-man
-$(INSTALL) -d $(DROPS_STDDIR)/tool/man/man1
$(INSTALL) -m 644 man/man1/preprocess.1 \
$(DROPS_STDDIR)/tool/man/man1/preprocess.1
cleanall clean:
rm -rf $(DIRS) stamp-*

View File

@@ -0,0 +1,667 @@
/*! <!-- -*- html-helper -*- -->
\page preprocess Preprocess - A preprocessor for C and C++ modules
\ifnot man
Do you hate writing C or C++ header files?
Do you always forget where to place those <code>inline</code>,
<code>virtual</code>, <code>static</code>, and <code>explicit</code>
modifiers -- to the member-function definition or declaration?
Do you often find yourself avoiding to factor out a new method because
you also need to add a method declaration to the class declaration in
the header file?
Do you hate putting inline function into header files, in a special
order?
If so, Preprocess may be your answer. With this tool, you write
<b>unit-style single-source-file modules</b> in C++, from which it
automatically generates header and implementation files.
<p>
<hr>
<h3>Table of contents:</h3>
<ul>
<li>\ref SYNOPSIS
<li>\ref DESCRIPTION
<li>\ref OPTIONS
<li>\ref LANGUAGE
<li>\ref MISC
<li>\ref MAKEFILE
<li>\ref BUGS
<li>\ref DOWNLOAD
<li>\ref LIST
<li>\ref AUTHOR
<li>\ref SEE
</ul>
<p>
\endif
\section SYNOPSIS Synopsis
<code>preprocess -c</code> <var>filename_base</var>
[ <code>-o</code> <var>outfile_base</var> | <code>-s</code>]
<br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code>[ <code>-p</code> <var>prepend</var> ]
<br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code>[ <code>-C</code> <var>source_ext</var> ]
[ <code>-H</code> <var>header_ext</var> ]
<br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code>[ <code>-e</code> <var>tag_list</var> ]
<br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code>[ <code>-i</code> ] [ <code>-t</code> ]
[ <code>-l</code> | <code>-L</code> ] [ <code>-v</code> ] [ <code>-d</code> ]
<br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><var>sources</var>...
\section DESCRIPTION Description
Preprocess is a preprocessor for C++ modules. With this tool, you
write <b>unit-style single-source-file modules</b> in C++.
Preprocess essentially does these things (and frees the programmer
from doing them):
<UL>
<LI>Generate header files that contain declarations for public
classes and functions.</LI>
<LI>Fill in member-function declarations into class declarations.</LI>
<LI>Export public inline and template functions in correct order
(you need to declare dependencies for inline functions).</LI>
<LI>Optionally, function marked "<code>inline</code>" can be put
into the implementation file (out of line). This can ease
development (as it temporarily decreases dependencies on header
files that change frequently) and debugging.</LI>
</UL>
These automatisms lead to source files that are more logically
cohesive (no need to put inline and template functions into a separate
file, in a special order) and saves typing effort.
Preprocess works by transforming unit-style single-source-file C++
modules into three output files: public header, private header, and
implementation file. C and C++ comments are preserved during the
transformation, keeping the resulting files readable and making it
possible to run another preprocessor on Preprocess' output.
\section OPERATION Basic operation
\htmlonly
<table border=0>
<tr><td width="70%" valign=top>
\endhtmlonly
Modules contain two sections. The "<code>INTERFACE:</code>"
section contains the public interface to the module; the
"<code>IMPLEMENTATION:</code>" section contains everything else. The
preprocessor puts interface declarations into a public header file and
tries to hide everything else.
Class definitions deliberately lack declarations for member
functions: Preprocess will add them automatically. Member-function
definitions (in the implementation section) labelled
<code>PUBLIC</code>, <code>PROTECTED</code> and <code>PRIVATE</code>
are put into the corresponding section of the class. This feature
saves typing effort and reduces duplication.
From this input file (foo.cpp), Preprocess extracts three C++ source
files that can then be processed using the standard C++ compiler
toolchain:
\htmlonly
</td>
<td bgcolor="#dedede">
\endhtmlonly
<code><pre>
// C++ module -- Preprocess input file
INTERFACE:
\#include "bar.h"
struct Baz;
class Foo : public Bar
{
Baz* d_baz;
};
IMPLEMENTATION:
struct Baz
{
int data;
};
PUBLIC
int Foo::get_info()
{
return d_baz->data;
}</pre></code>
\htmlonly
</td></tr>
<tr valign=top><td>
\endhtmlonly
First, Preprocess generates a <b>public header file</b> (foo.h). This
header file contains all declarations from the interface section, with
class definitions properly expanded to contain member-function
declarations\htmlonly (shown <font color="#ff0000">red</font> in the
example on the right side)\endhtmlonly.
It also contains declarations of non-"<code>static</code>" free
functions found in the implementation section, as well as definitions
for functions declared "<code>inline</code>". Additionally, it
contains all "<code>\#include</code>" directives and function and class
declarations and definitions the inline functions need; these
dependencies need to be declared in the input file. (These features
are not shown in the example\htmlonly on the right side\endhtmlonly.)
If desired, preprocess can also be instructed to hide all inline
functions (and to generate them out-of-line instead), resulting in a
public header file that better insulates clients from implementation
details.
\htmlonly
</td><td bgcolor="#dedec0">
\endhtmlonly
<code><pre>
// Preprocess-generated public header file
\#ifndef foo_h
\#define foo_h
\#include "bar.h"
struct Baz;
class Foo : public Bar
{
private:
Baz* d_baz;
\htmlonly <font color="#ff0000"> \endhtmlonly
public:
int get_info();\htmlonly </font> \endhtmlonly
};
\#endif // foo_h</pre></code>
\htmlonly
</td></tr>
<tr valign=top><td>
\endhtmlonly
Second, a <b>private header file</b> containing all non-public type
definitions (foo_i.h). This file can be used by debugging modules
that need access to implementation-specific data structures.
This file also contains all inline member functions belonging to
classes declared here. (This feature is not shown in the example.)
\htmlonly
</td><td bgcolor="#dedec0">
\endhtmlonly
<code><pre>
// Preprocess-generated private header file
\#ifndef foo_i_h
\#define foo_i_h
struct Baz
{
int data;
};
\#endif // foo_i_h</pre></code>
\htmlonly
</td></tr>
<tr valign=top><td>
\endhtmlonly
Third, an <b>implementation file</b> (foo.cc). This file starts with
declarations for all free "<code>static</code>" functions (not shown in
the example). Otherwise, it comprises all non-inline function
definitions (and static inline functions).
\htmlonly
</td><td bgcolor="#dedec0">
\endhtmlonly
<code><pre>
// Preprocess-generated implementation file
\#include "foo.h"
\#include "foo_i.h"
void Foo::get_info()
{
return d_baz->info();
}</pre></code>
\htmlonly
</td></tr>
</table>
\endhtmlonly
\section OPTIONS Options reference
Output files have names of the following form:
<ul>
<li>Implementation file:
[<var>prepend</var>]<var>outfile_base</var>[<code>-</code><var>suffix</var>]<code>.</code><var>source_ext</var></li>
<li>Public header file:
[<var>prepend</var>]<var>outfile_base</var><code>.</code><var>header_ext</var></li>
<li>Private header file:
[<var>prepend</var>]<var>outfile_base</var><code>_i.</code><var>header_ext</var></li>
</ul>
where [<var>prepend</var>] is an optional filename part that can be
specified using <code>-p</code>, <var>outfile_base</var> needs to be
specified using <code>-c</code>, <var>suffix</var> is an optional
suffix that can be specified using the <code>IMPLEMENTATION</code>
directive, and <var>source_ext</var> and <var>header_ext</var> default
to ".cc" and ".h" but can be overridden using <code>-C</code> and
<code>-H</code>, respectively.
<dl>
<dt><code>-c </code><var>filename_base</var> </dt>
<dd>Specifies the basename of generated file names that appear in
the output files. This option is mandantory.</dd>
<dt><code>-o </code><var>outfile_base</var> </dt>
<dd>Specifies the basename of output files. It defaults to the
value of the <code>-c</code> option.</dd>
<dt><code>-s</code></dt>
<dd>Generate one implementation file per source file, using the base
name of the implementation file as <var>outfile_base</var>, and not one
implementation file per <var>suffix</var> specified as
arguments to <code>IMPLEMENTATION</code> directives in the
source files.</dd>
<dt><code>-p </code><var>prepend</var> </dt>
<dd>Specifies a prefix for all output file names. This prefix is
prepended to <var>filename_base</var> and can contain directory
separators ("<code>/</code>").</dd>
<dt><code>-C </code><var>source_ext</var></dt>
<dd>Specify the extension of generated implementation files.
Defaults to ".cc".</dd>
<dt><code>-H </code><var>header_ext</var></dt>
<dd>Specify the extension of generated header files.
Defaults to ".h".</dd>
<dt><code>-e</code> <var>tag_list</var></dt>
<dd>Enable conditional compilation using the selectors included in
the comma-separated <var>tag_list</var>. This option is
intended to be used in conjunction with the <code>-s</code>
option. See Section
\ref CONDITIONAL \if man CONDITIONAL COMPILATION \endif
for details on this option.</dd>
<dt><code>-t</code> </dt>
<dd>Truncate to size 0 output files for which Preprocess generates
no output. This option supresses even <code>\#include</code>
directives in generated source files that are otherwise empty,
resulting in increased compilation speed for these files.</dd>
<dt><code>-i</code> </dt>
<dd>Generate <code>inline</code> code. If this option is not
given, all code (including code marked "<code>inline</code>")
is generated out-of-line.</dd>
<dt><code>-l</code> </dt>
<dd>Avoid generating <code>\#line</code> directives in output
files. If this option is not given, <code>\#line</code> will be
generated by default.</dd>
<dt><code>-L</code> </dt>
<dd>Avoid generating <code>\#line</code> directives in header files only.
Using this option can speed up builds because the contents of
header files change less frequently, as <code>\#line</code>
directives for (member) function declarations do not have to be
updated every time its definition in the source module changes
its absolute position. (Of course, this assumes that the time
stamp of header files are updated only when the contents of the
files change. See Section
\ref MAKEFILE \if man EXAMPLE MAKEFILE FRAGMENT \endif
for a possible way to
do this.) </dd>
<dt><code>-v</code> </dt>
<dd>Be verbose: Print results of <code>preprocess</code>' parser pass.</dd>
<dt><code>-d</code> </dt>
<dd>Be verbose: Print a diagnostic when dropping a section in
conditional-compilation mode (Option <code>-e</code>).</dd>
</dl>
\section LANGUAGE Language directives
Preprocess understands a number of language directive that control its
behavior.
<dl>
<dt><code>INTERFACE:</code>
<dd>Starts an interface section. Every declaration from such a
section will be copied to the public header file. Class
declarations found here (``public class'') will be completed
with member-function declarations for member functions found in
<code>IMPLEMENTATION</code> sections.
\htmlonly <p> \endhtmlonly
Function definitions are not allowed in this section.
<dt><code>IMPLEMENTATION:</code>
<dd>Starts an implementation section. Preprocess tries to hide
declarations found in these sections in the internal header
file and in the implementation file, as follows:
<dl>
<dt>Class declarations (``private classes'')
<dd>(subject to member-function-declaration completion
as with those in
<code>INTERFACE:</code> sections) end up in the internal
header file -- except if a public inline function of a
public class depends on the private class, in which case
the private class' declaration will be put into the
public header file.
<dt>Include directives
<dd>underlie the same rules as class declarations.
<dt>Function definitions
<dd>are usually held in the implementation file. Public
inline functions, private inline
functions needed by a public inline function, and
functions subject to template instatiation are exported
to the public header file. Other inline functions
(except static non-member inline functions) are put into
the private header file.
<dt>Other code (e.g., variable definitions)
<dd>is put into the implementation file.
</dl>
<dt><code>PUBLIC</code>, <code>PRIVATE</code>, and <code>PROTECTED</code>
<dd>specify member-function visibility.
<dt><code>explicit</code>, <code>static</code>, and <code>virtual</code>
<dd>specify member-function attributes. The attributes will be
copied to the automatically-created member-function
declarations in class declarations (and removed for the actual
function definition, as C++ requires).
<dt><code>inline</code>
<dd>specifies inline functions. This attribute will be retained
for function definitions (but deleted for
automatically-created member-function declarations, as C++
requires). (Inline functions will be
exported subject to the rules defined above.)
<dt><code>inline NEEDS [</code><i>dependencies</i><code>,</code>
<i>...</i> <code>]</code>
<dd>like <code>inline</code>, but additionally specifies types,
functions, and <code>\#include</code> statements that this
inline function depends on and that consequently need to be
exported as well, in front of this inline function. Preprocess
reorders definitions such that all dependencies are defined
before the inline function.
\htmlonly <p> \endhtmlonly
Example:
<blockquote><pre><code>inline NEEDS["foo.h", some_func, Some_class,
Some_other_class::member_func]
int
foo ()
{ }
</code></pre></blockquote>
<dt><code>constexpr</code>
<dd>specifies constexpr functions. Annotating a function with constexpr
implies <code>inline</code>, i.e. it is treated by preprocess as an
inline function. With the only difference that a constexpr function is
always inlined even if the <code>-i</code> option is not used.
</dl>
\subsection ADVANCED Language directives for advanced use
<dl>
<dt><code>IMPLEMENTATION [</code><i>suffix</i><code>]:</code>
<dd>Starts an implementation section with code that will be put
into a nonstandard output file. Instead of landing in
<i>outfile_base</i><code>.cc</code>, the code ends up in
<i>outfile_base</i><code>-</code><i>suffix</i><code>.cc</code>.
This directive is useful if there are several input files that
together make up one input module (which are fed to Preprocess
at the same time and which share one public and one private
header file).
(This form of the IMPLEMENTATION directive works only if
neither the <code>-s</code> (no-suffix) nor the <code>-e</code>
(conditional compilation) options are used. See Section
\ref CONDITIONAL \if man CONDITIONAL COMPILATION \endif
for information on conditional compilation.)
<dt><code>EXTENSION class </code><var>classname</var><code> {</code>
... <code>};</code>
<dd>Extends the definition of class <var>classname</var> (which
usually appears in another input file) with more members. This
clause is usually used when a class can be configured with
several alternative extensions, for example to provide
portability across architectures.
<dt><code>IMPLEMENT</code>
<dd>is a member-function attribute that specifies that the member
function's declaration <em>should not</em> be copied to the
class declaration. Use this attribute to implement an
interface that is already declared in the class declaration.
<dt><code>inline NOEXPORT</code>
<dd>specifies inline functions that will not be exported via the
public header file even if it is a publibly-visible function.
Instead, the function definition will end up in the
implementation file.
<dt><code>inline ALWAYS_INLINE</code>
<dd>specifies a functions that is generated as an inline function
even if the <code>-i</code> option is not used. Use this
specifier for functions that absolutely must be inline even in
debugging builds.
</dl>
\subsection CONDITIONAL Conditional compilation
Conditional compilation is a Preprocess mode that is enabled by using
the "<code>-e</code> <var>tag_list</var>" option.
<dl>
<dt><code>INTERFACE [</code><i>tag_expression</i><code>]:</code> </dt>
<dt><code>IMPLEMENTATION [</code><i>tag_expression</i><code>]:</code></dt>
<dd>A <var>tag_expression</var> is a logical expression with negation (!),
conjunction (-), disjunction (,), and one level of parentheses
({ and }), using selector tags as its atoms. The
<code>INTERFACE</code> or <code>IMPLEMENTATION</code> section
is included in the output only if it is true using the
selectors specified in <var>tag_list</var>.
</dd>
</dl>
Examples:
<pre><code>INTERFACE [a,b]:</code>
// This section is used whenever a or b is contained in the <var>tag_list</var>
<code>INTERFACE [a-b]: </code>
// This section is used whenever a and b are contained in the <var>tag_list</var>
<code>INTERFACE [a,b-c]:</code>
// This section is used whenever a, or b and c are
// contained in the <var>tag_list</var>
<code>INTERFACE [!a]:</code>
// This section is used whenever a is not contained in the <var>tag_list</var>
<code>INTERFACE [{a,b}-c]:</code>
// This section is used whenever a and c, or b and c are
// contained in the <var>tag_list</var>
<code>INTERFACE [!a,b-c]:</code>
// This section is used whenever a is not contained in the <var>tag_list</var>,
// or b and c are contained in the <var>tag_list</var></pre>
\section MISC Usage hints
When you use Preprocess, there are a few things you need to keep in
mind.
<ul>
<li>Preprocess currently does not support namespaces and nested
classes. It is possible to use namespaces and nested classes
defined elsewhere (for example, in a library header file), but
you cannot define new namespaces and nested classes.
\htmlonly <p> \endhtmlonly
<li>Preprocess copies function declarations for publicly visible
functions to the public header file. If you use user-defined
types in function signatures, you need to "<code>\#include</code>"
the corresponding header files (or add forward declarations) in
the "<code>INTERFACE:</code>" section of your module. Private
inline functions (which might end up in the public header file)
need to specify their include dependencies in a "<code>NEEDS[]</code>"
clause.
\htmlonly <p> \endhtmlonly
Also, if you use names declared in an (externally-defined)
namespace (such as namespace "<code>std</code>"), you must
specify the fully-qualified name (including the namespace) in
the function signature (unless you use a "<code>using
namespace</code>" directive in the "<code>INTERFACE:</code>"
section, which is not recommended).
\htmlonly <p> \endhtmlonly
<li>Don't forget to specify inline functions required by other
inline functions in the latter's "<code>NEEDS</code>" clause.
Otherwise, Preprocess cannot guarantee the correct
inline-function order in the output, and you may get compiler
warnings like ``inline function is used but not defined.'' This
problem is reinforced when using private inline functions,
because Preprocess moves them out of the public header file
(into the private header file) unless a public function's
"<code>NEEDS</code>" clause requires them.
</ul>
\section MAKEFILE Example Makefile fragment
\htmlonly
<table border=0><tr valign=top>
<td width="70%" valign=top>
\endhtmlonly
This is an example fragment from a Makefile (for GNU Make) that
generates <code>*.cc</code>, <code>*.h</code>, and <code>*_i.h</code>
files on the fly. It only updates the generated files if they
actually change; that is, if you change something in the
implementation section that does not influence the header files, they
will not be updated, avoiding recompilation of files that depend on
them.
This Makefile fragment needs GNU Make and the <a
href="move-if-change">move-if-change</a> script that only updates a
target if it is different from the source.
This example assumes that you do not use the
<code>IMPLEMENTATION[</code><var>suffix</var><code>]</code>
directive. If you do plan using this directive, a more elaborate
mechanism is needed, such as the one used in the Makefiles for the
<a href="http://os.inf.tu-dresden.de/fiasco/">Fiasco microkernel</a>.
\htmlonly
</td>
<td bgcolor="#dedede">
\endhtmlonly
<pre><code>PREPROCESS = preprocess
.PRECIOUS: stamp-%.ready
stamp-%.ready: %.cpp
\$(PREPROCESS) -i -o new_\$* -c \$* \$<
./move-if-change new_\$*.h \$*.h
./move-if-change new_\$*_i.h \$*_i.h
./move-if-change new_\$*.cc \$*.cc
touch \$@
%.cc: stamp-%.ready
@[ -e \$@ ] || { rm -f \$<; \$(MAKE) \$<; }
%.h: stamp-%.ready
@[ -e \$@ ] || { rm -f \$<; \$(MAKE) \$<; }
\%_i.h: stamp-%.ready
@[ -e \$@ ] || { rm -f \$<; \$(MAKE) \$<; }</code></pre></td>
\htmlonly
</tr></table>
\endhtmlonly
<!-- ------------------------------------------------------------------- -->
\section BUGS Limitations and ideas for future extensions
<h3>Bugs</h3>
<ul>
<li>Namespaces and nested classes currently are unsupported.
<li>The <code>\#line</code> directives Preprocess generates sometimes
are offset plus/minus one or two lines to the real code.
<li>Preprocess doesn't really understand preprocessor constructs
besides <code>\#include</code> and <code>\#if 0</code>; it just
copies all other direcitives into the output as it finds them.
That makes it easy for you to shoot yourself into the foot.
</ul>
<h3>Ideas for future extensions</h3>
<ul>
<li>Generate HTML documentation for modules/classes.
<li>Auto-generated getters and setters for attributes
<li>Auto-generate insulation (wrappers, protocol classes,
procedural interface) for any given class.
<li>Transform input <code>.cpp</code> files into new
<code>.cpp</code> files, refactoring or renaming code on the
fly.
<li>Aspect-oriented programming: Weave in extensions (``aspects'')
to member functions. Aspects can be
synchronization or debugging checks, for example.
<li>Support for class invariants (design by contract)
<li>Enforce a set of naming conventions.
</ul>
\section DOWNLOAD Download
Preprocess is free software licensed under the GNU General Public
License. Its implementation language is Perl, so you need a Perl5
interpreter to run it.
You can download Preprocess as CVS module "<code>preprocess</code>"
from the DROPS project's remote-CVS server. Please refer to the <a
href="http://os.inf.tu-dresden.de/drops/download.html">download
instructions</a> on DROPS' website.
\section LIST Mailing list
There is a mailing list to which CVS-commit messages for changes made
to preprocess are posted. Please ask me if you would like to be put
on this list (see Section \ref AUTHOR \if man AUTHOR \endif).
New releases are periodically announced on <a
href=http://freshmeat.net/projects/preprocess/"">the Freshmeat
website</a>. If you are a registered Freshmeat user, you can <a
href="http://freshmeat.net/subscribe/36508/">subscribe to these
release announcements</a>\if man at
http://freshmeat.net/subscribe/36508/\endif.
\section AUTHOR Author
Michael Hohmuth <hohmuth@inf.tu-dresden.de>
\section SEE See also
<a href="http://os.inf.tu-dresden.de/~hohmuth/prj/preprocess/move-if-change"><code>move-if-change</code></a>(1) shell script\if man
: http://os.inf.tu-dresden.de/~hohmuth/prj/preprocess/move-if-change
\endif
\if man
<a
href="http://os.inf.tu-dresden.de/~hohmuth/prj/preprocess/">Preprocess
project web page</a>
: http://os.inf.tu-dresden.de/~hohmuth/prj/preprocess/
\endif
Preprocess was originally written for the <a
href="http://os.inf.tu-dresden.de/fiasco/">Fiasco microkernel</a>\if man
: http://os.inf.tu-dresden.de/fiasco/
\endif.
*/

View File

@@ -0,0 +1,25 @@
#
# Makefile for the preprocess sources
#
# scan the L4 global configuration file
L4DIR ?= ../../..
include $(L4DIR)/mk/Makeconf
-include Makeconf.local
TARGET = preprocess
all:: $(TARGET)
install:: all
-$(INSTALL) -d $(DROPS_STDDIR)/tool/bin
$(INSTALL) -m 755 $(TARGET) $(DROPS_STDDIR)/tool/bin
clean::
# $(RM) $(TARGET) $(OBJS) tmp.*
cleanall:: clean
$(RM) *~ .*.d
#include $(DEPS)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,156 @@
# scan the L4 global configuration file
L4DIR ?= ../../..
#include $(L4DIR)/mk/Makeconf
TOOL = ../src/preprocess
all:: test
ALL_TESTS = $(TOOL_TESTS)
TOOL_TESTS = mapping mapping_inline random random_inline extern_c static \
noinline explicit operator template template_inline c-preproc \
inline inline_noinline \
parser parser_noinline \
multifile variable line line_not line_nh interface comment_in_string \
default_args drop_single1 drop_single2 drop_single3 drop_multi1 \
drop_multi2 implement_template implement_default implement_default_err \
nested_class template_base_class func_defs extension_inherit \
tag_enabled
mapping_inline_src = mapping
mapping_inline_flags = -i
random_inline_src = random
random_inline_flags = -i
static_flags = -i
inline_flags = -i
inline_noinline_src = inline
inline_noinline_flags =
noinline_flags = -i
template_inline_src = template
template_inline_flags = -i
parser_flags = -i
parser_noinline_src = parser
parser_noinline_flags =
multifile_src = multifile1 multifile2
multifile_flags = -i
multifile_extra = multifile-part1.cc multifile-part2.cc
line_not_src = line
line_not_flags = -l
line_nh_src = line
line_nh_flags = -L
interface_missing = interface.h
interface_extra = interfacepublic.h
drop_single1_src = dropsection
drop_single1_flags = -s -e "bax"
drop_single2_src = dropsection
drop_single2_flags = -s -e "bax ixbix"
drop_single3_src = dropsection
drop_single3_flags = -s -e "bax aba"
drop_multi1_src = dropsection dropsection-ext
drop_multi1_flags = -s -e "bax aba"
drop_multi1_extra = drop_multi1-ext.cc
drop_multi2_src = dropsection dropsection-ext
drop_multi2_flags = -s -e "bax aba ext"
drop_multi2_extra = drop_multi2-ext.cc
ifdef_src = ifdef
ifdef_flags = -s -e "true"
ifdef1_src = ifdef1
ifdef1_flags = -s -e "true"
ifdef1_extra = ifdef1-more.cpp
implement_default_redirect = 2>implement_default.stderr
implement_default_extra = implement_default.stderr
implement_default_err_redirect = 2>implement_default_err.stderr; test $$? -ne 0
implement_default_err_extra = implement_default_err.stderr
implement_default_err_missing += implement_default_err.h
implement_default_err_missing += implement_default_err_i.h
implement_default_err_missing += implement_default_err.cc
tag_enabled_src = tag_enabled
tag_enabled_flags = -e tag_defined
random.cpp: combine.pl
perl $< > $@.new
mv $@.new $@
clean::
rm -f random.cpp
test_rules: Makefile
rm -f $@.new
for test in $(TOOL_TESTS); \
do \
echo "ifndef $${test}_src" >> $@.new; \
echo "$${test}_src = $${test}" >> $@.new; \
echo "endif" >> $@.new; \
echo "ifndef $${test}_flags" >> $@.new; \
echo "$${test}_flags = " >> $@.new; \
echo "endif" >> $@.new; \
echo "ifndef $${test}_redirect" >> $@.new; \
echo "$${test}_redirect = " >> $@.new;\
echo "endif" >> $@.new; \
echo "$${test}.cc: \$$(addsuffix .cpp, \$$($${test}_src)) \$$(TOOL); \$$(TOOL) \$$($${test}_flags) -c $${test} \$$(filter-out \$$(TOOL), \$$^) \$$($${test}_redirect)" >> $@.new; \
echo "ifdef $${test}_extra" >> $@.new; \
echo "clean:: ; \$$(RM) \$$($${test}_extra)" >> $@.new; \
echo "endif" >> $@.new; \
done
mv $@.new $@
include test_rules
clean::
rm -f $(addsuffix .cc, $(TOOL_TESTS)) \
$(addsuffix .h, $(TOOL_TESTS)) \
$(addsuffix _i.h, $(TOOL_TESTS))
.PHONY: test
test: $(addsuffix .t.ok, $(ALL_TESTS))
%.t.ok: %.cc
@echo -n "Running test $* ... "
ifeq ($(RECREATE_OUTPUT),1)
@cp $(filter-out $($*_missing),$*.h $*_i.h $*.cc) $($*_extra) verify/
endif
@ERROR=0; \
for i in $(filter-out $($*_missing),$*.h $*_i.h $*.cc) $($*_extra); \
do \
if ! diff --color -u verify $$i; then ERROR=1; fi; \
done; \
test $$ERROR -eq 0
@echo "OK"
@touch $@
.PHONY: init
init:
$(MAKE) test RECREATE_OUTPUT=1
install:
@echo Not installing tests.
clean::
$(RM) $(ALL) $(OBJS) *.t.ok
cleanall:: clean
$(RM) *~ .*.d test_rules
#include $(DEPS)

View File

@@ -0,0 +1,19 @@
INTERFACE:
IMPLEMENTATION:
// set CS (missing from OSKIT)
#define set_cs(cs) \
asm volatile \
("ljmp %0,$1f \n1:" \
: : "i" (cs));
void
function (void)
{
#if 1
bar ();
#else
foo ();
#endif
}

View File

@@ -0,0 +1,59 @@
#!/usr/bin/env perl
use warnings;
print '
INTERFACE:
#include "bar.h"
class Baz;
class Foo : public Bar
{
// DATA
int d_data;
Baz* d_baz;
};
IMPLEMENTATION:
#include "yes.h"
#include <no.h>
class Rambo
{
};
// Try combinations of {PUBLIC|PROTECTED|PRIVATE|} {static|}
// {inline|INLINE|inline NEEDS[]|INLINE NEEDS[]} {virtual|}
';
$count = 0;
foreach my $class ("Foo", "")
{
foreach my $public ("PUBLIC", "PROTECTED", "PRIVATE", "")
{
foreach my $static ("static", "")
{
foreach my $inline ("inline", "INLINE",
"inline NEEDS [Rambo,\"yes.h\"]",
"INLINE NEEDS[Rambo, \"yes.h\"]", "")
{
foreach my $virtual ("virtual", "")
{
next if ($public ne '') && ($class eq '');
next if ($virtual ne '') && (($static ne '')
|| ($class eq ''));
print "$public $virtual $static $inline\n";
print "void ";
print "${class}::" if ($class ne '');
print "function" . $count++;
print "() {}\n\n";
}
}
}
}
}

View File

@@ -0,0 +1,23 @@
INTERFACE:
IMPLEMENTATION:
int foo(char *s);
void irq_init(unsigned char master_base, unsigned char slave_base)
{
if (!(foo(" -vmware"))
{
foo("outb_p(MASTER_OCW, 0xfb); // unmask irq2");
}
else
{
foo("using normal pic mode \n");
}
}
void bar()
{
foo ("if (0) {");
foo ("} // if(0)");
}

View File

@@ -0,0 +1,32 @@
#include <vector>
IMPLEMENTATION:
template <typename T>
std::vector<T>
vec(T f1 = T(), T f2 = T(), T f3 = T(),
T f4 = T(), T f5 = T(), T f6 = T())
{
std::vector<T> v;
if (f1 != T()) {
v.push_back (f1);
if (f2 != T()) {
v.push_back (f2);
if (f3 != T()) {
v.push_back (f3);
if (f4 != T()) {
v.push_back (f4);
if (f5 != T()) {
v.push_back (f5);
if (f6 != T()) {
v.push_back (f6);
}}}}}}
return v;
}
extern "C"
void
disasm_bytes(char *buffer, unsigned len, unsigned va, unsigned task,
int show_symbols, int show_intel_syntax,
int (*peek_task)(unsigned addr, unsigned task),
const char* (*get_symbol)(unsigned addr, unsigned task)) WEAK;

View File

@@ -0,0 +1,26 @@
INTERFACE [ext]:
/**
* Preprocess should discard this comment and adjust the line directive
* accordingly.
*/
EXTENSION class Gen_foo : public Gen_bar
{
public:
int extra_var;
};
EXTENSION class Gen_foo_ext : public Gen_baz
{
private:
char *extension;
};
IMPLEMENTATION [ext]:
PRIVATE int
Gen_foo::do_something_private()
{
// just do it
}

View File

@@ -0,0 +1,60 @@
INTERFACE:
class Gen_foo
{
public:
int baz;
protected:
int foo( int );
};
class Gen_foo_ext : private Gen_foo, public Ixdebix
{
protected:
unsigned stuff;
};
IMPLEMENTATION:
PUBLIC inline void
Gen_foo::bar( unsigned x )
{
// do soemthing with x;
}
PUBLIC void
Gen_foo_ext::test()
{
// the test
}
IMPLEMENTATION [ixbix-bax]:
IMPLEMENT int
Gen_foo::foo( int y )
{
// do something strange with y
bar(y);
return y;
}
IMPLEMENTATION [aba-bax]:
IMPLEMENT int
Gen_foo::foo( int y )
{
// just return y
return y;
}
IMPLEMENTATION [{!bax,!ixbix}]:
PUBLIC int
Gen_foo::tust( int y )
{
// just return y
return y;
}

View File

@@ -0,0 +1,11 @@
INTERFACE:
class Foo
{
};
IMPLEMENTATION:
PUBLIC explicit
Foo::Foo (int bar)
{}

View File

@@ -0,0 +1,155 @@
INTERFACE:
// Variable number of class inheritance extensions
class Class_b0_e1
{
};
EXTENSION class Class_b0_e1 : Ext_base_0
{
};
// ----------------------------------------------------------------------
class Class_b0_e1_e1
{
};
EXTENSION class Class_b0_e1_e1 : Ext_base_0
{
};
EXTENSION class Class_b0_e1_e1 : Ext2_base_0
{
};
// ----------------------------------------------------------------------
class Class_b0_e2
{
};
EXTENSION class Class_b0_e2 : Ext_base_0, Ext_base_1
{
};
// ----------------------------------------------------------------------
class Class_b0_e2_e1
{
};
EXTENSION class Class_b0_e2_e1 : Ext_base_0, Ext_base_1
{
};
EXTENSION class Class_b0_e2_e1 : Ext2_base_0
{
};
// ----------------------------------------------------------------------
class Class_b1_e1 : Base_0
{
};
EXTENSION class Class_b1_e1 : Ext_base_0
{
};
// ----------------------------------------------------------------------
class Class_b1_e1_e1 : Base_0
{
};
EXTENSION class Class_b1_e1_e1 : Ext_base_0
{
};
EXTENSION class Class_b1_e1_e1 : Ext2_base_0
{
};
// ----------------------------------------------------------------------
class Class_b1_e2 : Base_0
{
};
EXTENSION class Class_b1_e2 : Ext_base_0, Ext_base_1
{
};
// ----------------------------------------------------------------------
class Class_b1_e2_e1 : Base_0
{
};
EXTENSION class Class_b1_e2_e1 : Ext_base_0, Ext_base_1
{
};
EXTENSION class Class_b1_e2_e1 : Ext2_base_0
{
};
// ----------------------------------------------------------------------
class Class_b2_e1 : Base_0, Base_1
{
};
EXTENSION class Class_b2_e1 : Ext_base_0
{
};
// ----------------------------------------------------------------------
class Class_b2_e1_e1 : Base_0, Base_1
{
};
EXTENSION class Class_b2_e1_e1 : Ext_base_0
{
};
EXTENSION class Class_b2_e1_e1 : Ext2_base_0
{
};
// ----------------------------------------------------------------------
class Class_b2_e2 : Base_0, Base_1
{
};
EXTENSION class Class_b2_e2 : Ext_base_0, Ext_base_1
{
};
// ----------------------------------------------------------------------
class Class_b2_e2_e1 : Base_0, Base_1
{
};
EXTENSION class Class_b2_e2_e1 : Ext_base_0, Ext_base_1
{
};
EXTENSION class Class_b2_e2_e1 : Ext2_base_0
{
};
// Variable spacing around class inheritance extensions
class Class_var : Base_0 /* Unconvenient comment
that wraps around */ {
};
EXTENSION class Class_var
: Ext_base_0
{
};
EXTENSION class Class_var : Ext2_base_0
{
};
EXTENSION class Class_var : Ext3_base_0 {};
IMPLEMENTATION:

View File

@@ -0,0 +1,8 @@
INTERFACE:
IMPLEMENTATION:
extern "C"
{
extern char _mappings_1, _mappings_end_1;
}

View File

@@ -0,0 +1,60 @@
INTERFACE:
class Test
{
};
IMPLEMENTATION:
PUBLIC
void
Test::func1() const throw()
{}
PUBLIC
void
Test::func2() throw(int, char const *) override final
{};
PUBLIC
void
Test::func3(unsigned) noexcept final override
{}
PUBLIC
void
Test::func4(int) noexcept ( this->func2() )
{}
PUBLIC explicit
Test::Test(int) noexcept(true) __attribute__ (( test("str") )) final
: init(This)
{}
PUBLIC
void
Test::func5() noexcept ( this->func2() ) [[test(attr)]] [[test2]]
{}
PUBLIC [[cppattr]] [[another_attr]] static inline
int
Test::func_attr_no_needs()
{}
PUBLIC [[anattr]] inline NEEDS["bar_fails"]
int
Test::func_attr_needs()
{}
PUBLIC inline
int attribute((foo("murx("))) [[this->is->a->test]]
Test::func_with_stupid_attributes(Tmpl<Type> x) const && throw() = default;
/**
* This is the comment for `free_function`.
*/
Test const &
free_function(int, long a) noexcept
{
return Test(a);
}

View File

@@ -0,0 +1,33 @@
INTERFACE:
class Test
{
public:
void warn_func1();
void warn_func2();
void func1();
void func2();
void defl();
// skip this as the test cannot deal with errors
// void err_func1();
};
IMPLEMENTATION:
IMPLEMENT_DEFAULT void Test::warn_func1() { /* this is the default */ }
IMPLEMENT void Test::warn_func1() { /* this is the override */ }
IMPLEMENT void Test::warn_func2() { /* this is the override */ }
IMPLEMENT_DEFAULT void Test::warn_func2() { /* this is the default */ }
IMPLEMENT_DEFAULT void Test::func1() { /* this is the default */ }
IMPLEMENT_OVERRIDE void Test::func1() { /* this is the override */ }
IMPLEMENT_OVERRIDE void Test::func2() { /* this is the override */ }
IMPLEMENT_DEFAULT void Test::func2() { /* this is the default */ }
IMPLEMENT_DEFAULT void Test::defl() { /* this is the default */ }
// skip this as the test cannot deal with errors
// IMPLEMENT_OVERRIDE void Test::err_func1() { /* this is the override */ }

View File

@@ -0,0 +1,11 @@
INTERFACE:
class Test
{
public:
void err_func1();
};
IMPLEMENTATION:
IMPLEMENT_OVERRIDE void Test::err_func1() { /* this is the override */ }

View File

@@ -0,0 +1,31 @@
INTERFACE:
template< typename T >
class Test
{
public:
void test_func();
};
IMPLEMENTATION:
IMPLEMENT
template< typename T >
// comment
void __attribute__((deprecated))
Test<T>::test_func()
{
}
PUBLIC
template< typename T > // comment 1
template<
typename X, // comment within template args list
typename X2 // another comment in tl args
>
// comment 2
void __attribute__((deprecated))
Test<T>::test_func2<X, X2>()
{
}

View File

@@ -0,0 +1,112 @@
INTERFACE:
class Foo
{
};
class Bar
{
};
class Cexpr
{
constexpr test1();
};
IMPLEMENTATION:
// Test dependency-chain resolver
class Frob
{
};
inline
bool
Frob::private_func()
{
}
inline
bool
Foo::private_func()
{
}
inline
bool
Bar::private_func()
{
}
constexpr
bool
Frob::private_cexpr()
{
}
inline NEEDS [Foo::private_func, Bar::private_func]
void
Bar::another_private_func()
{
}
PUBLIC inline NEEDS [Bar::another_private_func, Frob::private_func]
void
Bar::public_func()
{
}
// This inline funtion is public only because it is needed by an
// extern-"C" function. So we do not want to export it.
PUBLIC inline NOEXPORT
void
Foo::bar()
{
}
// Try both NOEXPORT and NEEDED.
PUBLIC inline NOEXPORT NEEDS[Foo::private_func]
void
Foo::baz()
{
}
PUBLIC constexpr NEEDS[Foo::private_func]
void
Foo::cexpr1()
{
}
PUBLIC constexpr NOEXPORT
void
Foo::cexpr2()
{
}
IMPLEMENT constexpr
void
Cexpr::test1()
{
}
IMPLEMENT inline constexpr
void
Cexpr::test2()
{
}
extern "C"
void function (Foo* f)
{
f->bar();
f->cexpr2();
}
template <typename T> inline void* xcast(T* t)
{
return (void*) t;
}

View File

@@ -0,0 +1,15 @@
INTERFACE [interfacepublic]:
// This is class Foo.
class Foo
{
};
IMPLEMENTATION:
PUBLIC
void
Foo::func1()
{
}

View File

@@ -0,0 +1,20 @@
INTERFACE:
// This is class Foo.
class Foo
{
};
IMPLEMENTATION:
// A long, multiline comment in front of this function definition.
// Also, a lot of specifiers that need to be handled.
PUBLIC
inline
static
void
Foo::func1()
{
}

View File

@@ -0,0 +1,784 @@
INTERFACE:
#include <flux/x86/types.h> // for vm_offset_t, vm_size_t
#include "space.h" // for space_index_t
enum mapping_type_t { Map_mem = 0, Map_io };
class mapping_tree_t; // forward decls
struct mapping_s;
//
// class mapping_t
//
class mapping_t
{
friend class mapdb_t;
friend class mapping_tree_t;
friend class jdb;
// CREATORS
mapping_t(const mapping_t&); // this constructor is undefined.
// DATA
char _data[5];
} __attribute__((packed));
class kmem_slab_t;
struct physframe_data;
//
// class mapdb_t: The mapping database
//
class mapdb_t
{
friend class jdb;
public:
enum { Size_factor = 4,
Size_id_max = 8 /* can be up to 15 (4 bits) */ };
private:
// DATA
physframe_data *physframe;
kmem_slab_t *allocator_for_treesize[Size_id_max + 1];
};
IMPLEMENTATION:
// The mapping database.
// This implementation encodes mapping trees in very compact arrays of
// fixed sizes, prefixed by a tree header (mapping_tree_t). Array
// sizes can vary from 4 mappings to 4<<15 mappings. For each size,
// we set up a slab allocator. To grow or shrink the size of an
// array, we have to allocate a larger or smaller tree from the
// corresponding allocator and then copy the array elements.
//
// The array elements (mapping_t) contain a tree depth element. This
// depth and the relative position in the array is all information we
// need to derive tree structure information. Here is an example:
//
// array
// element depth
// number value comment
// --------------------------
// 0 0 Sigma0 mapping
// 1 1 child of element #0 with depth 0
// 2 2 child of element #1 with depth 1
// 3 2 child of element #1 with depth 1
// 4 3 child of element #3 with depth 2
// 5 2 child of element #1 with depth 1
// 6 3 child of element #5 with depth 2
// 7 1 child of element #0 with depth 0
//
// This array is a pre-order encoding of the following tree:
//
// 0
// / \
// 1 7
// / | \
// 2 3 5
// | |
// 4 6
// IDEAS for enhancing this implementation:
// We often have to find a tree header corresponding to a mapping.
// Currently, we do this by iterating backwards over the array
// containing the mappings until we find the Sigma0 mapping, from
// whose address we can compute the address of the tree header. If
// this becomes a problem, we could add one more byte to the mappings
// with a hint (negative array offset) where to find the sigma0
// mapping. (If the hint value overflows, just iterate using the hint
// value of the mapping we find with the first hint value.) Another
// idea (from Adam) would be to just look up the tree header by using
// the physical address from the page-table lookup, but we would need
// to change the interface of the mapping database for that (pass in
// the physical address at all times), or we would have to include the
// physical address (or just the address of the tree header) in the
// mapdb_t-user-visible mapping_t (which could be different from the
// internal tree representation). (XXX: Implementing one of these
// ideas is probably worthwile doing!)
// Instead of copying whole trees around when they grow or shrink a
// lot, or copying parts of trees when inserting an element, we could
// give up the array representation and add a "next" pointer to the
// elements -- that is, keep the tree of mappings in a
// pre-order-encoded singly-linked list (credits to: Christan Szmajda
// and Adam Wiggins). 24 bits would probably be enough to encode that
// pointer. Disadvantages: Mapping entries would be larger, and the
// cache-friendly space-locality of tree entries would be lost.
// The current handling of superpages sucks rocks both in this module
// and in our user, ipc_map.cc. We could support multiple page sizes
// by not using a physframe[] array only for the largest page size.
// (Entries of that array point to the top-level mappings -- sigma0
// mappings.) Mapping-tree entries would then either be regular
// mappings or pointers to an array of mappings of the next-smaller
// size. (credits: Christan Szmajda)
//
// physframe[]
// -------------------------------
// | | | | | | | | | | | | | | | | array of ptr to 4M mapping_tree_t's
// ---|---------------------------
// |
// v a mapping_tree_t
// ---------------
// | | tree header
// |-------------|
// | | mapping_t *or* ptr to array of ptr to 4K trees
// | | e.g.
// | ----------------|
// | | v array of ptr to 4M mapping_tree_t's
// --------------- -------------------------------
// | | | | | | | | | | | | | | | |
// ---|---------------------------
// |
// v a mapping_tree_t
// ---------------
// | | tree header
// |-------------|
// | | mapping_t
// | |
// | |
// | |
// ---------------
//-
#include <assert.h>
#include <string.h>
#ifndef offsetof // should be defined in stddef.h, but isn't
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
#endif
// For implementation of mapping_t functions, we need mapping_tree_t.
//
// class mapping_tree_t
//
class mapping_tree_t
{
friend class mapping_t;
friend class mapdb_t;
friend class jdb;
// DATA
unsigned _count: 16;
unsigned _size_id: 4;
unsigned _empty_count: 11;
unsigned _unused: 1; // make this 32 bits to avoid a compiler bug
mapping_t _mappings[0] __attribute__((packed));
} __attribute__((packed));
// public routines with inline implementations
inline
unsigned
mapping_tree_t::number_of_entries() const
{
return mapdb_t::Size_factor << _size_id;
}
inline
mapping_t *
mapping_tree_t::mappings()
{
return & _mappings[0];
}
// Define (otherwise private) stuff needed by public inline
// functions.
enum mapping_depth_t
{
Depth_sigma0_mapping = 0, Depth_max = 253,
Depth_empty = 254, Depth_end = 255
};
struct mapping_s
{
unsigned space:11;
unsigned size:1;
unsigned address:20;
mapping_depth_t depth:8;
unsigned do_not_touch: 24; // make this 64 bits, and make sure the
// compiler never touches memory after the
// real data
};
inline
mapping_t::mapping_t()
{}
inline
mapping_s *
mapping_t::data()
{
return reinterpret_cast<mapping_s*>(_data);
}
PUBLIC inline NEEDS[mapping_depth_t, mapping_s, mapping_t::data]
space_index_t
mapping_t::space()
{
return space_index_t(data()->space);
}
PUBLIC inline NEEDS[mapping_depth_t, mapping_s, mapping_t::data]
vm_offset_t
mapping_t::vaddr()
{
return (data()->address << PAGE_SHIFT);
}
PUBLIC inline NEEDS[mapping_depth_t, mapping_s, mapping_t::data]
vm_size_t
mapping_t::size()
{
if ( data()->size )
return SUPERPAGE_SIZE;
else
return PAGE_SIZE;
}
PUBLIC inline
mapping_type_t
mapping_t::type()
{
// return data()->type;;
return Map_mem;
}
inline NEEDS[mapping_depth_t, mapping_s, mapping_t::data]
bool
mapping_t::unused()
{
return (data()->depth > Depth_max);
}
mapping_tree_t *
mapping_t::tree()
{
mapping_t *m = this;
while (m->data()->depth > Depth_sigma0_mapping)
{
// jump in bigger steps if this is not a free mapping
if (! m->unused())
{
m -= m->data()->depth;
continue;
}
m--;
}
return reinterpret_cast<mapping_tree_t *>
(reinterpret_cast<char *>(m) - offsetof(mapping_tree_t, _mappings));
}
//
// more of class mapping_t
//
PUBLIC mapping_t *
mapping_t::parent()
{
if (data()->depth <= Depth_sigma0_mapping)
{
// Sigma0 mappings don't have a parent.
return nullptr;
}
// Iterate over mapping entries of this tree backwards until we find
// an entry with a depth smaller than ours. (We assume here that
// "special" depths (empty, end) are larger than Depth_max.)
mapping_t *m = this - 1;
while (m->data()->depth >= data()->depth)
m--;
return m;
}
PUBLIC mapping_t *
mapping_t::next_iter()
{
mapping_tree_t *t = tree();
mapping_t *last_in_tree = t->mappings() + t->number_of_entries() - 1;
mapping_t *m = this;
// Look for a valid element in the tree structure.
while (m != last_in_tree)
{
m++;
if (! m->unused())
return m; // Found a valid entry!
// Don't iterate to end of tree if this is the last tree entry.
if (m->data()->depth == Depth_end)
return 0;
}
// Couldn't find a non-empty element behind ourselves in the tree
// structure.
return 0;
}
PUBLIC mapping_t *
mapping_t::next_child(mapping_t *parent)
{
// Find the next valid entry in the tree structure.
mapping_t *m = next_iter();
// If we didn't find an entry, or if the entry cannot be a child of
// "parent", return nullptr
if (m == 0
|| m->data()->depth <= parent->data()->depth)
return nullptr;
return m; // Found!
}
// helpers
//
// class mapping_tree_t
//
// This function copies the elements of mapping tree src to mapping
// tree dst, ignoring empty elements (that is, compressing the
// source tree. In-place compression is supported.
PUBLIC static void
mapping_tree_t::copy_compact_tree(mapping_tree_t *dst, mapping_tree_t *src)
{
dst->_count = 0;
dst->_empty_count = 0;
mapping_t *d = dst->mappings();
for (mapping_t *s = src->mappings();
s < src->mappings() + src->number_of_entries();
s++)
{
if (s->unused()) // entry free
{
if (s->data()->depth == Depth_end)
break;
continue;
}
*d++ = *s;
dst->_count += 1;
}
assert (dst->_count == src->_count);
assert (d < dst->mappings() + dst->number_of_entries());
d->data()->depth = Depth_end;
dst->mappings()[dst->number_of_entries() - 1].data()->depth = Depth_end;
} // copy_compact_tree()
//
// class mapdb
//
#include "lock.h"
#include "kmem_slab.h"
struct physframe_data {
mapping_tree_t *tree;
helping_lock_t lock;
};
PUBLIC
mapdb_t::mapdb_t()
{
vm_offset_t page_number = kmem::info()->main_memory.high / PAGE_SIZE + 1;
// allocate physframe array
check ( physframe = reinterpret_cast<physframe_data *>
(kmem::alloc(page_number * sizeof(physframe_data))) );
memset(physframe, 0, page_number * sizeof(physframe_data));
// create a slab for each mapping tree size
for (int slab_number = 0;
slab_number <= Size_id_max;
slab_number++ )
{
unsigned elem_size =
(Size_factor << slab_number) * sizeof(mapping_t)
+ sizeof(mapping_tree_t);
allocator_for_treesize[slab_number] =
new kmem_slab_t(((PAGE_SIZE / elem_size) < 40
? 8*PAGE_SIZE : PAGE_SIZE),
elem_size, 1);
}
// create a sigma0 mapping for all physical pages
for (unsigned page_id = 0; page_id < page_number; page_id++)
{
mapping_tree_t *t;
check( (t = physframe[page_id].tree
= reinterpret_cast<mapping_tree_t*>
(allocator_for_treesize[0]->alloc())) );
t->_count = 1; // 1 valid mapping
t->_size_id = 0; // size is equal to Size_factor << 0
t->_empty_count = 0; // no gaps in tree representation
t->mappings()[0].data()->depth = Depth_sigma0_mapping;
t->mappings()[0].data()->address = page_id;
t->mappings()[0].data()->space = config::sigma0_taskno;
t->mappings()[0].data()->size = 0;
t->mappings()[1].data()->depth = Depth_end;
// We also always set the end tag on last entry so that we can
// check whether it has been overwritten.
t->mappings()[t->number_of_entries() - 1].data()->depth = Depth_end;
}
} // mapdb_t()
// insert a new mapping entry with the given values as child of
// "parent" After locating the right place for the new entry, it will
// be stored there (if this place is empty) or the following entries
// moved by one entry.
// We assume that there is at least one free entry at the end of the
// array so that at least one insert() operation can succeed between a
// lock()/free() pair of calls. This is guaranteed by the free()
// operation which allocates a larger tree if the current one becomes
// to small.
PUBLIC mapping_t *
mapdb_t::insert(mapping_t *parent,
space_t *space,
vm_offset_t va,
vm_size_t size,
mapping_type_t type)
{
assert(type == Map_mem); // we don't yet support Map_io
mapping_tree_t *t = parent->tree();
// We cannot continue if the last array entry is not free. This
// only happens if an earlier call to free() with this mapping tree
// couldn't allocate a bigger array. In this case, signal an
// out-of-memory condition.
if (! t->mappings()[t->number_of_entries() - 1].unused())
return nullptr;
// If the parent mapping already has the maximum depth, we cannot
// insert a child.
if (parent->data()->depth == Depth_max)
return nullptr;
mapping_t *insert = 0;
bool
found_free_entry = false,
need_to_move = false;
mapping_t temp;
// Find a free entry in the array encoding the tree, and find the
// insertion point for the new entry. These two entries might not
// be equivalent, so we may need to move entries backwards in the
// array. In this implementation, we move entries as we traverse
// the array, instead of doing one big memmove
for (mapping_t *m = parent + 1;
m < t->mappings() + t->number_of_entries();
m++)
{
if (m->unused())
{
// We found a free entry in the tree -- allocate it.
found_free_entry = true;
t->_count += 1;
// Did we find an empty element != the end tag?
if (m->data()->depth == Depth_empty)
{
t->_empty_count -= 1;
}
// Else we have found the end tag. If there is another
// array entry left, apply a new end tag to the array
else if (m + 1 < t->mappings() + t->number_of_entries())
{
(m + 1)->data()->depth = Depth_end;
}
// if we haven't identified a place for inserting the new
// element, this is it.
if (! need_to_move)
insert = m;
}
else if (! need_to_move
&& m->data()->depth <= parent->data()->depth)
{
// we found a non-descendant of ourselves -- need to make
// space for new child
need_to_move = true;
insert = m;
temp = *insert;
continue;
}
if (need_to_move)
{
// replace *m with temp (which used to be *(m - 1); but
// *(m - 1) has since been overwritten), and load temp with
// the old value of *m
mapping_t temp2;
temp2 = *m;
*m = temp;
temp = temp2;
}
if (found_free_entry)
break;
}
assert(insert && found_free_entry);
// found a place to insert new child.
insert->data()->depth = mapping_depth_t(parent->data()->depth + 1);
insert->data()->address = va >> PAGE_SHIFT;
insert->data()->space = space->space();
insert->data()->size = (size == SUPERPAGE_SIZE);
return insert;
} // insert()
PUBLIC mapping_t *
mapdb_t::lookup(space_t *space,
vm_offset_t va,
mapping_type_t type)
{
vm_offset_t phys = space->virt_to_phys(va);
if (phys == 0xffffffff)
return nullptr;
mapping_tree_t *t;
// get and lock the tree.
// XXX For now, use a simple lock with helping. Later
// unify locking with our request scheme.
physframe[phys >> PAGE_SHIFT].lock.lock();
t = physframe[phys >> PAGE_SHIFT].tree;
assert(t);
mapping_t *m;
for (m = t->mappings();
m->data()->depth != Depth_end
&& m < t->mappings() + t->number_of_entries();
m++)
{
if (m->data()->space == space->space()
&& m->data()->address == va >> PAGE_SHIFT)
{
// found!
return m;
}
}
// not found -- unlock tree
physframe[phys >> PAGE_SHIFT].lock.clear();
return nullptr;
} // lookup()
PUBLIC void
mapdb_t::free(mapping_t* mapping_of_tree)
{
mapping_tree_t *t = mapping_of_tree->tree();
// We assume that the zeroth mapping of the tree is a sigma0
// mapping, that is, its virtual address == the page's physical
// address.
vm_offset_t phys_pno = t->mappings()[0].data()->address;
// We are the owner of the tree lock.
assert(physframe[phys_pno].lock.lock_owner() == current());
// Before we unlock the tree, we need to make sure that there is
// room for at least one new mapping. In particular, this means
// that the last entry of the array encoding the tree must be free.
// (1) When we use up less than a quarter of all entries of the
// array encoding the tree, copy to a smaller tree. Otherwise, (2)
// if the last entry is free, do nothing. Otherwise, (3) if less
// than 3/4 of the entries are used, compress the tree. Otherwise,
// (4) copy to a larger tree.
bool maybe_out_of_memory = false;
do // (this is not actually a loop, just a block we can "break" out of)
{
// (1) Do we need to allocate a smaller tree?
if (t->_size_id > 0 // must not be smallest size
&& (t->_count << 2) < t->number_of_entries())
{
mapping_tree_t *new_t =
reinterpret_cast<mapping_tree_t *>
(allocator_for_treesize[t->_size_id - 1]->alloc());
if (new_t)
{
// XXX should be asserted by allocator:
new_t->_size_id = t->_size_id - 1;
new_t->mappings()[new_t->number_of_entries() - 1].data()->depth
= Depth_end;
mapping_tree_t::copy_compact_tree(new_t, t);
// Register new tree.
physframe[phys_pno].tree = new_t;
allocator_for_treesize[t->_size_id]->free(t);
t = new_t;
break;
}
}
// (2) Is last entry is free?
if (t->mappings()[t->number_of_entries() - 1].unused())
break; // OK, last entry is free.
// Last entry is not free -- either compress current array
// (i.e., move free entries to end of array), or allocate bigger
// array.
// (3) Should we compress the tree?
// We also try to compress if we cannot allocate a bigger
// tree because there is no bigger tree size.
if (t->_count < (t->number_of_entries() >> 2)
+ (t->number_of_entries() >> 1)
|| t->_size_id == Size_id_max) // cannot enlarge?
{
if (t->_size_id == Size_id_max)
maybe_out_of_memory = true;
mapping_tree_t::copy_compact_tree(t, t); // in-place compression
break;
}
// (4) OK, allocate a bigger array.
mapping_tree_t *new_t =
reinterpret_cast<mapping_tree_t*>
(allocator_for_treesize[t->_size_id + 1]->alloc());
if (new_t)
{
// XXX should be asserted by allocator:
new_t->_size_id = t->_size_id + 1;
new_t->mappings()[new_t->number_of_entries() - 1].data()->depth
= Depth_end;
mapping_tree_t::copy_compact_tree(new_t, t);
// Register new tree.
physframe[phys_pno].tree = new_t;
allocator_for_treesize[t->_size_id]->free(t);
t = new_t;
}
else
{
// out of memory -- just do tree compression and hope that helps.
maybe_out_of_memory = true;
mapping_tree_t::copy_compact_tree(t, t); // in-place compression
}
}
while (false);
// The last entry of the tree should now be free -- exept if we're
// out of memory.
assert(t->mappings()[t->number_of_entries() - 1].unused()
|| maybe_out_of_memory);
// Unlock tree.
physframe[phys_pno].lock.clear();
} // free()
// Delete mappings from a tree. This is easy to do: We just have to
// iterate over the array encoding the tree.
PUBLIC bool
mapdb_t::flush(mapping_t *m, bool me_too)
{
mapping_tree_t *t = m->tree();
mapping_t *start_of_deletions = m;
unsigned m_depth = m->data()->depth;
unsigned deleted = 0, empty_elems_passed = 0;
if (me_too)
{
m->data()->depth = Depth_empty;
t->_count -= 1;
deleted++;
}
else
start_of_deletions++;
m++;
for (;
m < t->mappings() + t->number_of_entries()
&& m->data()->depth != Depth_end;
m++)
{
if (unsigned (m->data()->depth) <= m_depth)
{
// Found another data element -- stop deleting. Since we
// created holes in the tree representation, account for it.
t->_empty_count += deleted;
return true;
}
if (m->data()->depth == Depth_empty)
{
empty_elems_passed++;
continue;
}
// Delete the element.
m->data()->depth = Depth_empty;
t->_count -= 1;
deleted++;
}
// We deleted stuff at the end of the array -- move end tag
if (start_of_deletions < t->mappings() + t->number_of_entries())
{
start_of_deletions->data()->depth = Depth_end;
// also, reduce number of free entries
t->_empty_count -= empty_elems_passed;
}
return true;
} // flush()
PUBLIC void
mapdb_t::grant(mapping_t *m, space_t *new_space, vm_offset_t va)
{
m->data()->space = new_space->space();
m->data()->address = va >> PAGE_SHIFT;
} // grant()

View File

@@ -0,0 +1,24 @@
INTERFACE:
class Foo
{
};
IMPLEMENTATION [part1]:
PUBLIC
void
Foo::bar ()
{}
PROTECTED inline NEEDS [Foo::rambo]
void
Foo::baz ()
{}
IMPLEMENTATION:
PRIVATE
void
Foo::gizmatic ()
{}

View File

@@ -0,0 +1,23 @@
INTERFACE:
EXTENSION class Foo
{
int more;
};
class Bar;
IMPLEMENTATION [part2]:
#include "bar.h"
PUBLIC
void
Foo::bingo (Bar* bar)
{}
PROTECTED inline
void
Foo::rambo ()
{}

View File

@@ -0,0 +1,44 @@
INTERFACE:
class Outer
{
public:
class Inner
{
void *test() const;
template<typename R>
R *test_template() const;
};
template<typename T>
class Inner_template
{
T *test() const;
template<typename R>
R *test_template(T *a) const;
};
};
IMPLEMENTATION:
IMPLEMENT inline
void *
Outer::Inner::test() const
{ return nullptr; }
IMPLEMENT template<typename R>
R *
Outer::Inner::test_template() const
{ return nullptr; }
IMPLEMENT template<typename T>
T *
Outer::Inner_template<T>::test() const
{ return nullptr; }
IMPLEMENT template<typename T> template<typename R>
R *
Outer::Inner_template<T>::test_template(T *a) const
{ return reinterpret_cast<R *>(a); }

View File

@@ -0,0 +1,8 @@
INTERFACE:
IMPLEMENTATION:
// There is nothing to inline -- therefore, this #include directive
// should not be put in public header.
#include "foo.h"

View File

@@ -0,0 +1,88 @@
INTERFACE:
class Foo
{
};
IMPLEMENTATION:
PUBLIC
void *
Foo::operator new (size_t) // funny comment
{
}
PUBLIC
Foo&
Foo::operator + (const Foo&) // funny comment
{
}
PUBLIC
Foo&
Foo::operator = (const Foo&) // funny comment
{
}
PUBLIC
Foo&
Foo::operator * (const Foo&) // funny comment
{
}
template <typename T, typename A>
std::vector<T, A >&
operator << (std::vector<T, A>& in, const T& new_elem)
{
in.push_back (new_elem);
return in;
}
// Some systematic tests (contributed by Matthias Daum)
struct X { };
PUBLIC inline void* X::operator new(unsigned int) { return (void*)0; }
PUBLIC inline void X::operator delete(void*) { }
PUBLIC inline void* X::operator new [] (unsigned int, int) { return (void*)0; }
PUBLIC inline void X::operator delete [] (void*) { }
PUBLIC inline X X::operator + (const X&) { return *this; }
PUBLIC inline X X::operator - (const X&) { return *this; }
PUBLIC inline X X::operator * (const X&) { return *this; }
PUBLIC inline X X::operator / (const X&) { return *this; }
PUBLIC inline X X::operator % (const X&) { return *this; }
PUBLIC inline X X::operator ^ (const X&) { return *this; }
PUBLIC inline X X::operator & (const X&) { return *this; }
PUBLIC inline X X::operator | (const X&) { return *this; }
PUBLIC inline X X::operator ~ () { return *this; }
PUBLIC inline X X::operator ! () { return *this; }
PUBLIC inline X& X::operator = (const X&) {return *this; }
PUBLIC inline bool X::operator < (const X&) { return false; }
PUBLIC inline bool X::operator > (const X&) { return false; }
PUBLIC inline X& X::operator += (const X&) { return *this; }
PUBLIC inline X& X::operator -= (const X&) { return *this; }
PUBLIC inline X& X::operator *= (const X&) { return *this; }
PUBLIC inline X& X::operator /= (const X&) { return *this; }
PUBLIC inline X& X::operator %= (const X&) { return *this; }
PUBLIC inline X& X::operator ^= (const X&) { return *this; }
PUBLIC inline X& X::operator &= (const X&) { return *this; }
PUBLIC inline X& X::operator |= (const X&) { return *this; }
PUBLIC inline X X::operator << (const X&) { return *this; }
PUBLIC inline X X::operator >> (const X&) { return *this; }
PUBLIC inline X& X::operator >>= (const X&) { return *this; }
PUBLIC inline X& X::operator <<= (const X&) { return *this; }
PUBLIC inline bool X::operator == (const X&) { return true; }
PUBLIC inline bool X::operator != (const X&) { return false; }
PUBLIC inline bool X::operator <= (const X&) { return true; }
PUBLIC inline bool X::operator >= (const X&) { return true; }
PUBLIC inline bool X::operator && (const X&) { return false; }
PUBLIC inline bool X::operator || (const X&) { return true; }
PUBLIC inline X& X::operator ++ () { return *this; }
PUBLIC inline X X::operator ++ (int) { return *this; }
PUBLIC inline X& X::operator -- () { return *this; }
PUBLIC inline X X::operator -- (int) { return *this; }
PUBLIC inline X& X::operator , (const X&) { return *this; }
PUBLIC inline X* X::operator ->* (const X&) { return this; }
PUBLIC inline X* X::operator -> () { return this; }
PUBLIC inline int X::operator () (const X&) { return 0; }
PUBLIC inline int X::operator [] (const X&) { return 0; }

View File

@@ -0,0 +1,96 @@
INTERFACE:
struct Foo
{
struct Bar
{
int baz;
};
public:
int alreadythere();
inline int alsoalreadythere();
};
IMPLEMENTATION:
#include "foo.h"
inline
int bar()
{}
// Try multiline NEEDS
inline NEEDS["foo.h",
bar]
int baz()
{}
// Try NEEDS with more whitespace
inline NEEDS [ "foo.h",
bar ]
int bak()
{}
// Try function arguments
unsigned
somefunc(unsigned (*func1)(),
unsigned (*func2)())
{
}
// Try function-pointer typedef
typedef int (* diag_printf_t) (const char *, ...);
typedef int (**dblfptr) (void);
typedef int (* arrfptr[20]) (void);
// Try to initialize a nested structure object.
struct Foo::Bar some_bar = { 1 };
// And add a Foo function
void Foo::func ()
{}
// Try default arguments
void Foo::bar (int i = 15, int j = somefunc(0, somefunc(0, 0)))
{}
// Try a constructor with weird syntax
PUBLIC
Foo::Foo ()
: something (reinterpret_cast<Bar*>(Baz::bla()))
{}
// Try implementing an already-declared function
IMPLEMENT int
Foo::alreadythere()
{}
IMPLEMENT inline int
Foo::alsoalreadythere()
{}
//
// Try some commented-out code -- only #if 0 supported at the moment.
//
#if 0
#ifdef FOO
funny
#else
even funnier
#endif
#else // ! 0
void find_this ();
#if 0
but not this
#endif
#ifdef HEILIGE_WEIHNACHT
static void present_this ();
#endif
#endif

View File

@@ -0,0 +1,25 @@
INTERFACE:
IMPLEMENTATION:
extern "C" {
extern char _mappings_1, _mappings_end_1;
}
static const vm_offset_t mem_alloc_region
= reinterpret_cast<vm_offset_t>(&_mappings_1);
static const vm_offset_t mem_alloc_region_end
= reinterpret_cast<vm_offset_t>(&_mappings_end_1);
static kmem_slab_t *amm_entry_cache;
static amm_t region_amm;
static oskit_addr_t end_of_last_region;
static helping_lock_t region_lock;
static char keymap[128][2] = {
{'[', '{'},
// {']', '}'}, /* 27 */
{'+', '*'}, /* 27 */
};

View File

@@ -0,0 +1,28 @@
INTERFACE:
class T
{
};
IMPLEMENTATION:
PUBLIC
bool T::function1(void)
{
return TAG_ENABLED(tag_defined);
}
bool T::function2(void)
{
return TAG_ENABLED(tag_not_defined);
}
bool T::function3(void)
{
return TAG_ENABLED(tag_not_defined && tag_defined);
}
bool T::function4(void)
{
return TAG_ENABLED(tag_not_defined || tag_defined);
}

View File

@@ -0,0 +1,252 @@
INTERFACE:
template<class T>
class stack_t;
template<class T>
class stack_top_t
{
private:
friend class stack_t<T>;
// Dont change the layout !!, comp_and_swap2 expects
// version and _next next to each other, in that order
int _version;
T *_next;
};
template<class T>
class stack_t
{
private:
stack_top_t<T> _head;
};
IMPLEMENTATION:
//
// atomic-manipulation functions
//
// typesafe variants
template <class I>
inline bool compare_and_swap(I *ptr, I oldval, I newval)
{
return compare_and_swap(reinterpret_cast<unsigned*>(ptr),
*reinterpret_cast<unsigned*>(&oldval),
*reinterpret_cast<unsigned*>(&newval));
}
template <class I>
inline bool test_and_set(I *l)
{
return test_and_set(reinterpret_cast<unsigned*>(l));
}
//
// stack_top_t
//
// template<class T>
// stack_top_t<T> &
// stack_top_t<T>::operator=(const stack_top_t& _copy){
// _version = _copy._version;
// _next = _copy._next;
// return *this;
// }
PUBLIC inline
template<class T>
stack_top_t<T>::stack_top_t (int version, T *next)
: _version (version),
_next (next)
{}
PUBLIC inline
template<class T>
stack_top_t<T>::stack_top_t ()
: _version (0),
_next (0)
{}
//
// stack_t
//
PUBLIC
template<class T>
stack_t<T>::stack_t()
: _head (0, 0)
{}
PUBLIC
template<class T>
int
stack_t<T>::insert(T *e)
{
stack_top_t<T> old_head,
new_head;
do {
e->set_next(_head._next);
old_head = _head;
new_head._version = _head._version+1;
new_head._next = e;
} while (! compare_and_swap2((int *) &_head,
(int *) &old_head,
(int *) &new_head));
return new_head._version;
}
PUBLIC
template<class T>
T*
stack_t<T>::dequeue()
{
stack_top_t<T> old_head,
new_head;
T *first;
do {
old_head = _head;
first = _head._next;
if(! first){
break;
}
new_head._next = first->get_next();
new_head._version = _head._version + 1;
} while (! compare_and_swap2((int *) &_head,
(int *) &old_head,
(int *) &new_head));
// XXX Why did the old implementation test on e ?
// while (e && ! compare_and_swap(&_first, e, e->list_property.next));
// This is necessary to handle the case of a empty stack.
// return old_head._next;
return first;
}
// This version of dequeue only returns a value
// if it is equal to the one passed as top
PUBLIC
template<class T>
T*
stack_t<T>::dequeue(T *top)
{
stack_top_t<T> old_head,
new_head;
// stack_elem_t *first;
old_head._version = _head._version; // version doesnt matter
old_head._next = top; // cas will fail, if top aint at top
if(!_head._next){ // empty stack
return nullptr;
}
new_head._version = _head._version + 1;
new_head._next = top->get_next();
if(! compare_and_swap2((int *) &_head,
(int *) &old_head,
(int *) &new_head))
// we didnt succeed
return nullptr;
else
// top was on top , so we dequeued it
return top;
}
PUBLIC
template<class T>
T*
stack_t<T>::first()
{
return _head._next;
}
PUBLIC
template<class T>
void
stack_t<T>::reset()
{
_head._version = 0;
_head._next = 0;
}
template<class T>
stack_t<T>*
create_stack()
{
return new stack_t<T>();
}
template <>
stack_t<int>*
create_stack<int>()
{
return new stack<int>();
}
template <>
inline
stack_t<bool>*
create_stack<bool>()
{
return new stack<bool>();
}
//
// Member templates
//
class Foo
{
template <typename T> T* goo(T* t);
};
template <class Bar>
class TFoo
{
};
PUBLIC
template <typename T>
T*
Foo::bar (T* t)
{
}
IMPLEMENT
template <typename T>
T*
Foo::goo (T* t)
{
}
PUBLIC
template <class Bar>
template <typename T>
T*
TFoo::baz (T* t)
{
}
template<typename FOO,
typename = typename cxx::enable_if<!cxx::is_same<SPACE, Mem_space>::value>::type>
void
template_with_dfl_arg1()
{}
template<typename FOO,
typename = typename cxx::enable_if<!cxx::is_same<SPACE, Mem_space>::value>::type,
typename BAR>
void
template_with_dfl_arg2()
{}
template<T = int>
[[nodiscard]] T template_with_attribute()
{}

View File

@@ -0,0 +1,15 @@
INTERFACE:
template<typename T>
struct Base {};
template<typename X>
struct Derived : Base<int>
{};
IMPLEMENTATION:
PUBLIC template<typename T> inline
Derived<T>::Derived() : Base<int>()
{}

View File

@@ -0,0 +1,6 @@
IMPLEMENTATION:
int (Foo::*func_vec[100]) (int arg) =
{
0,
};

View File

@@ -0,0 +1,29 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#include "c-preproc.h"
#include "c-preproc_i.h"
//
// IMPLEMENTATION follows
//
#line 4 "c-preproc.cpp"
// set CS (missing from OSKIT)
#define set_cs(cs) \
asm volatile \
("ljmp %0,$1f \n1:" \
: : "i" (cs));
#line 10 "c-preproc.cpp"
void
function (void)
{
#if 1
bar ();
#else
foo ();
#endif
}

View File

@@ -0,0 +1,15 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#ifndef c_preproc_h
#define c_preproc_h
//
// INTERFACE definition follows
//
#line 11 "c-preproc.cpp"
void
function (void);
#endif // c_preproc_h

View File

@@ -0,0 +1,7 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#ifndef c_preproc_i_h
#define c_preproc_i_h
#include "c-preproc.h"
#endif // c_preproc_i_h

View File

@@ -0,0 +1,35 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#include "comment_in_string.h"
#include "comment_in_string_i.h"
//
// IMPLEMENTATION follows
//
#line 4 "comment_in_string.cpp"
int foo(char *s);
#line 6 "comment_in_string.cpp"
void irq_init(unsigned char master_base, unsigned char slave_base)
{
if (!(foo(" -vmware"))
{
foo("outb_p(MASTER_OCW, 0xfb); // unmask irq2");
}
else
{
foo("using normal pic mode \n");
}
}
#line 18 "comment_in_string.cpp"
void bar()
{
foo ("if (0) {");
foo ("} // if(0)");
}

View File

@@ -0,0 +1,17 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#ifndef comment_in_string_h
#define comment_in_string_h
//
// INTERFACE definition follows
//
#line 7 "comment_in_string.cpp"
void irq_init(unsigned char master_base, unsigned char slave_base);
#line 19 "comment_in_string.cpp"
void bar();
#endif // comment_in_string_h

View File

@@ -0,0 +1,7 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#ifndef comment_in_string_i_h
#define comment_in_string_i_h
#include "comment_in_string.h"
#endif // comment_in_string_i_h

View File

@@ -0,0 +1,18 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#include "default_args.h"
#include "default_args_i.h"
//
// IMPLEMENTATION follows
//
#line 26 "default_args.cpp"
extern "C"
void
disasm_bytes(char *buffer, unsigned len, unsigned va, unsigned task,
int show_symbols, int show_intel_syntax,
int (*peek_task)(unsigned addr, unsigned task),
const char* (*get_symbol)(unsigned addr, unsigned task)) WEAK;

View File

@@ -0,0 +1,52 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#ifndef default_args_h
#define default_args_h
//
// INTERFACE definition follows
//
#line 6 "default_args.cpp"
template <typename T> std::vector<T>
vec(T f1 = T(), T f2 = T(), T f3 = T(),
T f4 = T(), T f5 = T(), T f6 = T());
//
// IMPLEMENTATION includes follow (for use by inline functions/templates)
//
#line 1 "default_args.cpp"
#include <vector>
//
// IMPLEMENTATION of function templates
//
#line 4 "default_args.cpp"
template <typename T> std::vector<T>
vec(T f1, T f2, T f3,
T f4, T f5, T f6)
{
std::vector<T> v;
if (f1 != T()) {
v.push_back (f1);
if (f2 != T()) {
v.push_back (f2);
if (f3 != T()) {
v.push_back (f3);
if (f4 != T()) {
v.push_back (f4);
if (f5 != T()) {
v.push_back (f5);
if (f6 != T()) {
v.push_back (f6);
}}}}}}
return v;
}
#endif // default_args_h

View File

@@ -0,0 +1,7 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#ifndef default_args_i_h
#define default_args_i_h
#include "default_args.h"
#endif // default_args_i_h

View File

@@ -0,0 +1,5 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#include "drop_multi1.h"
#include "drop_multi1_i.h"

View File

@@ -0,0 +1,44 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#include "drop_multi1.h"
#include "drop_multi1_i.h"
//
// IMPLEMENTATION follows
//
#line 20 "dropsection.cpp"
void
Gen_foo::bar( unsigned x )
{
// do soemthing with x;
}
#line 26 "dropsection.cpp"
void
Gen_foo_ext::test()
{
// the test
}
#line 44 "dropsection.cpp"
int
Gen_foo::foo( int y )
{
// just return y
return y;
}
#line 53 "dropsection.cpp"
int
Gen_foo::tust( int y )
{
// just return y
return y;
}

View File

@@ -0,0 +1,43 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#ifndef drop_multi1_h
#define drop_multi1_h
//
// INTERFACE definition follows
//
#line 2 "dropsection.cpp"
class Gen_foo
{
public:
int baz;
protected:
int foo( int );
public:
#line 21 "dropsection.cpp"
void
bar( unsigned x );
#line 54 "dropsection.cpp"
int
tust( int y );
};
#line 12 "dropsection.cpp"
class Gen_foo_ext : private Gen_foo, public Ixdebix
{
protected:
unsigned stuff;
public:
#line 27 "dropsection.cpp"
void
test();
};
#endif // drop_multi1_h

View File

@@ -0,0 +1,7 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#ifndef drop_multi1_i_h
#define drop_multi1_i_h
#include "drop_multi1.h"
#endif // drop_multi1_i_h

View File

@@ -0,0 +1,18 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#include "drop_multi2.h"
#include "drop_multi2_i.h"
//
// IMPLEMENTATION follows
//
#line 20 "dropsection-ext.cpp"
int
Gen_foo::do_something_private()
{
// just do it
}

View File

@@ -0,0 +1,44 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#include "drop_multi2.h"
#include "drop_multi2_i.h"
//
// IMPLEMENTATION follows
//
#line 20 "dropsection.cpp"
void
Gen_foo::bar( unsigned x )
{
// do soemthing with x;
}
#line 26 "dropsection.cpp"
void
Gen_foo_ext::test()
{
// the test
}
#line 44 "dropsection.cpp"
int
Gen_foo::foo( int y )
{
// just return y
return y;
}
#line 53 "dropsection.cpp"
int
Gen_foo::tust( int y )
{
// just return y
return y;
}

View File

@@ -0,0 +1,72 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#ifndef drop_multi2_h
#define drop_multi2_h
//
// INTERFACE definition follows
//
#line 2 "dropsection.cpp"
class Gen_foo
#line 7 "dropsection-ext.cpp"
: public Gen_bar
#line 4 "dropsection.cpp"
{
public:
int baz;
protected:
int foo( int );
private: // EXTENSION
#line 8 "dropsection-ext.cpp"
public:
int extra_var;
public:
#line 21 "dropsection.cpp"
void
bar( unsigned x );
#line 54 "dropsection.cpp"
int
tust( int y );
private:
#line 21 "dropsection-ext.cpp"
int
do_something_private();
};
#line 12 "dropsection.cpp"
class Gen_foo_ext : private Gen_foo, public Ixdebix
#line 13 "dropsection-ext.cpp"
, public Gen_baz
#line 14 "dropsection.cpp"
{
protected:
unsigned stuff;
private: // EXTENSION
#line 14 "dropsection-ext.cpp"
private:
char *extension;
public:
#line 27 "dropsection.cpp"
void
test();
};
#endif // drop_multi2_h

View File

@@ -0,0 +1,7 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#ifndef drop_multi2_i_h
#define drop_multi2_i_h
#include "drop_multi2.h"
#endif // drop_multi2_i_h

View File

@@ -0,0 +1,35 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#include "drop_single1.h"
#include "drop_single1_i.h"
//
// IMPLEMENTATION follows
//
#line 20 "dropsection.cpp"
void
Gen_foo::bar( unsigned x )
{
// do soemthing with x;
}
#line 26 "dropsection.cpp"
void
Gen_foo_ext::test()
{
// the test
}
#line 53 "dropsection.cpp"
int
Gen_foo::tust( int y )
{
// just return y
return y;
}

View File

@@ -0,0 +1,43 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#ifndef drop_single1_h
#define drop_single1_h
//
// INTERFACE definition follows
//
#line 2 "dropsection.cpp"
class Gen_foo
{
public:
int baz;
protected:
int foo( int );
public:
#line 21 "dropsection.cpp"
void
bar( unsigned x );
#line 54 "dropsection.cpp"
int
tust( int y );
};
#line 12 "dropsection.cpp"
class Gen_foo_ext : private Gen_foo, public Ixdebix
{
protected:
unsigned stuff;
public:
#line 27 "dropsection.cpp"
void
test();
};
#endif // drop_single1_h

View File

@@ -0,0 +1,7 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#ifndef drop_single1_i_h
#define drop_single1_i_h
#include "drop_single1.h"
#endif // drop_single1_i_h

View File

@@ -0,0 +1,36 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#include "drop_single2.h"
#include "drop_single2_i.h"
//
// IMPLEMENTATION follows
//
#line 20 "dropsection.cpp"
void
Gen_foo::bar( unsigned x )
{
// do soemthing with x;
}
#line 26 "dropsection.cpp"
void
Gen_foo_ext::test()
{
// the test
}
#line 34 "dropsection.cpp"
int
Gen_foo::foo( int y )
{
// do something strange with y
bar(y);
return y;
}

View File

@@ -0,0 +1,39 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#ifndef drop_single2_h
#define drop_single2_h
//
// INTERFACE definition follows
//
#line 2 "dropsection.cpp"
class Gen_foo
{
public:
int baz;
protected:
int foo( int );
public:
#line 21 "dropsection.cpp"
void
bar( unsigned x );
};
#line 12 "dropsection.cpp"
class Gen_foo_ext : private Gen_foo, public Ixdebix
{
protected:
unsigned stuff;
public:
#line 27 "dropsection.cpp"
void
test();
};
#endif // drop_single2_h

View File

@@ -0,0 +1,7 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#ifndef drop_single2_i_h
#define drop_single2_i_h
#include "drop_single2.h"
#endif // drop_single2_i_h

View File

@@ -0,0 +1,44 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#include "drop_single3.h"
#include "drop_single3_i.h"
//
// IMPLEMENTATION follows
//
#line 20 "dropsection.cpp"
void
Gen_foo::bar( unsigned x )
{
// do soemthing with x;
}
#line 26 "dropsection.cpp"
void
Gen_foo_ext::test()
{
// the test
}
#line 44 "dropsection.cpp"
int
Gen_foo::foo( int y )
{
// just return y
return y;
}
#line 53 "dropsection.cpp"
int
Gen_foo::tust( int y )
{
// just return y
return y;
}

View File

@@ -0,0 +1,43 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#ifndef drop_single3_h
#define drop_single3_h
//
// INTERFACE definition follows
//
#line 2 "dropsection.cpp"
class Gen_foo
{
public:
int baz;
protected:
int foo( int );
public:
#line 21 "dropsection.cpp"
void
bar( unsigned x );
#line 54 "dropsection.cpp"
int
tust( int y );
};
#line 12 "dropsection.cpp"
class Gen_foo_ext : private Gen_foo, public Ixdebix
{
protected:
unsigned stuff;
public:
#line 27 "dropsection.cpp"
void
test();
};
#endif // drop_single3_h

View File

@@ -0,0 +1,7 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#ifndef drop_single3_i_h
#define drop_single3_i_h
#include "drop_single3.h"
#endif // drop_single3_i_h

View File

@@ -0,0 +1,16 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#include "explicit.h"
#include "explicit_i.h"
//
// IMPLEMENTATION follows
//
#line 8 "explicit.cpp"
Foo::Foo (int bar)
{}

View File

@@ -0,0 +1,20 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#ifndef explicit_h
#define explicit_h
//
// INTERFACE definition follows
//
#line 2 "explicit.cpp"
class Foo
{
public:
#line 10 "explicit.cpp"
explicit Foo (int bar);
};
#endif // explicit_h

View File

@@ -0,0 +1,7 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#ifndef explicit_i_h
#define explicit_i_h
#include "explicit.h"
#endif // explicit_i_h

View File

@@ -0,0 +1,5 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#include "extension_inherit.h"
#include "extension_inherit_i.h"

View File

@@ -0,0 +1,285 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#ifndef extension_inherit_h
#define extension_inherit_h
//
// INTERFACE definition follows
//
#line 2 "extension_inherit.cpp"
// Variable number of class inheritance extensions
class Class_b0_e1
#line 9 "extension_inherit.cpp"
: Ext_base_0
#line 6 "extension_inherit.cpp"
{
private: // EXTENSION
#line 10 "extension_inherit.cpp"
};
#line 12 "extension_inherit.cpp"
// ----------------------------------------------------------------------
class Class_b0_e1_e1
#line 18 "extension_inherit.cpp"
: Ext_base_0
#line 22 "extension_inherit.cpp"
, Ext2_base_0
#line 15 "extension_inherit.cpp"
{
private: // EXTENSION
#line 19 "extension_inherit.cpp"
private: // EXTENSION
#line 23 "extension_inherit.cpp"
};
#line 25 "extension_inherit.cpp"
// ----------------------------------------------------------------------
class Class_b0_e2
#line 31 "extension_inherit.cpp"
: Ext_base_0, Ext_base_1
#line 28 "extension_inherit.cpp"
{
private: // EXTENSION
#line 32 "extension_inherit.cpp"
};
#line 34 "extension_inherit.cpp"
// ----------------------------------------------------------------------
class Class_b0_e2_e1
#line 40 "extension_inherit.cpp"
: Ext_base_0, Ext_base_1
#line 44 "extension_inherit.cpp"
, Ext2_base_0
#line 37 "extension_inherit.cpp"
{
private: // EXTENSION
#line 41 "extension_inherit.cpp"
private: // EXTENSION
#line 45 "extension_inherit.cpp"
};
#line 47 "extension_inherit.cpp"
// ----------------------------------------------------------------------
class Class_b1_e1 : Base_0
#line 53 "extension_inherit.cpp"
, Ext_base_0
#line 50 "extension_inherit.cpp"
{
private: // EXTENSION
#line 54 "extension_inherit.cpp"
};
#line 56 "extension_inherit.cpp"
// ----------------------------------------------------------------------
class Class_b1_e1_e1 : Base_0
#line 62 "extension_inherit.cpp"
, Ext_base_0
#line 66 "extension_inherit.cpp"
, Ext2_base_0
#line 59 "extension_inherit.cpp"
{
private: // EXTENSION
#line 63 "extension_inherit.cpp"
private: // EXTENSION
#line 67 "extension_inherit.cpp"
};
#line 69 "extension_inherit.cpp"
// ----------------------------------------------------------------------
class Class_b1_e2 : Base_0
#line 75 "extension_inherit.cpp"
, Ext_base_0, Ext_base_1
#line 72 "extension_inherit.cpp"
{
private: // EXTENSION
#line 76 "extension_inherit.cpp"
};
#line 78 "extension_inherit.cpp"
// ----------------------------------------------------------------------
class Class_b1_e2_e1 : Base_0
#line 84 "extension_inherit.cpp"
, Ext_base_0, Ext_base_1
#line 88 "extension_inherit.cpp"
, Ext2_base_0
#line 81 "extension_inherit.cpp"
{
private: // EXTENSION
#line 85 "extension_inherit.cpp"
private: // EXTENSION
#line 89 "extension_inherit.cpp"
};
#line 91 "extension_inherit.cpp"
// ----------------------------------------------------------------------
class Class_b2_e1 : Base_0, Base_1
#line 97 "extension_inherit.cpp"
, Ext_base_0
#line 94 "extension_inherit.cpp"
{
private: // EXTENSION
#line 98 "extension_inherit.cpp"
};
#line 100 "extension_inherit.cpp"
// ----------------------------------------------------------------------
class Class_b2_e1_e1 : Base_0, Base_1
#line 106 "extension_inherit.cpp"
, Ext_base_0
#line 110 "extension_inherit.cpp"
, Ext2_base_0
#line 103 "extension_inherit.cpp"
{
private: // EXTENSION
#line 107 "extension_inherit.cpp"
private: // EXTENSION
#line 111 "extension_inherit.cpp"
};
#line 113 "extension_inherit.cpp"
// ----------------------------------------------------------------------
class Class_b2_e2 : Base_0, Base_1
#line 119 "extension_inherit.cpp"
, Ext_base_0, Ext_base_1
#line 116 "extension_inherit.cpp"
{
private: // EXTENSION
#line 120 "extension_inherit.cpp"
};
#line 122 "extension_inherit.cpp"
// ----------------------------------------------------------------------
class Class_b2_e2_e1 : Base_0, Base_1
#line 128 "extension_inherit.cpp"
, Ext_base_0, Ext_base_1
#line 132 "extension_inherit.cpp"
, Ext2_base_0
#line 125 "extension_inherit.cpp"
{
private: // EXTENSION
#line 129 "extension_inherit.cpp"
private: // EXTENSION
#line 133 "extension_inherit.cpp"
};
#line 135 "extension_inherit.cpp"
// Variable spacing around class inheritance extensions
class Class_var : Base_0 /* Unconvenient comment
that wraps around */
#line 145 "extension_inherit.cpp"
, Ext_base_0
#line 149 "extension_inherit.cpp"
, Ext2_base_0
#line 153 "extension_inherit.cpp"
, Ext3_base_0
#line 141 "extension_inherit.cpp"
{
private: // EXTENSION
#line 146 "extension_inherit.cpp"
private: // EXTENSION
#line 150 "extension_inherit.cpp"
private: // EXTENSION
#line 153 "extension_inherit.cpp"
};
#endif // extension_inherit_h

View File

@@ -0,0 +1,7 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#ifndef extension_inherit_i_h
#define extension_inherit_i_h
#include "extension_inherit.h"
#endif // extension_inherit_i_h

View File

@@ -0,0 +1,16 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#include "extern_c.h"
#include "extern_c_i.h"
//
// IMPLEMENTATION follows
//
#line 4 "extern_c.cpp"
extern "C"
{
extern char _mappings_1, _mappings_end_1;
}

View File

@@ -0,0 +1,6 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#ifndef extern_c_h
#define extern_c_h
#endif // extern_c_h

View File

@@ -0,0 +1,7 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#ifndef extern_c_i_h
#define extern_c_i_h
#include "extern_c.h"
#endif // extern_c_i_h

View File

@@ -0,0 +1,77 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#include "func_defs.h"
#include "func_defs_i.h"
//
// IMPLEMENTATION follows
//
#line 8 "func_defs.cpp"
void
Test::func1() const throw()
{}
#line 13 "func_defs.cpp"
void
Test::func2() throw(int, char const *)
{};
#line 18 "func_defs.cpp"
void
Test::func3(unsigned) noexcept
{}
#line 23 "func_defs.cpp"
void
Test::func4(int) noexcept ( this->func2() )
{}
#line 28 "func_defs.cpp"
Test::Test(int) noexcept(true) __attribute__ (( test("str") ))
: init(This)
{}
#line 33 "func_defs.cpp"
void
Test::func5() noexcept ( this->func2() ) [[test(attr)]] [[test2]]
{}
#line 38 "func_defs.cpp"
[[cppattr]] [[another_attr]] int
Test::func_attr_no_needs()
{}
#line 43 "func_defs.cpp"
[[anattr]] int
Test::func_attr_needs()
{}
#line 52 "func_defs.cpp"
/**
* This is the comment for `free_function`.
*/
Test const &
free_function(int, long a) noexcept
{
return Test(a);
}

View File

@@ -0,0 +1,59 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#ifndef func_defs_h
#define func_defs_h
//
// INTERFACE definition follows
//
#line 2 "func_defs.cpp"
class Test
{
public:
#line 10 "func_defs.cpp"
void
func1() const throw();
#line 15 "func_defs.cpp"
void
func2() throw(int, char const *) override final;
#line 20 "func_defs.cpp"
void
func3(unsigned) noexcept final override;
#line 25 "func_defs.cpp"
void
func4(int) noexcept ( this->func2() );
#line 30 "func_defs.cpp"
explicit Test(int) noexcept(true) __attribute__ (( test("str") )) final;
#line 35 "func_defs.cpp"
void
func5() noexcept ( this->func2() ) [[test(attr)]] [[test2]];
#line 40 "func_defs.cpp"
[[cppattr]] [[another_attr]] static int
func_attr_no_needs();
#line 45 "func_defs.cpp"
[[anattr]] int
func_attr_needs();
#line 50 "func_defs.cpp"
int attribute((foo("murx("))) [[this->is->a->test]]
func_with_stupid_attributes(Tmpl<Type> x) const && throw() = default;
};
#line 53 "func_defs.cpp"
/**
* This is the comment for `free_function`.
*/
Test const &
free_function(int, long a) noexcept;
#endif // func_defs_h

View File

@@ -0,0 +1,7 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#ifndef func_defs_i_h
#define func_defs_i_h
#include "func_defs.h"
#endif // func_defs_i_h

View File

@@ -0,0 +1,28 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#include "implement_default.h"
#include "implement_default_i.h"
//
// IMPLEMENTATION follows
//
#line 19 "implement_default.cpp"
void Test::warn_func1() { /* this is the override */ }
#line 20 "implement_default.cpp"
void Test::warn_func2() { /* this is the override */ }
#line 25 "implement_default.cpp"
void Test::func1() { /* this is the override */ }
#line 26 "implement_default.cpp"
void Test::func2() { /* this is the override */ }
#line 29 "implement_default.cpp"
void Test::defl() { /* this is the default */ }

View File

@@ -0,0 +1,25 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#ifndef implement_default_h
#define implement_default_h
//
// INTERFACE definition follows
//
#line 2 "implement_default.cpp"
class Test
{
public:
void warn_func1();
void warn_func2();
void func1();
void func2();
void defl();
// skip this as the test cannot deal with errors
// void err_func1();
};
#endif // implement_default_h

View File

@@ -0,0 +1,3 @@
implement_default.cpp:19: warning: Function Test::warn_func1 overrides an IMPLEMENT_DEFAULT function but does not use IMPLEMENT_OVERRIDE
implement_default.cpp:20: warning: Function Test::warn_func2 overrides an IMPLEMENT_DEFAULT function but does not use IMPLEMENT_OVERRIDE
warning: found 2 warning(s)

View File

@@ -0,0 +1 @@
implement_default_err.cpp:10: error: No default implementation for Test::err_func1 found

View File

@@ -0,0 +1,7 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#ifndef implement_default_i_h
#define implement_default_i_h
#include "implement_default.h"
#endif // implement_default_i_h

View File

@@ -0,0 +1,5 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#include "implement_template.h"
#include "implement_template_i.h"

View File

@@ -0,0 +1,58 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#ifndef implement_template_h
#define implement_template_h
//
// INTERFACE definition follows
//
#line 2 "implement_template.cpp"
template< typename T >
class Test
{
public:
void test_func();
public:
#line 23 "implement_template.cpp"
// comment 2
// comment 1
template<
typename X, // comment within template args list
typename X2 // another comment in tl args
> void __attribute__((deprecated))
test_func2();
};
//
// IMPLEMENTATION of function templates
//
#line 12 "implement_template.cpp"
// comment
template< typename T > void __attribute__((deprecated))
Test<T>::test_func()
{
}
#line 20 "implement_template.cpp"
// comment 2
// comment 1
template< typename T > template<
typename X, // comment within template args list
typename X2 // another comment in tl args
> void __attribute__((deprecated))
Test<T>::test_func2<X, X2>()
{
}
#endif // implement_template_h

View File

@@ -0,0 +1,7 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#ifndef implement_template_i_h
#define implement_template_i_h
#include "implement_template.h"
#endif // implement_template_i_h

View File

@@ -0,0 +1,47 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#include "inline.h"
#include "inline_i.h"
//
// IMPLEMENTATION follows
//
#line 60 "inline.cpp"
// This inline funtion is public only because it is needed by an
// extern-"C" function. So we do not want to export it.
inline void
Foo::bar()
{
}
#line 69 "inline.cpp"
// Try both NOEXPORT and NEEDED.
inline void
Foo::baz()
{
}
#line 83 "inline.cpp"
constexpr void
Foo::cexpr2()
{
}
#line 101 "inline.cpp"
extern "C"
void function (Foo* f)
{
f->bar();
f->cexpr2();
}

View File

@@ -0,0 +1,168 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#ifndef inline_h
#define inline_h
//
// INTERFACE definition follows
//
#line 2 "inline.cpp"
class Foo
{
public:
#line 61 "inline.cpp"
// This inline funtion is public only because it is needed by an
// extern-"C" function. So we do not want to export it.
inline void
bar();
#line 70 "inline.cpp"
// Try both NOEXPORT and NEEDED.
inline void
baz();
#line 78 "inline.cpp"
constexpr void
cexpr1();
#line 85 "inline.cpp"
constexpr void
cexpr2();
private:
#line 32 "inline.cpp"
inline bool
private_func();
};
#line 6 "inline.cpp"
class Bar
{
public:
#line 56 "inline.cpp"
inline void
public_func();
private:
#line 38 "inline.cpp"
inline bool
private_func();
#line 50 "inline.cpp"
inline void
another_private_func();
};
#line 10 "inline.cpp"
class Cexpr
{
constexpr test1();
};
#line 102 "inline.cpp"
extern "C"
void function (Foo* f);
#line 109 "inline.cpp"
template <typename T> inline void* xcast(T* t);
//
// IMPLEMENTATION of inline functions (and needed classes)
//
#line 18 "inline.cpp"
// Test dependency-chain resolver
class Frob
{
private:
#line 26 "inline.cpp"
inline bool
private_func();
#line 44 "inline.cpp"
constexpr bool
private_cexpr();
};
#line 30 "inline.cpp"
inline bool
Foo::private_func()
{
}
#line 76 "inline.cpp"
constexpr void
Foo::cexpr1()
{
}
#line 36 "inline.cpp"
inline bool
Bar::private_func()
{
}
#line 48 "inline.cpp"
inline void
Bar::another_private_func()
{
}
#line 24 "inline.cpp"
inline bool
Frob::private_func()
{
}
#line 54 "inline.cpp"
inline void
Bar::public_func()
{
}
#line 89 "inline.cpp"
constexpr void
Cexpr::test1()
{
}
#line 95 "inline.cpp"
constexpr void
Cexpr::test2()
{
}
#line 108 "inline.cpp"
template <typename T> inline void* xcast(T* t)
{
return (void*) t;
}
#endif // inline_h

View File

@@ -0,0 +1,20 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#ifndef inline_i_h
#define inline_i_h
#include "inline.h"
//
// IMPLEMENTATION of inline functions follows
//
#line 42 "inline.cpp"
constexpr bool
Frob::private_cexpr()
{
}
#endif // inline_i_h

View File

@@ -0,0 +1,87 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#include "inline_noinline.h"
#include "inline_noinline_i.h"
//
// IMPLEMENTATION follows
//
#line 83 "inline.cpp"
constexpr void
Foo::cexpr2()
{
}
#line 24 "inline.cpp"
bool
Frob::private_func()
{
}
#line 30 "inline.cpp"
bool
Foo::private_func()
{
}
#line 36 "inline.cpp"
bool
Bar::private_func()
{
}
#line 48 "inline.cpp"
void
Bar::another_private_func()
{
}
#line 54 "inline.cpp"
void
Bar::public_func()
{
}
#line 60 "inline.cpp"
// This inline funtion is public only because it is needed by an
// extern-"C" function. So we do not want to export it.
void
Foo::bar()
{
}
#line 69 "inline.cpp"
// Try both NOEXPORT and NEEDED.
void
Foo::baz()
{
}
#line 101 "inline.cpp"
extern "C"
void function (Foo* f)
{
f->bar();
f->cexpr2();
}

View File

@@ -0,0 +1,117 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#ifndef inline_noinline_h
#define inline_noinline_h
//
// INTERFACE definition follows
//
#line 2 "inline.cpp"
class Foo
{
public:
#line 61 "inline.cpp"
// This inline funtion is public only because it is needed by an
// extern-"C" function. So we do not want to export it.
void
bar();
#line 70 "inline.cpp"
// Try both NOEXPORT and NEEDED.
void
baz();
#line 78 "inline.cpp"
constexpr void
cexpr1();
#line 85 "inline.cpp"
constexpr void
cexpr2();
private:
#line 32 "inline.cpp"
bool
private_func();
};
#line 6 "inline.cpp"
class Bar
{
public:
#line 56 "inline.cpp"
void
public_func();
private:
#line 38 "inline.cpp"
bool
private_func();
#line 50 "inline.cpp"
void
another_private_func();
};
#line 10 "inline.cpp"
class Cexpr
{
constexpr test1();
};
#line 102 "inline.cpp"
extern "C"
void function (Foo* f);
#line 109 "inline.cpp"
template <typename T> void* xcast(T* t);
//
// IMPLEMENTATION of inline functions (and needed classes)
//
#line 76 "inline.cpp"
constexpr void
Foo::cexpr1()
{
}
#line 89 "inline.cpp"
constexpr void
Cexpr::test1()
{
}
#line 95 "inline.cpp"
constexpr void
Cexpr::test2()
{
}
//
// IMPLEMENTATION of function templates
//
#line 108 "inline.cpp"
template <typename T> void* xcast(T* t)
{
return (void*) t;
}
#endif // inline_noinline_h

View File

@@ -0,0 +1,41 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#ifndef inline_noinline_i_h
#define inline_noinline_i_h
#include "inline_noinline.h"
//
// INTERFACE internal declaration follows
//
#line 18 "inline.cpp"
// Test dependency-chain resolver
class Frob
{
private:
#line 26 "inline.cpp"
bool
private_func();
#line 44 "inline.cpp"
constexpr bool
private_cexpr();
};
//
// IMPLEMENTATION of inline functions follows
//
#line 42 "inline.cpp"
constexpr bool
Frob::private_cexpr()
{
}
#endif // inline_noinline_i_h

View File

@@ -0,0 +1,19 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#include "interfacepublic.h"
#include "interface_i.h"
//
// IMPLEMENTATION follows
//
#line 9 "interface.cpp"
void
Foo::func1()
{
}

View File

@@ -0,0 +1,7 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#ifndef interface_i_h
#define interface_i_h
#include "interfacepublic.h"
#endif // interface_i_h

View File

@@ -0,0 +1,22 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#ifndef interface_h
#define interface_h
//
// INTERFACE definition follows
//
#line 2 "interface.cpp"
// This is class Foo.
class Foo
{
public:
#line 11 "interface.cpp"
void
func1();
};
#endif // interface_h

View File

@@ -0,0 +1,24 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#include "line.h"
#include "line_i.h"
//
// IMPLEMENTATION follows
//
#line 9 "line.cpp"
// A long, multiline comment in front of this function definition.
// Also, a lot of specifiers that need to be handled.
void
Foo::func1()
{
}

View File

@@ -0,0 +1,28 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#ifndef line_h
#define line_h
//
// INTERFACE definition follows
//
#line 2 "line.cpp"
// This is class Foo.
class Foo
{
public:
#line 10 "line.cpp"
// A long, multiline comment in front of this function definition.
// Also, a lot of specifiers that need to be handled.
static void
func1();
};
#endif // line_h

View File

@@ -0,0 +1,7 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#ifndef line_i_h
#define line_i_h
#include "line.h"
#endif // line_i_h

View File

@@ -0,0 +1,24 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#include "line_nh.h"
#include "line_nh_i.h"
//
// IMPLEMENTATION follows
//
#line 9 "line.cpp"
// A long, multiline comment in front of this function definition.
// Also, a lot of specifiers that need to be handled.
void
Foo::func1()
{
}

View File

@@ -0,0 +1,22 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#ifndef line_nh_h
#define line_nh_h
//
// INTERFACE definition follows
//
// This is class Foo.
class Foo
{
public:
// A long, multiline comment in front of this function definition.
// Also, a lot of specifiers that need to be handled.
static void func1();
};
#endif // line_nh_h

View File

@@ -0,0 +1,7 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#ifndef line_nh_i_h
#define line_nh_i_h
#include "line_nh.h"
#endif // line_nh_i_h

Some files were not shown because too many files have changed in this diff Show More