Skip to content

Commit 9ba2df4

Browse files
wchilders-nvidiadaveedvdv-nvidia
authored andcommitted
Various improvements to build documentation []
1 parent 7e58dfe commit 9ba2df4

1 file changed

Lines changed: 133 additions & 80 deletions

File tree

‎doc/source/build.rst‎

Lines changed: 133 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,15 @@ directories and files:
5454
``Makefile``\ s in the appropriate subdirectories (especially
5555
``misc/`` and ``src/``) are still likely to be useful.
5656
* - | ``src/``
57-
- | The directory containing the source files of the C++ front end and its
58-
optional components (such as the C- and C++-generating back ends).
59-
This directory contains a subdirectory ``disp/`` used to build the
60-
stand-alone IL display utility. In addition to source code, the
61-
``src/`` directory also holds the ``Changes`` file, which describes
62-
the various changes made to the front end in the current and previous
63-
releases. Note that most of the source files have the ``.c`` suffix
64-
that would normally indicate a C source file. Starting with the 6.0
65-
release, these files contain C++ source code and must be compiled
66-
using a C++ compiler (with the C++11 dialect). The original filenames
57+
- | The directory containing the source files of the C++ front end and
58+
its optional components (such as the C- and C++-generating back
59+
ends). In addition to source code, the ``src/`` directory also
60+
holds the ``Changes`` file, which describes the various changes
61+
made to the front end in the current and previous releases. Note
62+
that most of the source files have the ``.c`` suffix that would
63+
normally indicate a C source file. Starting with the 6.0 release,
64+
these files contain C++ source code and must be compiled using a
65+
C++ compiler (with the C++14 dialect). The original filenames
6766
have been maintained to make patching files easier. If desired,
6867
symbolic links can be added to accommodate build environments as
6968
necessary.
@@ -104,17 +103,18 @@ directories and files:
104103
* - | ``lib/``
105104
- | Initially, this directory only contains a file
106105
``predefined_macros.txt``. This file is read by the front end to
107-
predefine certain macros. It is typically used to define macros that
108-
are defined by compilers being emulated (see
109-
``make_predef_macro_table`` and ``make_win_predef_macro_table.c`` for
110-
utilities that automatically generate a set of predefined macros for
111-
GNU and Microsoft compilers, respectively). Once the run-time support
112-
library is built (in the ``lib_src/`` directory), it can be moved here
113-
so the ``eccp`` script can find it (this is done automatically if the
114-
top-level ``Makefile`` is used). Note that this directory is only
115-
used when an unnamed "legacy" target configuration is specified -- see
116-
``lib_``\ *target*\ ``/`` below for cases where a named target
117-
configuration is used.
106+
predefine certain macros. It is typically used to define macros
107+
that are defined by compilers being emulated (see
108+
``make_predef_macro_table`` and ``make_win_predef_macro_table.c``
109+
for utilities that automatically generate a set of predefined
110+
macros for GNU and clang and Microsoft compilers, respectively).
111+
Once the run-time support library is built (in the ``lib_src/``
112+
directory), it can be moved here so the ``eccp`` script can find
113+
it (this is done automatically if the top-level ``Makefile`` is
114+
used). Note that this directory is only used when an unnamed
115+
"legacy" target configuration is specified -- see ``lib_``\
116+
*target*\ ``/`` below for cases where a named target configuration
117+
is used.
118118
* - | ``lib_``\ *target*\ ``/``
119119
- | Target-specific version of the ``lib/`` directory described above
120120
used when the "``--target`` *target*" command-line option is
@@ -127,9 +127,9 @@ directories and files:
127127
- This directory contains sources for four utility programs (and a
128128
``Makefile`` to build them) to build and configure the front end:
129129

130-
* ``make_predef_macro_table``: A script to generate a predefined macros
131-
file (like ``lib/predefined_macros.txt``) to match a given version of
132-
``gcc/g++``.
130+
* ``make_predef_macro_table``: A script to generate a predefined
131+
macros file (like ``lib/predefined_macros.txt``) to match given
132+
versions of ``gcc/g++`` and ``clang``.
133133
* ``make_win_predef_macro_table.c``: A program to generate a
134134
predefined macros file (like ``lib/predefined_macros.txt``) to match
135135
a given version of Microsoft Visual Studio. Note that this program
@@ -377,6 +377,12 @@ Support for Source Language Dialects
377377
|
378378
- | Control whether compatibility with Sun CC should be enabled, either by
379379
default or only when the ``--sun`` command-line option is specified.
380+
* - | ``DEFAULT_CLANG_COMPATIBILITY``
381+
|
382+
- | Controls whether compatibility with clang C and C++ should be
383+
enabled by default or only when the ``--clang`` command-line
384+
option is specified. (Clang extensions are mostly identical to GNU
385+
extensions and are controlled by ``GNU_EXTENSIONS_ALLOWED``.)
380386

381387
Setting an ...\ ``_ALLOWED`` macro to TRUE makes the corresponding
382388
``DEFAULT_``\ ... macro TRUE by default. If the front end is configured to
@@ -386,15 +392,18 @@ to avoid selecting more than one dialect as the default.
386392
.. list-table::
387393

388394
* - | ``CPPCLI_ENABLING_POSSIBLE``
395+
| ``CPPCX_ENABLING_POSSIBLE``
389396
|
390-
- | Control whether a mode compatible with Microsoft's C++/CLI extensions
391-
should be available through the command-line option ``--cppcli``.
392-
Setting this option to TRUE requires that
393-
``MICROSOFT_EXTENSIONS_ALLOWED`` also be TRUE.
397+
- | Control whether a mode compatible with Microsoft's C++/CLI or
398+
C++/CX extensions should be available through the command-line
399+
options ``--cppcli``/``--cppcx``. Setting either of these options
400+
to TRUE requires that ``MICROSOFT_EXTENSIONS_ALLOWED`` also be
401+
TRUE.
394402
* - | ``DEFAULT_CPPCLI_ENABLED``
403+
| ``DEFAULT_CPPCX_ENABLED``
395404
|
396-
- | TRUE if C++/CLI extensions should be enabled by default when Microsoft
397-
extensions are enabled.
405+
- | TRUE if C++/CLI or C++/CX extensions should be enabled by default
406+
when Microsoft extensions are enabled.
398407

399408
IL Features
400409
^^^^^^^^^^^
@@ -415,14 +424,18 @@ IL Features
415424
including position information for operators that generally do not
416425
appear in the IL, such as ``*``, ``&``, and ``()``.
417426
* - | ``RECORD_MACROS_IN_IL``
427+
| ``RECORD_MACRO_INVOCATIONS``
428+
| ``RECORD_MACRO_ARGS``
418429
| ``FULLY_RESOLVED_MACRO_POSITIONS``
419430
| ``MACRO_INVOCATION_TREE_IN_IL``
420431
|
421-
- | Indicate whether extra information should be recorded in the IL to
422-
track macros and their expansions. Setting either of the latter two
423-
configuration macros to TRUE can increase the size of the IL
424-
substantially.
425-
* - | ``PROTOTYPE_INSTANTIATIONS_IN_IL``
432+
- | Indicate whether extra information should be recorded in the IL
433+
describing macros and their expansions. Setting
434+
``RECORD_MACRO_ARGS`` to TRUE requires that
435+
``RECORD_MACRO_INVOCATIONS`` be set to TRUE. Setting either of
436+
the latter two configuration macros to TRUE can increase the size
437+
of the IL substantially.
438+
* - | ``ALL_TEMPLATE_INFO_IN_IL``
426439
|
427440
- | TRUE if prototype template instantiations (i.e., the parsed generic
428441
form of templates) should be recorded in the main IL tree.
@@ -437,15 +450,16 @@ differ between target configurations).
437450
.. list-table::
438451

439452
* - | ``IA64_ABI``
440-
- | Controls whether the IA-64 ABI standard is used for code generation
441-
and object layout. This is a "modern" C++ object layout (unlike the
442-
cfront layout), and is a good starting point even on architectures
443-
other than IA-64 (Itanium). This ABI is used by many versions of g++
444-
(3.2 and later). For a complete specification, see
445-
``www.codesourcery.com/cxx-abi``. See also other macro names
446-
beginning with ``IA64_ABI``, some of which enable compatibility with
447-
the ARM EABI variant of the ``IA64_ABI``. If ``IA64_ABI`` is set to
448-
FALSE (or 0), a cfront-like ABI is used instead.
453+
- | Controls whether the IA-64 ABI standard is used for code
454+
generation and object layout. This is a "modern" C++ object
455+
layout (unlike the cfront layout), and is a good starting point
456+
even on architectures other than IA-64 (Itanium). This ABI is
457+
used by many versions of g++ (3.2 and later) and clang. For a
458+
complete specification, see ``www.codesourcery.com/cxx-abi``. See
459+
also other macro names beginning with ``IA64_ABI``, some of which
460+
enable compatibility with the ARM EABI variant of the
461+
``IA64_ABI``. If ``IA64_ABI`` is set to FALSE (or 0), a
462+
cfront-like ABI is used instead.
449463
* - | ``DEFAULT_GNU_ABI_VERSION``
450464
| ``DEFAULT_EMULATE_GNU_ABI_BUGS``
451465
|
@@ -456,11 +470,13 @@ differ between target configurations).
456470
| ``MSVC_TARGET_VERSION_NUMBER``
457471
| ``SUN_IS_GENERATED_CODE_TARGET``
458472
| ``SUN_TARGET_VERSION_NUMBER``
473+
| ``CLANG_IS_GENERATED_CODE_TARGET``
474+
| ``CLANG_TARGET_VERSION_NUMBER``
459475
|
460-
- | Control whether the code generated by the C- or C++-generating back
461-
end should target a specific GNU, Microsoft, or Sun compiler. This is
462-
information is used to avoid limitations of those compilers and to
463-
exploit extensions provided by those compilers.
476+
- | Control whether the code generated by the C- or C++-generating
477+
back end should target a specific GNU, Microsoft, Sun, or clang
478+
compiler. This is information is used to avoid limitations of
479+
those compilers and to exploit extensions they provide.
464480
* - | ``CP_GEN_BE_TARGET_MATCHES_SOURCE_DIALECT``
465481
|
466482
- | TRUE if the C++-generating back end should generate code that matches
@@ -512,9 +528,14 @@ Front End Behaviors
512528
while reading the source code.
513529
* - | ``UNICODE_SOURCE_SUPPORTED``
514530
|
515-
- | TRUE if the multibyte character set to be supported is Unicode encoded
516-
as UTF-8. UTF-16 is also accepted, and is translated to UTF-8
517-
immediately on input.
531+
- | TRUE if the character set to be supported is Unicode. When
532+
``MULTIBYTE_CHARS_IN_SOURCE_SUPPORTED`` is TRUE, source files
533+
encoded as UTF-8 and UTF-16 are accepted, depending on the
534+
``--unicode_source_kind`` command-line option,
535+
``DEFAULT_UNICODE_SOURCE_KIND`` configuration macro, or Byte Order
536+
Mark (BOM), and UTF-16 is translated to UTF-8 immediately on
537+
input. When ``MULTIBYTE_CHARS_IN_SOURCE_SUPPORTED`` is FALSE, the
538+
source file is assumed to be encoded as ISO/IEC 8859-1 (Latin-1).
518539

519540
Development Aids
520541
^^^^^^^^^^^^^^^^
@@ -534,17 +555,17 @@ Development Aids
534555
recommended for production builds.)
535556
* - | ``WRITE_CPPCLI_PORTABLE_ASSEMBLIES``
536557
|
537-
- | When TRUE, this enables an internal command-line option "``--set_flag
538-
generate_portable_assemblies``" that causes a front end built with
539-
support for C++/CLI (for Microsoft Windows) to write out all
540-
assemblies used in the compilation (likely including ``mscorlib.dll``)
541-
to be written in the current directory in a format that is readable on
542-
non-Windows platforms (i.e., with a front end not built with
543-
``EDG_WIN32`` set to TRUE). Since the assemblies are written in the
544-
current directory with their original file name (e.g.,
545-
"``mscorlib.dll``"), care should be taken that no required assemblies
546-
are in the current directory when the front end is invoked in this
547-
way.
558+
- | When TRUE, this enables an internal command-line option
559+
"``--set_flag generate_portable_assemblies``" that causes a front
560+
end built with support for C++/CLI (for Microsoft Windows) to
561+
write out all assemblies used in the compilation (likely including
562+
``mscorlib.dll``) in the current directory in a format that is
563+
readable on non-Windows platforms (i.e., with a front end not
564+
built with ``EDG_WIN32`` set to TRUE). Since the assemblies are
565+
written in the current directory with their original file name
566+
(e.g., "``mscorlib.dll``"), care should be taken that no required
567+
assemblies are in the current directory when the front end is
568+
invoked in this way.
548569

549570
.. _target-specific-configuration:
550571

@@ -742,15 +763,16 @@ can also support C++/CX, with the same caveats as those mentioned for C++/CLI
742763
support (in particular, IL lowering is not available for C++/CX mode).
743764

744765
To include support for C++/CLI and/or C++/CX the configuration macros
745-
``CPPCLI_ENABLING_POSSIBLE`` and/or ``CPPCX_ENABLING_POSSIBLE`` (respectively)
746-
must be set to TRUE. (The macros ``MICROSOFT_EXTENSIONS_ALLOWED`` and
747-
``EDG_WIN32`` must also be TRUE when building such configurations.) In addition
748-
to compiling the C files constituting the front end proper (as explained
749-
above), support for C++/CLI and/or C++/CX requires that the C++ source file
750-
``ms_metadata.cpp`` be compiled as C++ and the resulting object file must be
751-
added to the set of files linked into the final front end executable (or
752-
library). The system libraries ``mscoree.lib`` and ``oleaut32.lib`` are then
753-
also required in the final executable.
766+
``CPPCLI_ENABLING_POSSIBLE`` and/or ``CPPCX_ENABLING_POSSIBLE``
767+
(respectively) must be set to TRUE. (The macros
768+
``MICROSOFT_EXTENSIONS_ALLOWED`` and ``EDG_WIN32`` must also be TRUE when
769+
building such configurations.) In addition to compiling the C++ files
770+
constituting the front end proper (as explained above), support for C++/CLI
771+
and/or C++/CX requires that the C++ source file ``ms_metadata.cpp`` be
772+
compiled and the resulting object file must be added to the set of files
773+
linked into the final front end executable (or library). The system
774+
libraries ``mscoree.lib`` and ``oleaut32.lib`` are then also required in
775+
the final executable.
754776

755777
Compiling ``ms_metadata.cpp`` requires Visual C++ 2012 or later (or a C++
756778
compiler and libraries that are sufficiently compatible with that). The free
@@ -774,10 +796,10 @@ of the IL data structures contain fields that are present only in certain
774796
configurations.)
775797

776798
In an environment with a Unix-like ``make`` utility, ``edgcpdisp`` is
777-
automatically built (with a configuration that correctly matches that of the
778-
front end) when ``make`` is run for the default target in either the top-level
779-
or ``src/``\ directory. It can also be built separately by using ``make`` in
780-
the ``src/disp/``\ directory.
799+
automatically built (with a configuration that correctly matches that of
800+
the front end) when ``make`` is run for the default target in either the
801+
top-level or ``src/``\ directory. It can also be built separately in the
802+
``src/`` directory by specifying ``edgcpdisp`` as the target.
781803

782804
If ``make`` is not available, ``edgcpdisp`` can be built after the front end is
783805
built (as described in the preceding section) in the ``src/``\ directory by
@@ -803,6 +825,37 @@ following commands:
803825
To view the unlowered IL, see the ``--no_il_lowering`` front-end command-line
804826
option described in the next chapter.)
805827

828+
The format of the output is partially controlled by the configuration macro
829+
``ALTERNATIVE_IL_FILE_FORMAT``. When that macro is set to TRUE, each entry
830+
is given a unique numeric identifier, resulting in output like the
831+
following:
832+
833+
.. code:: text
834+
835+
...
836+
file-scope type#6
837+
source_corresp:
838+
name: file-scope id-name#17: "type_info"
839+
...
840+
841+
When ``ALTERNATIVE_IL_FILE_FORMAT`` is FALSE, the entries are
842+
distinguished by a hexadecimal representation of the entry's address:
843+
844+
.. code:: text
845+
846+
...
847+
file-scope type@a0013ee68
848+
source_corresp:
849+
name: file-scope id-name@a0013f050: "type_info"
850+
...
851+
852+
It is not necessary to use the ``edgcpdisp`` to get a human-readable
853+
display of the IL. When it is built with the configuration macro
854+
``NEED_IL_DISPLAY`` set to TRUE, the front end will put out the IL display
855+
on ``stdout`` (using the hexadecimal-address format) when the
856+
``--il_display`` command-line option is specified. (The IL need not be
857+
written to a file in this case.)
858+
806859
Driving the Front End
807860
=====================
808861

@@ -858,8 +911,8 @@ downloaded from the EDG download site. The file to download is
858911
it also contains source code for a Windows-hosted prelinker (``pl_nm``) and
859912
munch-like program (``munch_nm``).
860913

861-
The plain text file ``src/msinfo`` contains additional notes for running the
862-
front end in the Windows environment.
914+
The plain text file ``src/msinfo.txt`` contains additional notes for
915+
running the front end in the Windows environment.
863916

864917
Configuring and Building the Run-Time Support Library
865918
=====================================================
@@ -874,9 +927,9 @@ exception handling).
874927

875928
Similarly to the front end, the library can be configured through macro
876929
definitions placed in ``lib_src/defines.h``. Typically, however, few or no
877-
macros need to be defined because the ``--build_runtime`` option to the front
878-
end (used to build this library) causes most or all required macros to be
879-
predeclared.
930+
macros need to be defined because the ``--building_runtime`` option to the
931+
front end (used to build this library) causes most or all required macros
932+
to be predeclared.
880933

881934
The macros that might need manual configuration are documented in
882935
``lib_src/config.h``.

0 commit comments

Comments
 (0)