Skip to content

Commit dbbf110

Browse files
authored
args module (#437)
This completes rewriting the command line argument parsing to replace it with the Lyra library. The main() changes now allow for parsing project jamfiles before printing help text. And hence allow for all jam side args to be displayed with -h.
1 parent b967c35 commit dbbf110

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+2674
-2299
lines changed

.ci/azp-linux-test.yml

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,46 @@
11
parameters:
2-
- name: b2_opts
3-
type: string
4-
default: ''
2+
- name: b2_opts
3+
type: string
4+
default: ""
55

66
steps:
7-
- bash: |
8-
set -e
9-
uname -a
10-
./.ci/linux-cxx-install.sh
11-
python3 --version
12-
displayName: Install
13-
- bash: |
14-
set -e
15-
cd src/engine
16-
set PATH=${PATH};${CXX_PATH}
17-
./build.sh ${TOOLSET}
18-
./b2 -v
19-
cd ../..
20-
echo "using ${TOOLSET%%-[0-9]*} : : ${CXX} ;" > ${HOME}/user-config.jam
21-
displayName: Build
22-
- bash: |
23-
set -e
24-
echo "Available system locales:"
25-
locale -a
26-
echo "Switch to C.UTF-8 locale."
27-
export LC_ALL=C.UTF-8
28-
cd test
29-
./test_all.py ${TOOLSET}
30-
cd ..
31-
displayName: Test
32-
- bash: |
33-
set -e
34-
./src/engine/b2 b2 warnings-as-errors=on variant=debug,release ${TOOLSET:+toolset=$TOOLSET} ${{ parameters.b2_opts }}
35-
displayName: "No Warnings"
36-
- bash: |
37-
set -e
38-
./bootstrap.sh ${TOOLSET}
39-
./b2 --prefix=$HOME/temp/.b2 install ${TOOLSET:+toolset=$TOOLSET} ${{ parameters.b2_opts }}
40-
rm ./b2
41-
export PATH=$HOME/temp/.b2/bin:$PATH
42-
cd $HOME
43-
touch build.jam
44-
b2 -v
45-
b2 -n --debug-configuration ${TOOLSET:+toolset=$TOOLSET} ${{ parameters.b2_opts }}
46-
displayName: Bootstrap
7+
- bash: |
8+
set -e
9+
uname -a
10+
./.ci/linux-cxx-install.sh
11+
python3 --version
12+
displayName: Install
13+
- bash: |
14+
set -e
15+
cd src/engine
16+
set PATH=${PATH};${CXX_PATH}
17+
./build.sh ${TOOLSET}
18+
./b2 -v
19+
cd ../..
20+
echo "using ${TOOLSET%%-[0-9]*} : : ${CXX} ;" > ${HOME}/user-config.jam
21+
displayName: Build
22+
- bash: |
23+
set -e
24+
echo "Available system locales:"
25+
locale -a
26+
echo "Switch to C.UTF-8 locale."
27+
export LC_ALL=C.UTF-8
28+
cd test
29+
./test_all.py ${TOOLSET}
30+
cd ..
31+
displayName: Test
32+
- bash: |
33+
set -e
34+
./src/engine/b2 b2 warnings-as-errors=on variant=debug,release ${TOOLSET:+toolset=$TOOLSET} ${{ parameters.b2_opts }}
35+
displayName: "No Warnings"
36+
- bash: |
37+
set -e
38+
./bootstrap.sh ${TOOLSET}
39+
./b2 --prefix=$HOME/temp/.b2 install ${TOOLSET:+toolset=$TOOLSET} ${{ parameters.b2_opts }}
40+
rm ./b2
41+
export PATH=$HOME/temp/.b2/bin:$PATH
42+
cd $HOME
43+
touch build.jam
44+
b2 -v
45+
b2 -n --debug-configuration ${TOOLSET:+toolset=$TOOLSET} ${{ parameters.b2_opts }}
46+
displayName: Bootstrap

.clang-format

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@ UseTab: Always
77
Language: Cpp
88
AccessModifierOffset: 0
99
AlignAfterOpenBracket: DontAlign
10-
AlignConsecutiveAssignments: false
11-
AlignConsecutiveDeclarations: false
10+
AlignArrayOfStructures: None
11+
AlignConsecutiveAssignments: None
12+
AlignConsecutiveBitFields: None
13+
AlignConsecutiveDeclarations: None
14+
AlignConsecutiveMacros: None
1215
AlignEscapedNewlines: DontAlign
1316
AlignOperands: DontAlign
14-
AlignTrailingComments: false
17+
AlignTrailingComments: { Kind: Never }
1518
AllowAllArgumentsOnNextLine: true
1619
AllowAllConstructorInitializersOnNextLine: true
1720
AllowAllParametersOfDeclarationOnNextLine: true
@@ -29,22 +32,22 @@ BinPackParameters: false
2932
BitFieldColonSpacing: Both
3033
BreakBeforeBraces: Custom
3134
BraceWrapping:
32-
AfterCaseLabel: true
33-
AfterClass: true
34-
AfterControlStatement: Always
35-
AfterEnum: true
36-
AfterExternBlock: true
37-
AfterFunction: true
38-
AfterNamespace: false
39-
AfterStruct: true
40-
AfterUnion: true
41-
BeforeCatch: true
42-
BeforeElse: true
43-
BeforeWhile: true
44-
IndentBraces: false
45-
SplitEmptyFunction: false
46-
SplitEmptyNamespace: true
47-
SplitEmptyRecord: false
35+
AfterCaseLabel: true
36+
AfterClass: true
37+
AfterControlStatement: Always
38+
AfterEnum: true
39+
AfterExternBlock: true
40+
AfterFunction: true
41+
AfterNamespace: false
42+
AfterStruct: true
43+
AfterUnion: true
44+
BeforeCatch: true
45+
BeforeElse: true
46+
BeforeWhile: true
47+
IndentBraces: false
48+
SplitEmptyFunction: false
49+
SplitEmptyNamespace: true
50+
SplitEmptyRecord: false
4851
BreakBeforeBinaryOperators: All
4952
BreakBeforeTernaryOperators: true
5053
BreakConstructorInitializers: BeforeComma
@@ -70,6 +73,7 @@ NamespaceIndentation: None
7073
PenaltyBreakBeforeFirstCallParameter: 0
7174
PenaltyBreakFirstLessLess: 0
7275
PenaltyReturnTypeOnItsOwnLine: 999999
76+
PenaltyIndentedWhitespace: 999999
7377
PointerAlignment: Middle
7478
PPIndentWidth: 0
7579
ReflowComments: true

.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ trim_trailing_whitespace = true
1515
indent_size = 2
1616
indent_style = space
1717

18+
[*.clang-format]
19+
indent_size = 1
20+
indent_style = space
21+
1822
[*.jam]
1923
indent_style = space
2024

.vscode/launch.json

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"name": "(gdb) Pipe Launch",
99
"type": "cppdbg",
1010
"request": "launch",
11-
"program": "/root/b2/.build/gcc-12/debug/cxxstd-11-iso/threading-multi/b2",
11+
"program": "/root/b2/.build/gcc-14/debug/cxxstd-11-iso/threading-multi/b2",
1212
"args": [],
1313
"stopAtEntry": true,
1414
"cwd": "/root/b2/test/grep",
@@ -68,11 +68,16 @@
6868
"request": "launch",
6969
"program": "${workspaceFolder}\\.build\\msvc-14.3\\debug\\cxxstd-11-iso\\threading-multi\\b2.exe",
7070
"args": [
71-
"-v"
71+
"-ftest.jam"
7272
],
7373
"stopAtEntry": false,
74-
"cwd": "${workspaceFolder}\\src\\engine",
75-
"environment": []
74+
"cwd": "${workspaceFolder}\\test",
75+
"environment": [
76+
{
77+
"name": "BOOST_BUILD_PATH",
78+
"value": "${workspaceFolder}"
79+
}
80+
]
7681
},
7782
{
7883
"name": "(msvc) Launch, Unit Tests",
@@ -92,10 +97,12 @@
9297
"name": "(gcc) Launch",
9398
"type": "cppdbg",
9499
"request": "launch",
95-
"program": "${workspaceFolder}/.build/gcc-13/debug/cxxstd-11-iso/threading-multi/b2",
96-
"args": ["-d1", "--command-database=json", "b2"],
100+
"program": "${workspaceFolder}/.build/gcc-14/debug/cxxstd-11-iso/threading-multi/b2",
101+
"args": [
102+
"-h"
103+
],
97104
"stopAtEntry": false,
98-
"cwd": "${workspaceFolder}",
105+
"cwd": "${workspaceFolder}/example/hello",
99106
"environment": [],
100107
"externalConsole": false,
101108
"MIMode": "gdb",
@@ -111,10 +118,10 @@
111118
"name": "(gcc) Launch: ASAN",
112119
"type": "cppdbg",
113120
"request": "launch",
114-
"program": "${workspaceFolder}/.build/gcc-13/debug/address-sanitizer-on/cxxstd-11-iso/b2",
121+
"program": "${workspaceFolder}/.build/gcc-14/debug/address-sanitizer-on/cxxstd-11-iso/threading-multi/b2",
115122
"args": [
116-
"-na",
117-
"toolset=gcc"
123+
"-n",
124+
"-a"
118125
],
119126
"stopAtEntry": false,
120127
"cwd": "${workspaceFolder}",
@@ -133,7 +140,7 @@
133140
"name": "(gcc) Launch, Unit Tests",
134141
"type": "cppdbg",
135142
"request": "launch",
136-
"program": "${workspaceFolder}/.build/gcc-13/debug/cxxstd-11-iso/threading-multi/b2",
143+
"program": "${workspaceFolder}/.build/gcc-14/debug/cxxstd-11-iso/threading-multi/b2",
137144
"args": [
138145
"--debug",
139146
"--build-system=test/test",
@@ -158,7 +165,7 @@
158165
"name": "(gcc) Launch, Unit Tests: ASAN",
159166
"type": "cppdbg",
160167
"request": "launch",
161-
"program": "${workspaceFolder}/.build/gcc-13/debug/address-sanitizer-on/cxxstd-11-iso/b2",
168+
"program": "${workspaceFolder}/.build/gcc-14/debug/address-sanitizer-on/cxxstd-11-iso/b2",
162169
"args": [
163170
"--debug",
164171
"--build-system=test/test",
@@ -187,7 +194,7 @@
187194
"name": "(rr) Launch",
188195
"type": "cppdbg",
189196
"request": "launch",
190-
"program": "${workspaceFolder}/.build/gcc-13/debug/cxxstd-11-iso/b2",
197+
"program": "${workspaceFolder}/.build/gcc-14/debug/cxxstd-11-iso/b2",
191198
"args": [
192199
"--grep"
193200
],

doc/src/history.adoc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
* *New*: Add generic `cc` toolset for simply, direct, configuration of unknown
1010
C compiler toolsets (for example `tcc`).
1111
-- _René Ferdinand Rivera Morell_
12+
* *New*: Add `args` module for common handling of both native and Jam side
13+
command line arguments.
14+
-- _René Ferdinand Rivera Morell_
1215
* Fix command database output file path when an output dir is not given.
1316
-- _René Ferdinand Rivera Morell_
1417
* Fix asciidoctor ignoring relevant features when building which caused invalid
@@ -28,6 +31,10 @@
2831
-- _Andrey Semashev_
2932
* Fix Building on Haiku OS which doesn't have `wait4`.
3033
-- _Fas Xmut_
34+
* Rewrite the command like argument parsing to use the Lyra library. The result
35+
is that arguments from Jam and native are integrated and available with the
36+
built-in `-h` help.
37+
-- _René Ferdinand Rivera Morell_
3138

3239
== Version 5.2.1
3340

doc/src/reference.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,7 @@ include::../../src/engine/mod_set.h[tag=reference]
780780
include::../../src/engine/mod_string.h[tag=reference]
781781
include::../../src/engine/mod_version.h[tag=reference]
782782
include::../../src/engine/mod_db.h[tag=reference]
783+
include::../../src/engine/mod_args.h[tag=reference]
783784

784785
include::path.adoc[]
785786

0 commit comments

Comments
 (0)