Working Draft, Standard for C++ Ecosystem
- License [intro.license]
- 1. Scope [intro.scope]
- 2. Normative references [intro.refs]
- 3. Conformance [intro.cnf]
- 4. Terms and definitions [intro.defs]
- 5. Introspection [intspct]
- 5.1. Preamble [intspct.pre]
- 5.2. Overview [intspct.overview]
- 5.3. Options [intspct.options]
- 5.4. Output [intspct.output]
- 5.5. Files [intspct.file]
- 5.6. Schema [intspct.schema]
- 5.7. Capabilities [intspct.cap]
- 5.8. Versions [intspct.vers]
- 5.9. Minimum Level [intspct.min]
- 5.10. Full Level [intspct.full]
- 5.11. Introspection Information [intspct.info]
- 5.12. Introspection Declaration [intspct.dcl]
- 5.13. Compatability [intspct.compat]
- 6. Structured Parameters [strctparam]
- 6.1. Preamble [strctparam.pre]
- 6.2. Overview [strctparam.overview]
- 6.3. Input Option [strctparam.input]
- 6.4. Files [strctparam.file]
- 6.5. Schema [strctparam.schema]
- 6.5.1. Structured Parameters Object [strctparam.schema.obj]
- 6.5.2. JSON Schema Field [strctparam.schema.schema]
- 6.5.3. Version Field [strctparam.schema.ver]
- 6.5.4. Arguments Field [strctparam.schema.args]
- 6.5.5. Options Field [strctparam.schema.opts]
- 6.5.6. Names [strctparam.schema.names]
- 6.5.7. Structured Option std.param [strctparam.schema.opt.param]
- 7. Structured Core Options [strctopt.core]
- 7.1. Preamble [strctopt.core.pre]
- 7.2. Source [strctopt.core.src]
- 7.3. Output [strctopt.core.out]
- 7.4. Include Directories [strctopt.core.incd]
- 7.5. Library Directories [strctopt.core.libd]
- 7.6. Define Preprocessor Symbols [strctopt.core.def]
- 7.7. Undefine Preprocessor Symbols [strctopt.core.undef]
- 7.8. Optimization [strctopt.core.opt]
- 7.9. Vendor [strctopt.core.vendor]
- 7.10. Language [strctopt.core.lang]
- 7.11. Kind [strctopt.core.kind]
- 8. Diagnostics Output [diag]
- Annex A [intsjschm.annex]
- Annex B [strctparamjschm.annex]
- Annex C [strctoptcorejschm.annex]
- Bibliography
License [intro.license]
This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit https://creativecommons.org/licenses/by/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
CC BY 4.0 [intro.license.legalcode]
Creative Commons Attribution 4.0 International Public License
By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
Section 1 -- Definitions.
-
Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
-
Adapter’s License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
-
Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
-
Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
-
Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
-
Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
-
Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
-
Licensor means the individual(s) or entity(ies) granting rights under this Public License.
-
Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
-
Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
-
You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
Section 2 -- Scope
-
License grant.
-
Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
-
reproduce and Share the Licensed Material, in whole or in part; and
-
produce, reproduce, and Share Adapted Material.
-
-
Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
-
Term. The term of this Public License is specified in Section 6(a).
-
Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a) (4) never produces Adapted Material.
-
Downstream recipients.
-
Offer from the Licensor -- Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
-
No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
-
-
No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
-
-
Other rights.
-
Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
-
Patent and trademark rights are not licensed under this Public License.
-
To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties.
-
Section 3 -- License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the following conditions.
-
Attribution.
-
If You Share the Licensed Material (including in modified form), You must:
-
retain the following if it is supplied by the Licensor with the Licensed Material:
-
identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
-
a copyright notice;
-
a notice that refers to this Public License;
-
a notice that refers to the disclaimer of warranties;
-
a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
-
-
indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
-
indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
-
-
You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
-
If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
-
If You Share Adapted Material You produce, the Adapter’s License You apply must not prevent recipients of the Adapted Material from complying with this Public License.
-
Section 4 -- Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
-
for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database;
-
if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and
-
You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
-
UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
-
TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
-
The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
Section 6 -- Term and Termination.
-
This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
-
Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
-
automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
-
upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
-
-
For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
-
Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
Section 7 -- Other Terms and Conditions.
-
The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
-
Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
Section 8 -- Interpretation.
-
For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
-
To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
-
No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
-
Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
Attribution [intro.license.attribution]
This document contains works copyrighted by the following entities or individuals:
-
International Organization for Standardization, ISO
-
International Electrotechnical Commission, IEC
-
René Ferdinand Rivera Morell
1. Scope [intro.scope]
This document specifies formats, processes, definitions, and so on, that facilitates the interoperation of the tools and systems that implement, and interface with, the C++ programming language.
C++ is a general purpose programming language described in ISO/IEC 14882:2020 Programming languages --- C++ (hereinafter referred to as the C++ standard).
2. Normative references [intro.refs]
The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.
- Vocabulary
-
ISO/IEC 2382, Information technology --- Vocabulary
- POSIX
-
ISO/IEC 9945:2009, Information technology --- Portable Operating System Interface (POSIX®) Base Specifications, Issue 7
- C++
-
ISO/IEC 14882:2020, Programming languages --- C++
- JSON
-
ISO/IEC 21778:2017, Information technology --- The JSON data interchange syntax
- Mathematics
-
ISO 80000-2:2019, Quantities and units --- Part 2: Mathematics
- SemVer
-
The SemVer Team. Semantic Versioning 2.0.0. June 18 2013. Available at: https://semver.org/spec/v2.0.0.html
3. Conformance [intro.cnf]
A conforming implementation shall meet the following criteria for conformance to this standard:
-
An application shall support the minimum level functionality of introspection ([intspct.min]).
4. Terms and definitions [intro.defs]
For the purposes of this document, the terms and definitions given in ISO/IEC 2382, the terms and definitions given in ISO/IEC 14882:2020, and the following apply.
ISO and IEC maintain terminology databases for use in standardization at the following addresses:
-
ISO Online browsing platform: available at https://www.iso.org/obp/
-
IEC Electropedia: available at https://www.electropedia.org/
Terms that are used only in a small portion of this document are defined where they are used and italicized where they are defined.
- application
-
a computer program that performs some desired function.
Note:
|
From POSIX. |
- capability
-
an aspect of an overall specification that defines a subset of the entire specification.
- directory
-
a file that contains directory entries.
Note:
|
From POSIX. |
- directory entry
-
an object that associates a filename with a file.
Note:
|
From POSIX. |
- file
-
an object that can be written to, or read from, or both.
Note:
|
From POSIX. |
- filename
-
a sequence of bytes used to name a file.
Note:
|
From POSIX. |
- parent directory
-
a directory containing a directory entry for the file under discussion.
Note:
|
From POSIX. |
- pathname
-
a string that is used to identify a file.
Note:
|
From POSIX. |
5. Introspection [intspct]
5.1. Preamble [intspct.pre]
This clause describes options, output, and formats that describe what capabilities of this standard an application supports. An application shall support the minimum level functionality ([intspct.min]). An application can support the full level functionality ([intspct.full]).
This clause specifies the std.info
capability ([intspct.cap]).
5.2. Overview [intspct.overview]
application [ std-info-opt [ declaration ] ] [ std-info-out-opt file ]
5.3. Options [intspct.options]
Applications shall accept one of two options syntax variations:
--name=value
(--name
without a value) or
-name:value
(-name
without a value).
Applications shall indicate an error if invoked with an option syntax variation that it does not support.
Note:
|
An application will report the error in what is conventional for the platform it runs in. On POSIX and Windows it would return an error code, and optionally output to the error stream. |
Note:
|
It is up to a program that interacts with an application implementing introspection to determine what option syntax variation the application supports. One method to accomplish that is to execute the application with one of the two syntax styles and use the error indication to conclude which syntax works. Another is to have a priori knowledge of which syntax variation works. |
5.3.1. Information Option [intspct.opt.info]
This option shall be supported.
std-info-opt
Outputs the version information of the capabilities supported by the
application.
The option is specified as --std-info
or -std-info
.
The option can be specified zero or one time.
The application shall support the option for minimum level
([intspct.min]) functionality.
5.3.2. Information Output Option [intspct.opt.out]
This option shall be supported.
std-info-out-opt file
The pathname of a file to output the information to.
The option is specified as --std-info-out=file
or
-std-info-out:file
.
If file is ‘-
’, the standard output shall be used.
The application shall support the option for minimum level
([intspct.min]) functionality.
Not specifying this option while specifying the
std-info-opt option ([intspct.opt.info]) shall be
equivalent to also specifying a std-info-out-opt
file option where file is ‘-
’.
5.3.3. Declaration Option [intspct.opt.decl]
This option should be supported.
std-info-opt declaration
Declares the required capability version of the application.
The option is specified as --std-info=
declaration or
-std-info:
declaration.
The option can be specified any number of times.
The application shall support the option for full level
([intspct.full]) functionality.
5.4. Output [intspct.output]
An application shall output a valid JSON text file that conforms to the introspection schema ([intspct.schema]) to the file specified in the options ([intspct.opt.out]).
5.5. Files [intspct.file]
An application can provide an introspection file that contains valid JSON that conforms to the introspection schema ([intspct.schema]).
An introspection file shall contain the same information as that produced from the std-info-opt information option ([intspct.opt.info]).
An introspection file shall be named the same as the application with
any filename extension replaced with the stdinfo
filename extension. It
is implementation defined how the filename of the introspection file replaces
the application filename extension with the new stdinfo
filename
extension.
Note:
|
For Windows, POSIX, and other platforms replacing the filename extension
would remove any filename bytes after the last period
(002E FULL STOP) and append the stdinfo sequence of
bytes.
|
An introspection file shall either have the same parent directory as the application, have an implementation defined parent directory that is relative to the parent directory of the application, or have an implementation defined parent directory.
5.6. Schema [intspct.schema]
An introspection JSON text file shall contain one introspection JSON object ([intspct.schema.obj]).
5.6.1. Introspection Object [intspct.schema.obj]
The introspection object is the root JSON object of the introspection JSON text.
An introspection object can have the following fields.
5.6.2. JSON Schema Field [intspct.schema.schema]
Name: $schema
Type: string
Value:
The value shall be a reference to a JSON Schema specification.
Description:
An introspection object can contain this field.
If an introspection object does not contain this field the value
shall be a reference to the JSON Schema corresponding to the current
edition of this standard.
5.6.3. Capability Field [intspct.schema.cap]
Name:
capability-identifier ([intspct.cap])
Type:
string
or array
Value: (for string
)
The value shall be a version-number for minimum level
functionality.
Or the value shall be a version-range for full level
functionality.
Value: (for array
)
The value can be a JSON array
for full level functionality.
If the value is a JSON array
the items in the array
shall be a
version-number or version-range.
Description:
An introspection object can contain this field one or more times.
When the field appears more than one time the name of the fields shall be
unique within the introspection object.
5.7. Capabilities [intspct.cap]
- capability-identifier
-
name scope-designator name sub-capability-identifier
- sub-capability-identifier
-
scope-designator name sub-capability-identifier
- name
-
one or more of:
0061 .. 007A LATIN SMALL LETTER A .. Z
005F LOW LINE - scope-designator
-
002E FULL STOP
A capability-identifier is composed of two or more scope-designator delimited name parts.
The name std
in a capability-identifier is
reserved for capabilities defined in this standard.
Applications can specify vendor designated name parts defined outside of this standard.
5.8. Versions [intspct.vers]
A version shall be either a single version number ([intspct.vers.num]) or a version range ([intspct.vers.range]).
A single version number shall be equivalent to the inclusive version range spanning solely that single version number.
Note:
|
That is, the version number i.j.k is equivalent to version range
[i.j.k,i.j.k] .
|
5.8.1. Version Number [intspct.vers.num]
A version number shall conform to the SemVer <version core>
syntax.
A version number can be truncated to only <major>
or
<major>.<minor>
syntax.
A version number composed of only <major>
is equivalent to
<major>.0.0
.
A version number composed of only <major>.<minor>
is equivalent to
<major>.<minor>.0
.
Version numbers define a total ordering where version number a is ordered before a version number b when a has a lower SemVer precedence than b.
5.8.2. Version Range [intspct.vers.range]
- version-range
-
version-range-min-bracket
version-min-number version-range-max-part
version-range-max-bracket - version-range-max-part
-
002C COMMA version-max-number
- version-min-number
-
version-number
- version-max-number
-
version-number
- version-range-min-bracket
-
one of:
005B LEFT SQUARE BRACKET
0028 LEFT PARENTHESIS - version-range-max-bracket
-
one of:
005D RIGHT SQUARE BRACKET
0029 RIGHT PARENTHESIS
A version range is composed of either one version number bracketed, or two version numbers separated by a 002C COMMA and bracketed.
[1.0.0]
”.
[1.0.0,2.0.0]
”.
A version range a that is [
i,
j]
makes
i and j inclusive version range numbers, defining a Mathematics
closed interval.
A version range a that is (
i,
j)
makes
i and j exclusive version range numbers, defining a Mathematics
open interval.
A version range a that is (
i,
j]
makes
i an exclusive version number and j an inclusive version number,
defining a Mathematics half-open interval.
A version range a that is [
i,
j)
makes
j an exclusive version number.
A version range with a single inclusive version number x is equivalent
to the version range [
x,
x]
.
A version range with a single exclusive version number x is invalid.
An exclusive version number x does not include the version number x when compared to another version number y.
A version range a with version numbers i and j when compared to a version range b with version number m and n will result in an empty version range when: j < m or n < i.
Otherwise if i or m are inclusive version numbers and if j or n are inclusive version numbers the resulting range when a is compare to b is the inclusive version numbers “lesser of i and m” and “lesser of j and n”.
Otherwise if i or m are inclusive version numbers and if j or n are inclusive version numbers the resulting range when a is compare to b is the inclusive version number “lesser of i and m” and the exclusive version number “lesser of j and n”.
Otherwise if j or n are inclusive version numbers the resulting range when a is compared to b is the exclusive version number “lesser of i and m” and the inclusive version number “lesser of j and n”.
Otherwise the resulting range when a is compared to b is the exclusive version numbers “lesser of i and m” and “lesser of j and n”.
5.9. Minimum Level [intspct.min]
An application that supports the minimum level functionality indicates
it by specifying a single version ([intspct.vers.num]) as the value of the
std.info
capability ([intspct.cap]).
{ "std.info": "1.0.0" }
5.10. Full Level [intspct.full]
An application can support the full level functionality as defined in this section. An application that reports supporting the full level functionality shall support all of the functionality in this section.
An application that supports the full level functionality indicates it by
specifying a version range ([intspct.vers.range]) or an array of version
range items as the value of the std.info
capability ([intspct.cap]).
{ "std.info": "[1.0.0]" }
An application that responds with an array of version range items as the value of a capability field shall support the union of the range items indicated.
5.11. Introspection Information [intspct.info]
An application shall output an introspection schema ([intspct.schema]) that
contains one capability field for each capability that the application supports
when given the --std-info
option ([intspct.opt.info]).
An application shall indicate the single version ([intspct.vers.num]) or version range ([intspct.vers.range]) of each capability it supports as the value of the capability field.
5.12. Introspection Declaration [intspct.dcl]
An application that supports the full level functionality when given one or more std-info-opt declaration options shall conform its functionality to the indicated edition of this standard in the given declaration version-number for the given capability.
- declaration
-
capability-identifier 003d equals sign version-number
An application, when not given a std-info-opt declaration option for a capability it supports, should conform its functionality to the most recent version of the standard it supports for that capability.
An application, when given a capability declaration option and the given version is outside of the version range that the application supports, should indicate an error.
5.13. Compatability [intspct.compat]
An application shall indicate, per SemVer specification, that version n
of the interface it implements is backward compatible with another
version p of the interface that another application implements when the
<major>
number is the same in version n and p and version
n follows version p.
6. Structured Parameters [strctparam]
6.1. Preamble [strctparam.pre]
This clause describes options, output, and formats that control the behavior of applications through the specification of arguments and options from structured parameters.
This clause specifies the std.strctparam
capability
([intspct.cap]) version 1.0.0
.
An application can implement this capability.
An application that implements the std.strctparam
capability shall
include the std.strctparam
field and version value in the introspection
JSON text output ([intspct.schema.cap]).
6.2. Overview [strctparam.overview]
application [ std-strctparam-input file ]
6.3. Input Option [strctparam.input]
std-strctparam-input
The pathname of a file to read the structured parameters from.
The option is specified as --std-param=
file or -std-param:
file.
If file is ‘-’, the standard input shall be used.
6.4. Files [strctparam.file]
An application shall read a valid JSON text file that conforms to the structured parameters schema ([strctparam.schema]).
An application shall interpret the information in the file as if the options and arguments in the file occur in the same position as the std-strctparam-input parameter of the list of parameters given to the application. Given either directly as part of the application command line or as part of the arguments field ([strctparam.schema.args]).
An application shall process arguments in the file in the order that they appear.
An application shall process options in the file as if the a new modified state replaces the current state.
6.5. Schema [strctparam.schema]
A structured parameters JSON text file shall contain one structured parameters JSON object ([strctparam.schema.obj]).
6.5.1. Structured Parameters Object [strctparam.schema.obj]
The structured parameters object is the root JSON object of the structured parameters JSON text.
A structured parameters object can have the following fields.
A structured parameters object shall have only one of the
arguments
and options
fields.
6.5.2. JSON Schema Field [strctparam.schema.schema]
Name: $schema
Type: string
Value:
The value shall be a reference to a JSON Schema specification.
Description:
A structured parameters object can contain this field.
If a structured parameters object does not contain this field the
value shall be a reference to the JSON Schema corresponding to the current
edition of this standard ([strctparamjschm]).
6.5.3. Version Field [strctparam.schema.ver]
Name: version
Type: string
Value: 1
or 1.0
or 1.0.0
Description:
The version field indicates the version of the structured parameters
represented in the contents of the JSON text.
If a structured parameters object does not contain this field the
value shall be 1.0.0
.
6.5.4. Arguments Field [strctparam.schema.args]
Name: arguments
Type: array
Value:
The value shall be a JSON array
. The items in the array
shall be of JSON
string
types.
Description:
The arguments field specifies items to be interpreted directly as if they
occur in the command line of the program.
The application shall process the items as if they replace the
std-strctparam-input
argument.
6.5.5. Options Field [strctparam.schema.opts]
Name: options
Type: object
Value: The value shall be a JSON object
.
Description:
A structured parameters object can contain this structured
options field. The keys of items shall be name
([strctparam.schema.names]) values.
6.5.6. Names [strctparam.schema.names]
- name
-
one or more of:
0061 .. 007A LATIN SMALL LETTER A .. Z
0030 .. 0039 DIGIT ZERO .. NINE
005F LOW LINE 002D HYPHEN-MINUS - scope
-
name scope-designator scope
- scope-designator
-
002E FULL STOP
The name std
is reserved for structured options
defined in this standard.
Applications can specify vendor designated name parts outside of this standard.
6.5.7. Structured Option std.param [strctparam.schema.opt.param]
The std.param
structured option defines an option to refer to additional
structured parameters ([strctparam]) to process.
An application shall implement this option.
The std.param
option shall have the following fields.
Name: pre
Type: string
or array
Value:
(for string
) A pathname to a file containing structured parameters
([strctparam]).
Value:
(for array
) A list of pathname string
items to files containing
structured parameters ([strctparam])
Description:
One or more references to files that include additional structured
parameters ([strctparam]).
Name: post
Type: string
or array
Value:
(for string
) A pathname to a file containing structured parameters
([strctparam]).
Value:
(for array
) A list of pathname string
items to files containing
structured parameters ([strctparam])
Description:
One or more references to files that include additional structured
parameters ([strctparam]).
A string
value in the pre
or post
field shall be as if the
value was given as an array
with the string
value as the only
value in the array
.
An application shall process the structured parameters ([strctparam]) in the
pre
field before processing the structured options where the
std.param
option is specified.
An application shall process the structured parameters ([strctparam]) in the
post
field after processing the structured options where the
std.param
option is specified.
An application shall process the structured parameters ([strctparam]) in the
pre
and post
field in the order given in the value applying
semantics as specified in the parameters or options of the structured
parameters.
7. Structured Core Options [strctopt.core]
7.1. Preamble [strctopt.core.pre]
This clause describes the schema and semantics of core structured options ([strctparam.schema.opts]) for C++ compiler front-end applications.
This clause specifies the std.strctopt.core
capability
([intspct.cap]) version 1.0.0
.
An application can implement this capability.
An application that implements the std.strctopt.core
capability shall include
the std.strctopt.core
field and version value in the introspection JSON
text output ([intspct.schema.cap]).
7.2. Source [strctopt.core.src]
Name: source
Type: array
Value: The value shall be a JSON array
. The items in the array
shall be of JSON object
items specifying source objects
([strctopt.core.srcobj]).
Description:
Defines a list of source files for an application to process.
The application shall add the given sources to the set of files to process.
The sources given shall be appended to existing sources in the order given.
7.2.1. Source Object [strctopt.core.srcobj]
A source object shall have a name
field.
Name: name
Type: string
Value: A pathname to a file.
Description: The pathname of the source file.
A source object can have a language field ([strctopt.core.lang]).
Specifying a language field for a source shall replace any other determination of the source language by the application.
Specifying a language field for a source shall replace a language field specified in the structured parameters options field ([strctparam.schema.opts]).
A source object can have a kind field ([strctopt.core.kind]).
Specifying a kind field for a source shall replace any other determination of the source kind by the application.
Specifying a kind field for a source shall replace a kind field specified in the structured parameters options field ([strctparam.schema.opts]).
A source object can have a vendor field ([strctopt.core.vendor]).
7.3. Output [strctopt.core.out]
Name: output
Type: array
Value: The value shall be a JSON array
. The items in the array
shall be JSON object
items specifying output objects
([strctopt.core.outobj]).
Description:
Specifies the output files to generated when processing sources
([strctopt.core.src]).
7.3.1. Output Object [strctopt.core.outobj]
An output object shall have a name
field.
Name: name
Type: string
Value: A pathname to a file.
Description: The name of the output file.
An output object can have a kind field ([strctopt.core.kind]).
Specifying a kind field for output shall replace any other determination of the output kind by the application.
An output object can have a vendor field ([strctopt.core.vendor]).
7.4. Include Directories [strctopt.core.incd]
Name: include_dirs
Type: array
Value: The value shall be a JSON array
. The items in the array
shall be JSON string
items of pathnames to directories.
Description:
One or more entries to directories that are searched by the header inclusion
of a C++ preprocessor.
The application shall add the given directories to the set of directories searched by the header inclusion of a C++ preprocessor.
The directories given shall be appended to the existing include search directories in the order given.
7.5. Library Directories [strctopt.core.libd]
Name: library_dirs
Type: array
Value: The value shall be a JSON array
. The items in the array
shall be JSON string
items of pathnames to directories.
Description:
One or more entries to directories that are searched for libraries.
The application shall add the given directories to the set of directories searched for libraries.
The directories given shall be appended to the existing library search directories in the order given.
7.6. Define Preprocessor Symbols [strctopt.core.def]
Name: define
Type: array
Value: The value shall be a JSON array
. The items in the array
shall be JSON object
items specifying preprocessor symbol definition
objects ([strctopt.core.def.sym]).
Description:
Specifies preprocessor symbols to define during processing of sources.
7.6.1. Preprocessor Symbol Definition Object [strctopt.core.def.sym]
Name: name
Type: string
Value: A valid preprocessor symbol.
Description:
The field specifies the preprocessor symbol to define.
The symbol shall be valid for the consuming application.
The application shall indicate an error for invalid symbols.
Name: value
Type: number
, string
, boolean
, or null
Value: A valid preprocessor define value.
Description:
The field specifies the value to assign to the preprocessor symbol.
The value shall be valid for the consuming application.
The value can be omitted. When the value is omitted it shall be converted to a
string value of 1
.
A number
value shall be converted to a string value.
A string
value shall be used as given.
A true
value shall be converted to a string value of 1
.
A false
value shall be converted to a string value of 0
.
A null
value shall be converted to a string value of 1
.
7.7. Undefine Preprocessor Symbols [strctopt.core.undef]
Name: undef
Type: array
Value: The value shall be a JSON array
. The items in the array
shall be of JSON string
defining preprocessor symbol names.
Description: Specifies preprocessor symbols to "undefine".
The symbols shall be valid for the consuming application.
The application shall indicate an error for invalid symbols.
The application shall evaluate this option after any define
([strctopt.core.def]) options.
7.8. Optimization [strctopt.core.opt]
Name: optimization
Type: string
Value: An optimization object item ([strctopt.core.optobj])
Description: The optimization to apply when generating the output.
The application shall replace each existing field in the optimization object ([strctopt.core.optobj]).
7.8.1. Optimization Object [strctopt.core.optobj]
An optimization object can have any of compile
and link
fields.
Name: compile
Type: string
Value: off
, minimal
, speed
, space
, or debug
Description:
The amount or type of optimization to apply to the generated output.
An application shall not perform optimization when given the off
value.
For minimal
, speed
, space
, and debug
values the application behavior is
unspecified.
Name: link
Type: boolean
Value: true
or false
Description:
Specify if optimizations that happen for linked output generation happen.
An application shall not perform optimizations for linked output generation
when the value is false
.
For a true
value the application behavior is unspecified.
An optimization object can have a vendor field ([strctopt.core.vendor]).
7.9. Vendor [strctopt.core.vendor]
Name: vendor
Type: object
Value: A vendor object ([strctopt.core.vendorobj])
Description:
Specifies vendor defined options to apply in the context they appear.
An application shall apply the vendor option semantics in the context they appear.
7.9.1. Vendor Object [strctopt.core.vendorobj]
A vendor object can have any number of fields.
The name of a field is unspecified.
The value of a field is unspecified.
Note:
|
It is up to application vendors to agree on the name fields. |
Note:
|
It is up to application vendors to document the schema of the field values. |
7.10. Language [strctopt.core.lang]
Name: language
Type: object
Value: A language object [strctop.core.langobj]
Description: The language to interpret the source as.
7.10.1. Language Object [strctopt.core.langobj]
A language object shall have a name
field.
Name: name
Type: string
Value: One of: c++
or an application defined value.
Description: Specifies the source text language.
Only a value of c++
specifies that source text ([strctopt.core.src]) is
C++ ISO language.
7.11. Kind [strctopt.core.kind]
Name: kind
Type: string
Value: A kind item ([strctopt.core.kind])
Description:
The kind, or format, of the source file corresponding to the output
file ([strctopt.core.out]).
7.11.1. Kind Object [strctopt.core.kindobj]
Name: name
Type: string
Value: One of: text
, exec
, object
, dynamic_lib
,
archive_lib
Description: The kind, or format, of source and output files.
A text
value specifies that the source or output is textual.
A exec
value specifies that the source or output is an executable program.
A object
value specifies that the source or output is a linkable object.
A dynamic_lib
value specifies that the source or output is dynamically
linkable.
A archive_lib
value specifies that the source or output is an archive, or
collection, of linkable objects.
8. Diagnostics Output [diag]
8.1. Preamble [diag.pre]
This clause describes options, output, and formats that define formatted reporting of application diagnostics messages.
Annex A [intsjschm.annex]
Tool Introspection JSON Schema [intsjschm]
General [intsjschm.general]
This Annex defines the introspection capability schema ([intspct.schema]) in terms of a JSON Schema [jsonschema].
This JSON Schema can be referenced as the $schema
field with URI value
of "std_info-1.0.0.json"
.
JSON Schema Specification [intsjschm.spec]
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "std_info-1.0.0.json",
"title": "Tool Introspection Version 1.0.0 JSON Schema",
"$defs": {
"VersionMin": {
"type": "string",
"pattern": "^[0-9]+([.][0-9]+){0,2}$"
},
"VersionFull": {
"type": "string",
"pattern": "^[[(][0-9]+([.][0-9]+){0,2}[)\\]]$"
},
"VersionRange": {
"type": "string",
"pattern": "^[[(][0-9]+([.][0-9]+){0,2},[0-9]+([.][0-9]+){0,2}[)\\]]$"
},
"Version": {
"oneOf": [
{
"$ref": "#/$defs/VersionMin"
},
{
"$ref": "#/$defs/VersionFull"
},
{
"$ref": "#/$defs/VersionRange"
}
]
},
"Versions": {
"type": "array",
"items": {
"$ref": "#/$defs/Version"
}
},
"VersionSpec": {
"oneOf": [
{
"$ref": "#/$defs/Version"
},
{
"$ref": "#/$defs/Versions"
}
]
}
},
"anyOf": [
{
"type": "object",
"properties": {
"$schema": {
"description": "JSON Schema URI for the version of the tool introspection format.",
"type": "string",
"format": "uri"
},
"std.info": {
"description": "The Tool Introspection format version.",
"$ref": "#/$defs/VersionSpec"
}
},
"patternProperties": {
"^[a-z_]+([.][a-z_]+)+$": {
"$ref": "#/$defs/VersionSpec"
}
},
"additionalProperties": false
}
],
"required": ["std.info"]
}
Annex B [strctparamjschm.annex]
Structured Parameters JSON Schema [strctparamjschm]
General [strctparamjschm.general]
This Annex defines the structured parameters capability schema ([strctparam.schema]) in terms of a JSON Schema [jsonschema].
This JSON Schema can be referenced as the \verb|$schema| field with URI value
of "std_param-1.0.0.json"
.
JSON Schema Specification [strctparamjschm.spec]
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "std_param-1.0.0.json",
"title": "Structured Parameters Version 1.0.0 JSON Schema",
"type": "object",
"properties": {
"$schema": {
"description": "JSON Schema URI for the version of the structured parameters format.",
"type": "string",
"format": "uri"
},
"version": {
"description": "The Structured Parameters format version.",
"type": "string",
"$ref": "#/$defs/Version"
}
},
"patternProperties": {
"arguments": {
"description": "Application direct arguments.",
"type": "array",
"items": { "type": "string" }
},
"options": {
"type": "object",
"patternProperties": {
"param": { "$ref": "#/$defs/Std.Param" },
"source": {
"$ref": "std_opt_core-1.0.0.json#/$defs/Std.Source"
},
"output": {
"$ref": "std_opt_core-1.0.0.json#/$defs/Std.Output"
},
"include_dirs": {
"$ref": "std_opt_core-1.0.0.json#/$defs/Std.IncludeDirs"
},
"library_dirs": {
"$ref": "std_opt_core-1.0.0.json#/$defs/Std.LibraryDirs"
},
"define": {
"$ref": "std_opt_core-1.0.0.json#/$defs/Std.Define"
},
"undef": {
"$ref": "std_opt_core-1.0.0.json#/$defs/Std.Undef"
},
"language": {
"$ref": "std_opt_core-1.0.0.json#/$defs/Std.Language"
},
"optimization": {
"$ref": "std_opt_core-1.0.0.json#/$defs/Std.Optimization"
},
"vendor": {
"$ref": "std_opt_core-1.0.0.json#/$defs/Std.Vendor"
}
}
}
},
"additionalProperties": false,
"oneOf": [{ "required": ["arguments"] }, { "required": ["options"] }],
"$defs": {
"Version": {
"type": "string",
"pattern": "^[0-9]+([.][0-9]+){0,2}$"
},
"Name": {
"type": "string",
"pattern": "^([a-z0-9_-]+[.])*([a-z0-9_-]+)$"
},
"StringOrArray": {
"type": ["string", "array"],
"items": { "type": "string" }
},
"Std.Param": {
"description": "Recursive reference to one or more structured parameters files.",
"type": "object",
"properties": {
"pre": { "$ref": "#/$defs/StringOrArray" },
"post": { "$ref": "#/$defs/StringOrArray" }
},
"additionalProperties": false
}
}
}
Annex C [strctoptcorejschm.annex]
Structured Core Options JSON Schema [strctoptcorejschm]
General [strctoptcorejschm.general]
This Annex defines the structured parameter core options schema ([strctopt.core]) in terms os a JSON Schema [jsonschema].
This JSON Schema can be referenced as the \verb|$schema| field with URI value
of "std_opt_core-1.0.0.json"
.
JSON Schema Specification [strctoptcorejschm.spec]
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "std_opt_core-1.0.0",
"title": "Structured Core Options Version 1.0.0 JSON Schema",
"patternProperties": {
"source": { "$ref": "#/$defs/Std.Source" },
"output": { "$ref": "#/$defs/Std.Output" },
"include_dirs": { "$ref": "#/$defs/Std.IncludeDirs" },
"library_dirs": { "$ref": "#/$defs/Std.LibraryDirs" },
"define": { "$ref": "#/$defs/Std.Define" },
"undef": { "$ref": "#/$defs/Std.Undef" },
"optimization": { "$ref": "#/$defs/Std.Optimization" },
"vendor": { "$ref": "#/$defs/Std.Vendor" },
"language": { "$ref": "#/$defs/Std.Language" },
"kind": { "$ref": "#/$defs/Std.Kind" }
},
"$defs": {
"Std.Source": {
"description": "The source files to process.",
"type": "array",
"items": {
"description": "A file to process.",
"type": "object",
"patternProperties": {
"name": { "type": "string" },
"language": { "$ref": "#/$defs/Std.Language" },
"kind": { "$ref": "#/$defs/Std.Kind" },
"vendor": { "$ref": "#/$defs/Std.Vendor" }
},
"required": ["name"],
"additionalProperties": false
}
},
"Std.Output": {
"description": "The output files to generate.",
"type": "array",
"items": {
"description": "An output file.",
"type": "object",
"patternProperties": {
"name": { "type": "string" },
"kind": { "$ref": "#/$defs/Std.Kind" },
"vendor": { "$ref": "#/$defs/Std.Vendor" }
},
"required": ["name"],
"additionalProperties": false
}
},
"Std.IncludeDirs": {
"description": "Include directories.",
"type": "array",
"items": { "type": "string" }
},
"Std.LibraryDirs": {
"description": "Library directories.",
"type": "array",
"items": { "type": "string" }
},
"Std.Define": {
"description": "Define preprocessor symbols.",
"type": "array",
"items": {
"type": "object",
"patternProperties": {
"name": { "type": "string" },
"value": {
"type": ["number", "integer", "string", "boolean", "null"]
}
},
"required": ["name"],
"additionalProperties": false
}
},
"Std.Undef": {
"description": "Undefine preprocessor symbols.",
"type": "array",
"items": { "type": "string" }
},
"Std.Language": {
"description": "The language to interpret sources for.",
"type": "object",
"patternProperties": {
"name": {
"type": "string"
}
},
"required": ["name"]
},
"Std.Optimization": {
"description": "The optimizations to apply to different stages of the processing.",
"type": "object",
"patternProperties": {
"compile": {
"type": "string",
"enum": ["off", "minimal", "speed", "space", "debug"]
},
"link": {
"type": "boolean"
},
"vendor": { "$ref": "#/$defs/Std.Vendor" }
}
},
"Std.Vendor": {
"description": "Vendor defined specifications.",
"type": "object",
"patterProperties": {
"^[a-z]+$": {
"type": "object"
}
}
},
"Std.Kind": {
"description": "The kind of data a source of output is.",
"type": "string",
"enum": ["text", "exec", "object", "dynamic_lib", "archive_lib"]
}
}
}
Bibliography
-
Internet Engineering Task Force. IETF RFC draft JSON Schema: A Media Type for Describing JSON Documents. Available from: https://json-schema.org/draft/2020-12/json-schema-core.html