mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-08-08 18:25:13 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ebddc0a0d2 | ||
|
|
8359341013 | ||
|
|
c7fe52e514 | ||
|
|
5cdbc97c9d | ||
|
|
9017924783 | ||
|
|
e3fdc37049 | ||
|
|
a99b4f45bb | ||
|
|
ea31f21fd8 | ||
|
|
2b0a9c69df | ||
|
|
c69944ff8b | ||
|
|
01898726e2 | ||
|
|
20a6c3175f | ||
|
|
45ef3d92a1 | ||
|
|
fa386893aa | ||
|
|
dc73dc4fb2 | ||
|
|
677a91aef2 | ||
|
|
dab2ee0f74 | ||
|
|
7f49dc7d1d | ||
|
|
5f26baa748 | ||
|
|
80752c0dc1 | ||
|
|
f8c9c7acae | ||
|
|
7d324cf00c | ||
|
|
98364385a6 | ||
|
|
b5197d5770 | ||
|
|
e9b69f8655 | ||
|
|
099339df0a | ||
|
|
8e4ca87228 | ||
|
|
72e2a94d5f | ||
|
|
059cb26ca2 | ||
|
|
c3d32f4a9a | ||
|
|
74484f42f3 | ||
|
|
6565b9a566 | ||
|
|
b8351d06f1 | ||
|
|
67521bc0e8 | ||
|
|
4fb70e4dd3 | ||
|
|
3ac6af879d | ||
|
|
f3d09f3108 | ||
|
|
1cb6c26b4f | ||
|
|
c164fc0822 | ||
|
|
25347d885c | ||
|
|
fa264a0687 | ||
|
|
5fe636c7ee | ||
|
|
50b8d4ba5a | ||
|
|
57d69b04b2 | ||
|
|
3e6a075f7f | ||
|
|
29b1da4e18 | ||
|
|
667588ee8a | ||
|
|
b122a71c83 | ||
|
|
1a0b3bf83b | ||
|
|
53bde230c6 | ||
|
|
fd3c17995e | ||
|
|
d13a7fdb0a | ||
|
|
a61a84ec6a | ||
|
|
394c1aa6f2 | ||
|
|
5281d09af7 | ||
|
|
0299b699bb | ||
|
|
cff8d06e51 | ||
|
|
45372aed4e | ||
|
|
b89b6517f2 | ||
|
|
cd45c269e2 | ||
|
|
44cad07704 | ||
|
|
f612071298 | ||
|
|
a7694cedf9 | ||
|
|
2fead9abdb | ||
|
|
d573ef0d69 | ||
|
|
6cdd3287dd | ||
|
|
2d60a624c9 | ||
|
|
5d4bd04588 | ||
|
|
47f92cb354 | ||
|
|
715fdcffbf | ||
|
|
153df66692 | ||
|
|
ce9d542a78 | ||
|
|
c66e591fa5 | ||
|
|
2495c49077 | ||
|
|
6c3b482891 | ||
|
|
5ec892c480 | ||
|
|
9188385b55 | ||
|
|
1bf3e2860b | ||
|
|
7d8d1c3f92 | ||
|
|
694c6234f9 | ||
|
|
13b70e2218 | ||
|
|
fa55bfa71f | ||
|
|
93d2986bba | ||
|
|
75964cf0df | ||
|
|
3c2b71cde6 | ||
|
|
37c6dbb8ad | ||
|
|
0883e6591f | ||
|
|
a538d0d8aa | ||
|
|
2645ee3519 | ||
|
|
ad15cd977a | ||
|
|
4e97614f5a | ||
|
|
82c36f0f0b | ||
|
|
ee1bcce627 | ||
|
|
8347aabe14 | ||
|
|
25bdc41ee0 | ||
|
|
57e3f5a80c | ||
|
|
8c3eae0d44 | ||
|
|
6fe281271c | ||
|
|
23a37cc1c5 | ||
|
|
eb1b04fa00 | ||
|
|
cdc252ace9 | ||
|
|
95b55cc5c4 | ||
|
|
e96d567a27 | ||
|
|
b62b690ccf | ||
|
|
7d687eaee3 | ||
|
|
a2ab59fa18 | ||
|
|
777226dd9f | ||
|
|
95e1b48e20 | ||
|
|
bb077f38f7 | ||
|
|
a6316700e8 | ||
|
|
795f7e32cc | ||
|
|
c721eb9e28 | ||
|
|
3aed6a21f5 | ||
|
|
b6d3f107fe | ||
|
|
704a04512c | ||
|
|
2586398fcc | ||
|
|
d9b37a62ff | ||
|
|
3d2bf2a8e3 | ||
|
|
a3ced22c06 | ||
|
|
a2b6281b39 | ||
|
|
cf4600ca45 | ||
|
|
8d64416e8c | ||
|
|
26859f6d61 | ||
|
|
f84a8e96d1 | ||
|
|
4247df921b | ||
|
|
9bdff3d271 | ||
|
|
d03b1a7e8c | ||
|
|
973c456f63 | ||
|
|
2d07940325 | ||
|
|
13cdb2d397 | ||
|
|
b2a3a302e6 | ||
|
|
8c4a1163ee | ||
|
|
cf4e3eecef | ||
|
|
2eaa7ed946 | ||
|
|
e198269f40 | ||
|
|
6181f05630 | ||
|
|
a4ba0d21a1 | ||
|
|
5d0764d23b | ||
|
|
41ded58286 | ||
|
|
5649888686 | ||
|
|
e40a3eed34 | ||
|
|
6537a59c98 | ||
|
|
154bc7ddac | ||
|
|
a990213582 | ||
|
|
9dfd46a5d5 | ||
|
|
984d8cc72c | ||
|
|
896b2f75c5 | ||
|
|
3ce67fa673 | ||
|
|
889dea0275 | ||
|
|
ab3ec56ffe | ||
|
|
c8da23c372 | ||
|
|
69720f1231 | ||
|
|
100f8696c7 | ||
|
|
8c6b06df1f | ||
|
|
6d9aafc5ad | ||
|
|
878dc0a172 | ||
|
|
a874011e37 | ||
|
|
3eb9042a30 | ||
|
|
aa5de5728c | ||
|
|
21eeee46e9 | ||
|
|
db025a6fb7 | ||
|
|
ca822faeec | ||
|
|
ae915ab8e7 | ||
|
|
27630864e7 | ||
|
|
857be0e10f | ||
|
|
bbfa419b89 | ||
|
|
b7613423ce | ||
|
|
49dc1b5bf1 | ||
|
|
f475105c2f | ||
|
|
a60a9e3071 | ||
|
|
c53d599df4 | ||
|
|
9458250968 | ||
|
|
8cbc235723 | ||
|
|
9a377eb0a8 | ||
|
|
09aa05d89c | ||
|
|
2b7dca1c86 | ||
|
|
3367d8dd5c | ||
|
|
8da0cef821 | ||
|
|
fb1e27cf47 | ||
|
|
65fa634cdc | ||
|
|
7c64b1f4ff | ||
|
|
9611baf855 | ||
|
|
2559f4cec5 | ||
|
|
d4fbda2a94 | ||
|
|
84dcd7991b | ||
|
|
50910389c9 | ||
|
|
6cc69f4d14 | ||
|
|
46532a9d3b | ||
|
|
5603f0bdf2 | ||
|
|
ce99bc67b8 | ||
|
|
9ff76cdda8 | ||
|
|
84744e5f63 | ||
|
|
09bc1b99c9 | ||
|
|
f19ecae3b2 | ||
|
|
e3257f88e2 | ||
|
|
b4ea71a8b2 | ||
|
|
c85418ba07 | ||
|
|
0e38617ad7 | ||
|
|
493182f70e | ||
|
|
ed2c9a69d3 | ||
|
|
333bcd2ee3 | ||
|
|
04705b9370 | ||
|
|
79331541ae | ||
|
|
d6fb1813ee | ||
|
|
7194099027 | ||
|
|
171b6bacb9 | ||
|
|
e1c33f04d1 | ||
|
|
3c22b260b1 | ||
|
|
e5000890a4 | ||
|
|
ea0db44fed | ||
|
|
ec99c418a7 | ||
|
|
a807cfa6eb | ||
|
|
41c43ef3d7 | ||
|
|
1dac131ec4 | ||
|
|
9268d9aceb | ||
|
|
bb5603c2f0 | ||
|
|
2c29a70819 | ||
|
|
cf31256f9a | ||
|
|
7132650bba | ||
|
|
d908fb3f18 | ||
|
|
d023679818 | ||
|
|
d87c8ac79a | ||
|
|
a7e46f6e41 | ||
|
|
2d7e743802 | ||
|
|
50fb434689 | ||
|
|
b5d4eb8913 | ||
|
|
2116ad3a28 | ||
|
|
15233a3728 | ||
|
|
b476c143c0 | ||
|
|
2caaeba496 | ||
|
|
95a65a3215 | ||
|
|
33e523878b | ||
|
|
2360e39906 | ||
|
|
10082ac068 | ||
|
|
de64159e7f | ||
|
|
280c40a350 | ||
|
|
c1cf82f9c8 | ||
|
|
55947367c6 | ||
|
|
b4e9eaefd5 | ||
|
|
1a968edcb8 | ||
|
|
82fa282a1b | ||
|
|
e504c843c1 | ||
|
|
3fda8335bf | ||
|
|
9645a2b20e | ||
|
|
7ff6b7bbca | ||
|
|
44e76d801f | ||
|
|
32e0fd1a99 | ||
|
|
b610f43f25 | ||
|
|
f348522005 | ||
|
|
e866c476fd | ||
|
|
72252aaa97 | ||
|
|
a1513c265b | ||
|
|
425044a936 | ||
|
|
5010af94d0 | ||
|
|
005ea24cbb | ||
|
|
adf0425d11 | ||
|
|
cb4e7ecefa | ||
|
|
2e9ad04cdb | ||
|
|
28cde9c128 | ||
|
|
d288047e9b | ||
|
|
d135a16792 | ||
|
|
75417c1c1c | ||
|
|
8bc4348cc7 | ||
|
|
1113522acb | ||
|
|
45b9d97b54 | ||
|
|
b01b80836d | ||
|
|
bd07c76b0a | ||
|
|
45ca5043ce | ||
|
|
ef98967ada | ||
|
|
7783ba2d4f | ||
|
|
bbd17b68fb | ||
|
|
30c179fee8 | ||
|
|
7ab25ad020 | ||
|
|
e555fb5e55 | ||
|
|
0931d14728 | ||
|
|
e76245fcd9 | ||
|
|
c2de9dafd1 | ||
|
|
f7de571ff1 | ||
|
|
c226d4ed48 | ||
|
|
9df53e7288 | ||
|
|
9a5c688ae4 | ||
|
|
e3b7c01820 | ||
|
|
5cc5703239 | ||
|
|
c8dc9a8f51 | ||
|
|
f9a6b34147 | ||
|
|
48828e779f | ||
|
|
4ad0ed3425 | ||
|
|
ad42f96053 | ||
|
|
4410084223 | ||
|
|
ccc759e81a | ||
|
|
e19e088e66 | ||
|
|
9c80fa286e | ||
|
|
da8f4a2f5f | ||
|
|
f18f71cfb0 | ||
|
|
11548b8e68 | ||
|
|
b79b889de5 | ||
|
|
7b24c424b5 | ||
|
|
0d06a966f8 | ||
|
|
3df32101e7 | ||
|
|
c699078246 | ||
|
|
4c7377f499 | ||
|
|
9502b2ab48 | ||
|
|
a0f33a28e9 | ||
|
|
0def17c3d1 | ||
|
|
d2e7bc1613 | ||
|
|
70875b4873 | ||
|
|
34d1773990 | ||
|
|
27767290da | ||
|
|
2efaa8e96a | ||
|
|
4cdcb6f243 | ||
|
|
7f42eb0a5e | ||
|
|
d03ad8b686 | ||
|
|
f462a08572 | ||
|
|
0ac08d2d6c | ||
|
|
6053dcae59 | ||
|
|
5952fe5abf | ||
|
|
d0447d949b | ||
|
|
f3bd6a25bf | ||
|
|
38d91ccd96 | ||
|
|
0dfa650f59 | ||
|
|
1e7a8315f6 | ||
|
|
4eeec4e41f | ||
|
|
6fd3372db4 | ||
|
|
f24afe4435 | ||
|
|
1047f3c095 | ||
|
|
928a817418 | ||
|
|
ae8d777ad6 | ||
|
|
d17dc9a8b5 | ||
|
|
7bb478bd19 | ||
|
|
9c29c52fce | ||
|
|
2a11380460 | ||
|
|
77a0e35143 | ||
|
|
2e9e591889 | ||
|
|
a6ec9ca2f1 | ||
|
|
370a302f34 | ||
|
|
2b5a27ba3d | ||
|
|
d132c2d545 | ||
|
|
bb45005671 | ||
|
|
0afeaa2ab7 | ||
|
|
dbd1609311 | ||
|
|
ad9500f3fd | ||
|
|
76bd8a6b4a | ||
|
|
7e6bd4bb33 | ||
|
|
e1dd2807e6 | ||
|
|
96748b2bf8 | ||
|
|
4b314bdb6d | ||
|
|
d855f6c806 | ||
|
|
1ee41a50d9 | ||
|
|
8bf276d820 | ||
|
|
476c1cca59 | ||
|
|
55fb68aabf | ||
|
|
0d40b36417 | ||
|
|
b809770efb | ||
|
|
009285d20a | ||
|
|
3e8d1bd053 | ||
|
|
32ea6125e3 | ||
|
|
baa423bd59 | ||
|
|
75fbe357c8 | ||
|
|
a668f48631 | ||
|
|
3d75e7de1e | ||
|
|
9524161147 | ||
|
|
d6445ec10b | ||
|
|
7ca7a3abf3 | ||
|
|
c4e686a1ab | ||
|
|
2646fd012d | ||
|
|
a2c525b34c | ||
|
|
658b189348 | ||
|
|
a06344172a | ||
|
|
573654ca9e | ||
|
|
0b0370ff42 | ||
|
|
eaa476a7e9 | ||
|
|
16832bf546 | ||
|
|
eabb3df7aa | ||
|
|
0ab29b7c20 | ||
|
|
559b30881d | ||
|
|
88ffc4b907 | ||
|
|
3e82dfaa0d | ||
|
|
11d820174f | ||
|
|
875ef1b90c | ||
|
|
650af77812 | ||
|
|
c03a8db0cc | ||
|
|
8b06c6b871 | ||
|
|
c5da1a2adc | ||
|
|
dfd5b89d01 | ||
|
|
13e294ee55 | ||
|
|
8044fda634 | ||
|
|
b7d4c48e55 | ||
|
|
fc6c85664a | ||
|
|
4f3cc9c21b | ||
|
|
55a2063005 | ||
|
|
a728075710 |
+1
-1
@@ -1 +1 @@
|
||||
3.0.2
|
||||
3.1
|
||||
|
||||
+293
@@ -0,0 +1,293 @@
|
||||
# Travis defines and exports CC and CXX *after* we have defined our
|
||||
# environment variables via 'env'. So, do not use 'env' to define
|
||||
# them. Instead, put their definitions in MATRIX_EVAL, which we eval
|
||||
# after the definitions from Travis.
|
||||
|
||||
language: cpp
|
||||
|
||||
env:
|
||||
global:
|
||||
# ICC serial number.
|
||||
secure: ED3w6rzxuE6tVu3oyxha2MoGMRzRQCtinvr9uor1gw9TGKB80esTLx4KyX0xHemUdyQVarFDDQfVS5rf7jSDY8XiWIR6O+2Af9/30gb+8eyngyvACu7E28n+1XHmYWIEHsbvB9mic6C60FBj5sPcDnFWZeyttGL0WooSjYHiw1Egafwqbeu1mD3Aet9OI9VaLQvy0KcWAdVrYWSI9UWLvLM+xPVUjPFko4oS+dTlETzVnmn6JFbZX1OKONtfcvdoDRFBzs3iHm5dQUt/Fz+y/DtKSuvF3zvePHSgF6c8URbEPPjBdh87gkovSLyy+83fVeh4WMkF8b+dGZmikQv6kRsjKJdbQrS8tiMhZlORC5Gfmn4HXNgmapL+paUweakH7UZQHm6d5SZoBgCHNazfqMrywbZsZkGvZTDQIVG1Be7Lhh2BDFbPhPZNDvI9XYiqZP0QSb0BVfeO+AUSRcUPM7TvarxB74jYdfpTBu7sqJP6dSwhcDTEUhHmuLGjzsNm3uTZe8SUw/TGGx5uPTXNsCjJq6ClIOAIYXZTXLbBmIL/NBWCy0MUpD+9zsiknU7vzzq1RfgCCExhvYgosTjBLcX1kKI+eRSU5M44e+xCg4xx0m9WfafbKbhA20FfnWxCFIkZeVpkOOsexJ9zfe0SflVLxkd7vmci5SCBixLVbN0=
|
||||
|
||||
matrix:
|
||||
include:
|
||||
## ----- ##
|
||||
## GCC. ##
|
||||
## ----- ##
|
||||
#- name: "GCC 8 with sanitizers"
|
||||
# os: linux
|
||||
# addons:
|
||||
# apt:
|
||||
# sources:
|
||||
# - ubuntu-toolchain-r-test
|
||||
# packages:
|
||||
# - g++-8
|
||||
# env:
|
||||
# # Can't use UBSAN: I get:
|
||||
# # configure:4951: gcc-8 -fsanitize=undefined,address -fno-omit-frame-pointer conftest.c
|
||||
# # /usr/bin/ld: unrecognized option '--push-state'
|
||||
# - MATRIX_EVAL="CC='gcc-8 -fsanitize=undefined,address -fno-omit-frame-pointer' CXX='g++-8 -fsanitize=undefined,address -fno-omit-frame-pointer'"
|
||||
|
||||
- name: "GCC 7 -O3"
|
||||
os: linux
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-7
|
||||
env:
|
||||
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7 && CONFIGUREFLAGS='CPPFLAGS=-DNDEBUG CFLAGS=-O3 CXXFLAGS=-O3'"
|
||||
|
||||
- name: "GCC 6"
|
||||
os: linux
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-6
|
||||
env:
|
||||
- MATRIX_EVAL="CC=gcc-6 && CXX=g++-6"
|
||||
|
||||
- name: "GCC 5"
|
||||
os: linux
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-5
|
||||
env:
|
||||
- MATRIX_EVAL="CC=gcc-5 && CXX=g++-5"
|
||||
|
||||
- name: "GCC 4.9"
|
||||
os: linux
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-4.9
|
||||
env:
|
||||
- MATRIX_EVAL="CC=gcc-4.9 && CXX=g++-4.9"
|
||||
|
||||
- name: "GCC 4.8"
|
||||
os: linux
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-4.8
|
||||
env:
|
||||
- MATRIX_EVAL="CC=gcc-4.8 && CXX=g++-4.8"
|
||||
|
||||
- name: "GCC 4.7"
|
||||
os: linux
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-4.7
|
||||
env:
|
||||
- MATRIX_EVAL="CC=gcc-4.7 && CXX=g++-4.7"
|
||||
|
||||
- name: "GCC 4.6"
|
||||
os: linux
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-4.6
|
||||
env:
|
||||
- MATRIX_EVAL="CC=gcc-4.6 && CXX=g++-4.6"
|
||||
|
||||
## ------- ##
|
||||
## Clang. ##
|
||||
## ------- ##
|
||||
|
||||
- name: "Clang 7 libc++ and ASAN"
|
||||
os: linux
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- llvm-toolchain-trusty-7
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- clang-7
|
||||
- libc++-7-dev
|
||||
- libc++abi-7-dev
|
||||
env:
|
||||
# Do not use ASAN with ubuntu's libc++: https://bugs.llvm.org/show_bug.cgi?id=17379
|
||||
- MATRIX_EVAL="CC='clang-7 -fsanitize=address' CXX='clang++-7 -fsanitize=address -stdlib=libc++'"
|
||||
|
||||
- name: "Clang 6 -O3 and libc++"
|
||||
os: linux
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- llvm-toolchain-trusty-6.0
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- clang-6.0
|
||||
- libc++-dev
|
||||
env:
|
||||
- MATRIX_EVAL="CC=clang-6.0 && CXX='clang++-6.0 -stdlib=libc++'"
|
||||
- CONFIGUREFLAGS='CPPFLAGS=-DNDEBUG CFLAGS=-O3 CXXFLAGS=-O3'
|
||||
|
||||
- name: "Clang 5"
|
||||
os: linux
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- llvm-toolchain-trusty-5.0
|
||||
packages:
|
||||
- clang-5.0
|
||||
- libc++-dev
|
||||
env:
|
||||
- MATRIX_EVAL="CC='clang-5.0' CXX='clang++-5.0'"
|
||||
|
||||
- name: "Clang 4"
|
||||
os: linux
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- llvm-toolchain-trusty-4.0
|
||||
packages:
|
||||
- clang-4.0
|
||||
env:
|
||||
- MATRIX_EVAL="CC=clang-4.0 && CXX=clang++-4.0"
|
||||
|
||||
- name: "Clang 3.9"
|
||||
os: linux
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- llvm-toolchain-trusty-3.9
|
||||
packages:
|
||||
- clang-3.9
|
||||
env:
|
||||
- MATRIX_EVAL="CC=clang-3.9 && CXX=clang++-3.9"
|
||||
|
||||
- name: "Clang 3.8"
|
||||
os: linux
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.8
|
||||
packages:
|
||||
- clang-3.8
|
||||
env:
|
||||
- MATRIX_EVAL="CC=clang-3.8 && CXX=clang++-3.8"
|
||||
|
||||
- name: "CLang 3.7"
|
||||
os: linux
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.7
|
||||
packages:
|
||||
- clang-3.7
|
||||
env:
|
||||
- MATRIX_EVAL="CC=clang-3.7 && CXX=clang++-3.7"
|
||||
|
||||
- name: "Clang 3.6"
|
||||
os: linux
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.6
|
||||
packages:
|
||||
- clang-3.6
|
||||
env:
|
||||
- MATRIX_EVAL="CC=clang-3.6 && CXX=clang++-3.6"
|
||||
|
||||
- name: "Clang 3.5"
|
||||
os: linux
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.5
|
||||
packages:
|
||||
- clang-3.5
|
||||
env:
|
||||
- MATRIX_EVAL="CC=clang-3.5 && CXX=clang++-3.5"
|
||||
|
||||
- name: "Clang 3.4"
|
||||
os: linux
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.4
|
||||
env:
|
||||
# No versioned name installed, but beware that Travis installs
|
||||
# a more modern clang earlier in the default PATH.
|
||||
- MATRIX_EVAL='CC=/usr/bin/clang && CXX=/usr/bin/clang++'
|
||||
|
||||
- name: "Clang 3.3"
|
||||
os: linux
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.3
|
||||
env:
|
||||
# See comment for 3.4.
|
||||
- MATRIX_EVAL='CC=/usr/bin/clang && CXX=/usr/bin/clang++'
|
||||
|
||||
## ----- ##
|
||||
## ICC. ##
|
||||
## ----- ##
|
||||
- name: "ICC"
|
||||
os: linux
|
||||
env:
|
||||
# ICC's warnings are often very wrong (e.g., it thinks foo ?
|
||||
# "bar" : "baz" is char* instead of const char*), so don't try
|
||||
# to work around the, and obviously, don't die on them.
|
||||
- MATRIX_EVAL="CC=icc && CXX=icpc"
|
||||
- MAKE_ARGS='WERROR_CFLAGS= WERROR_CXXFLAGS='
|
||||
|
||||
before_install:
|
||||
- eval "$MATRIX_EVAL"
|
||||
- env
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install -qq autoconf automake autopoint doxygen flex gettext graphviz help2man m4 texinfo
|
||||
- if [[ $CC == "icc" ]]; then build-aux/install-icc.sh; fi
|
||||
- if [[ -f ~/.bashrc ]]; then source ~/.bashrc; fi
|
||||
- autoconf --version
|
||||
- automake --version
|
||||
- autopoint --version
|
||||
- $CC --version
|
||||
- $CXX --version
|
||||
- doxygen --version
|
||||
- flex --version
|
||||
- gettext --version
|
||||
- dot -V
|
||||
- help2man --version
|
||||
- m4 --version
|
||||
- makeinfo --version
|
||||
|
||||
script:
|
||||
- git show
|
||||
- git tag -l
|
||||
# For some reasons, sometimes the checkout does not have any tags,
|
||||
# so `git describe` fails, so bootstrap fails.
|
||||
- git describe || git tag v3.0 -m "Fake version 3.0."
|
||||
- git describe
|
||||
- ./bootstrap
|
||||
- if [[ -f ~/.bashrc ]]; then source ~/.bashrc; fi
|
||||
- ./configure --enable-gcc-warnings CC="$CC" CXX="$CXX" $CONFIGUREFLAGS || { cat config.log && false; }
|
||||
- make -j2 $MAKE_ARGS
|
||||
- make check VERBOSE=1 TESTSUITEFLAGS=-j2 || { cat tests/testsuite.log && false; }
|
||||
- make maintainer-check-posix VERBOSE=1 TESTSUITEFLAGS=-j2 || { cat tests/testsuite.log && false; }
|
||||
- make maintainer-check-g++ VERBOSE=1 TESTSUITEFLAGS=-j2 || { cat tests/testsuite.log && false; }
|
||||
|
||||
after_script:
|
||||
- if [[ $CC == "icc" ]]; then uninstall_intel_software; fi
|
||||
@@ -24,7 +24,7 @@ and nasty bugs.
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 1998-2015 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
|
||||
+45
-45
@@ -3671,12 +3671,12 @@
|
||||
2009-02-25 Akim Demaille <[email protected]>
|
||||
|
||||
Copyright years.
|
||||
* data/glr.c: Add 2007 and 2008 here, consistenly with the comments.
|
||||
* data/glr.c: Add 2007 and 2008 here, consistently with the comments.
|
||||
|
||||
2009-02-25 Akim Demaille <[email protected]>
|
||||
|
||||
Style changes.
|
||||
* etc/bench.pl.in (generate_grammar_list): Consitently use
|
||||
* etc/bench.pl.in (generate_grammar_list): Consistently use
|
||||
location_type, not yy::location.
|
||||
|
||||
2009-02-25 Akim Demaille <[email protected]>
|
||||
@@ -3702,7 +3702,7 @@
|
||||
Remove trailing blanks.
|
||||
The epilogue has its own ending \n, no need to add another.
|
||||
|
||||
* data/glr.c, data/lalr1.java, data/yacc.c: dnl when outputing the
|
||||
* data/glr.c, data/lalr1.java, data/yacc.c: dnl when outputting the
|
||||
epilogue.
|
||||
* data/glr.cc: dnl when extending the epilogue.
|
||||
Remove stray "private:".
|
||||
@@ -3764,7 +3764,7 @@
|
||||
2008-12-11 Akim Demaille <[email protected]>
|
||||
|
||||
Pass the token type to yysyntax_error.
|
||||
* data/yacc.c (yysyntax_error): Take the transated token instead
|
||||
* data/yacc.c (yysyntax_error): Take the translated token instead
|
||||
of the raw number.
|
||||
Adjust callers.
|
||||
* TODO: Update.
|
||||
@@ -5019,7 +5019,7 @@
|
||||
|
||||
Now instead of monolithic tables, we define one macro per cell. For
|
||||
instance "b4_symbol(0, tag)" is a macro name which contents is
|
||||
self-decriptive. The macro "b4_symbol" provides easier access to
|
||||
self-descriptive. The macro "b4_symbol" provides easier access to
|
||||
these cells.
|
||||
|
||||
* src/output.c (type_names_output): Remove.
|
||||
@@ -5200,7 +5200,7 @@
|
||||
|
||||
2008-11-09 Akim Demaille <[email protected]>
|
||||
|
||||
Agregate yylval and yylloc.
|
||||
Aggregate yylval and yylloc.
|
||||
* data/lalr1.cc (parser::yylval, parser::yylloc): Replace by...
|
||||
(parser::yyla): this.
|
||||
|
||||
@@ -5815,7 +5815,7 @@
|
||||
of members. Document that token names are added as fields.
|
||||
Document constructors accurately. Remove error method.
|
||||
(Java Scanner Interface): Move note on %pure-parser to Java Bison
|
||||
Interface. Describe %code lexer and yylex accutately.
|
||||
Interface. Describe %code lexer and yylex accurately.
|
||||
Remove documentation that does not match the code.
|
||||
(Java Action Features): New.
|
||||
(Java Differences): Add reference. Add item on semantic values.
|
||||
@@ -6432,7 +6432,7 @@
|
||||
* djgpp/config.site: Copyright timestamp adjusted.
|
||||
* djgpp/config_h.sed: Copyright timestamp adjusted.
|
||||
* djgpp/djunpack.bat: Copyright timestamp adjusted.
|
||||
* djgpp/fnchnage.lst: Add filenames that are not 8.3 clean to the
|
||||
* djgpp/fnchange.lst: Add filenames that are not 8.3 clean to the
|
||||
filename translation list.
|
||||
* djgpp/subpipe.c (init_subpipe): Check the environment variables
|
||||
TMPDIR, TMP and TEMP, in that order, to determinate where the temp
|
||||
@@ -7588,7 +7588,7 @@
|
||||
2007-03-07 Juan Manuel Guerrero <[email protected]>
|
||||
|
||||
DJGPP spefic issue. Inhibit the use of disallowed characters for
|
||||
file name genertion on Win98, WinXP, etc. These are |<>":?*\
|
||||
file name generation on Win98, WinXP, etc. These are |<>":?*\
|
||||
and concern testsuite case 46.
|
||||
* Makefile.am: djgpp/testsuite.sed added to EXTRA_DIST
|
||||
* djgpp/testsuite.sed: Inhibit the use of disallowed characters.
|
||||
@@ -8796,7 +8796,7 @@
|
||||
2006-12-13 Paul Eggert <[email protected]>
|
||||
|
||||
* TODO: Add pointer to Sylvain Schmitz's work on static detection
|
||||
of potential ambiguities in GLR grammers.
|
||||
of potential ambiguities in GLR grammars.
|
||||
|
||||
2006-12-12 Joel E. Denny <[email protected]>
|
||||
|
||||
@@ -9059,7 +9059,7 @@
|
||||
* src/scan-gram.l (<SC_BRACED_CODE>): Use val->code for BRACED_CODE,
|
||||
which is "{...}" in the parser.
|
||||
* tests/Makefile.am (maintainer-check-valgrind): Set
|
||||
VALGRIND_OPTS='--leak-check=full --show-reacheable=yes' before invoking
|
||||
VALGRIND_OPTS='--leak-check=full --show-reachable=yes' before invoking
|
||||
Valgrind.
|
||||
* tests/calc.at (_AT_DATA_CALC_Y): fclose the FILE* so Valgrind doesn't
|
||||
complain.
|
||||
@@ -12349,7 +12349,7 @@
|
||||
* data/lalr1.cc: here.
|
||||
(location.hh): Include it after the user prologue, in case the
|
||||
filename type is defined by the user.
|
||||
Forward declation location and position before the pre-prologue.
|
||||
Forward declaration location and position before the pre-prologue.
|
||||
(yyresult_): Rename as...
|
||||
(yyresult): this, it's a local variable, not an attribute.
|
||||
* data/Makefile.am (dist_pkgdata_DATA): Adjust.
|
||||
@@ -12439,8 +12439,8 @@
|
||||
(Table of Symbols): Under YYSTACK_USE_ALLOCA, Don't claim that the
|
||||
user must declare alloca.
|
||||
|
||||
* HACKING (release): Forwarn the Translation Project about
|
||||
stable releses.
|
||||
* HACKING (release): Forewarn the Translation Project about
|
||||
stable releases.
|
||||
|
||||
2005-09-20 Akim Demaille <[email protected]>
|
||||
|
||||
@@ -13165,7 +13165,7 @@
|
||||
not GNU M4, and that it works with any POSIX-compatible Awk.
|
||||
* examples/calc++/Makefile.am (run_extexi): Remove; not used.
|
||||
($(calc_extracted)): Renamed from $(calc_sources_extracted),
|
||||
so that we also get calc++-parser.yy. Geneate it.
|
||||
so that we also get calc++-parser.yy. Generate it.
|
||||
Use $(AWK), not gawk, since any conforming Awk will do.
|
||||
Put comment before action, since older 'make' can't handle comment
|
||||
in action.
|
||||
@@ -13993,7 +13993,7 @@
|
||||
* src/LR0.c (allocate_itemsets): Use xnmalloc, not xcalloc,
|
||||
to allocate kernel_base, kernel_items, kernel_size, since
|
||||
they needn't be initialized to 0.
|
||||
(allocate_storgae): Likewise, for shiftset, redset, shift_symbol.
|
||||
(allocate_storage): Likewise, for shiftset, redset, shift_symbol.
|
||||
* src/closure.c (new_closure): Likewise, for itemset.
|
||||
* src/derives.c (derives_compute): Likewise, for delts, derives, q.
|
||||
* src/lalr.c (set_goto_map): Likewise, for temp_map.
|
||||
@@ -14181,7 +14181,7 @@
|
||||
2004-10-05 Akim Demaille <[email protected]>
|
||||
|
||||
In Bison 1.875's yacc.c, YYLLOC_DEFAULT was called regardless
|
||||
whether the reducion was empty or not. This leaves room to
|
||||
whether the reduction was empty or not. This leaves room to
|
||||
improve the use of YYLLOC_DEFAULT in such a case.
|
||||
lalr1.cc is still experimental, so changing this is acceptable.
|
||||
And finally, there are probably not many users who changed the
|
||||
@@ -16524,7 +16524,7 @@
|
||||
(struct state): Renamed from struct state_s.
|
||||
(state): Renamed from state_t.
|
||||
(transitions): Renamed from transitions_t. Unused (and
|
||||
misspelled) transtion_s tag removed.
|
||||
misspelled) transition_s tag removed.
|
||||
(errs): Renamed from errs_t. Unused errs_s tag removed.
|
||||
(reductions): Renamed from reductions_t. Unused tag
|
||||
reductions_s removed.
|
||||
@@ -16612,9 +16612,9 @@
|
||||
|
||||
|
||||
Fix misspelling in names.
|
||||
* src/vcg.h (enum_alignment_e): Renamed from enum_alignement_e.
|
||||
* src/vcg.h (enum_alignment_e): Renamed from enum_alignment_e.
|
||||
* src/vcg_defaults.h (G_NODE_ALIGNMENT): Renamed from
|
||||
G_NODE_ALIGNEMENT.
|
||||
G_NODE_ALIGNMENT.
|
||||
|
||||
|
||||
* lib/timevar.c (timevar_report): Renamed from time_report,
|
||||
@@ -16866,7 +16866,7 @@
|
||||
* src/tables.c (conflict_row, pack_vector): Likewise.
|
||||
* src/vcg.c (get_color_str, get_textmode_str, get_shape_str,
|
||||
get_layoutalgorithm_str, get_decision_str, get_orientation_str,
|
||||
get_node_alignement_str, get_arrow_mode_str, get_crossing_type_str,
|
||||
get_node_alignment_str, get_arrow_mode_str, get_crossing_type_str,
|
||||
get_view_str, get_linestyle_str, get_arrowstyle_str): Likewise.
|
||||
|
||||
* lib/argmatch.h (ARRAY_CARDINALITY): Do not bother to #undef.
|
||||
@@ -17365,7 +17365,7 @@
|
||||
(scanner_last_string_free): Remove; not used.
|
||||
(percent_percent_count): Move decl to just before use.
|
||||
(SC_ESCAPED_CHARACTER): Return ID at unexpected end of file,
|
||||
not the (never otherwised-used) CHARACTER.
|
||||
not the (never otherwise-used) CHARACTER.
|
||||
|
||||
2002-11-07 Akim Demaille <[email protected]>
|
||||
|
||||
@@ -18052,7 +18052,7 @@
|
||||
suite using a GLR parser driven by LALR tables. It fails with -O2
|
||||
because `struct stat' gives two different answers on my machine:
|
||||
88 (definition of an auto var) and later 96 (memset on this var).
|
||||
Hence the stack is badly corrumpted. The headers inclusion is to
|
||||
Hence the stack is badly corrupted. The headers inclusion is to
|
||||
blame: if I move the awk.h inclusion before GLR's system header
|
||||
inclusion, the two struct stat have the same size.
|
||||
|
||||
@@ -18962,7 +18962,7 @@
|
||||
|
||||
2002-07-16 Akim Demaille <[email protected]>
|
||||
|
||||
* src/assoc.c, src/asssoc.h (assoc_t, assoc_to_string): New.
|
||||
* src/assoc.c, src/assoc.h (assoc_t, assoc_to_string): New.
|
||||
Adjust all former `associativity' dependencies.
|
||||
* src/symtab.c (symbol_new): Default associativity is `undef', not
|
||||
`right'.
|
||||
@@ -20105,7 +20105,7 @@
|
||||
|
||||
* data/bison.c++: Catch up with bison.simple:
|
||||
2002-05-24 Paul Hilfinger <[email protected]>
|
||||
and Paul Eggert <[email protected]>: `error' handing.
|
||||
and Paul Eggert <[email protected]>: `error' handling.
|
||||
2002-05-26 Akim Demaille <[email protected]>: stos_, token_number_,
|
||||
and popping traces.
|
||||
|
||||
@@ -20455,7 +20455,7 @@
|
||||
single characters while replacing `[' and `]' with quadrigraphs, to
|
||||
avoid troubles with M4 quotes.
|
||||
(copy_comment): Output characters with copy_character.
|
||||
(read_additionnal_code): Likewise.
|
||||
(read_additional_code): Likewise.
|
||||
(copy_string2): Likewise.
|
||||
(copy_definition): Likewise.
|
||||
|
||||
@@ -20638,7 +20638,7 @@
|
||||
* data/bison.simple, data/bison.c++: Adjust.
|
||||
* tests/torture.at (Big triangle): Move the limit from 254 to
|
||||
500.
|
||||
* tests/regression.at (Web2c Actions): Ajust.
|
||||
* tests/regression.at (Web2c Actions): Adjust.
|
||||
|
||||
Trying with bigger grammars shows various phenomena: at 3000 (28Mb
|
||||
of grammar file) bison is killed by my system, at 2000 (12Mb) bison
|
||||
@@ -20949,7 +20949,7 @@
|
||||
|
||||
2002-03-05 Robert Anisko <[email protected]>
|
||||
|
||||
* src/reader.c (read_additionnal_code): `c' should be an integer, not
|
||||
* src/reader.c (read_additional_code): `c' should be an integer, not
|
||||
a character.
|
||||
Reported by Nicolas Tisserand and Nicolas Burrus.
|
||||
|
||||
@@ -21070,7 +21070,7 @@
|
||||
|
||||
* src/L0.c, src/LR0.h (nstates): Be size_t.
|
||||
Adjust comparisons (signed vs unsigned).
|
||||
* src/conflics.c, src/lalr.c, src/lalr.h, src/output.c (LA): Now a
|
||||
* src/conflicts.c, src/lalr.c, src/lalr.h, src/output.c (LA): Now a
|
||||
bitset*.
|
||||
Adjust all dependencies.
|
||||
|
||||
@@ -22337,7 +22337,7 @@
|
||||
|
||||
* src/bison.simple: Remove #line just before %%epilogue. It
|
||||
is now handled in ...
|
||||
* src/reader.c (read_additionnal_code): Add the output of a
|
||||
* src/reader.c (read_additional_code): Add the output of a
|
||||
#line for the epilogue.
|
||||
|
||||
2001-12-10 Marc Autret <[email protected]>
|
||||
@@ -22797,7 +22797,7 @@
|
||||
on user names when possible.
|
||||
|
||||
(YYSTACK_USE_ALLOCA): Do not define; just use any existing defn.
|
||||
Simplify test for whather <alloca.h> exists.
|
||||
Simplify test for whether <alloca.h> exists.
|
||||
|
||||
(<stdlib.h>): Include if we will use malloc, and if standard C or C++.
|
||||
|
||||
@@ -23563,7 +23563,7 @@
|
||||
|
||||
2001-10-04 Akim Demaille <[email protected]>
|
||||
|
||||
* src/reader.c (parse_union_decl): Push the caracters in
|
||||
* src/reader.c (parse_union_decl): Push the characters in
|
||||
union_obstack, not attrs_obstack.
|
||||
|
||||
2001-10-04 Akim Demaille <[email protected]>
|
||||
@@ -23844,7 +23844,7 @@
|
||||
|
||||
* src/vcg.h (graph_s): color, textcolor, bordercolor are now
|
||||
enum color_e.
|
||||
* src/print_graph.c (print_graph): Initalize graph.layoutalgorithm
|
||||
* src/print_graph.c (print_graph): Initialize graph.layoutalgorithm
|
||||
to `normal'.
|
||||
* src/reader.c (parse_token_decl): Initialize token with tok_eof.
|
||||
* src/lex.h: Adjust prototype.
|
||||
@@ -23999,7 +23999,7 @@
|
||||
|
||||
* src/vcg.c: Remove includes of `complain.h' and `xalloc.h'.
|
||||
(get_xxxx_str): Use assert () instead of complain ().
|
||||
Remove return invokations in default cases.
|
||||
Remove return invocations in default cases.
|
||||
(get_decision_str): Modify default behaviour. Remove second argument.
|
||||
Echo modifications on calls.
|
||||
(output_graph): Fix.
|
||||
@@ -24030,7 +24030,7 @@
|
||||
informations about %union.
|
||||
(parse_union_decl): Copy the union_obstack in the muscle stype.
|
||||
* src/bison.simple: Add new #line directive.
|
||||
Add typdef %%stype YYSTYPE.
|
||||
Add typedef %%stype YYSTYPE.
|
||||
|
||||
2001-09-23 Pascal Bart <[email protected]>
|
||||
|
||||
@@ -24115,7 +24115,7 @@
|
||||
(parse_union_decl): Update.
|
||||
(parse_macro_decl): Rename parse_muscle_decl.
|
||||
Update to use renamed functions and variable.
|
||||
(read_declarations, copy_action, read_additionnal_code, : Updated
|
||||
(read_declarations, copy_action, read_additional_code, : Updated
|
||||
with correct variables and functions names.
|
||||
(packsymbols, reader): Likewise.
|
||||
|
||||
@@ -24196,7 +24196,7 @@
|
||||
|
||||
2001-08-31 Pascal Bart <[email protected]>, Marc Autret <[email protected]>
|
||||
|
||||
* src/reader.c (read_additionnal_code): Rename %%user_code to
|
||||
* src/reader.c (read_additional_code): Rename %%user_code to
|
||||
%%epilogue.
|
||||
* src/output.c (output): Rename %%declarations to %%prologue.
|
||||
* src/bison.simple: Echo modifications.
|
||||
@@ -24240,7 +24240,7 @@
|
||||
2001-08-29 Marc Autret <[email protected]>
|
||||
|
||||
* src/bison.simple: Add %%user_code directive at the end.
|
||||
* src/reader.c (read_additionnal_code): New.
|
||||
* src/reader.c (read_additional_code): New.
|
||||
(reader): Use it.
|
||||
* src/output.c (output_program): Remove.
|
||||
(output): Update.
|
||||
@@ -24303,7 +24303,7 @@
|
||||
(readgram): Disable a piece of code that was writing a default
|
||||
definition for 'YYSTYPE'.
|
||||
(reader_output_yylsp): Remove.
|
||||
(packsymbols): Output token defintions to a macro.
|
||||
(packsymbols): Output token definitions to a macro.
|
||||
(copy_definition): Disable C output.
|
||||
|
||||
* src/reader.c (parse_macro_decl): New function used to parse macro
|
||||
@@ -24641,7 +24641,7 @@
|
||||
|
||||
2001-07-08 Pascal Bart <[email protected]>
|
||||
|
||||
* src/bison.simple (yyparse): Suppress warning `comparaison
|
||||
* src/bison.simple (yyparse): Suppress warning `comparison
|
||||
between signed and unsigned'.
|
||||
|
||||
2001-07-05 Pascal Bart <[email protected]>
|
||||
@@ -25128,7 +25128,7 @@
|
||||
* tests/calc.m4: Test it.
|
||||
|
||||
For regularity of the names, replace each
|
||||
(nolineflag, toknumflag, rawtokenumflag, noparserflag): with...
|
||||
(nolineflag, toknumflag, rawtoknumflag, noparserflag): with...
|
||||
(no_lineflag, token_tableflag, rawflag, no_parserflag): this.
|
||||
In addition replace each `flag' with `_flag'.
|
||||
|
||||
@@ -25731,7 +25731,7 @@
|
||||
|
||||
* src/getargs.c, src/Makefile.am, src/reader.c, src/version.c:
|
||||
Have configure build version string instead of relying on ANSI string
|
||||
concatentation.
|
||||
concatenation.
|
||||
|
||||
1999-06-14 Jesse Thilo <[email protected]>
|
||||
|
||||
@@ -25741,7 +25741,7 @@
|
||||
|
||||
* acconfig.h, configure.in:
|
||||
Have configure build version string instead of relying on ANSI string
|
||||
concatentation.
|
||||
concatenation.
|
||||
|
||||
1999-06-08 Jesse Thilo <[email protected]>
|
||||
|
||||
@@ -26733,8 +26733,8 @@
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 1987-1988, 1991-2015 Free Software Foundation,
|
||||
Inc.
|
||||
Copyright (C) 1987-1988, 1991-2015, 2018 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without
|
||||
modification, are permitted provided the copyright notice and this
|
||||
|
||||
+8
-3
@@ -1,6 +1,6 @@
|
||||
## Process this file with automake to produce Makefile.in.
|
||||
|
||||
# Copyright (C) 2001-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2015, 2018 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -39,9 +39,11 @@ AM_YFLAGS = -d -v -Werror -Wall -Wno-yacc --report=all
|
||||
|
||||
# Initialization before completion by local.mk's.
|
||||
AM_CFLAGS = $(WARN_CFLAGS)
|
||||
# Find builddir/src/scan-code.c etc.
|
||||
AM_CPPFLAGS = -I. -Ilib -I$(top_srcdir) -I$(top_srcdir)/lib
|
||||
# Find builddir/src/scan-code.c etc. For some reason "-I./lib"
|
||||
# instead of "-Ilib" avoids infinite recursions on #include_next.
|
||||
AM_CPPFLAGS = -I. -I./lib -I$(top_srcdir) -I$(top_srcdir)/lib
|
||||
BUILT_SOURCES =
|
||||
CLEANDIRS =
|
||||
CLEANFILES =
|
||||
DISTCLEANFILES =
|
||||
EXTRA_DIST += $(dist_TESTS)
|
||||
@@ -63,6 +65,9 @@ include lib/local.mk
|
||||
include src/local.mk
|
||||
include tests/local.mk
|
||||
|
||||
clean-local:
|
||||
rm -rf $(CLEANDIRS)
|
||||
|
||||
# See comments in build-aux/git-version-gen. However, we make .version depend
|
||||
# on configure so that .version and VERSION/PACKAGE_VERSION stay in sync in the
|
||||
# working copy (for example, when you run autoreconf && make). Allowing these
|
||||
|
||||
@@ -1,5 +1,337 @@
|
||||
GNU Bison NEWS
|
||||
|
||||
* Noteworthy changes in release 3.1.90 (2018-10-17) [beta]
|
||||
|
||||
** Backward incompatible changes
|
||||
|
||||
Support for DJGPP, which have been unmaintained and untested for years, is
|
||||
obsolete. Unless there is activity to revive it, it will be removed.
|
||||
|
||||
** New features
|
||||
|
||||
*** C++: Support for move semantics (lalr1.cc)
|
||||
|
||||
The lalr1.cc skeleton now fully supports C++ move semantics, while
|
||||
maintaining compatibility with C++98. You may now store move-only types
|
||||
when using Bison's variants. For instance:
|
||||
|
||||
%code {
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
}
|
||||
|
||||
%skeleton "lalr1.cc"
|
||||
%define api.value.type variant
|
||||
|
||||
%%
|
||||
|
||||
%token <int> INT "int";
|
||||
%type <std::unique_ptr<int>> int;
|
||||
%type <std::vector<std::unique_ptr<int>>> list;
|
||||
|
||||
list:
|
||||
%empty {}
|
||||
| list int { $$ = std::move($1); $$.emplace_back(std::move($2)); }
|
||||
|
||||
int: "int" { $$ = std::make_unique<int>($1); }
|
||||
|
||||
*** C++: Implicit move of right-hand side values (lalr1.cc)
|
||||
|
||||
In modern C++ (C++11 and later), you should always use 'std::move' with
|
||||
the values of the right-hand side symbols ($1, $2, etc.), as they will be
|
||||
popped from the stack anyway. Using 'std::move' is mandatory for
|
||||
move-only types such as unique_ptr, and it provides a significant speedup
|
||||
for large types such as std::string, or std::vector, etc.
|
||||
|
||||
If '%define api.value.automove' is set, every occurrence '$n' is replaced
|
||||
by 'std::move ($n)'. The second rule in the previous grammar can be
|
||||
simplified to:
|
||||
|
||||
list: list int { $$ = $1; $$.emplace_back($2); }
|
||||
|
||||
With automove enabled, the semantic values are no longer lvalues, so do
|
||||
not use the swap idiom:
|
||||
|
||||
list: list int { std::swap($$, $1); $$.emplace_back($2); }
|
||||
|
||||
This idiom is anyway obsolete: it is preferable to move than to swap.
|
||||
|
||||
A warning is issued when automove is enabled, and a value is used several
|
||||
times.
|
||||
|
||||
input.yy:16.31-32: warning: multiple occurrences of $2 with api.value.automove enabled [-Wother]
|
||||
exp: "twice" exp { $$ = $2 + $2; }
|
||||
^^
|
||||
|
||||
Enabling api.value.automove does not require support for modern C++. The
|
||||
generated code is valid C++98/03, but will use copies instead of moves.
|
||||
|
||||
The new examples/variant-11.yy shows these features in action.
|
||||
|
||||
*** C++: The implicit default semantic action is always run
|
||||
|
||||
When variants are enabled, the default action was not run, so
|
||||
|
||||
exp: "number"
|
||||
|
||||
was equivalent to
|
||||
|
||||
exp: "number" {}
|
||||
|
||||
It now behaves like in all the other cases, as
|
||||
|
||||
exp: "number" { $$ = $1; }
|
||||
|
||||
possibly using std::move if automove is enabled.
|
||||
|
||||
We do not expect backward compatibility issues. However, beware of
|
||||
forward compatibility issues: if you rely on default actions with
|
||||
variants, be sure to '%require "3.2"' to avoid older versions of Bison to
|
||||
generate incorrect parsers.
|
||||
|
||||
*** C++: Renaming location.hh
|
||||
|
||||
When both %defines and %locations are enabled, Bison generates a
|
||||
location.hh file. If you don't use locations outside of the parser, you
|
||||
may avoid its creation with:
|
||||
|
||||
%define api.location.file none
|
||||
|
||||
However this file is useful if, for instance, your parser builds an AST
|
||||
decorated with locations: you may use Bison's location independently of
|
||||
Bison's parser. You can now give it another name, for instance:
|
||||
|
||||
%define api.location.file "my-location.hh"
|
||||
|
||||
This name can have directory components, and even be absolute. The name
|
||||
under which the location file is included is controlled by
|
||||
api.location.include.
|
||||
|
||||
This way it is possible to have several parsers share the same location
|
||||
file.
|
||||
|
||||
For instance, in src/foo/parser.hh, generate the include/ast/loc.hh file:
|
||||
|
||||
%locations
|
||||
%define api.namespace {foo}
|
||||
%define api.location.file "include/ast/loc.hh"
|
||||
%define api.location.include {<ast/loc.hh>}
|
||||
|
||||
and use it in src/bar/parser.hh:
|
||||
|
||||
%locations
|
||||
%define api.namespace {bar}
|
||||
%code requires {#include <ast/loc.hh>}
|
||||
%define api.location.type {bar::location}
|
||||
|
||||
Absolute file names are supported, so in your Makefile, passing the flag
|
||||
-Dapi.location.file='"$(top_srcdir)/include/ast/location.hh"' to bison is
|
||||
safe.
|
||||
|
||||
*** C++: stack.hh and position.hh are deprecated
|
||||
|
||||
When asked to generate a header file (%defines), the lalr1.cc skeleton
|
||||
generates a stack.hh file. This file had no interest for users; it is now
|
||||
made useless: its content is included in the parser definition. It is
|
||||
still generated for backward compatibility.
|
||||
|
||||
When in addition to %defines, location support is requested (%locations),
|
||||
the file position.hh is also generated. It is now also useless: its
|
||||
content is now included in location.hh.
|
||||
|
||||
These files are no longer generated when your grammar file requires at
|
||||
least Bison 3.2 (%require "3.2").
|
||||
|
||||
** Bug fixes
|
||||
|
||||
Portability issues on MinGW and VS2015.
|
||||
|
||||
Portability issues in the test suite.
|
||||
|
||||
Portability/warning issues with Flex.
|
||||
|
||||
* Noteworthy changes in release 3.1 (2018-08-27) [stable]
|
||||
|
||||
** Backward incompatible changes
|
||||
|
||||
Compiling Bison now requires a C99 compiler---as announced during the
|
||||
release of Bison 3.0, five years ago. Generated parsers do not require a
|
||||
C99 compiler.
|
||||
|
||||
Support for DJGPP, which have been unmaintained and untested for years, is
|
||||
obsolete. Unless there is activity to revive it, the next release of Bison
|
||||
will have it removed.
|
||||
|
||||
** New features
|
||||
|
||||
*** Typed midrule actions
|
||||
|
||||
Because their type is unknown to Bison, the values of midrule actions are
|
||||
not treated like the others: they don't have %printer and %destructor
|
||||
support. It also prevents C++ (Bison) variants to handle them properly.
|
||||
|
||||
Typed midrule actions address these issues. Instead of:
|
||||
|
||||
exp: { $<ival>$ = 1; } { $<ival>$ = 2; } { $$ = $<ival>1 + $<ival>2; }
|
||||
|
||||
write:
|
||||
|
||||
exp: <ival>{ $$ = 1; } <ival>{ $$ = 2; } { $$ = $1 + $2; }
|
||||
|
||||
*** Reports include the type of the symbols
|
||||
|
||||
The sections about terminal and nonterminal symbols of the '*.output' file
|
||||
now specify their declared type. For instance, for:
|
||||
|
||||
%token <ival> NUM
|
||||
|
||||
the report now shows '<ival>':
|
||||
|
||||
Terminals, with rules where they appear
|
||||
|
||||
NUM <ival> (258) 5
|
||||
|
||||
*** Diagnostics about useless rules
|
||||
|
||||
In the following grammar, the 'exp' nonterminal is trivially useless. So,
|
||||
of course, its rules are useless too.
|
||||
|
||||
%%
|
||||
input: '0' | exp
|
||||
exp: exp '+' exp | exp '-' exp | '(' exp ')'
|
||||
|
||||
Previously all the useless rules were reported, including those whose
|
||||
left-hand side is the 'exp' nonterminal:
|
||||
|
||||
warning: 1 nonterminal useless in grammar [-Wother]
|
||||
warning: 4 rules useless in grammar [-Wother]
|
||||
2.14-16: warning: nonterminal useless in grammar: exp [-Wother]
|
||||
input: '0' | exp
|
||||
^^^
|
||||
2.14-16: warning: rule useless in grammar [-Wother]
|
||||
input: '0' | exp
|
||||
^^^
|
||||
3.6-16: warning: rule useless in grammar [-Wother]
|
||||
exp: exp '+' exp | exp '-' exp | '(' exp ')'
|
||||
^^^^^^^^^^^
|
||||
3.20-30: warning: rule useless in grammar [-Wother]
|
||||
exp: exp '+' exp | exp '-' exp | '(' exp ')'
|
||||
^^^^^^^^^^^
|
||||
3.34-44: warning: rule useless in grammar [-Wother]
|
||||
exp: exp '+' exp | exp '-' exp | '(' exp ')'
|
||||
^^^^^^^^^^^
|
||||
|
||||
Now, rules whose left-hand side symbol is useless are no longer reported
|
||||
as useless. The locations of the errors have also been adjusted to point
|
||||
to the first use of the nonterminal as a left-hand side of a rule:
|
||||
|
||||
warning: 1 nonterminal useless in grammar [-Wother]
|
||||
warning: 4 rules useless in grammar [-Wother]
|
||||
3.1-3: warning: nonterminal useless in grammar: exp [-Wother]
|
||||
exp: exp '+' exp | exp '-' exp | '(' exp ')'
|
||||
^^^
|
||||
2.14-16: warning: rule useless in grammar [-Wother]
|
||||
input: '0' | exp
|
||||
^^^
|
||||
|
||||
*** C++: Generated parsers can be compiled with -fno-exceptions (lalr1.cc)
|
||||
|
||||
When compiled with exceptions disabled, the generated parsers no longer
|
||||
uses try/catch clauses.
|
||||
|
||||
Currently only GCC and Clang are supported.
|
||||
|
||||
** Documentation
|
||||
|
||||
*** A demonstration of variants
|
||||
|
||||
A new example was added (installed in .../share/doc/bison/examples),
|
||||
'variant.yy', which shows how to use (Bison) variants in C++.
|
||||
|
||||
The other examples were made nicer to read.
|
||||
|
||||
*** Some features are no longer 'experimental'
|
||||
|
||||
The following features, mature enough, are no longer flagged as
|
||||
experimental in the documentation: push parsers, default %printer and
|
||||
%destructor (typed: <*> and untyped: <>), %define api.value.type union and
|
||||
variant, Java parsers, XML output, LR family (lr, ielr, lalr), and
|
||||
semantic predicates (%?).
|
||||
|
||||
** Bug fixes
|
||||
|
||||
*** GLR: Predicates support broken by #line directives
|
||||
|
||||
Predicates (%?) in GLR such as
|
||||
|
||||
widget:
|
||||
%? {new_syntax} 'w' id new_args
|
||||
| %?{!new_syntax} 'w' id old_args
|
||||
|
||||
were issued with #lines in the middle of C code.
|
||||
|
||||
*** Printer and destructor with broken #line directives
|
||||
|
||||
The #line directives were not properly escaped when emitting the code for
|
||||
%printer/%destructor, which resulted in compiler errors if there are
|
||||
backslashes or double-quotes in the grammar file name.
|
||||
|
||||
*** Portability on ICC
|
||||
|
||||
The Intel compiler claims compatibility with GCC, yet rejects its _Pragma.
|
||||
Generated parsers now work around this.
|
||||
|
||||
*** Various
|
||||
|
||||
There were several small fixes in the test suite and in the build system,
|
||||
many warnings in bison and in the generated parsers were eliminated. The
|
||||
documentation also received its share of minor improvements.
|
||||
|
||||
Useless code was removed from C++ parsers, and some of the generated
|
||||
constructors are more 'natural'.
|
||||
|
||||
* Noteworthy changes in release 3.0.5 (2018-05-27) [stable]
|
||||
|
||||
** Bug fixes
|
||||
|
||||
*** C++: Fix support of 'syntax_error'
|
||||
|
||||
One incorrect 'inline' resulted in linking errors about the constructor of
|
||||
the syntax_error exception.
|
||||
|
||||
*** C++: Fix warnings
|
||||
|
||||
GCC 7.3 (with -O1 or -O2 but not -O0 or -O3) issued null-dereference
|
||||
warnings about yyformat being possibly null. It also warned about the
|
||||
deprecated implicit definition of copy constructors when there's a
|
||||
user-defined (copy) assignment operator.
|
||||
|
||||
*** Location of errors
|
||||
|
||||
In C++ parsers, out-of-bounds errors can happen when a rule with an empty
|
||||
ride-hand side raises a syntax error. The behavior of the default parser
|
||||
(yacc.c) in such a condition was undefined.
|
||||
|
||||
Now all the parsers match the behavior of glr.c: @$ is used as the
|
||||
location of the error. This handles gracefully rules with and without
|
||||
rhs.
|
||||
|
||||
*** Portability fixes in the test suite
|
||||
|
||||
On some platforms, some Java and/or C++ tests were failing.
|
||||
|
||||
* Noteworthy changes in release 3.0.4 (2015-01-23) [stable]
|
||||
|
||||
** Bug fixes
|
||||
|
||||
*** C++ with Variants (lalr1.cc)
|
||||
|
||||
Fix a compiler warning when no %destructor use $$.
|
||||
|
||||
*** Test suites
|
||||
|
||||
Several portability issues in tests were fixed.
|
||||
|
||||
* Noteworthy changes in release 3.0.3 (2015-01-15) [stable]
|
||||
|
||||
** Bug fixes
|
||||
@@ -49,7 +381,7 @@ GNU Bison NEWS
|
||||
extracted from the documentation:
|
||||
|
||||
- rpcalc
|
||||
Reverse polish calculator, a simple introductory example.
|
||||
Reverse Polish Calculator, a simple introductory example.
|
||||
- mfcalc
|
||||
Multi-function Calc, a calculator with memory and functions and located
|
||||
error messages.
|
||||
@@ -516,9 +848,9 @@ GNU Bison NEWS
|
||||
fixed, and introducing tokens with any of %token, %left, %right,
|
||||
%precedence, or %nonassoc yields the same result.
|
||||
|
||||
When mixing declarations of tokens with a litteral character (e.g., 'a')
|
||||
or with an identifier (e.g., B) in a precedence declaration, Bison
|
||||
numbered the litteral characters first. For example
|
||||
When mixing declarations of tokens with a literal character (e.g., 'a') or
|
||||
with an identifier (e.g., B) in a precedence declaration, Bison numbered
|
||||
the literal characters first. For example
|
||||
|
||||
%right A B 'c' 'd'
|
||||
|
||||
@@ -839,7 +1171,7 @@ GNU Bison NEWS
|
||||
Although introduced more than four years ago, XML and Graphviz reports
|
||||
were not properly documented.
|
||||
|
||||
The translation of mid-rule actions is now described.
|
||||
The translation of midrule actions is now described.
|
||||
|
||||
* Noteworthy changes in release 2.6.5 (2012-11-07) [stable]
|
||||
|
||||
@@ -1835,16 +2167,16 @@ GNU Bison NEWS
|
||||
The prologue alternatives are experimental. More user feedback will help to
|
||||
determine whether they should become permanent features.
|
||||
|
||||
** Revised warning: unset or unused mid-rule values
|
||||
** Revised warning: unset or unused midrule values
|
||||
|
||||
Since Bison 2.2, Bison has warned about mid-rule values that are set but not
|
||||
Since Bison 2.2, Bison has warned about midrule values that are set but not
|
||||
used within any of the actions of the parent rule. For example, Bison warns
|
||||
about unused $2 in:
|
||||
|
||||
exp: '1' { $$ = 1; } '+' exp { $$ = $1 + $4; };
|
||||
|
||||
Now, Bison also warns about mid-rule values that are used but not set. For
|
||||
example, Bison warns about unset $$ in the mid-rule action in:
|
||||
Now, Bison also warns about midrule values that are used but not set. For
|
||||
example, Bison warns about unset $$ in the midrule action in:
|
||||
|
||||
exp: '1' { $1 = 1; } '+' exp { $$ = $2 + $4; };
|
||||
|
||||
@@ -1870,7 +2202,7 @@ GNU Bison NEWS
|
||||
|
||||
Bison no longer supports the "%symbol-default" notation from Bison 2.3a.
|
||||
"<*>" and "<>" combined achieve the same effect with one exception: Bison no
|
||||
longer applies any %destructor to a mid-rule value if that mid-rule value is
|
||||
longer applies any %destructor to a midrule value if that midrule value is
|
||||
not actually ever referenced using either $$ or $n in a semantic action.
|
||||
|
||||
The default %destructor's and %printer's are experimental. More user
|
||||
@@ -2048,7 +2380,7 @@ GNU Bison NEWS
|
||||
| exp "+" exp { $$ = $1; (void) $3; }
|
||||
;
|
||||
|
||||
If there are mid-rule actions, the warning is issued if no action
|
||||
If there are midrule actions, the warning is issued if no action
|
||||
uses it. The following triggers no warning: $1 and $3 are used.
|
||||
|
||||
exp: exp { push ($1); } '+' exp { push ($3); sum (); };
|
||||
@@ -2323,13 +2655,13 @@ GNU Bison NEWS
|
||||
|
||||
typed: ... untyped;
|
||||
|
||||
** Values of mid-rule actions
|
||||
** Values of midrule actions
|
||||
The following code:
|
||||
|
||||
foo: { ... } { $$ = $1; } ...
|
||||
|
||||
was incorrectly rejected: $1 is defined in the second mid-rule
|
||||
action, and is equal to the $$ of the first mid-rule action.
|
||||
was incorrectly rejected: $1 is defined in the second midrule
|
||||
action, and is equal to the $$ of the first midrule action.
|
||||
|
||||
* Changes in version 1.50, 2002-10-04:
|
||||
|
||||
@@ -2465,7 +2797,7 @@ GNU Bison NEWS
|
||||
|
||||
** Type clashes
|
||||
Previous versions don't complain when there is a type clash on
|
||||
the default action if the rule has a mid-rule action, such as in:
|
||||
the default action if the rule has a midrule action, such as in:
|
||||
|
||||
%type <foo> bar
|
||||
%%
|
||||
@@ -2736,7 +3068,7 @@ Output file does not redefine const for C++.
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 1995-2015 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Parser Generator.
|
||||
|
||||
@@ -2776,7 +3108,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
LocalWords: Wprecedence Rassoul Wempty Paolo Bonzini parser's Michiel loc
|
||||
LocalWords: redeclaration sval fcaret reentrant XSLT xsl Wmaybe yyvsp Tedi
|
||||
LocalWords: pragmas noreturn untyped Rozenman unexpanded Wojciech Polak
|
||||
LocalWords: Alexandre MERCHANTABILITY yytype
|
||||
LocalWords: Alexandre MERCHANTABILITY yytype emplace ptr automove lvalues
|
||||
LocalWords: nonterminal yy args Pragma dereference yyformat rhs docdir
|
||||
LocalWords: Redeclarations rpcalc Autoconf YFLAGS Makefiles outout PROG
|
||||
LocalWords: Heimbigner AST src ast Makefile srcdir MinGW
|
||||
|
||||
Local Variables:
|
||||
mode: outline
|
||||
|
||||
@@ -36,7 +36,7 @@ to the bison package.
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2002, 2005, 2009-2015 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2005, 2009-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ instructions.
|
||||
|
||||
Bison requires GNU m4 1.4.6 or later. See:
|
||||
|
||||
ftp://ftp.gnu.org/gnu/m4/m4-1.4.6.tar.gz
|
||||
https://ftp.gnu.org/gnu/m4/m4-1.4.6.tar.gz
|
||||
|
||||
** Internationalization
|
||||
Bison supports two catalogues: one for Bison itself (i.e., for the
|
||||
@@ -37,17 +37,17 @@ test case in each bug report.
|
||||
For any copyright year range specified as YYYY-ZZZZ in this package,
|
||||
note that the range specifies every single year in that closed interval.
|
||||
|
||||
-----
|
||||
|
||||
Local Variables:
|
||||
mode: outline
|
||||
fill-column: 76
|
||||
End:
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2015 Free Software
|
||||
Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2015, 2018 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
This file is part of GNU bison, the GNU Compiler Compiler.
|
||||
|
||||
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
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ the problems you encounter.
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2002, 2004, 2009-2015 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2004, 2009-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bison.
|
||||
|
||||
|
||||
+101
-104
@@ -9,19 +9,19 @@ Everything related to the development of Bison is on Savannah:
|
||||
* Administrivia
|
||||
|
||||
** If you incorporate a change from somebody on the net:
|
||||
First, if it is a large change, you must make sure they have signed
|
||||
the appropriate paperwork. Second, be sure to add their name and
|
||||
email address to THANKS.
|
||||
First, if it is a large change, you must make sure they have signed the
|
||||
appropriate paperwork. Second, be sure to add their name and email address
|
||||
to THANKS.
|
||||
|
||||
** If a change fixes a test, mention the test in the commit message.
|
||||
|
||||
** Bug reports
|
||||
If somebody reports a new bug, mention his name in the commit message
|
||||
and in the test case you write. Put him into THANKS.
|
||||
If somebody reports a new bug, mention his name in the commit message and in
|
||||
the test case you write. Put him into THANKS.
|
||||
|
||||
The correct response to most actual bugs is to write a new test case
|
||||
which demonstrates the bug. Then fix the bug, re-run the test suite,
|
||||
and check everything in.
|
||||
The correct response to most actual bugs is to write a new test case which
|
||||
demonstrates the bug. Then fix the bug, re-run the test suite, and check
|
||||
everything in.
|
||||
|
||||
|
||||
* Hacking
|
||||
@@ -30,17 +30,17 @@ and check everything in.
|
||||
Which include serious bug fixes, must be mentioned in NEWS.
|
||||
|
||||
** Translations
|
||||
Only user visible strings are to be translated: error messages, bits
|
||||
of the .output file etc. This excludes impossible error messages
|
||||
(comparable to assert/abort), and all the --trace output which is
|
||||
meant for the maintainers only.
|
||||
Only user visible strings are to be translated: error messages, bits of the
|
||||
.output file etc. This excludes impossible error messages (comparable to
|
||||
assert/abort), and all the --trace output which is meant for the maintainers
|
||||
only.
|
||||
|
||||
** Horizontal tabs
|
||||
Do not add horizontal tab characters to any file in Bison's repository
|
||||
except where required. For example, do not use tabs to format C code.
|
||||
However, make files, ChangeLog, and some regular expressions require
|
||||
tabs. Also, test cases might need to contain tabs to check that Bison
|
||||
properly processes tabs in its input.
|
||||
However, make files, ChangeLog, and some regular expressions require tabs.
|
||||
Also, test cases might need to contain tabs to check that Bison properly
|
||||
processes tabs in its input.
|
||||
|
||||
|
||||
* Working from the repository
|
||||
@@ -103,14 +103,16 @@ to perform the first checkout of the submodules, run
|
||||
|
||||
$ git submodule update --init
|
||||
|
||||
Git submodule support is weak before versions 1.6 and later, upgrade Git if
|
||||
your version is older.
|
||||
|
||||
The next step is to get other files needed to build, which are
|
||||
extracted from other source packages:
|
||||
|
||||
$ ./bootstrap
|
||||
|
||||
Bootstrapping updates the submodules to the versions registered in the
|
||||
top-level directory. To change gnulib, first check out the version you want
|
||||
in `gnulib`, then commit this change in Bison's repository, and finally run
|
||||
bootstrap.
|
||||
|
||||
If it fails with missing symbols (e.g., "error: possibly undefined macro:
|
||||
AC_PROG_GNU_M4"), you are likely to have forgotten the submodule
|
||||
initialization part. Otherwise, there you are! Just
|
||||
@@ -137,13 +139,12 @@ explicitly by the user.
|
||||
*** Updating Bison
|
||||
|
||||
If you pull a newer version of a branch, say via "git pull", you might
|
||||
import requests for updated submodules. A simple "git diff" will
|
||||
reveal if the current version of the submodule (i.e., the actual
|
||||
contents of the gnulib directory) and the current request from the
|
||||
subscriber (i.e., the reference of the version of gnulib that the
|
||||
Bison repository requests) differ. To upgrade the submodules (i.e.,
|
||||
to check out the version that is actually requested by the subscriber,
|
||||
run "git submodule update".
|
||||
import requests for updated submodules. A simple "git diff" will reveal if
|
||||
the current version of the submodule (i.e., the actual contents of the
|
||||
gnulib directory) and the current request from the subscriber (i.e., the
|
||||
reference of the version of gnulib that the Bison repository requests)
|
||||
differ. To upgrade the submodules (i.e., to check out the version that is
|
||||
actually requested by the subscriber, run "git submodule update".
|
||||
|
||||
$ git pull
|
||||
$ git submodule update
|
||||
@@ -167,8 +168,8 @@ Register your changes.
|
||||
|
||||
$ git checkin ...
|
||||
|
||||
For a suggestion of what gnulib commit might be stable enough for a
|
||||
formal release, see the ChangeLog in the latest gnulib snapshot at:
|
||||
For a suggestion of what gnulib commit might be stable enough for a formal
|
||||
release, see the ChangeLog in the latest gnulib snapshot at:
|
||||
|
||||
http://erislabs.net/ianb/projects/gnulib/
|
||||
|
||||
@@ -178,9 +179,9 @@ The Autoconf files we use are currently:
|
||||
lib/m4sugar/m4sugar.m4
|
||||
lib/m4sugar/foreach.m4
|
||||
|
||||
These files don't change very often in Autoconf, so it should be
|
||||
relatively straight-forward to examine the differences in order to
|
||||
decide whether to update.
|
||||
These files don't change very often in Autoconf, so it should be relatively
|
||||
straight-forward to examine the differences in order to decide whether to
|
||||
update.
|
||||
|
||||
* Test suite
|
||||
|
||||
@@ -189,12 +190,15 @@ Use liberally.
|
||||
|
||||
** TESTSUITEFLAGS
|
||||
|
||||
The default is for make check to run all tests sequentially. This can be
|
||||
very time consumming when checking repeatedly or on slower setups. This can
|
||||
be sped up in two ways:
|
||||
To run just the testsuite (not the tests related to the examples), run `make
|
||||
check-local`.
|
||||
|
||||
The default is for make check-local to run all tests sequentially. This can
|
||||
be very time consuming when checking repeatedly or on slower setups. This
|
||||
can be sped up in two ways:
|
||||
|
||||
Using -j, in a make-like fashion, for example:
|
||||
$ make check TESTSUITEFLAGS='-j8'
|
||||
$ make check-local TESTSUITEFLAGS='-j8'
|
||||
|
||||
Running only the tests of a certain category, as specified in the AT files
|
||||
with AT_KEYWORDS([[category]]). Categories include:
|
||||
@@ -205,7 +209,7 @@ with AT_KEYWORDS([[category]]). Categories include:
|
||||
- report, for automaton dumps
|
||||
|
||||
To run a specific set of tests, use -k (for "keyword"). For example:
|
||||
$ make check TESTSUITEFLAGS='-k c++'
|
||||
$ make check-local TESTSUITEFLAGS='-k c++'
|
||||
|
||||
Both can be combined.
|
||||
|
||||
@@ -243,102 +247,96 @@ suite. So currently, do not try to run valgrind on Mac OS X.
|
||||
Try to run the test suite with more severe conditions before a
|
||||
release:
|
||||
|
||||
- Configure the package with --enable-gcc-warnings, so that one checks
|
||||
that 1. Bison compiles cleanly, 2. the parsers it produces compile
|
||||
cleanly too.
|
||||
- Configure the package with --enable-gcc-warnings, so that one checks that
|
||||
1. Bison compiles cleanly, 2. the parsers it produces compile cleanly too.
|
||||
|
||||
- Maybe build with -DGNULIB_POSIXCHECK, which suggests gnulib modules
|
||||
that can fix portability issues. See if you really want to pay
|
||||
attention to its warnings; there's no need to obey blindly to it
|
||||
- Maybe build with -DGNULIB_POSIXCHECK, which suggests gnulib modules that
|
||||
can fix portability issues. See if you really want to pay attention to
|
||||
its warnings; there's no need to obey blindly to it
|
||||
(<http://lists.gnu.org/archive/html/bison-patches/2012-05/msg00057.html>).
|
||||
|
||||
- Check with "make syntax-check" if there are issues diagnosed by
|
||||
gnulib.
|
||||
- Check with "make syntax-check" if there are issues diagnosed by gnulib.
|
||||
|
||||
- run "make maintainer-check" which:
|
||||
- runs "valgrind -q bison" to run Bison under Valgrind.
|
||||
- runs the parsers under Valgrind.
|
||||
- runs the test suite with G++ as C compiler...
|
||||
|
||||
- run "make maintainer-push-check", which runs "make maintainer-check"
|
||||
while activating the push implementation and its pull interface wrappers
|
||||
in many test cases that were originally written to exercise only the
|
||||
pull implementation. This makes certain the push implementation can
|
||||
perform every task the pull implementation can.
|
||||
- run "make maintainer-check-push", which runs "make maintainer-check" while
|
||||
activating the push implementation and its pull interface wrappers in many
|
||||
test cases that were originally written to exercise only the pull
|
||||
implementation. This makes certain the push implementation can perform
|
||||
every task the pull implementation can.
|
||||
|
||||
- run "make maintainer-xml-check", which runs "make maintainer-check"
|
||||
while checking Bison's XML automaton report for every working grammar
|
||||
passed to Bison in the test suite. The check just diffs the output of
|
||||
Bison's included XSLT style sheets with the output of --report=all and
|
||||
--graph.
|
||||
- run "make maintainer-check-xml", which runs "make maintainer-check" while
|
||||
checking Bison's XML automaton report for every working grammar passed to
|
||||
Bison in the test suite. The check just diffs the output of Bison's
|
||||
included XSLT style sheets with the output of --report=all and --graph.
|
||||
|
||||
- running "make maintainer-release-check" takes care of running
|
||||
maintainer-check, maintainer-push-check and maintainer-xml-check.
|
||||
- running "make maintainer-check-release" takes care of running
|
||||
maintainer-check, maintainer-check-push and maintainer-check-xml.
|
||||
|
||||
- Change tests/atlocal/CFLAGS to add your preferred options. For
|
||||
instance, "-traditional" to check that the parsers are K&R. Note
|
||||
that it does not make sense for glr.c, which should be ANSI, but
|
||||
currently is actually GNU C, nor for lalr1.cc.
|
||||
- Change tests/atlocal/CFLAGS to add your preferred options.
|
||||
|
||||
- Test with a very recent version of GCC for both C and C++. Testing
|
||||
with older versions that are still in use is nice too.
|
||||
- Test with a very recent version of GCC for both C and C++. Testing with
|
||||
older versions that are still in use is nice too.
|
||||
|
||||
|
||||
* Release Procedure
|
||||
This section needs to be updated to take into account features from
|
||||
gnulib. In particular, be sure to read README-release.
|
||||
This section needs to be updated to take into account features from gnulib.
|
||||
In particular, be sure to read README-release.
|
||||
|
||||
** Update the submodules. See above.
|
||||
|
||||
** Update maintainer tools, such as Autoconf. See above.
|
||||
|
||||
** Try to get the *.pot files to the Translation Project at least one
|
||||
week before a stable release, to give them time to translate them.
|
||||
Before generating the *.pot files, make sure that po/POTFILES.in and
|
||||
runtime-po/POTFILES.in list all files with translatable strings.
|
||||
This helps: grep -l '\<_(' *
|
||||
week before a stable release, to give them time to translate them. Before
|
||||
generating the *.pot files, make sure that po/POTFILES.in and
|
||||
runtime-po/POTFILES.in list all files with translatable strings. This
|
||||
helps: grep -l '\<_(' *.
|
||||
|
||||
** Tests
|
||||
See above.
|
||||
|
||||
** Update the foreign files
|
||||
Running "./bootstrap" in the top level should update them all for you.
|
||||
This covers PO files too. Sometimes a PO file contains problems that
|
||||
causes it to be rejected by recent Gettext releases; please report
|
||||
these to the Translation Project.
|
||||
Running "./bootstrap" in the top level should update them all for you. This
|
||||
covers PO files too. Sometimes a PO file contains problems that causes it
|
||||
to be rejected by recent Gettext releases; please report these to the
|
||||
Translation Project.
|
||||
|
||||
** Update README
|
||||
Make sure the information in README is current. Most notably, make sure
|
||||
it recommends a version of GNU M4 that is compatible with the latest
|
||||
Bison sources.
|
||||
Make sure the information in README is current. Most notably, make sure it
|
||||
recommends a version of GNU M4 that is compatible with the latest Bison
|
||||
sources.
|
||||
|
||||
** Check copyright years.
|
||||
We update years in copyright statements throughout Bison once at the
|
||||
start of every year by running "make update-copyright". However, before
|
||||
a release, it's good to verify that it's actually been run. Besides the
|
||||
copyright statement for each Bison file, check the copyright statements
|
||||
that the skeletons insert into generated parsers, and check all
|
||||
occurrences of PACKAGE_COPYRIGHT_YEAR in configure.ac.
|
||||
We update years in copyright statements throughout Bison once at the start
|
||||
of every year by running "make update-copyright". However, before a
|
||||
release, it's good to verify that it's actually been run. Besides the
|
||||
copyright statement for each Bison file, check the copyright statements that
|
||||
the skeletons insert into generated parsers, and check all occurrences of
|
||||
PACKAGE_COPYRIGHT_YEAR in configure.ac.
|
||||
|
||||
** Update NEWS, commit and tag.
|
||||
See do-release-commit-and-tag in README-release. For a while, we used
|
||||
beta names such as "2.6_rc1". Now that we use gnulib in the release
|
||||
procedure, we must use "2.5.90", which has the additional benefit of
|
||||
being properly sorted in "git tag -l".
|
||||
See do-release-commit-and-tag in README-release. For a while, we used beta
|
||||
names such as "2.6_rc1". Now that we use gnulib in the release procedure,
|
||||
we must use "2.5.90", which has the additional benefit of being properly
|
||||
sorted in "git tag -l".
|
||||
|
||||
** make alpha, beta, or stable
|
||||
See README-release.
|
||||
|
||||
** Upload
|
||||
There are two ways to upload the tarballs to the GNU servers: using
|
||||
gnupload (from gnulib), or by hand. Obviously prefer the former. But
|
||||
in either case, be sure to read the following paragraph.
|
||||
There are two ways to upload the tarballs to the GNU servers: using gnupload
|
||||
(from gnulib), or by hand. Obviously prefer the former. But in either
|
||||
case, be sure to read the following paragraph.
|
||||
|
||||
*** Setup
|
||||
You need "gnupg".
|
||||
|
||||
Make sure your public key has been uploaded at least to
|
||||
keys.gnupg.net. You can upload it with:
|
||||
Make sure your public key has been uploaded at least to keys.gnupg.net. You
|
||||
can upload it with:
|
||||
|
||||
gpg --keyserver keys.gnupg.net --send-keys F125BDF3
|
||||
|
||||
@@ -347,8 +345,8 @@ where F125BDF3 should be replaced with your key ID.
|
||||
*** Using gnupload
|
||||
You need "ncftp".
|
||||
|
||||
At the end "make stable" (or alpha/beta) will display the procedure to
|
||||
run. Just copy and paste it in your shell.
|
||||
At the end "make stable" (or alpha/beta) will display the procedure to run.
|
||||
Just copy and paste it in your shell.
|
||||
|
||||
*** By hand
|
||||
|
||||
@@ -410,9 +408,9 @@ sections that have been removed or renamed):
|
||||
$ ls -lt
|
||||
|
||||
Remove these files and commit their removal to CVS. For each of these
|
||||
files, add a line to the file .symlinks. This will ensure that
|
||||
hyperlinks to the removed files will redirect to the entire manual; this
|
||||
is better than a 404 error.
|
||||
files, add a line to the file .symlinks. This will ensure that hyperlinks
|
||||
to the removed files will redirect to the entire manual; this is better than
|
||||
a 404 error.
|
||||
|
||||
There is a problem with 'index.html' being written twice (once for POSIX
|
||||
function 'index', once for the table of contents); you can ignore this
|
||||
@@ -431,19 +429,18 @@ Complete/fix the announcement file. The generated list of recipients
|
||||
([email protected], [email protected], [email protected],
|
||||
[email protected], and [email protected]) is
|
||||
appropriate for a stable release or a "serious beta". For any other
|
||||
release, drop at least [email protected]. For an example of how to
|
||||
fill out the rest of the template, search the mailing list archives
|
||||
for the most recent release announcement.
|
||||
release, drop at least [email protected]. For an example of how to fill out
|
||||
the rest of the template, search the mailing list archives for the most
|
||||
recent release announcement.
|
||||
|
||||
For a stable release, send the same announcement on the comp.compilers
|
||||
newsgroup by sending email to [email protected]. Do not make any Cc as
|
||||
the moderator will throw away anything cross-posted or Cc'ed. It really
|
||||
needs to be a separate message.
|
||||
newsgroup by sending email to [email protected]. Do not make any Cc as the
|
||||
moderator will throw away anything cross-posted or Cc'ed. It really needs
|
||||
to be a separate message.
|
||||
|
||||
** Prepare NEWS
|
||||
So that developers don't accidentally add new items to the old NEWS
|
||||
entry, create a new empty entry in line 3 (without the two leading
|
||||
spaces):
|
||||
So that developers don't accidentally add new items to the old NEWS entry,
|
||||
create a new empty entry in line 3 (without the two leading spaces):
|
||||
|
||||
* Noteworthy changes in release ?.? (????-??-??) [?]
|
||||
|
||||
@@ -451,7 +448,7 @@ Push these changes.
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2002-2005, 2007-2015 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002-2005, 2007-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bison.
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ Anthony Heading [email protected]
|
||||
Antonio Silva Correia [email protected]
|
||||
Arnold Robbins [email protected]
|
||||
Art Haas [email protected]
|
||||
Askar Safin [email protected]
|
||||
Baron Schwartz [email protected]
|
||||
Ben Pfaff [email protected]
|
||||
Benoit Perrot [email protected]
|
||||
@@ -24,6 +25,7 @@ Bert Deknuydt [email protected]
|
||||
Bill Allombert [email protected]
|
||||
Bob Rossi [email protected]
|
||||
Brandon Lucia [email protected]
|
||||
Brooks Moses [email protected]
|
||||
Bruce Lilly [email protected]
|
||||
Bruno Haible [email protected]
|
||||
Charles-Henri de Boysson [email protected]
|
||||
@@ -38,7 +40,10 @@ Daniel Galloway [email protected]
|
||||
Daniel Hagerty [email protected]
|
||||
David J. MacKenzie [email protected]
|
||||
David Kastrup [email protected]
|
||||
David Michael [email protected]
|
||||
Dengke Du [email protected]
|
||||
Dennis Clarke [email protected]
|
||||
Derek Clegg [email protected]
|
||||
Derek M. Jones [email protected]
|
||||
Di-an Jan [email protected]
|
||||
Dick Streefland [email protected]
|
||||
@@ -46,28 +51,34 @@ Didier Godefroy [email protected]
|
||||
Efi Fogel [email protected]
|
||||
Enrico Scholz [email protected]
|
||||
Eric Blake [email protected]
|
||||
Étienne Renault [email protected]
|
||||
Evgeny Stambulchik [email protected]
|
||||
Fabrice Bauzac [email protected]
|
||||
Ferdinand Thiessen [email protected]
|
||||
Florian Krohm [email protected]
|
||||
Frank Heckenbach [email protected]
|
||||
Frans Englich [email protected]
|
||||
Gabriel Rassoul [email protected]
|
||||
Gary L Peskin [email protected]
|
||||
Georg Sauthoff [email protected]
|
||||
George Neuner [email protected]
|
||||
Gilles Espinasse [email protected]
|
||||
Goran Uddeborg [email protected]
|
||||
Guido Trentalancia [email protected]
|
||||
H. Merijn Brand [email protected]
|
||||
Hans Aberg haberg@matematik.su.se
|
||||
Hans Åberg haberg[email protected]
|
||||
Jan Nieuwenhuizen [email protected]
|
||||
Jannick [email protected]
|
||||
Jerry Quinn [email protected]
|
||||
Jesse Thilo [email protected]
|
||||
Jim Kent [email protected]
|
||||
Jim Meyering [email protected]
|
||||
Joel E. Denny [email protected]
|
||||
Johan van Selst [email protected]
|
||||
John Horigan [email protected]
|
||||
Jonathan Fabrizio [email protected]
|
||||
Jonathan Nieder [email protected]
|
||||
Josh Soref [email protected]
|
||||
Juan Manuel Guerrero [email protected]
|
||||
Kees Zeelenberg [email protected]
|
||||
Keith Browne [email protected]
|
||||
@@ -83,6 +94,7 @@ Martin Mokrejs [email protected]
|
||||
Martin Nylin [email protected]
|
||||
Matt Kraai [email protected]
|
||||
Matt Rosing [email protected]
|
||||
Maxim Prohorenko [email protected]
|
||||
Michael Catanzaro [email protected]
|
||||
Michael Felt [email protected]
|
||||
Michael Hayes [email protected]
|
||||
@@ -92,6 +104,7 @@ Michiel De Wilde [email protected]
|
||||
Mickael Labau [email protected]
|
||||
Mike Castle [email protected]
|
||||
Mike Sullivan [email protected]
|
||||
Nate Guerin [email protected]
|
||||
Neil Booth [email protected]
|
||||
Nelson H. F. Beebe [email protected]
|
||||
Nick Bowler [email protected]
|
||||
@@ -113,7 +126,9 @@ Peter Fales [email protected]
|
||||
Peter Hamorsky [email protected]
|
||||
Peter Simons [email protected]
|
||||
Petr Machata [email protected]
|
||||
Pho [email protected]
|
||||
Piotr Gackiewicz [email protected]
|
||||
Piotr Marcińczyk [email protected]
|
||||
Quentin Hocquet [email protected]
|
||||
Quoc Peyrot [email protected]
|
||||
R Blake [email protected]
|
||||
@@ -125,12 +140,14 @@ Rici Lake [email protected]
|
||||
Rob Conde [email protected]
|
||||
Rob Vermaas [email protected]
|
||||
Robert Anisko [email protected]
|
||||
Robert Yang [email protected]
|
||||
Roland Levillain [email protected]
|
||||
Satya Kiran Popuri [email protected]
|
||||
Sebastian Setzer [email protected]
|
||||
Sebastien Fricker [email protected]
|
||||
Sergei Steshenko [email protected]
|
||||
Shura [email protected]
|
||||
Simon Sobisch [email protected]
|
||||
Stefano Lattarini [email protected]
|
||||
Stephen Cameron [email protected]
|
||||
Steve Murphy [email protected]
|
||||
@@ -159,6 +176,7 @@ Wolfram Wagner [email protected]
|
||||
Wwp [email protected]
|
||||
xolodho [email protected]
|
||||
Zack Weinberg [email protected]
|
||||
長田偉伸 [email protected]
|
||||
|
||||
Many people are not named here because we lost track of them. We
|
||||
thank them! Please, help us keeping this list up to date.
|
||||
@@ -170,7 +188,7 @@ End:
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2000-2015 Free Software Foundation, Inc.
|
||||
Copyright (C) 2000-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Parser Generator.
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ We could (should?) also treat the case of the undef_token, which is
|
||||
numbered 257 for yylex, and 2 internal. Both appear for instance in
|
||||
toknum:
|
||||
|
||||
const unsigned short int
|
||||
const unsigned short
|
||||
parser::yytoken_number_[] =
|
||||
{
|
||||
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
|
||||
@@ -196,6 +196,24 @@ DeRemer and Penello: they already provide the algorithm.
|
||||
|
||||
|
||||
* Extensions
|
||||
** Multiple start symbols
|
||||
Would be very useful when parsing closely related languages.
|
||||
|
||||
** Better error messages
|
||||
The users are not provided with enough tools to forge their error messages.
|
||||
See for instance "Is there an option to change the message produced by
|
||||
YYERROR_VERBOSE?" by Simon Sobisch, on bison-help.
|
||||
|
||||
** %include
|
||||
This is a popular demand. We already made many changes in the parser that
|
||||
should make this reasonably easy to implement.
|
||||
|
||||
** Push parsers
|
||||
There is demand for push parsers in Java and C++. And GLR I guess.
|
||||
|
||||
** Generate code instead of tables
|
||||
This is certainly quite a lot of work. See
|
||||
http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.50.4539.
|
||||
|
||||
** $-1
|
||||
We should find a means to provide an access to values deep in the
|
||||
@@ -231,6 +249,10 @@ XML output for GNU Bison and gcc
|
||||
XML output for GNU Bison
|
||||
http://yaxx.sourceforge.net/
|
||||
|
||||
** Counterexample generation
|
||||
https://lists.gnu.org/archive/html/bug-bison/2016-06/msg00000.html
|
||||
http://www.cs.cornell.edu/andru/papers/cupex/
|
||||
|
||||
* Unit rules
|
||||
Maybe we could expand unit rules, i.e., transform
|
||||
|
||||
@@ -365,11 +387,13 @@ Here's a proposal for how a new implementation might look:
|
||||
Local Variables:
|
||||
mode: outline
|
||||
coding: utf-8
|
||||
fill-column: 76
|
||||
End:
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2001-2004, 2006, 2008-2015 Free Software Foundation, Inc.
|
||||
Copyright (C) 2001-2004, 2006, 2008-2015, 2018 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#! /bin/sh
|
||||
# Print a version string.
|
||||
scriptversion=2014-12-08.12; # UTC
|
||||
scriptversion=2018-10-13.05; # UTC
|
||||
|
||||
# Bootstrap this package from checked-out sources.
|
||||
|
||||
# Copyright (C) 2003-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2003-2018 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -17,7 +17,7 @@ scriptversion=2014-12-08.12; # UTC
|
||||
# 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, see <http://www.gnu.org/licenses/>.
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Originally written by Paul Eggert. The canonical version of this
|
||||
# script is maintained as build-aux/bootstrap in gnulib, however, to
|
||||
@@ -42,11 +42,13 @@ export LC_ALL
|
||||
|
||||
local_gl_dir=gl
|
||||
|
||||
# Honour $PERL, but work even if there is none
|
||||
# Honor $PERL, but work even if there is none.
|
||||
PERL="${PERL-perl}"
|
||||
|
||||
me=$0
|
||||
|
||||
default_gnulib_url=git://git.sv.gnu.org/gnulib
|
||||
|
||||
usage() {
|
||||
cat <<EOF
|
||||
Usage: $me [OPTION]...
|
||||
@@ -76,6 +78,37 @@ contents are read as shell variables to configure the bootstrap.
|
||||
For build prerequisites, environment variables like \$AUTOCONF and \$AMTAR
|
||||
are honored.
|
||||
|
||||
Gnulib sources can be fetched in various ways:
|
||||
|
||||
* If this package is in a git repository with a 'gnulib' submodule
|
||||
configured, then that submodule is initialized and updated and sources
|
||||
are fetched from there. If \$GNULIB_SRCDIR is set (directly or via
|
||||
--gnulib-srcdir) and is a git repository, then it is used as a reference.
|
||||
|
||||
* Otherwise, if \$GNULIB_SRCDIR is set (directly or via --gnulib-srcdir),
|
||||
then sources are fetched from that local directory. If it is a git
|
||||
repository and \$GNULIB_REVISION is set, then that revision is checked
|
||||
out.
|
||||
|
||||
* Otherwise, if this package is in a git repository with a 'gnulib'
|
||||
submodule configured, then that submodule is initialized and updated and
|
||||
sources are fetched from there.
|
||||
|
||||
* Otherwise, if the 'gnulib' directory does not exist, Gnulib sources are
|
||||
cloned into that directory using git from \$GNULIB_URL, defaulting to
|
||||
$default_gnulib_url.
|
||||
If \$GNULIB_REVISION is set, then that revision is checked out.
|
||||
|
||||
* Otherwise, the existing Gnulib sources in the 'gnulib' directory are
|
||||
used. If it is a git repository and \$GNULIB_REVISION is set, then that
|
||||
revision is checked out.
|
||||
|
||||
If you maintain a package and want to pin a particular revision of the
|
||||
Gnulib sources that has been tested with your package, then there are two
|
||||
possible approaches: either configure a 'gnulib' submodule with the
|
||||
appropriate revision, or set \$GNULIB_REVISION (and if necessary
|
||||
\$GNULIB_URL) in $me.conf.
|
||||
|
||||
Running without arguments will suffice in most cases.
|
||||
EOF
|
||||
}
|
||||
@@ -129,19 +162,12 @@ bootstrap_post_import_hook() { :; }
|
||||
# Override it via your own definition in bootstrap.conf.
|
||||
bootstrap_epilogue() { :; }
|
||||
|
||||
# The command to download all .po files for a specified domain into
|
||||
# a specified directory. Fill in the first %s is the domain name, and
|
||||
# the second with the destination directory. Use rsync's -L and -r
|
||||
# options because the latest/%s directory and the .po files within are
|
||||
# all symlinks.
|
||||
# The command to download all .po files for a specified domain into a
|
||||
# specified directory. Fill in the first %s with the destination
|
||||
# directory and the second with the domain name.
|
||||
po_download_command_format=\
|
||||
"rsync --delete --exclude '*.s1' -Lrtvz \
|
||||
'translationproject.org::tp/latest/%s/' '%s'"
|
||||
|
||||
# Fallback for downloading .po files (if rsync fails).
|
||||
po_download_command_format2=\
|
||||
"wget --mirror -nd -q -np -A.po -P '%s' \
|
||||
http://translationproject.org/latest/%s/"
|
||||
"wget --mirror --level=1 -nd -q -A.po -P '%s' \
|
||||
https://translationproject.org/latest/%s/"
|
||||
|
||||
# Prefer a non-empty tarname (4th argument of AC_INIT if given), else
|
||||
# fall back to the package name (1st argument with munging)
|
||||
@@ -170,7 +196,15 @@ source_base=lib
|
||||
m4_base=m4
|
||||
doc_base=doc
|
||||
tests_base=tests
|
||||
gnulib_extra_files=''
|
||||
gnulib_extra_files="
|
||||
build-aux/install-sh
|
||||
build-aux/mdate-sh
|
||||
build-aux/texinfo.tex
|
||||
build-aux/depcomp
|
||||
build-aux/config.guess
|
||||
build-aux/config.sub
|
||||
doc/INSTALL
|
||||
"
|
||||
|
||||
# Additional gnulib-tool options to use. Use "\newline" to break lines.
|
||||
gnulib_tool_option_extras=
|
||||
@@ -264,24 +298,18 @@ case "$0" in
|
||||
*) test -r "$0.conf" && . ./"$0.conf" ;;
|
||||
esac
|
||||
|
||||
# Extra files from gnulib, which override files from other sources.
|
||||
test -z "${gnulib_extra_files}" && \
|
||||
gnulib_extra_files="
|
||||
build-aux/install-sh
|
||||
build-aux/mdate-sh
|
||||
build-aux/texinfo.tex
|
||||
build-aux/depcomp
|
||||
build-aux/config.guess
|
||||
build-aux/config.sub
|
||||
doc/INSTALL
|
||||
"
|
||||
|
||||
if test "$vc_ignore" = auto; then
|
||||
vc_ignore=
|
||||
test -d .git && vc_ignore=.gitignore
|
||||
test -d CVS && vc_ignore="$vc_ignore .cvsignore"
|
||||
fi
|
||||
|
||||
if test x"$gnulib_modules$gnulib_files$gnulib_extra_files" = x; then
|
||||
use_gnulib=false
|
||||
else
|
||||
use_gnulib=true
|
||||
fi
|
||||
|
||||
# Translate configuration into internal form.
|
||||
|
||||
# Parse options.
|
||||
@@ -418,28 +446,30 @@ sort_ver() { # sort -V is not generally available
|
||||
done
|
||||
}
|
||||
|
||||
get_version_sed='
|
||||
# Move version to start of line.
|
||||
s/.*[v ]\([0-9]\)/\1/
|
||||
|
||||
# Skip lines that do not start with version.
|
||||
/^[0-9]/!d
|
||||
|
||||
# Remove characters after the version.
|
||||
s/[^.a-z0-9-].*//
|
||||
|
||||
# The first component must be digits only.
|
||||
s/^\([0-9]*\)[a-z-].*/\1/
|
||||
|
||||
#the following essentially does s/5.005/5.5/
|
||||
s/\.0*\([1-9]\)/.\1/g
|
||||
p
|
||||
q'
|
||||
|
||||
get_version() {
|
||||
app=$1
|
||||
|
||||
$app --version >/dev/null 2>&1 || { $app --version; return 1; }
|
||||
|
||||
$app --version 2>&1 |
|
||||
sed -n '# Move version to start of line.
|
||||
s/.*[v ]\([0-9]\)/\1/
|
||||
|
||||
# Skip lines that do not start with version.
|
||||
/^[0-9]/!d
|
||||
|
||||
# Remove characters after the version.
|
||||
s/[^.a-z0-9-].*//
|
||||
|
||||
# The first component must be digits only.
|
||||
s/^\([0-9]*\)[a-z-].*/\1/
|
||||
|
||||
#the following essentially does s/5.005/5.5/
|
||||
s/\.0*\([1-9]\)/.\1/g
|
||||
p
|
||||
q'
|
||||
$app --version 2>&1 | sed -n "$get_version_sed"
|
||||
}
|
||||
|
||||
check_versions() {
|
||||
@@ -610,95 +640,101 @@ git_modules_config () {
|
||||
test -f .gitmodules && git config --file .gitmodules "$@"
|
||||
}
|
||||
|
||||
if $use_git; then
|
||||
gnulib_path=$(git_modules_config submodule.gnulib.path)
|
||||
test -z "$gnulib_path" && gnulib_path=gnulib
|
||||
fi
|
||||
|
||||
# Get gnulib files. Populate $GNULIB_SRCDIR, possibly updating a
|
||||
# submodule, for use in the rest of the script.
|
||||
|
||||
case ${GNULIB_SRCDIR--} in
|
||||
-)
|
||||
# Note that $use_git is necessarily true in this case.
|
||||
if git_modules_config submodule.gnulib.url >/dev/null; then
|
||||
echo "$0: getting gnulib files..."
|
||||
git submodule init -- "$gnulib_path" || exit $?
|
||||
git submodule update -- "$gnulib_path" || exit $?
|
||||
|
||||
elif [ ! -d "$gnulib_path" ]; then
|
||||
echo "$0: getting gnulib files..."
|
||||
|
||||
trap cleanup_gnulib 1 2 13 15
|
||||
|
||||
shallow=
|
||||
git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2'
|
||||
git clone $shallow git://git.sv.gnu.org/gnulib "$gnulib_path" ||
|
||||
cleanup_gnulib
|
||||
|
||||
trap - 1 2 13 15
|
||||
if $use_gnulib; then
|
||||
if $use_git; then
|
||||
gnulib_path=$(git_modules_config submodule.gnulib.path)
|
||||
test -z "$gnulib_path" && gnulib_path=gnulib
|
||||
fi
|
||||
GNULIB_SRCDIR=$gnulib_path
|
||||
;;
|
||||
*)
|
||||
# Use GNULIB_SRCDIR directly or as a reference.
|
||||
if $use_git && test -d "$GNULIB_SRCDIR"/.git && \
|
||||
git_modules_config submodule.gnulib.url >/dev/null; then
|
||||
echo "$0: getting gnulib files..."
|
||||
if git submodule -h|grep -- --reference > /dev/null; then
|
||||
# Prefer the one-liner available in git 1.6.4 or newer.
|
||||
git submodule update --init --reference "$GNULIB_SRCDIR" \
|
||||
"$gnulib_path" || exit $?
|
||||
else
|
||||
# This fallback allows at least git 1.5.5.
|
||||
if test -f "$gnulib_path"/gnulib-tool; then
|
||||
# Since file already exists, assume submodule init already complete.
|
||||
git submodule update -- "$gnulib_path" || exit $?
|
||||
else
|
||||
# Older git can't clone into an empty directory.
|
||||
rmdir "$gnulib_path" 2>/dev/null
|
||||
git clone --reference "$GNULIB_SRCDIR" \
|
||||
"$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \
|
||||
&& git submodule init -- "$gnulib_path" \
|
||||
&& git submodule update -- "$gnulib_path" \
|
||||
|| exit $?
|
||||
|
||||
# Get gnulib files. Populate $GNULIB_SRCDIR, possibly updating a
|
||||
# submodule, for use in the rest of the script.
|
||||
|
||||
case ${GNULIB_SRCDIR--} in
|
||||
-)
|
||||
# Note that $use_git is necessarily true in this case.
|
||||
if git_modules_config submodule.gnulib.url >/dev/null; then
|
||||
echo "$0: getting gnulib files..."
|
||||
git submodule init -- "$gnulib_path" || exit $?
|
||||
git submodule update -- "$gnulib_path" || exit $?
|
||||
|
||||
elif [ ! -d "$gnulib_path" ]; then
|
||||
echo "$0: getting gnulib files..."
|
||||
|
||||
trap cleanup_gnulib 1 2 13 15
|
||||
|
||||
shallow=
|
||||
if test -z "$GNULIB_REVISION"; then
|
||||
git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2'
|
||||
fi
|
||||
git clone $shallow ${GNULIB_URL:-$default_gnulib_url} "$gnulib_path" \
|
||||
|| cleanup_gnulib
|
||||
|
||||
trap - 1 2 13 15
|
||||
fi
|
||||
GNULIB_SRCDIR=$gnulib_path
|
||||
;;
|
||||
*)
|
||||
# Use GNULIB_SRCDIR directly or as a reference.
|
||||
if $use_git && test -d "$GNULIB_SRCDIR"/.git && \
|
||||
git_modules_config submodule.gnulib.url >/dev/null; then
|
||||
echo "$0: getting gnulib files..."
|
||||
if git submodule -h|grep -- --reference > /dev/null; then
|
||||
# Prefer the one-liner available in git 1.6.4 or newer.
|
||||
git submodule update --init --reference "$GNULIB_SRCDIR" \
|
||||
"$gnulib_path" || exit $?
|
||||
else
|
||||
# This fallback allows at least git 1.5.5.
|
||||
if test -f "$gnulib_path"/gnulib-tool; then
|
||||
# Since file already exists, assume submodule init already complete.
|
||||
git submodule update -- "$gnulib_path" || exit $?
|
||||
else
|
||||
# Older git can't clone into an empty directory.
|
||||
rmdir "$gnulib_path" 2>/dev/null
|
||||
git clone --reference "$GNULIB_SRCDIR" \
|
||||
"$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \
|
||||
&& git submodule init -- "$gnulib_path" \
|
||||
&& git submodule update -- "$gnulib_path" \
|
||||
|| exit $?
|
||||
fi
|
||||
fi
|
||||
GNULIB_SRCDIR=$gnulib_path
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if test -d "$GNULIB_SRCDIR"/.git && test -n "$GNULIB_REVISION" \
|
||||
&& ! git_modules_config submodule.gnulib.url >/dev/null; then
|
||||
(cd "$GNULIB_SRCDIR" && git checkout "$GNULIB_REVISION") || cleanup_gnulib
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# $GNULIB_SRCDIR now points to the version of gnulib to use, and
|
||||
# we no longer need to use git or $gnulib_path below here.
|
||||
# $GNULIB_SRCDIR now points to the version of gnulib to use, and
|
||||
# we no longer need to use git or $gnulib_path below here.
|
||||
|
||||
if $bootstrap_sync; then
|
||||
cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || {
|
||||
echo "$0: updating bootstrap and restarting..."
|
||||
case $(sh -c 'echo "$1"' -- a) in
|
||||
a) ignored=--;;
|
||||
*) ignored=ignored;;
|
||||
esac
|
||||
exec sh -c \
|
||||
'cp "$1" "$2" && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \
|
||||
$ignored "$GNULIB_SRCDIR/build-aux/bootstrap" \
|
||||
"$0" "$@" --no-bootstrap-sync
|
||||
}
|
||||
if $bootstrap_sync; then
|
||||
cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || {
|
||||
echo "$0: updating bootstrap and restarting..."
|
||||
case $(sh -c 'echo "$1"' -- a) in
|
||||
a) ignored=--;;
|
||||
*) ignored=ignored;;
|
||||
esac
|
||||
exec sh -c \
|
||||
'cp "$1" "$2" && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \
|
||||
$ignored "$GNULIB_SRCDIR/build-aux/bootstrap" \
|
||||
"$0" "$@" --no-bootstrap-sync
|
||||
}
|
||||
fi
|
||||
|
||||
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
|
||||
<$gnulib_tool || exit $?
|
||||
fi
|
||||
|
||||
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
|
||||
<$gnulib_tool || exit $?
|
||||
|
||||
# Get translations.
|
||||
|
||||
download_po_files() {
|
||||
subdir=$1
|
||||
domain=$2
|
||||
echo "$me: getting translations into $subdir for $domain..."
|
||||
cmd=$(printf "$po_download_command_format" "$domain" "$subdir")
|
||||
eval "$cmd" && return
|
||||
# Fallback to HTTP.
|
||||
cmd=$(printf "$po_download_command_format2" "$subdir" "$domain")
|
||||
cmd=$(printf "$po_download_command_format" "$subdir" "$domain")
|
||||
eval "$cmd"
|
||||
}
|
||||
|
||||
@@ -788,9 +824,9 @@ symlink_to_dir()
|
||||
# Leave any existing symlink alone, if it already points to the source,
|
||||
# so that broken build tools that care about symlink times
|
||||
# aren't confused into doing unnecessary builds. Conversely, if the
|
||||
# existing symlink's time stamp is older than the source, make it afresh,
|
||||
# existing symlink's timestamp is older than the source, make it afresh,
|
||||
# so that broken tools aren't confused into skipping needed builds. See
|
||||
# <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00326.html>.
|
||||
# <https://lists.gnu.org/r/bug-gnulib/2011-05/msg00326.html>.
|
||||
test -h "$dst" &&
|
||||
src_ls=$(ls -diL "$src" 2>/dev/null) && set $src_ls && src_i=$1 &&
|
||||
dst_ls=$(ls -diL "$dst" 2>/dev/null) && set $dst_ls && dst_i=$1 &&
|
||||
@@ -896,31 +932,33 @@ fi
|
||||
|
||||
# Import from gnulib.
|
||||
|
||||
gnulib_tool_options="\
|
||||
--import\
|
||||
--no-changelog\
|
||||
--aux-dir $build_aux\
|
||||
--doc-base $doc_base\
|
||||
--lib $gnulib_name\
|
||||
--m4-base $m4_base/\
|
||||
--source-base $source_base/\
|
||||
--tests-base $tests_base\
|
||||
--local-dir $local_gl_dir\
|
||||
$gnulib_tool_option_extras\
|
||||
"
|
||||
if test $use_libtool = 1; then
|
||||
case "$gnulib_tool_options " in
|
||||
*' --libtool '*) ;;
|
||||
*) gnulib_tool_options="$gnulib_tool_options --libtool" ;;
|
||||
esac
|
||||
fi
|
||||
echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
|
||||
$gnulib_tool $gnulib_tool_options --import $gnulib_modules &&
|
||||
if $use_gnulib; then
|
||||
gnulib_tool_options="\
|
||||
--no-changelog\
|
||||
--aux-dir=$build_aux\
|
||||
--doc-base=$doc_base\
|
||||
--lib=$gnulib_name\
|
||||
--m4-base=$m4_base/\
|
||||
--source-base=$source_base/\
|
||||
--tests-base=$tests_base\
|
||||
--local-dir=$local_gl_dir\
|
||||
$gnulib_tool_option_extras\
|
||||
"
|
||||
if test $use_libtool = 1; then
|
||||
case "$gnulib_tool_options " in
|
||||
*' --libtool '*) ;;
|
||||
*) gnulib_tool_options="$gnulib_tool_options --libtool" ;;
|
||||
esac
|
||||
fi
|
||||
echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
|
||||
$gnulib_tool $gnulib_tool_options --import $gnulib_modules \
|
||||
|| die "gnulib-tool failed"
|
||||
|
||||
for file in $gnulib_files; do
|
||||
symlink_to_dir "$GNULIB_SRCDIR" $file \
|
||||
|| die "failed to symlink $file"
|
||||
done
|
||||
for file in $gnulib_files; do
|
||||
symlink_to_dir "$GNULIB_SRCDIR" $file \
|
||||
|| die "failed to symlink $file"
|
||||
done
|
||||
fi
|
||||
|
||||
bootstrap_post_import_hook \
|
||||
|| die "bootstrap_post_import_hook failed"
|
||||
@@ -1017,9 +1055,9 @@ bootstrap_epilogue
|
||||
echo "$0: done. Now you can run './configure'."
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
|
||||
+6
-4
@@ -1,6 +1,6 @@
|
||||
# Bootstrap configuration.
|
||||
|
||||
# Copyright (C) 2006-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2006-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -17,7 +17,8 @@
|
||||
|
||||
# gnulib modules used by this package.
|
||||
gnulib_modules='
|
||||
argmatch assert calloc-posix close closeout config-h c-strcase
|
||||
argmatch assert
|
||||
calloc-posix close closeout config-h c-strcase
|
||||
configmake
|
||||
dirname
|
||||
error extensions fdl fopen-safer
|
||||
@@ -33,7 +34,8 @@ gnulib_modules='
|
||||
quote quotearg
|
||||
readme-release
|
||||
realloc-posix
|
||||
spawn-pipe stdbool stpcpy strdup-posix strerror strtoul strverscmp
|
||||
spawn-pipe stdbool stpcpy strdup-posix strerror strverscmp
|
||||
timevar
|
||||
unistd unistd-safer unlink unlocked-io
|
||||
update-copyright unsetenv verify
|
||||
warnings
|
||||
@@ -81,7 +83,7 @@ gnulib_tool_option_extras='--symlink --makefile-name=gnulib.mk'
|
||||
bootstrap_post_import_hook()
|
||||
{
|
||||
# Massage lib/gnulib.mk before using it later in the bootstrapping process.
|
||||
build-aux/prefix-gnulib-mk --lib-name=$gnulib_name lib/$gnulib_mk
|
||||
build-aux/prefix-gnulib-mk --lib-name="$gnulib_name" "lib/$gnulib_mk"
|
||||
|
||||
# Ensure that ChangeLog exists, for automake.
|
||||
test -f ChangeLog || touch ChangeLog
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
/announce-gen
|
||||
/arg-nonnull.h
|
||||
/c++defs.h
|
||||
/compile
|
||||
/config.guess
|
||||
/config.rpath
|
||||
@@ -16,14 +14,12 @@
|
||||
/install-sh
|
||||
/javacomp.sh.in
|
||||
/javaexec.sh.in
|
||||
/link-warning.h
|
||||
/mdate-sh
|
||||
/missing
|
||||
/prefix-gnulib-mk
|
||||
/test-driver
|
||||
/texinfo.tex
|
||||
/update-copyright
|
||||
/useless-if-before-free
|
||||
/vc-list-files
|
||||
/warn-on-use.h
|
||||
/ylwrap
|
||||
/prefix-gnulib-mk
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2012-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2012-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -0,0 +1,61 @@
|
||||
# Copyright (C) 2012-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Valgrind suppression file for Bison.
|
||||
|
||||
# Travis Trusty, 2018-09-07.
|
||||
{
|
||||
libstdcxx_init
|
||||
Memcheck:Leak
|
||||
match-leak-kinds: reachable
|
||||
fun:malloc
|
||||
obj:/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25
|
||||
fun:call_init.part.0
|
||||
fun:call_init
|
||||
fun:_dl_init
|
||||
obj:/lib/x86_64-linux-gnu/ld-2.19.so
|
||||
}
|
||||
|
||||
# Linux prague 4.1.2-2-ARCH #1 SMP PREEMPT Wed Jul 15 08:30:32 UTC 2015
|
||||
# x86_64 GNU/Linux
|
||||
{
|
||||
Probably exception handling from G++ 5.1.
|
||||
Memcheck:Leak
|
||||
match-leak-kinds: reachable
|
||||
fun:malloc
|
||||
fun:pool
|
||||
fun:__static_initialization_and_destruction_0
|
||||
fun:_GLOBAL__sub_I_eh_alloc.cc
|
||||
fun:call_init.part.0
|
||||
fun:_dl_init
|
||||
obj:/usr/lib/ld-2.21.so
|
||||
}
|
||||
|
||||
# Linux seattle 2.6.32-5-amd64 #1 SMP Thu Mar 22 17:26:33 UTC 2012
|
||||
# x86_64 GNU/Linux
|
||||
{
|
||||
index
|
||||
Memcheck:Cond
|
||||
fun:index
|
||||
fun:expand_dynamic_string_token
|
||||
fun:_dl_map_object
|
||||
fun:map_doit
|
||||
fun:_dl_catch_error
|
||||
fun:do_preload
|
||||
fun:dl_main
|
||||
fun:_dl_sysdep_start
|
||||
fun:_dl_start
|
||||
obj:/lib/ld-2.11.3.so
|
||||
}
|
||||
@@ -35,7 +35,7 @@ while (<STDIN>)
|
||||
$arg =~ s/^=//;
|
||||
$arg = lc ($arg);
|
||||
my $dir_arg = $arg;
|
||||
# If the argument is compite (e.g., for --define[=NAME[=VALUE]]),
|
||||
# If the argument is complete (e.g., for --define[=NAME[=VALUE]]),
|
||||
# put each word in @var, to build @var{name}[=@var{value}], not
|
||||
# @var{name[=value]}].
|
||||
$arg =~ s/(\w+)/\@var{$1}/g;
|
||||
|
||||
Executable
+234
@@ -0,0 +1,234 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Install Intel Parallel Studio on Travis CI
|
||||
# https://github.com/nemequ/icc-travis
|
||||
#
|
||||
# Originally written for Squash <https://github.com/quixdb/squash> by
|
||||
# Evan Nemerson. For documentation, bug reports, support requests,
|
||||
# etc. please use <https://github.com/nemequ/icc-travis>.
|
||||
#
|
||||
# To the extent possible under law, the author(s) of this script have
|
||||
# waived all copyright and related or neighboring rights to this work.
|
||||
# See <https://creativecommons.org/publicdomain/zero/1.0/> for
|
||||
# details.
|
||||
|
||||
# Tools - Not very useful in non-interactive mode.
|
||||
COMPONENTS_VTUNE="intel-vtune-amplifier-xe-2016-cli__x86_64;intel-vtune-amplifier-xe-2016-common__noarch;intel-vtune-amplifier-xe-2016-cli-common__noarch;intel-vtune-amplifier-xe-2016-collector-64linux__x86_64;intel-vtune-amplifier-xe-2016-sep__noarch;intel-vtune-amplifier-xe-2016-gui-common__noarch;intel-vtune-amplifier-xe-2016-gui__x86_64;intel-vtune-amplifier-xe-2016-common-pset__noarch"
|
||||
COMPONENTS_INSPECTOR="intel-inspector-xe-2016-cli__x86_64;intel-inspector-xe-2016-cli-common__noarch;intel-inspector-xe-2016-gui-common__noarch;intel-inspector-xe-2016-gui__x86_64;intel-inspector-xe-2016-cli-pset__noarch"
|
||||
COMPONENTS_ADVISOR="intel-advisor-xe-2016-cli__x86_64;intel-advisor-xe-2016-cli-common__noarch;intel-advisor-xe-2016-gui-common__noarch;intel-advisor-xe-2016-gui__x86_64;intel-advisor-xe-2016-cli-pset__noarch"
|
||||
COMPONENTS_GDB="intel-gdb-gt__x86_64;intel-gdb-gt-src__noarch;intel-gdb-gt-libelfdwarf__x86_64;intel-gdb-gt-devel__x86_64;intel-gdb-gt-common__noarch;intel-gdb-ps-cdt__x86_64;intel-gdb-ps-cdt-source__x86_64;intel-gdb-ps-mic__x86_64;intel-gdb-ps-mpm__x86_64;intel-gdb__x86_64;intel-gdb-source__noarch;intel-gdb-python-source__noarch;intel-gdb-common__noarch;intel-gdb-ps-common__noarch"
|
||||
|
||||
# Parallel libraries
|
||||
COMPONENTS_MPI="intel-mpi-rt-core__x86_64;intel-mpi-rt-mic__x86_64;intel-mpi-sdk-core__x86_64;intel-mpi-sdk-mic__x86_64;intel-mpi-psxe__x86_64;intel-mpi-rt-psxe__x86_64"
|
||||
COMPONENTS_TBB="intel-tbb-libs__noarch;intel-mkl-ps-tbb__x86_64;intel-mkl-ps-tbb-devel__x86_64;intel-mkl-ps-tbb-mic__x86_64;intel-mkl-ps-tbb-mic-devel__x86_64;intel-tbb-source__noarch;intel-tbb-devel__noarch;intel-tbb-common__noarch;intel-tbb-ps-common__noarch;intel-tbb-psxe__noarch"
|
||||
COMPONENTS_MKL="intel-mkl__x86_64;intel-mkl-ps__x86_64;intel-mkl-common__noarch;intel-mkl-ps-common__noarch;intel-mkl-devel__x86_64;intel-mkl-ps-mic-devel__x86_64;intel-mkl-ps-f95-devel__x86_64;intel-mkl-gnu-devel__x86_64;intel-mkl-ps-gnu-devel__x86_64;intel-mkl-ps-pgi-devel__x86_64;intel-mkl-sp2dp-devel__x86_64;intel-mkl-ps-cluster-devel__x86_64;intel-mkl-ps-cluster-common__noarch;intel-mkl-ps-f95-common__noarch;intel-mkl-ps-cluster__x86_64;intel-mkl-gnu__x86_64;intel-mkl-ps-gnu__x86_64;intel-mkl-ps-pgi__x86_64;intel-mkl-sp2dp__x86_64;intel-mkl-ps-mic__x86_64;intel-mkl-ps-tbb__x86_64;intel-mkl-ps-tbb-devel__x86_64;intel-mkl-ps-tbb-mic__x86_64;intel-mkl-ps-tbb-mic-devel__x86_64;intel-mkl-psxe__noarch"
|
||||
COMPONENTS_IPP="intel-ipp-l-common__noarch;intel-ipp-l-ps-common__noarch;intel-ipp-l-st__x86_64;intel-ipp-l-mt__x86_64;intel-ipp-l-st-devel__x86_64;intel-ipp-l-ps-st-devel__x86_64;intel-ipp-l-mt-devel__x86_64;intel-ipp-psxe__noarch"
|
||||
COMPONENTS_IPP_CRYPTO="intel-crypto-ipp-st-devel__x86_64;intel-crypto-ipp-ps-st-devel__x86_64;intel-crypto-ipp-st__x86_64;intel-crypto-ipp-mt-devel__x86_64;intel-crypto-ipp-mt__x86_64;intel-crypto-ipp-ss-st-devel__x86_64;intel-crypto-ipp-common__noarch"
|
||||
COMPONENTS_DAAL="intel-daal__x86_64;intel-daal-common__noarch"
|
||||
|
||||
# Compilers
|
||||
COMPONENTS_OPENMP="intel-openmp-l-all__x86_64;intel-openmp-l-ps-mic__x86_64;intel-openmp-l-ps__x86_64;intel-openmp-l-ps-ss__x86_64;intel-openmp-l-all-devel__x86_64;intel-openmp-l-ps-mic-devel__x86_64;intel-openmp-l-ps-devel__x86_64;intel-openmp-l-ps-ss-devel__x86_64"
|
||||
COMPONENTS_COMPILER_COMMON="intel-comp-l-all-vars__noarch;intel-comp-l-all-common;intel-comp-l-ps-common;intel-comp-l-all-devel;intel-comp-l-ps-ss-devel;intel-comp-l-ps-ss-wrapper;intel-comp-l-all-devel;intel-comp-l-ps-devel__x86_64;intel-comp-l-ps-ss-devel__x86_64;intel-psf-intel__x86_64;intel-icsxe-pset;intel-ipsf__noarch;intel-ccompxe__noarch;${COMPONENTS_OPENMP}"
|
||||
COMPONENTS_IFORT="intel-ifort-l-ps__x86_64;intel-ifort-l-ps-vars__noarch;intel-ifort-l-ps-common__noarch;intel-ifort-l-ps-devel__x86_64;${COMPONENTS_COMPILER_COMMON}"
|
||||
COMPONENTS_ICC="intel-icc-l-all__x86_64;intel-icc-l-ps-ss__x86_64;intel-icc-l-all-vars__noarch;intel-icc-l-all-common__noarch;intel-icc-l-ps-common__noarch;intel-icc-l-all-devel__x86_64;intel-icc-l-ps-devel__x86_64;intel-icc-l-ps-ss-devel__x86_64;${COMPONENTS_COMPILER_COMMON}"
|
||||
|
||||
DESTINATION="${HOME}/intel"
|
||||
TEMPORARY_FILES="/tmp"
|
||||
PHONE_INTEL="no"
|
||||
COMPONENTS=""
|
||||
|
||||
add_components() {
|
||||
if [ ! -z "${COMPONENTS}" ]; then
|
||||
COMPONENTS="${COMPONENTS};$1"
|
||||
else
|
||||
COMPONENTS="$1"
|
||||
fi
|
||||
}
|
||||
|
||||
while [ $# != 0 ]; do
|
||||
case "$1" in
|
||||
"--dest")
|
||||
DESTINATION="$(realpath "$2")"; shift
|
||||
;;
|
||||
"--tmpdir")
|
||||
TEMPORARY_FILES="$2"; shift
|
||||
;;
|
||||
"--components")
|
||||
shift
|
||||
OLD_IFS="${IFS}"
|
||||
IFS=","
|
||||
for component in $1; do
|
||||
case "$component" in
|
||||
"icc")
|
||||
add_components "${COMPONENTS_ICC}"
|
||||
;;
|
||||
"mpi")
|
||||
add_components "${COMPONENTS_MPI}"
|
||||
;;
|
||||
"vtune")
|
||||
add_components "${COMPONENTS_VTUNE}"
|
||||
;;
|
||||
"inspector")
|
||||
add_components "${COMPONENTS_INSPECTOR}"
|
||||
;;
|
||||
"advisor")
|
||||
add_components "${COMPONENTS_ADVISOR}"
|
||||
;;
|
||||
"tbb")
|
||||
add_components "${COMPONENTS_TBB}"
|
||||
;;
|
||||
"ifort")
|
||||
add_components "${COMPONENTS_IFORT}"
|
||||
;;
|
||||
"mkl")
|
||||
add_components "${COMPONENTS_MKL}"
|
||||
;;
|
||||
"openmp")
|
||||
# Noop, here for compatability. OpenMP is installed with icc and ifort now.
|
||||
;;
|
||||
"ipp")
|
||||
add_components "${COMPONENTS_IPP}"
|
||||
;;
|
||||
"ipp-crypto")
|
||||
add_components "${COMPONENTS_IPP_CRYPTO}"
|
||||
;;
|
||||
"gdb")
|
||||
add_components "${COMPONENTS_GDB}"
|
||||
;;
|
||||
"daal")
|
||||
add_components "${COMPONENTS_DAAL}"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown component '$component'"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
IFS="${OLD_IFS}"
|
||||
;;
|
||||
*)
|
||||
echo "Unrecognized argument '$1'"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [ -z "${COMPONENTS}" ]; then
|
||||
COMPONENTS="${COMPONENTS_ICC}"
|
||||
fi
|
||||
|
||||
INSTALLER_SCRIPT="parallel_studio_xe_2016_update3_online.sh"
|
||||
INSTALLER="${TEMPORARY_FILES}/${INSTALLER_SCRIPT}"
|
||||
INSTALLER_URL="http://registrationcenter-download.intel.com/akdlm/irc_nas/9061/${INSTALLER_SCRIPT}"
|
||||
SILENT_CFG="${TEMPORARY_FILES}/silent.cfg"
|
||||
SUCCESS_INDICATOR="${TEMPORARY_FILES}/icc-travis-success"
|
||||
|
||||
if [ ! -e "${TEMPORARY_FILES}" ]; then
|
||||
echo "${TEMPORARY_FILES} does not exist, creating..."
|
||||
mkdir -p "${TEMPORARY_FILES}" || (sudo mkdir -p "${TEMPORARY_FILES}" && sudo chown -R "${USER}:${USER}" "${TEMPORARY_FILES}")
|
||||
fi
|
||||
|
||||
if [ ! -e "${DESTINATION}" ]; then
|
||||
echo "${DESTINATION} does not exist, creating..."
|
||||
mkdir -p "${DESTINATION}" || (sudo mkdir -p "${DESTINATION}" && sudo chown -R "${USER}:${USER}" "${DESTINATION}")
|
||||
fi
|
||||
|
||||
if [ ! -e "${INSTALLER}" ]; then
|
||||
wget -O "${INSTALLER}" "${INSTALLER_URL}" || exit 1
|
||||
fi
|
||||
chmod u+x "${INSTALLER}"
|
||||
|
||||
# See https://software.intel.com/en-us/articles/intel-composer-xe-2015-silent-installation-guide
|
||||
echo "# Generated silent configuration file" > "${SILENT_CFG}"
|
||||
echo "ACCEPT_EULA=accept" >> "${SILENT_CFG}"
|
||||
echo "INSTALL_MODE=NONRPM" >> "${SILENT_CFG}"
|
||||
echo "CONTINUE_WITH_OPTIONAL_ERROR=yes" >> "${SILENT_CFG}"
|
||||
echo "PSET_INSTALL_DIR=${DESTINATION}" >> "${SILENT_CFG}"
|
||||
echo "CONTINUE_WITH_INSTALLDIR_OVERWRITE=yes" >> "${SILENT_CFG}"
|
||||
echo "COMPONENTS=${COMPONENTS}" >> "${SILENT_CFG}"
|
||||
echo "PSET_MODE=install" >> "${SILENT_CFG}"
|
||||
echo "PHONEHOME_SEND_USAGE_DATA=${PHONE_INTEL}" >> "${SILENT_CFG}"
|
||||
if [ "x" != "x${INTEL_SERIAL_NUMBER}" ]; then
|
||||
echo "ACTIVATION_SERIAL_NUMBER=${INTEL_SERIAL_NUMBER}" >> "${SILENT_CFG}"
|
||||
echo "ACTIVATION_TYPE=serial_number" >> "${SILENT_CFG}"
|
||||
else
|
||||
echo "ACTIVATION_TYPE=trial_lic" >> "${SILENT_CFG}"
|
||||
fi
|
||||
|
||||
attempt=1;
|
||||
while [ $attempt -le 3 ]; do
|
||||
if [ ! -e "${TEMPORARY_FILES}/parallel-studio-install-data" ]; then
|
||||
mkdir -p "${TEMPORARY_FILES}/parallel-studio-install-data" || (sudo mkdir -p "${TEMPORARY_FILES}/parallel-studio-install-data" && sudo chown -R "${USER}:${USER}" "${TEMPORARY_FILES}")
|
||||
fi
|
||||
|
||||
("${INSTALLER}" \
|
||||
-t "${TEMPORARY_FILES}/parallel-studio-install-data" \
|
||||
-s "${SILENT_CFG}" \
|
||||
--cli-mode \
|
||||
--user-mode && \
|
||||
touch "${SUCCESS_INDICATOR}") &
|
||||
|
||||
# So Travis doesn't die in case of a long download/installation.
|
||||
#
|
||||
# NOTE: a watched script never terminates.
|
||||
elapsed=0;
|
||||
while kill -0 $! 2>/dev/null; do
|
||||
sleep 1
|
||||
elapsed=$(expr $elapsed + 1)
|
||||
if [ $(expr $elapsed % 60) -eq 0 ]; then
|
||||
mins_elapsed=$(expr $elapsed / 60)
|
||||
if [ $mins_elapsed = 1 ]; then
|
||||
minute_string="minute"
|
||||
else
|
||||
minute_string="minutes"
|
||||
fi
|
||||
echo "Still running... (about $(expr $elapsed / 60) ${minute_string} so far)."
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -e "${SUCCESS_INDICATOR}" ]; then
|
||||
echo "Installation failed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -e "${DESTINATION}/bin/compilervars.sh" ]; then
|
||||
# Sometimes the installer returns successfully without actually
|
||||
# installing anything. Let's try again…
|
||||
echo "Installation attempt #${attempt} completed, but unable to find compilervars.sh."
|
||||
find "${DESTINATION}"
|
||||
else
|
||||
break
|
||||
fi
|
||||
|
||||
rm -vrf "${TEMPORARY_FILES}/parallel-studio-install-data"
|
||||
echo "Trying again..."
|
||||
|
||||
attempt=$(expr $attempt + 1)
|
||||
done
|
||||
|
||||
if [ ! -e "${DESTINATION}/bin/compilervars.sh" ]; then
|
||||
echo "Installation failed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Apparently the installer drops the license file in a location it
|
||||
# doesn't know to check.
|
||||
ln -s "${DESTINATION}"/licenses ~/Licenses
|
||||
|
||||
# Add configuration information to ~/.bashrc. Unfortunately this will
|
||||
# not be picked up automatically by Travis, so you'll still need to
|
||||
# source ~/.bashrc in your .travis.yml
|
||||
#
|
||||
# Container-based builds include a `[ -z "$PS1" ] && return` near the
|
||||
# beginning of the file, so appending won't work, we'll need to
|
||||
# prepend.
|
||||
echo "export INTEL_INSTALL_PATH=\"${DESTINATION}\"" >> ~/.bashrc-intel
|
||||
echo ". \"\${INTEL_INSTALL_PATH}/bin/compilervars.sh\" intel64" >> ~/.bashrc-intel
|
||||
echo "export LD_LIBRARY_PATH=\"\${INTEL_INSTALL_PATH}/ism/bin/intel64:\${INTEL_INSTALL_PATH}/lib/intel64_lin:\$LD_LIBRARY_PATH\"" >> ~/.bashrc-intel
|
||||
echo "export PATH=\"\${INTEL_INSTALL_PATH}/bin:\$PATH\"" >> ~/.bashrc-intel
|
||||
echo "function uninstall_intel_software {" >> ~/.bashrc-intel
|
||||
echo " find \"\${INTEL_INSTALL_PATH}\" -name 'uninstall.sh' -not -path '*/ism/uninstall.sh' -exec {} -s \;" >> ~/.bashrc-intel
|
||||
echo "}" >> ~/.bashrc-intel
|
||||
cat ~/.bashrc >> ~/.bashrc-intel
|
||||
mv ~/.bashrc-intel ~/.bashrc
|
||||
@@ -1,16 +0,0 @@
|
||||
# Linux seattle 2.6.32-5-amd64 #1 SMP Thu Mar 22 17:26:33 UTC 2012
|
||||
# x86_64 GNU/Linux
|
||||
{
|
||||
index
|
||||
Memcheck:Cond
|
||||
fun:index
|
||||
fun:expand_dynamic_string_token
|
||||
fun:_dl_map_object
|
||||
fun:map_doit
|
||||
fun:_dl_catch_error
|
||||
fun:do_preload
|
||||
fun:dl_main
|
||||
fun:_dl_sysdep_start
|
||||
fun:_dl_start
|
||||
obj:/lib/ld-2.11.3.so
|
||||
}
|
||||
+7
-7
@@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2000-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2000-2015, 2018 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -13,10 +13,10 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
EXTRA_DIST += \
|
||||
build-aux/cross-options.pl \
|
||||
build-aux/darwin11.4.0.valgrind \
|
||||
build-aux/linux-gnu.valgrind \
|
||||
build-aux/move-if-change \
|
||||
build-aux/prev-version.txt \
|
||||
EXTRA_DIST += \
|
||||
build-aux/Darwin.valgrind \
|
||||
build-aux/Linux.valgrind \
|
||||
build-aux/cross-options.pl \
|
||||
build-aux/move-if-change \
|
||||
build-aux/prev-version.txt \
|
||||
build-aux/update-b4-copyright
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
/_Noreturn.h
|
||||
/arg-nonnull.h
|
||||
/c++defs.h
|
||||
/warn-on-use.h
|
||||
@@ -3,7 +3,7 @@
|
||||
# Update b4_copyright invocations or b4_copyright_years definitions to
|
||||
# include the current year.
|
||||
|
||||
# Copyright (C) 2009-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2009-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# In configure.ac, update PACKAGE_COPYRIGHT_YEAR to the current year.
|
||||
|
||||
# Copyright (C) 2010-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2010-2015, 2018 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Customize maint.mk -*- makefile -*-
|
||||
# Copyright (C) 2008-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2008-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -26,15 +26,15 @@ regen: _version
|
||||
manual_title = The Yacc-compatible Parser Generator
|
||||
gendocs_options_ = -I $(abs_top_srcdir)/doc -I $(abs_top_builddir)/doc
|
||||
|
||||
# It's useful to run maintainer-*check* targets during development, but we
|
||||
# It's useful to run maintainer-check* targets during development, but we
|
||||
# don't want to wait on a recompile because of an update to $(VERSION). Thus,
|
||||
# override the _is-dist-target from GNUmakefile so that maintainer-*check*
|
||||
# override the _is-dist-target from GNUmakefile so that maintainer-check*
|
||||
# targets are filtered out.
|
||||
_is-dist-target = $(filter-out %clean maintainer-check% maintainer-%-check, \
|
||||
_is-dist-target = $(filter-out %clean maintainer-check%, \
|
||||
$(filter maintainer-% dist% alpha beta major,$(MAKECMDGOALS)))
|
||||
|
||||
url_dir_list = \
|
||||
ftp://$(gnu_rel_host)/gnu/bison
|
||||
https://$(gnu_rel_host)/gnu/bison
|
||||
|
||||
# Tests not to run as part of "make distcheck".
|
||||
local-checks-to-skip = \
|
||||
@@ -158,23 +158,24 @@ sc_space_before_open_paren:
|
||||
|
||||
exclude = \
|
||||
$(foreach a,$(1),$(eval $(subst $$,$$$$,exclude_file_name_regexp--sc_$(a))))
|
||||
$(call exclude, \
|
||||
bindtextdomain=^lib/main.c$$ \
|
||||
preprocessor_indentation=^data/|^lib/|^src/parse-gram.[ch]$$ \
|
||||
program_name=^lib/main.c$$ \
|
||||
prohibit_always-defined_macros=^data/yacc.c$$|^djgpp/ \
|
||||
prohibit_always-defined_macros+=?|^lib/timevar.c$$ \
|
||||
prohibit_always-defined_macros+=?|^src/(parse-gram.c|system.h)$$ \
|
||||
prohibit_always-defined_macros+=?|^tests/regression.at$$ \
|
||||
prohibit_always_true_header_tests=^djgpp/subpipe.h$$|^lib/timevar.c$$ \
|
||||
prohibit_always_true_header_tests+=?|^m4/timevar.m4$$ \
|
||||
prohibit_defined_have_decl_tests=?|^lib/timevar.c$$ \
|
||||
prohibit_doubled_word=^tests/named-refs.at$$ \
|
||||
prohibit_magic_number_exit=^doc/bison.texi$$ \
|
||||
prohibit_magic_number_exit+=?|^tests/(conflicts|regression).at$$ \
|
||||
prohibit_strcmp=^doc/bison\.texi|tests/local\.at$$ \
|
||||
prohibit_tab_based_indentation=\.(am|mk)$$|^djgpp/|^\.git \
|
||||
require_config_h_first=^(lib/yyerror|data/(glr|yacc))\.c$$ \
|
||||
space_before_open_paren=^(data/|djgpp/) \
|
||||
unmarked_diagnostics=^(djgpp/|doc/bison.texi$$|tests/c\+\+\.at$$) \
|
||||
$(call exclude, \
|
||||
bindtextdomain=^lib/main.c$$ \
|
||||
preprocessor_indentation=^data/|^lib/|^src/parse-gram.[ch]$$ \
|
||||
program_name=^lib/main.c$$ \
|
||||
prohibit_always-defined_macros=^data/yacc.c$$|^djgpp/ \
|
||||
prohibit_always-defined_macros+=?|^lib/timevar.c$$ \
|
||||
prohibit_always-defined_macros+=?|^src/(parse-gram.c|system.h)$$ \
|
||||
prohibit_always-defined_macros+=?|^tests/regression.at$$ \
|
||||
prohibit_always_true_header_tests=^djgpp/subpipe.h$$|^lib/timevar.c$$ \
|
||||
prohibit_always_true_header_tests+=?|^m4/timevar.m4$$ \
|
||||
prohibit_defined_have_decl_tests=?|^lib/timevar.c$$ \
|
||||
prohibit_doubled_word=^tests/named-refs.at$$ \
|
||||
prohibit_magic_number_exit=^doc/bison.texi$$ \
|
||||
prohibit_magic_number_exit+=?|^tests/(conflicts|regression).at$$ \
|
||||
prohibit_strcmp=^doc/bison\.texi|tests/local\.at$$ \
|
||||
prohibit_tab_based_indentation=install-icc.sh|\.(am|mk)$$|^djgpp/|^\.git|Makefile$$ \
|
||||
require_config_h_first=^(lib/yyerror|data/(glr|yacc))\.c$$ \
|
||||
space_before_open_paren=^(data/|djgpp/) \
|
||||
two_space_separator_in_usage=^(bootstrap|build-aux/install-icc.sh) \
|
||||
unmarked_diagnostics=^(djgpp/|doc/bison.texi$$|tests/c\+\+\.at$$) \
|
||||
)
|
||||
|
||||
+39
-16
@@ -1,6 +1,6 @@
|
||||
# Configure template for GNU Bison. -*-Autoconf-*-
|
||||
#
|
||||
# Copyright (C) 2001-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2015, 2018 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -21,12 +21,13 @@
|
||||
# better to avoid a typo in the 'configure --help' entry for the YACC
|
||||
# environment variable.
|
||||
AC_PREREQ([2.68])
|
||||
m4_pattern_forbid([^gl_[A-Z]])
|
||||
m4_pattern_forbid([^_?(gl_[A-Z]|AX_|BISON_)])
|
||||
m4_pattern_allow([^BISON_USE_NLS$])
|
||||
|
||||
AC_INIT([GNU Bison],
|
||||
m4_esyscmd([build-aux/git-version-gen .tarball-version]),
|
||||
[[email protected]])
|
||||
AC_SUBST([PACKAGE_COPYRIGHT_YEAR], [2015])
|
||||
AC_SUBST([PACKAGE_COPYRIGHT_YEAR], [2018])
|
||||
AC_DEFINE_UNQUOTED([PACKAGE_COPYRIGHT_YEAR], [$PACKAGE_COPYRIGHT_YEAR],
|
||||
[The copyright year for this package])
|
||||
|
||||
@@ -70,6 +71,17 @@ AC_CACHE_CHECK([whether pragma GCC diagnostic push works],
|
||||
[lv_cv_gcc_pragma_push_works=no])
|
||||
CFLAGS=$save_CFLAGS])
|
||||
|
||||
AC_LANG_PUSH([C++])
|
||||
gl_WARN_ADD([-fno-exceptions], [NO_EXCEPTIONS_CXXFLAGS])
|
||||
BISON_CXXSTD([98])
|
||||
BISON_CXXSTD([03])
|
||||
BISON_CXXSTD([11])
|
||||
BISON_CXXSTD([14])
|
||||
BISON_CXXSTD([17])
|
||||
BISON_CXXSTD([2a])
|
||||
AM_CONDITIONAL([ENABLE_CXX11], [test x"$CXX11_CXXFLAGS" != x])
|
||||
AC_LANG_POP([C++])
|
||||
|
||||
AC_ARG_ENABLE([gcc-warnings],
|
||||
[ --enable-gcc-warnings turn on lots of GCC warnings (not recommended).
|
||||
Also, issue synclines from the examples/ to
|
||||
@@ -81,8 +93,9 @@ AC_ARG_ENABLE([gcc-warnings],
|
||||
[enable_gcc_warnings=no])
|
||||
AM_CONDITIONAL([ENABLE_GCC_WARNINGS], [test "$enable_gcc_warnings" = yes])
|
||||
if test "$enable_gcc_warnings" = yes; then
|
||||
warn_common='-Wall-Wextra -Wno-sign-compare -Wcast-align -Wdocumentation
|
||||
-Wformat -Wpointer-arith -Wwrite-strings'
|
||||
warn_common='-Wall -Wextra -Wno-sign-compare -Wcast-align
|
||||
-fparse-all-comments -Wdocumentation
|
||||
-Wformat -Wnull-dereference -Wpointer-arith -Wwrite-strings'
|
||||
warn_c='-Wbad-function-cast -Wshadow -Wstrict-prototypes'
|
||||
warn_cxx='-Wnoexcept'
|
||||
# Warnings for the test suite only.
|
||||
@@ -90,7 +103,12 @@ if test "$enable_gcc_warnings" = yes; then
|
||||
# -fno-color-diagnostics: Clang's use of colors in the error
|
||||
# messages is confusing the tests looking at the compiler's output
|
||||
# (e.g., synclines.at).
|
||||
warn_tests='-Wundef -pedantic -Wsign-compare -fno-color-diagnostics'
|
||||
#
|
||||
# -Wno-keyword-macro: We use the "#define private public" dirty
|
||||
# trick in the test suite to check some private implementation
|
||||
# details for lalr1.cc.
|
||||
warn_tests='-Wundef -pedantic -Wdeprecated -Wsign-compare -fno-color-diagnostics
|
||||
-Wno-keyword-macro'
|
||||
|
||||
AC_LANG_PUSH([C])
|
||||
# Clang supports many of GCC's -W options, but only issues warnings
|
||||
@@ -145,12 +163,15 @@ if test "$enable_gcc_warnings" = yes; then
|
||||
gl_WARN_ADD([-Wno-null-conversion], [FLEX_SCANNER_CXXFLAGS])
|
||||
# So does G++ 4.8...
|
||||
gl_WARN_ADD([-Wno-sign-compare], [FLEX_SCANNER_CXXFLAGS])
|
||||
# ... possiby in std=c++11 mode.
|
||||
# ... possibly in std=c++11 mode.
|
||||
gl_WARN_ADD([-Wno-zero-as-null-pointer-constant], [FLEX_SCANNER_CXXFLAGS])
|
||||
CXXFLAGS=$save_CXXFLAGS
|
||||
# Clang++ deprecates compiling C.
|
||||
gl_WARN_ADD([-Wno-deprecated], [WNO_DEPRECATED_CXXFLAGS])
|
||||
AC_LANG_POP([C++])
|
||||
fi
|
||||
|
||||
|
||||
BISON_TEST_FOR_WORKING_C_COMPILER
|
||||
BISON_C_COMPILER_POSIXLY_CORRECT
|
||||
BISON_TEST_FOR_WORKING_CXX_COMPILER
|
||||
@@ -198,7 +219,6 @@ gl_INIT
|
||||
# Checks for library functions.
|
||||
AC_CHECK_FUNCS_ONCE([setlocale])
|
||||
AM_WITH_DMALLOC
|
||||
BISON_PREREQ_TIMEVAR
|
||||
|
||||
# Gettext.
|
||||
# We use gnulib, which is only guaranteed to work properly with the
|
||||
@@ -220,22 +240,25 @@ AC_CONFIG_FILES([etc/bench.pl], [chmod +x etc/bench.pl])
|
||||
AC_CONFIG_TESTDIR(tests)
|
||||
AC_CONFIG_FILES([tests/atlocal])
|
||||
AC_CONFIG_FILES([tests/bison], [chmod +x tests/bison])
|
||||
|
||||
AC_CHECK_PROGS([VALGRIND], [valgrind])
|
||||
case $VALGRIND:$host_os in
|
||||
# Use something simpler that $host_os to select our suppression file.
|
||||
uname=`uname`
|
||||
case $VALGRIND:$uname in
|
||||
'':*) ;;
|
||||
*:darwin*)
|
||||
*:Darwin)
|
||||
# See README-hacking.
|
||||
# VALGRIND+='-q --suppressions=$(abs_top_srcdir)/build-aux/darwin11.4.0.valgrind'
|
||||
VALGRIND=;;
|
||||
*:*)
|
||||
suppfile=build-aux/$host_os.valgrind
|
||||
suppfile=build-aux/$uname.valgrind
|
||||
if test -f "$srcdir/$suppfile"; then
|
||||
VALGRIND="$VALGRIND --gen-suppressions=all"
|
||||
VALGRIND="$VALGRIND --suppressions=\$(abs_top_srcdir)/$suppfile"
|
||||
AC_SUBST([VALGRIND_OPTS_SUPPRESSION],
|
||||
["--suppressions=\$(abs_top_srcdir)/$suppfile"])
|
||||
fi
|
||||
AC_SUBST([VALGRIND_PREBISON], ["$VALGRIND -q"])
|
||||
;;
|
||||
esac
|
||||
AC_MSG_CHECKING([Valgrind suppression file])
|
||||
AC_MSG_RESULT([$suppfile])
|
||||
|
||||
# Whether we cannot run the compiled bison.
|
||||
AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])
|
||||
@@ -244,7 +267,7 @@ AM_MISSING_PROG([AUTOM4TE], [autom4te])
|
||||
# Needed by tests/atlocal.in.
|
||||
AC_SUBST([GCC])
|
||||
|
||||
gt_JAVACOMP([1.3], [1.4])
|
||||
gt_JAVACOMP([1.7], [1.7])
|
||||
gt_JAVAEXEC
|
||||
|
||||
AC_CONFIG_FILES([Makefile
|
||||
|
||||
+5
-3
@@ -1,5 +1,3 @@
|
||||
-*- outline -*-
|
||||
|
||||
This directory contains data needed by Bison.
|
||||
|
||||
* Skeletons
|
||||
@@ -52,7 +50,11 @@ into various formats.
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2002, 2008-2015 Free Software Foundation, Inc.
|
||||
Local Variables:
|
||||
mode: outline
|
||||
End:
|
||||
|
||||
Copyright (C) 2002, 2008-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bison.
|
||||
|
||||
|
||||
+76
-32
@@ -2,7 +2,7 @@
|
||||
|
||||
# Language-independent M4 Macros for Bison.
|
||||
|
||||
# Copyright (C) 2002, 2004-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002, 2004-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -61,23 +61,35 @@ This special exception was added by the Free Software Foundation in
|
||||
version 2.2 of Bison.])])
|
||||
|
||||
|
||||
# b4_required_version_if(VERSION, IF_NEWER, IF_OLDER)
|
||||
# ---------------------------------------------------
|
||||
# If the version %require'd by the user is VERSION (or newer) expand
|
||||
# IF_NEWER, otherwise IF_OLDER. VERSION should be an integer, e.g.,
|
||||
# 302 for 3.2.
|
||||
m4_define([b4_required_version_if],
|
||||
[m4_if(m4_eval($1 <= b4_required_version),
|
||||
[1], [$2], [$3])])
|
||||
|
||||
|
||||
## -------- ##
|
||||
## Output. ##
|
||||
## -------- ##
|
||||
|
||||
# b4_output_begin(FILE)
|
||||
# ---------------------
|
||||
# b4_output_begin(FILE1, FILE2)
|
||||
# -----------------------------
|
||||
# Enable output, i.e., send to diversion 0, expand after "#", and
|
||||
# generate the tag to output into FILE. Must be followed by EOL.
|
||||
# FILE is FILE1 concatenated to FILE2. FILE2 can be empty, or be
|
||||
# absolute: do the right thing.
|
||||
m4_define([b4_output_begin],
|
||||
[m4_changecom()
|
||||
m4_divert_push(0)dnl
|
||||
@output(m4_unquote([$1])@)@dnl
|
||||
@output(m4_unquote([$1])@,m4_unquote([$2])@)@dnl
|
||||
])
|
||||
|
||||
|
||||
# b4_output_end()
|
||||
# ---------------
|
||||
# b4_output_end
|
||||
# -------------
|
||||
# Output nothing, restore # as comment character (no expansions after #).
|
||||
m4_define([b4_output_end],
|
||||
[m4_divert_pop(0)
|
||||
@@ -389,11 +401,11 @@ b4_define_flag_if([yacc]) # Whether POSIX Yacc is emulated.
|
||||
#
|
||||
# The following macros provide access to these values.
|
||||
|
||||
# b4_symbol_(NUM, FIELD)
|
||||
# _b4_symbol(NUM, FIELD)
|
||||
# ----------------------
|
||||
# Recover a FIELD about symbol #NUM. Thanks to m4_indir, fails if
|
||||
# undefined.
|
||||
m4_define([b4_symbol_],
|
||||
m4_define([_b4_symbol],
|
||||
[m4_indir([b4_symbol($1, $2)])])
|
||||
|
||||
|
||||
@@ -404,8 +416,8 @@ m4_define([b4_symbol_],
|
||||
m4_define([b4_symbol],
|
||||
[m4_case([$2],
|
||||
[id], [m4_do([b4_percent_define_get([api.token.prefix])],
|
||||
[b4_symbol_([$1], [id])])],
|
||||
[b4_symbol_($@)])])
|
||||
[_b4_symbol([$1], [id])])],
|
||||
[_b4_symbol($@)])])
|
||||
|
||||
|
||||
# b4_symbol_if(NUM, FIELD, IF-TRUE, IF-FALSE)
|
||||
@@ -437,15 +449,14 @@ m4_define([b4_symbol_action_location],
|
||||
# b4_symbol_action(SYMBOL-NUM, KIND)
|
||||
# ----------------------------------
|
||||
# Run the action KIND (destructor or printer) for SYMBOL-NUM.
|
||||
# Same as in C, but using references instead of pointers.
|
||||
m4_define([b4_symbol_action],
|
||||
[b4_symbol_if([$1], [has_$2],
|
||||
[b4_dollar_pushdef([(*yyvaluep)],
|
||||
b4_symbol_if([$1], [has_type],
|
||||
[m4_dquote(b4_symbol([$1], [type]))]),
|
||||
[(*yylocationp)])dnl
|
||||
b4_symbol_case_([$1])[]dnl
|
||||
b4_syncline([b4_symbol([$1], [$2_line])], ["b4_symbol([$1], [$2_file])"])
|
||||
_b4_symbol_case([$1])[]dnl
|
||||
b4_syncline([b4_symbol([$1], [$2_line])], [b4_symbol([$1], [$2_file])])
|
||||
b4_symbol([$1], [$2])
|
||||
b4_syncline([@oline@], [@ofile@])
|
||||
break;
|
||||
@@ -479,10 +490,10 @@ m4_ifval(m4_defn([b4_actions_]),
|
||||
m4_popdef([b4_actions_])dnl
|
||||
])
|
||||
|
||||
# b4_symbol_case_(SYMBOL-NUM)
|
||||
# _b4_symbol_case(SYMBOL-NUM)
|
||||
# ---------------------------
|
||||
# Issue a "case NUM" for SYMBOL-NUM.
|
||||
m4_define([b4_symbol_case_],
|
||||
m4_define([_b4_symbol_case],
|
||||
[case b4_symbol([$1], [number]): b4_symbol_tag_comment([$1])])
|
||||
])
|
||||
|
||||
@@ -537,16 +548,16 @@ m4_define([b4_token_format],
|
||||
## Types. ##
|
||||
## ------- ##
|
||||
|
||||
# b4_type_action_(NUMS)
|
||||
# _b4_type_action(NUMS)
|
||||
# ---------------------
|
||||
# Run actions for the symbol NUMS that all have the same type-name.
|
||||
# Skip NUMS that have no type-name.
|
||||
#
|
||||
# To specify the action to run, define b4_dollar_dollar(NUMBER,
|
||||
# TAG, TYPE).
|
||||
m4_define([b4_type_action_],
|
||||
m4_define([_b4_type_action],
|
||||
[b4_symbol_if([$1], [has_type],
|
||||
[m4_map([ b4_symbol_case_], [$@])[]dnl
|
||||
[m4_map([ _b4_symbol_case], [$@])[]dnl
|
||||
b4_dollar_dollar([b4_symbol([$1], [number])],
|
||||
[b4_symbol([$1], [tag])],
|
||||
[b4_symbol([$1], [type])]);
|
||||
@@ -702,7 +713,7 @@ m4_define([b4_percent_define_use],
|
||||
# b4_percent_define_get([[foo]])
|
||||
m4_define([b4_percent_define_get],
|
||||
[b4_percent_define_use([$1])dnl
|
||||
b4_percent_define_ifdef_([$1],
|
||||
_b4_percent_define_ifdef([$1],
|
||||
[m4_indir([b4_percent_define(]$1[)])],
|
||||
[$2])])
|
||||
|
||||
@@ -711,7 +722,7 @@ b4_percent_define_ifdef_([$1],
|
||||
# Mimic muscle_percent_define_get_loc in ../src/muscle-tab.h exactly. That is,
|
||||
# if the %define variable VARIABLE is undefined, complain fatally since that's
|
||||
# a Bison or skeleton error. Otherwise, return its definition location in a
|
||||
# form approriate for the first two arguments of b4_warn_at, b4_complain_at, or
|
||||
# form appropriate for the first two arguments of b4_warn_at, b4_complain_at, or
|
||||
# b4_fatal_at. Don't record this as a Bison usage of VARIABLE as there's no
|
||||
# reason to suspect that the user-supplied value has yet influenced the output.
|
||||
#
|
||||
@@ -756,15 +767,15 @@ m4_define([b4_percent_define_get_syncline],
|
||||
[m4_indir([b4_percent_define_syncline(]$1[)])],
|
||||
[b4_fatal([[$0: undefined %%define variable '%s']], [$1])])])
|
||||
|
||||
# b4_percent_define_ifdef_(VARIABLE, IF-TRUE, [IF-FALSE])
|
||||
# _b4_percent_define_ifdef(VARIABLE, IF-TRUE, [IF-FALSE])
|
||||
# ------------------------------------------------------
|
||||
# If the %define variable VARIABLE is defined, expand IF-TRUE, else expand
|
||||
# IF-FALSE. Don't record usage of VARIABLE.
|
||||
#
|
||||
# For example:
|
||||
#
|
||||
# b4_percent_define_ifdef_([[foo]], [[it's defined]], [[it's undefined]])
|
||||
m4_define([b4_percent_define_ifdef_],
|
||||
# _b4_percent_define_ifdef([[foo]], [[it's defined]], [[it's undefined]])
|
||||
m4_define([_b4_percent_define_ifdef],
|
||||
[m4_ifdef([b4_percent_define(]$1[)],
|
||||
[$2],
|
||||
[$3])])
|
||||
@@ -780,11 +791,44 @@ m4_define([b4_percent_define_ifdef_],
|
||||
#
|
||||
# b4_percent_define_ifdef([[foo]], [[it's defined]], [[it's undefined]])
|
||||
m4_define([b4_percent_define_ifdef],
|
||||
[b4_percent_define_ifdef_([$1],
|
||||
[_b4_percent_define_ifdef([$1],
|
||||
[b4_percent_define_use([$1])$2],
|
||||
[$3])])
|
||||
|
||||
|
||||
# b4_percent_define_check_file_complain(VARIABLE)
|
||||
# -----------------------------------------------
|
||||
# Warn about %define variable VARIABLE having an incorrect
|
||||
# value.
|
||||
m4_define([b4_percent_define_check_file_complain],
|
||||
[b4_complain_at(b4_percent_define_get_loc([$1]),
|
||||
[[%%define variable '%s' requires 'none' or '"..."' values]],
|
||||
[$1])])
|
||||
|
||||
|
||||
# b4_percent_define_check_file(MACRO, VARIABLE, DEFAULT)
|
||||
# ------------------------------------------------------
|
||||
# If the %define variable VARIABLE:
|
||||
# - is undefined, then if DEFAULT is non-empty, define MACRO to DEFAULT
|
||||
# - is a string, define MACRO to its value
|
||||
# - is the keyword 'none', do nothing
|
||||
# - otherwise, warn about the incorrect value.
|
||||
m4_define([b4_percent_define_check_file],
|
||||
[b4_percent_define_ifdef([$2],
|
||||
[m4_case(b4_percent_define_get_kind([$2]),
|
||||
[string],
|
||||
[m4_define([$1], b4_percent_define_get([$2]))],
|
||||
[keyword],
|
||||
[m4_if(b4_percent_define_get([$2]), [none], [],
|
||||
[b4_percent_define_check_file_complain([$2])])],
|
||||
[b4_percent_define_check_file_complain([$2])])
|
||||
],
|
||||
[m4_ifval([$3],
|
||||
[m4_define([$1], [$3])])])
|
||||
])
|
||||
|
||||
|
||||
|
||||
## --------- ##
|
||||
## Options. ##
|
||||
## --------- ##
|
||||
@@ -825,7 +869,7 @@ m4_define([b4_percent_define_flag_if],
|
||||
#
|
||||
# b4_percent_define_default([[foo]], [[default value]])
|
||||
m4_define([b4_percent_define_default],
|
||||
[b4_percent_define_ifdef_([$1], [],
|
||||
[_b4_percent_define_ifdef([$1], [],
|
||||
[m4_define([b4_percent_define(]$1[)], [$2])dnl
|
||||
m4_define([b4_percent_define_kind(]$1[)],
|
||||
[m4_default([$3], [keyword])])dnl
|
||||
@@ -840,26 +884,26 @@ m4_define([b4_percent_define_default],
|
||||
# Define b4_NAME_if that executes its $1 or $2 depending whether
|
||||
# VARIABLE was %defined. The characters '.' and `-' in VARIABLE are mapped
|
||||
# to '_'.
|
||||
m4_define([b4_percent_define_if_define_],
|
||||
m4_define([_b4_percent_define_if_define],
|
||||
[m4_define(m4_bpatsubst([b4_$1_if], [[-.]], [_]),
|
||||
[b4_percent_define_flag_if(m4_default([$2], [$1]),
|
||||
[$3], [$4])])])
|
||||
m4_define([b4_percent_define_if_define],
|
||||
[b4_percent_define_default([m4_default([$2], [$1])], [[false]])
|
||||
b4_percent_define_if_define_([$1], [$2], $[1], $[2])])
|
||||
_b4_percent_define_if_define([$1], [$2], $[1], $[2])])
|
||||
|
||||
|
||||
# b4_percent_define_check_kind(VARIABLE, KIND, [DIAGNOSTIC = complain])
|
||||
# ---------------------------------------------------------------------
|
||||
m4_define([b4_percent_define_check_kind],
|
||||
[b4_percent_define_ifdef_([$1],
|
||||
[_b4_percent_define_ifdef([$1],
|
||||
[m4_if(b4_percent_define_get_kind([$1]), [$2], [],
|
||||
[b4_error([m4_default([$3], [complain])],
|
||||
b4_percent_define_get_loc([$1]),
|
||||
[m4_case([$2],
|
||||
[code], [[%%define variable '%s' requires '{...}' values]],
|
||||
[code], [[%%define variable '%s' requires '{...}' values]],
|
||||
[keyword], [[%%define variable '%s' requires keyword values]],
|
||||
[string], [[%%define variable '%s' requires '"..."' values]])],
|
||||
[string], [[%%define variable '%s' requires '"..."' values]])],
|
||||
[$1])])])dnl
|
||||
])
|
||||
|
||||
@@ -885,7 +929,7 @@ m4_define([b4_percent_define_check_values],
|
||||
[_b4_percent_define_check_values(b4_sublist)])])
|
||||
|
||||
m4_define([_b4_percent_define_check_values],
|
||||
[b4_percent_define_ifdef_([$1],
|
||||
[_b4_percent_define_ifdef([$1],
|
||||
[b4_percent_define_check_kind(]$1[, [keyword], [deprecated])dnl
|
||||
m4_pushdef([b4_good_value], [0])dnl
|
||||
m4_if($#, 1, [],
|
||||
@@ -947,7 +991,7 @@ m4_define([b4_percent_code_ifdef],
|
||||
# b4_parse_assert_if([IF-ASSERTIONS-ARE-USED], [IF-NOT])
|
||||
# b4_parse_trace_if([IF-DEBUG-TRACES-ARE-ENABLED], [IF-NOT])
|
||||
# b4_token_ctor_if([IF-YYLEX-RETURNS-A-TOKEN], [IF-NOT])
|
||||
# ----------------------------------------------
|
||||
# ----------------------------------------------------------
|
||||
b4_percent_define_if_define([token_ctor], [api.token.constructor])
|
||||
b4_percent_define_if_define([locations]) # Whether locations are tracked.
|
||||
b4_percent_define_if_define([parse.assert])
|
||||
|
||||
+2
-1
@@ -2,7 +2,8 @@
|
||||
|
||||
# C++ skeleton dispatching for Bison.
|
||||
|
||||
# Copyright (C) 2006-2007, 2009-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2006-2007, 2009-2015, 2018 Free Software Foundation,
|
||||
# Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
||||
+105
-79
@@ -2,7 +2,7 @@
|
||||
|
||||
# C++ skeleton for Bison
|
||||
|
||||
# Copyright (C) 2002-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2018 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -24,18 +24,51 @@ b4_percent_define_ifdef([[api.value.union.name]],
|
||||
|
||||
m4_include(b4_pkgdatadir/[c.m4])
|
||||
|
||||
b4_percent_define_check_kind([api.namespace], [code], [deprecated])
|
||||
b4_percent_define_check_kind([parser_class_name], [code], [deprecated])
|
||||
|
||||
|
||||
## ----- ##
|
||||
## C++. ##
|
||||
## ----- ##
|
||||
|
||||
# b4_comment(TEXT, [PREFIX])
|
||||
# --------------------------
|
||||
# Put TEXT in comment. Prefix all the output lines with PREFIX.
|
||||
m4_define([b4_comment],
|
||||
[b4_comment_([$1], [$2// ], [$2// ])])
|
||||
[_b4_comment([$1], [$2// ], [$2// ])])
|
||||
|
||||
## -------- ##
|
||||
## Checks. ##
|
||||
## -------- ##
|
||||
|
||||
b4_percent_define_check_kind([api.namespace], [code], [deprecated])
|
||||
b4_percent_define_check_kind([parser_class_name], [code], [deprecated])
|
||||
# b4_inline(hh|cc)
|
||||
# ----------------
|
||||
# Expand to `inline\n ` if $1 is hh.
|
||||
m4_define([b4_inline],
|
||||
[m4_case([$1],
|
||||
[cc], [],
|
||||
[hh], [[inline
|
||||
]],
|
||||
[m4_fatal([$0: invalid argument: $1])])])
|
||||
|
||||
|
||||
# b4_cxx_portability
|
||||
# ------------------
|
||||
m4_define([b4_cxx_portability],
|
||||
[// Support move semantics when possible.
|
||||
#if defined __cplusplus && 201103L <= __cplusplus
|
||||
# define YY_MOVE std::move
|
||||
# define YY_MOVE_OR_COPY move
|
||||
# define YY_MOVE_REF(Type) Type&&
|
||||
# define YY_RVREF(Type) Type&&
|
||||
# define YY_COPY(Type) Type
|
||||
#else
|
||||
# define YY_MOVE
|
||||
# define YY_MOVE_OR_COPY copy
|
||||
# define YY_MOVE_REF(Type) Type&
|
||||
# define YY_RVREF(Type) const Type&
|
||||
# define YY_COPY(Type) const Type&
|
||||
#endif[]dnl
|
||||
])
|
||||
|
||||
|
||||
## ---------------- ##
|
||||
## Default values. ##
|
||||
@@ -78,7 +111,7 @@ m4_if(m4_bregexp(b4_namespace_ref, [^[ ]*$]), [-1], [],
|
||||
[[namespace reference is empty]])])
|
||||
|
||||
# Instead of assuming the C++ compiler will do it, Bison should reject any
|
||||
# invalid b4_namepsace_ref that would be converted to a valid
|
||||
# invalid b4_namespace_ref that would be converted to a valid
|
||||
# b4_namespace_open. The problem is that Bison doesn't always output
|
||||
# b4_namespace_ref to uncommented code but should reserve the ability to do so
|
||||
# in future releases without risking breaking any existing user grammars.
|
||||
@@ -182,11 +215,18 @@ m4_define([b4_public_types_declare],
|
||||
|
||||
/// Internal symbol number for tokens (subsumed by symbol_number_type).
|
||||
typedef ]b4_int_type_for([b4_translate])[ token_number_type;
|
||||
]])
|
||||
|
||||
/// A complete symbol.
|
||||
|
||||
# b4_symbol_type_declare
|
||||
# ----------------------
|
||||
# Define symbol_type, the external type for symbols used for symbol
|
||||
# constructors.
|
||||
m4_define([b4_symbol_type_declare],
|
||||
[[ /// A complete symbol.
|
||||
///
|
||||
/// Expects its Base type to provide access to the symbol type
|
||||
/// via type_get().
|
||||
/// via type_get ().
|
||||
///
|
||||
/// Provide access to semantic value]b4_locations_if([ and location])[.
|
||||
template <typename Base>
|
||||
@@ -198,19 +238,20 @@ m4_define([b4_public_types_declare],
|
||||
/// Default constructor.
|
||||
basic_symbol ();
|
||||
|
||||
/// Copy constructor.
|
||||
basic_symbol (const basic_symbol& other);
|
||||
/// Move or copy constructor.
|
||||
basic_symbol (YY_RVREF (basic_symbol) other);
|
||||
|
||||
]b4_variant_if([[
|
||||
/// Constructor for valueless symbols, and symbols from each type.
|
||||
]b4_type_foreach([b4_basic_symbol_constructor_declare])], [[
|
||||
/// Constructor for valueless symbols.
|
||||
basic_symbol (typename Base::kind_type t]b4_locations_if([,
|
||||
const location_type& l])[);]])[
|
||||
YY_MOVE_REF (location_type) l])[);
|
||||
|
||||
/// Constructor for symbols with semantic value.
|
||||
basic_symbol (typename Base::kind_type t,
|
||||
const semantic_type& v]b4_locations_if([,
|
||||
const location_type& l])[);
|
||||
YY_RVREF (semantic_type) v]b4_locations_if([,
|
||||
YY_RVREF (location_type) l])[);]])[
|
||||
|
||||
/// Destroy the symbol.
|
||||
~basic_symbol ();
|
||||
@@ -231,8 +272,10 @@ m4_define([b4_public_types_declare],
|
||||
location_type location;])[
|
||||
|
||||
private:
|
||||
#if defined __cplusplus && __cplusplus < 201103L
|
||||
/// Assignment operator.
|
||||
basic_symbol& operator= (const basic_symbol& other);
|
||||
#endif
|
||||
};
|
||||
|
||||
/// Type access provider for token (enum) based symbols.
|
||||
@@ -271,82 +314,74 @@ m4_define([b4_public_types_declare],
|
||||
|
||||
/// "External" symbols: returned by the scanner.
|
||||
typedef basic_symbol<by_type> symbol_type;
|
||||
|
||||
]b4_symbol_constructor_declare])
|
||||
]])
|
||||
|
||||
|
||||
# b4_public_types_define
|
||||
# ----------------------
|
||||
# b4_public_types_define(hh|cc)
|
||||
# -----------------------------
|
||||
# Provide the implementation needed by the public types.
|
||||
m4_define([b4_public_types_define],
|
||||
[[ inline
|
||||
]b4_parser_class_name[::syntax_error::syntax_error (]b4_locations_if([const location_type& l, ])[const std::string& m)
|
||||
[ b4_inline([$1])b4_parser_class_name[::syntax_error::syntax_error (]b4_locations_if([const location_type& l, ])[const std::string& m)
|
||||
: std::runtime_error (m)]b4_locations_if([
|
||||
, location (l)])[
|
||||
{}
|
||||
|
||||
// basic_symbol.
|
||||
template <typename Base>
|
||||
inline
|
||||
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol ()
|
||||
: value ()
|
||||
: value ()]b4_locations_if([
|
||||
, location ()])[
|
||||
{}
|
||||
|
||||
template <typename Base>
|
||||
inline
|
||||
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (const basic_symbol& other)
|
||||
: Base (other)
|
||||
, value ()]b4_locations_if([
|
||||
, location (other.location)])[
|
||||
{
|
||||
]b4_variant_if([b4_symbol_variant([other.type_get ()], [value], [copy],
|
||||
[other.value])],
|
||||
[value = other.value;])[
|
||||
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (YY_RVREF (basic_symbol) other)
|
||||
: Base (YY_MOVE (other))
|
||||
, value (]b4_variant_if([], [YY_MOVE (other.value)]))b4_locations_if([
|
||||
, location (YY_MOVE (other.location))])[
|
||||
{]b4_variant_if([
|
||||
b4_symbol_variant([other.type_get ()], [value], [YY_MOVE_OR_COPY],
|
||||
[YY_MOVE (other.value)])])[
|
||||
}
|
||||
|
||||
|
||||
template <typename Base>
|
||||
inline
|
||||
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join(
|
||||
[typename Base::kind_type t],
|
||||
[const semantic_type& v],
|
||||
b4_locations_if([const location_type& l]))[)
|
||||
: Base (t)
|
||||
, value (]b4_variant_if([], [v])[)]b4_locations_if([
|
||||
, location (l)])[
|
||||
{]b4_variant_if([[
|
||||
(void) v;
|
||||
]b4_symbol_variant([this->type_get ()], [value], [copy], [v])])[}
|
||||
|
||||
]b4_variant_if([[
|
||||
// Implementation of basic_symbol constructor for each type.
|
||||
]b4_type_foreach([b4_basic_symbol_constructor_define])], [[
|
||||
/// Constructor for valueless symbols.
|
||||
template <typename Base>
|
||||
inline
|
||||
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join(
|
||||
[typename Base::kind_type t],
|
||||
b4_locations_if([const location_type& l]))[)
|
||||
b4_locations_if([YY_MOVE_REF (location_type) l]))[)
|
||||
: Base (t)
|
||||
, value ()]b4_locations_if([
|
||||
, location (l)])[
|
||||
{}]])[
|
||||
{}
|
||||
|
||||
template <typename Base>
|
||||
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join(
|
||||
[typename Base::kind_type t],
|
||||
[YY_RVREF (semantic_type) v],
|
||||
b4_locations_if([YY_RVREF (location_type) l]))[)
|
||||
: Base (t)
|
||||
, value (]b4_variant_if([], [YY_MOVE (v)])[)]b4_locations_if([
|
||||
, location (YY_MOVE (l))])[
|
||||
{]b4_variant_if([[
|
||||
(void) v;
|
||||
]b4_symbol_variant([this->type_get ()], [value], [YY_MOVE_OR_COPY], [YY_MOVE (v)])])[}]])[
|
||||
|
||||
template <typename Base>
|
||||
inline
|
||||
]b4_parser_class_name[::basic_symbol<Base>::~basic_symbol ()
|
||||
{
|
||||
clear ();
|
||||
}
|
||||
|
||||
template <typename Base>
|
||||
inline
|
||||
void
|
||||
]b4_parser_class_name[::basic_symbol<Base>::clear ()
|
||||
{]b4_variant_if([[
|
||||
// User destructor.
|
||||
symbol_number_type yytype = this->type_get ();
|
||||
basic_symbol<Base>& yysym = *this;
|
||||
(void) yysym;
|
||||
switch (yytype)
|
||||
{
|
||||
]b4_symbol_foreach([b4_symbol_destructor])dnl
|
||||
@@ -360,7 +395,6 @@ m4_define([b4_public_types_define],
|
||||
}
|
||||
|
||||
template <typename Base>
|
||||
inline
|
||||
bool
|
||||
]b4_parser_class_name[::basic_symbol<Base>::empty () const
|
||||
{
|
||||
@@ -368,57 +402,49 @@ m4_define([b4_public_types_define],
|
||||
}
|
||||
|
||||
template <typename Base>
|
||||
inline
|
||||
void
|
||||
]b4_parser_class_name[::basic_symbol<Base>::move (basic_symbol& s)
|
||||
{
|
||||
super_type::move(s);
|
||||
super_type::move (s);
|
||||
]b4_variant_if([b4_symbol_variant([this->type_get ()], [value], [move],
|
||||
[s.value])],
|
||||
[value = s.value;])[]b4_locations_if([
|
||||
location = s.location;])[
|
||||
[YY_MOVE (s.value)])],
|
||||
[value = YY_MOVE (s.value);])[]b4_locations_if([
|
||||
location = YY_MOVE (s.location);])[
|
||||
}
|
||||
|
||||
// by_type.
|
||||
inline
|
||||
]b4_parser_class_name[::by_type::by_type ()
|
||||
]b4_inline([$1])b4_parser_class_name[::by_type::by_type ()
|
||||
: type (empty_symbol)
|
||||
{}
|
||||
|
||||
inline
|
||||
]b4_parser_class_name[::by_type::by_type (const by_type& other)
|
||||
]b4_inline([$1])b4_parser_class_name[::by_type::by_type (const by_type& other)
|
||||
: type (other.type)
|
||||
{}
|
||||
|
||||
inline
|
||||
]b4_parser_class_name[::by_type::by_type (token_type t)
|
||||
]b4_inline([$1])b4_parser_class_name[::by_type::by_type (token_type t)
|
||||
: type (yytranslate_ (t))
|
||||
{}
|
||||
|
||||
inline
|
||||
void
|
||||
]b4_inline([$1])[void
|
||||
]b4_parser_class_name[::by_type::clear ()
|
||||
{
|
||||
type = empty_symbol;
|
||||
}
|
||||
|
||||
inline
|
||||
void
|
||||
]b4_inline([$1])[void
|
||||
]b4_parser_class_name[::by_type::move (by_type& that)
|
||||
{
|
||||
type = that.type;
|
||||
that.clear ();
|
||||
}
|
||||
|
||||
inline
|
||||
int
|
||||
]b4_inline([$1])[int
|
||||
]b4_parser_class_name[::by_type::type_get () const
|
||||
{
|
||||
return type;
|
||||
}
|
||||
]b4_token_ctor_if([[
|
||||
inline
|
||||
]b4_parser_class_name[::token_type
|
||||
]b4_inline([$1])b4_parser_class_name[::token_type
|
||||
]b4_parser_class_name[::by_type::token () const
|
||||
{
|
||||
// YYTOKNUM[NUM] -- (External) token number corresponding to the
|
||||
@@ -432,6 +458,7 @@ m4_define([b4_public_types_define],
|
||||
return static_cast<token_type> (yytoken_number_[type]);
|
||||
}
|
||||
]])[]dnl
|
||||
|
||||
b4_symbol_constructor_define])
|
||||
|
||||
|
||||
@@ -444,14 +471,13 @@ m4_define([b4_symbol_constructor_declare], [])
|
||||
m4_define([b4_symbol_constructor_define], [])
|
||||
|
||||
|
||||
# b4_yytranslate_define
|
||||
# ---------------------
|
||||
# Define yytranslate_. Sometimes used in the header file,
|
||||
# b4_yytranslate_define(cc|hh)
|
||||
# ----------------------------
|
||||
# Define yytranslate_. Sometimes used in the header file ($1=hh),
|
||||
# sometimes in the cc file.
|
||||
m4_define([b4_yytranslate_define],
|
||||
[[ // Symbol number corresponding to token number t.
|
||||
inline
|
||||
]b4_parser_class_name[::token_number_type
|
||||
]b4_inline([$1])b4_parser_class_name[::token_number_type
|
||||
]b4_parser_class_name[::yytranslate_ (]b4_token_ctor_if([token_type],
|
||||
[int])[ t)
|
||||
{
|
||||
@@ -461,12 +487,12 @@ m4_define([b4_yytranslate_define],
|
||||
{
|
||||
]b4_translate[
|
||||
};
|
||||
const unsigned int user_token_number_max_ = ]b4_user_token_number_max[;
|
||||
const unsigned user_token_number_max_ = ]b4_user_token_number_max[;
|
||||
const token_number_type undef_token_ = ]b4_undef_token_number[;
|
||||
|
||||
if (static_cast<int>(t) <= yyeof_)
|
||||
if (static_cast<int> (t) <= yyeof_)
|
||||
return yyeof_;
|
||||
else if (static_cast<unsigned int> (t) <= user_token_number_max_)
|
||||
else if (static_cast<unsigned> (t) <= user_token_number_max_)
|
||||
return translate_table[t];
|
||||
else
|
||||
return undef_token_;
|
||||
|
||||
+7
-7
@@ -2,7 +2,7 @@
|
||||
|
||||
# Common code for C-like languages (C, C++, Java, etc.)
|
||||
|
||||
# Copyright (C) 2012-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2012-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -17,14 +17,14 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# b4_comment_(TEXT, OPEN, CONTINUE, END)
|
||||
# _b4_comment(TEXT, OPEN, CONTINUE, END)
|
||||
# --------------------------------------
|
||||
# Put TEXT in comment. Avoid trailing spaces: don't indent empty lines.
|
||||
# Avoid adding indentation to the first line, as the indentation comes
|
||||
# from OPEN. That's why we don't patsubst([$1], [^\(.\)], [ \1]).
|
||||
#
|
||||
# Prefix all the output lines with PREFIX.
|
||||
m4_define([b4_comment_],
|
||||
m4_define([_b4_comment],
|
||||
[$2[]m4_bpatsubst(m4_expand([[$1]]), [
|
||||
\(.\)], [
|
||||
$3\1])$4])
|
||||
@@ -34,17 +34,17 @@ $3\1])$4])
|
||||
# --------------------------
|
||||
# Put TEXT in comment. Prefix all the output lines with PREFIX.
|
||||
m4_define([b4_comment],
|
||||
[b4_comment_([$1], [$2/* ], [$2 ], [ */])])
|
||||
[_b4_comment([$1], [$2/* ], [$2 ], [ */])])
|
||||
|
||||
|
||||
|
||||
|
||||
# b4_dollar_dollar_(VALUE, FIELD, DEFAULT-FIELD)
|
||||
# _b4_dollar_dollar(VALUE, FIELD, DEFAULT-FIELD)
|
||||
# ----------------------------------------------
|
||||
# If FIELD (or DEFAULT-FIELD) is non-null, return "VALUE.FIELD",
|
||||
# otherwise just VALUE. Be sure to pass "(VALUE)" is VALUE is a
|
||||
# pointer.
|
||||
m4_define([b4_dollar_dollar_],
|
||||
m4_define([_b4_dollar_dollar],
|
||||
[b4_symbol_value([$1],
|
||||
m4_if([$2], [[]],
|
||||
[[$3]], [[$2]]))])
|
||||
@@ -56,7 +56,7 @@ m4_define([b4_dollar_dollar_],
|
||||
# and b4_at_dollar for LOCATION.
|
||||
m4_define([b4_dollar_pushdef],
|
||||
[m4_pushdef([b4_dollar_dollar],
|
||||
[b4_dollar_dollar_([$1], m4_dquote($][1), [$2])])dnl
|
||||
[_b4_dollar_dollar([$1], m4_dquote($][1), [$2])])dnl
|
||||
m4_pushdef([b4_at_dollar], [$3])dnl
|
||||
])
|
||||
m4_define([b4_dollar_popdef],
|
||||
|
||||
+2
-1
@@ -2,7 +2,8 @@
|
||||
|
||||
# C skeleton dispatching for Bison.
|
||||
|
||||
# Copyright (C) 2006-2007, 2009-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2006-2007, 2009-2015, 2018 Free Software Foundation,
|
||||
# Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# C M4 Macros for Bison.
|
||||
|
||||
# Copyright (C) 2002, 2004-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002, 2004-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -172,10 +172,10 @@ m4_define([b4_int_type],
|
||||
[m4_if(b4_ints_in($@, [0], [255]), [1], [unsigned char],
|
||||
b4_ints_in($@, [-128], [127]), [1], [signed char],
|
||||
|
||||
b4_ints_in($@, [0], [65535]), [1], [unsigned short int],
|
||||
b4_ints_in($@, [-32768], [32767]), [1], [short int],
|
||||
b4_ints_in($@, [0], [65535]), [1], [unsigned short],
|
||||
b4_ints_in($@, [-32768], [32767]), [1], [short],
|
||||
|
||||
m4_eval([0 <= $1]), [1], [unsigned int],
|
||||
m4_eval([0 <= $1]), [1], [unsigned],
|
||||
|
||||
[int])])
|
||||
|
||||
@@ -242,7 +242,7 @@ m4_define([b4_attribute_define],
|
||||
# define YYUSE(E) /* empty */
|
||||
#endif
|
||||
|
||||
#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
|
||||
#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
|
||||
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
|
||||
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
|
||||
_Pragma ("GCC diagnostic push") \
|
||||
@@ -263,21 +263,23 @@ m4_define([b4_attribute_define],
|
||||
])
|
||||
|
||||
|
||||
## ---------##
|
||||
## Values. ##
|
||||
## ---------##
|
||||
|
||||
|
||||
# b4_null_define
|
||||
# --------------
|
||||
# Portability issues: define a YY_NULLPTR appropriate for the current
|
||||
# language (C, C++98, or C++11).
|
||||
#
|
||||
# In C++ pre C++11 it is standard practice to use 0 (not NULL) for the
|
||||
# null pointer. In C, prefer ((void*)0) to avoid having to include stdlib.h.
|
||||
m4_define([b4_null_define],
|
||||
[# ifndef YY_NULLPTR
|
||||
# if defined __cplusplus && 201103L <= __cplusplus
|
||||
# define YY_NULLPTR nullptr
|
||||
# if defined __cplusplus
|
||||
# if 201103L <= __cplusplus
|
||||
# define YY_NULLPTR nullptr
|
||||
# else
|
||||
# define YY_NULLPTR 0
|
||||
# endif
|
||||
# else
|
||||
# define YY_NULLPTR 0
|
||||
# define YY_NULLPTR ((void*)0)
|
||||
# endif
|
||||
# endif[]dnl
|
||||
])
|
||||
@@ -288,6 +290,12 @@ m4_define([b4_null_define],
|
||||
# Return a null pointer constant.
|
||||
m4_define([b4_null], [YY_NULLPTR])
|
||||
|
||||
|
||||
|
||||
## ---------##
|
||||
## Values. ##
|
||||
## ---------##
|
||||
|
||||
# b4_integral_parser_table_define(TABLE-NAME, CONTENT, COMMENT)
|
||||
# -------------------------------------------------------------
|
||||
# Define "yy<TABLE-NAME>" whose contents is CONTENT.
|
||||
@@ -361,7 +369,7 @@ m4_define([b4_token_enums_defines],
|
||||
# ----------------------------
|
||||
# Given a semantic value VAL ($$, $1 etc.), extract its value of type
|
||||
# TYPE if TYPE is given, otherwise just return VAL. The result can be
|
||||
# used safetly, it is put in parens to avoid nasty precedence issues.
|
||||
# used safely, it is put in parens to avoid nasty precedence issues.
|
||||
# TYPE is *not* put in braces, provide some if needed.
|
||||
m4_define([b4_symbol_value],
|
||||
[($1[]m4_ifval([$2], [.$2]))])
|
||||
@@ -459,7 +467,8 @@ b4_syncline([@oline@], [@ofile@])
|
||||
# ------------------------------------
|
||||
m4_define([b4_predicate_case],
|
||||
[ case $1:
|
||||
if (! ($2)) YYERROR;
|
||||
if (! (
|
||||
$2)) YYERROR;
|
||||
b4_syncline([@oline@], [@ofile@])
|
||||
break;])
|
||||
|
||||
|
||||
+72
-75
@@ -2,7 +2,7 @@
|
||||
|
||||
# GLR skeleton for Bison
|
||||
|
||||
# Copyright (C) 2002-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -198,12 +198,12 @@ m4_if(b4_skeleton, ["glr.c"],
|
||||
[b4_defines_if(
|
||||
[b4_output_begin([b4_spec_defines_file])
|
||||
b4_copyright([Skeleton interface for Bison GLR parsers in C],
|
||||
[2002-2015])[
|
||||
[2002-2015, 2018])[
|
||||
|
||||
]b4_cpp_guard_open([b4_spec_defines_file])[
|
||||
]b4_shared_declarations[
|
||||
]b4_cpp_guard_close([b4_spec_defines_file])[
|
||||
]b4_output_end()
|
||||
]b4_output_end
|
||||
])])
|
||||
|
||||
|
||||
@@ -213,13 +213,13 @@ b4_copyright([Skeleton interface for Bison GLR parsers in C],
|
||||
|
||||
b4_output_begin([b4_parser_file_name])
|
||||
b4_copyright([Skeleton implementation for Bison GLR parsers in C],
|
||||
[2002-2015])[
|
||||
[2002-2015, 2018])[
|
||||
|
||||
/* C GLR parser skeleton written by Paul Hilfinger. */
|
||||
|
||||
]b4_identification
|
||||
]b4_identification[
|
||||
|
||||
b4_percent_code_get([[top]])[
|
||||
]b4_percent_code_get([[top]])[
|
||||
]m4_if(b4_api_prefix, [yy], [],
|
||||
[[/* Substitute the type names. */
|
||||
#define YYSTYPE ]b4_api_PREFIX[STYPE]b4_locations_if([[
|
||||
@@ -292,19 +292,25 @@ b4_percent_code_get[]dnl
|
||||
#define YYSIZEMAX ((size_t) -1)
|
||||
|
||||
#ifdef __cplusplus
|
||||
typedef bool yybool;
|
||||
typedef bool yybool;
|
||||
# define yytrue true
|
||||
# define yyfalse false
|
||||
#else
|
||||
typedef unsigned char yybool;
|
||||
typedef unsigned char yybool;
|
||||
# define yytrue 1
|
||||
# define yyfalse 0
|
||||
#endif
|
||||
#define yytrue 1
|
||||
#define yyfalse 0
|
||||
|
||||
#ifndef YYSETJMP
|
||||
# include <setjmp.h>
|
||||
# define YYJMP_BUF jmp_buf
|
||||
# define YYSETJMP(Env) setjmp (Env)
|
||||
/* Pacify clang. */
|
||||
# define YYLONGJMP(Env, Val) (longjmp (Env, Val), YYASSERT (0))
|
||||
/* Pacify Clang and ICC. */
|
||||
# define YYLONGJMP(Env, Val) \
|
||||
do { \
|
||||
longjmp (Env, Val); \
|
||||
YYASSERT (0); \
|
||||
} while (yyfalse)
|
||||
#endif
|
||||
|
||||
]b4_attribute_define[
|
||||
@@ -337,7 +343,7 @@ b4_percent_code_get[]dnl
|
||||
#define YYMAXUTOK ]b4_user_token_number_max[
|
||||
|
||||
#define YYTRANSLATE(YYX) \
|
||||
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
|
||||
((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
|
||||
|
||||
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
|
||||
static const ]b4_int_type_for([b4_translate])[ yytranslate[] =
|
||||
@@ -398,9 +404,9 @@ static const ]b4_int_type_for([b4_conflict_list_heads])[ yyconflp[] =
|
||||
/* YYCONFL[I] -- lists of conflicting rule numbers, each terminated by
|
||||
0, pointed into by YYCONFLP. */
|
||||
]dnl Do not use b4_int_type_for here, since there are places where
|
||||
dnl pointers onto yyconfl are taken, whose type is "short int *".
|
||||
dnl pointers onto yyconfl are taken, whose type is "short*".
|
||||
dnl We probably ought to introduce a type for confl.
|
||||
[static const short int yyconfl[] =
|
||||
[static const short yyconfl[] =
|
||||
{
|
||||
]b4_conflicting_rules[
|
||||
};
|
||||
@@ -613,7 +619,7 @@ typedef int yyRuleNum;
|
||||
typedef int yySymbol;
|
||||
|
||||
/** Item references, as in LALR(1) machine */
|
||||
typedef short int yyItemNum;
|
||||
typedef short yyItemNum;
|
||||
|
||||
typedef struct yyGLRState yyGLRState;
|
||||
typedef struct yyGLRStateSet yyGLRStateSet;
|
||||
@@ -808,6 +814,7 @@ yyuserAction (yyRuleNum yyn, size_t yyrhslen, yyGLRStackItem* yyvsp,
|
||||
*yyvalp = yyval_default;
|
||||
else
|
||||
*yyvalp = yyvsp[YYFILL (1-yyrhslen)].yystate.yysemantics.yysval;]b4_locations_if([[
|
||||
/* Default location. */
|
||||
YYLLOC_DEFAULT ((*yylocp), (yyvsp - yyrhslen), yyrhslen);
|
||||
yystackp->yyerror_range[1].yystate.yyloc = *yylocp;
|
||||
]])[
|
||||
@@ -922,7 +929,7 @@ yydefaultAction (yyStateNum yystate)
|
||||
*/
|
||||
static inline void
|
||||
yygetLRActions (yyStateNum yystate, int yytoken,
|
||||
int* yyaction, const short int** yyconflicts)
|
||||
int* yyaction, const short** yyconflicts)
|
||||
{
|
||||
int yyindex = yypact[yystate] + yytoken;
|
||||
if (yypact_value_is_default (yypact[yystate])
|
||||
@@ -1195,7 +1202,7 @@ yyremoveDeletes (yyGLRStack* yystackp)
|
||||
if (yyj != yyi)
|
||||
{
|
||||
YYDPRINTF ((stderr, "Rename stack %lu -> %lu.\n",
|
||||
(unsigned long int) yyi, (unsigned long int) yyj));
|
||||
(unsigned long) yyi, (unsigned long) yyj));
|
||||
}
|
||||
yyj += 1;
|
||||
}
|
||||
@@ -1266,8 +1273,8 @@ yy_reduce_print (int yynormal, yyGLRStackItem* yyvsp, size_t yyk,
|
||||
int yylow = 1;])[
|
||||
int yyi;
|
||||
YYFPRINTF (stderr, "Reducing stack %lu by rule %d (line %lu):\n",
|
||||
(unsigned long int) yyk, yyrule - 1,
|
||||
(unsigned long int) yyrline[yyrule]);
|
||||
(unsigned long) yyk, yyrule - 1,
|
||||
(unsigned long) yyrline[yyrule]);
|
||||
if (! yynormal)
|
||||
yyfillin (yyvsp, 1, -yynrhs);
|
||||
/* The symbols being reduced. */
|
||||
@@ -1359,7 +1366,7 @@ yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
|
||||
if (yyflag == yyerr && yystackp->yysplitPoint != YY_NULLPTR)
|
||||
{
|
||||
YYDPRINTF ((stderr, "Parse on stack %lu rejected by rule #%d.\n",
|
||||
(unsigned long int) yyk, yyrule - 1));
|
||||
(unsigned long) yyk, yyrule - 1));
|
||||
}
|
||||
if (yyflag != yyok)
|
||||
return yyflag;
|
||||
@@ -1387,7 +1394,7 @@ yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
|
||||
YYDPRINTF ((stderr,
|
||||
"Reduced stack %lu by rule #%d; action deferred. "
|
||||
"Now in state %d.\n",
|
||||
(unsigned long int) yyk, yyrule - 1, yynewLRState));
|
||||
(unsigned long) yyk, yyrule - 1, yynewLRState));
|
||||
for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1)
|
||||
if (yyi != yyk && yystackp->yytops.yystates[yyi] != YY_NULLPTR)
|
||||
{
|
||||
@@ -1400,8 +1407,8 @@ yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
|
||||
yyaddDeferredAction (yystackp, yyk, yyp, yys0, yyrule);
|
||||
yymarkStackDeleted (yystackp, yyk);
|
||||
YYDPRINTF ((stderr, "Merging stack %lu into stack %lu.\n",
|
||||
(unsigned long int) yyk,
|
||||
(unsigned long int) yyi));
|
||||
(unsigned long) yyk,
|
||||
(unsigned long) yyi));
|
||||
return yyok;
|
||||
}
|
||||
yyp = yyp->yypred;
|
||||
@@ -1647,8 +1654,8 @@ yyreportTree (yySemanticOption* yyx, int yyindent)
|
||||
else
|
||||
YYFPRINTF (stderr, "%*s%s -> <Rule %d, tokens %lu .. %lu>\n",
|
||||
yyindent, "", yytokenName (yylhsNonterm (yyx->yyrule)),
|
||||
yyx->yyrule - 1, (unsigned long int) (yys->yyposn + 1),
|
||||
(unsigned long int) yyx->yystate->yyposn);
|
||||
yyx->yyrule - 1, (unsigned long) (yys->yyposn + 1),
|
||||
(unsigned long) yyx->yystate->yyposn);
|
||||
for (yyi = 1; yyi <= yynrhs; yyi += 1)
|
||||
{
|
||||
if (yystates[yyi]->yyresolved)
|
||||
@@ -1659,8 +1666,8 @@ yyreportTree (yySemanticOption* yyx, int yyindent)
|
||||
else
|
||||
YYFPRINTF (stderr, "%*s%s <tokens %lu .. %lu>\n", yyindent+2, "",
|
||||
yytokenName (yystos[yystates[yyi]->yylrState]),
|
||||
(unsigned long int) (yystates[yyi-1]->yyposn + 1),
|
||||
(unsigned long int) yystates[yyi]->yyposn);
|
||||
(unsigned long) (yystates[yyi-1]->yyposn + 1),
|
||||
(unsigned long) yystates[yyi]->yyposn);
|
||||
}
|
||||
else
|
||||
yyreportTree (yystates[yyi]->yysemantics.yyfirstVal, yyindent+2);
|
||||
@@ -1692,7 +1699,7 @@ yyreportAmbiguity (yySemanticOption* yyx0,
|
||||
* ending at YYS1. Has no effect on previously resolved states.
|
||||
* The first semantic option of a state is always chosen. */
|
||||
static void
|
||||
yyresolveLocations (yyGLRState* yys1, int yyn1,
|
||||
yyresolveLocations (yyGLRState *yys1, int yyn1,
|
||||
yyGLRStack *yystackp]b4_user_formals[)
|
||||
{
|
||||
if (0 < yyn1)
|
||||
@@ -1703,9 +1710,9 @@ yyresolveLocations (yyGLRState* yys1, int yyn1,
|
||||
yyGLRStackItem yyrhsloc[1 + YYMAXRHS];
|
||||
int yynrhs;
|
||||
yySemanticOption *yyoption = yys1->yysemantics.yyfirstVal;
|
||||
YYASSERT (yyoption != YY_NULLPTR);
|
||||
YYASSERT (yyoption);
|
||||
yynrhs = yyrhsLength (yyoption->yyrule);
|
||||
if (yynrhs > 0)
|
||||
if (0 < yynrhs)
|
||||
{
|
||||
yyGLRState *yys;
|
||||
int yyn;
|
||||
@@ -1728,18 +1735,7 @@ yyresolveLocations (yyGLRState* yys1, int yyn1,
|
||||
yyGLRState *yyprevious = yyoption->yystate;
|
||||
yyrhsloc[0].yystate.yyloc = yyprevious->yyloc;
|
||||
}
|
||||
{
|
||||
int yychar_current = yychar;
|
||||
YYSTYPE yylval_current = yylval;
|
||||
YYLTYPE yylloc_current = yylloc;
|
||||
yychar = yyoption->yyrawchar;
|
||||
yylval = yyoption->yyval;
|
||||
yylloc = yyoption->yyloc;
|
||||
YYLLOC_DEFAULT ((yys1->yyloc), yyrhsloc, yynrhs);
|
||||
yychar = yychar_current;
|
||||
yylval = yylval_current;
|
||||
yylloc = yylloc_current;
|
||||
}
|
||||
YYLLOC_DEFAULT ((yys1->yyloc), yyrhsloc, yynrhs);
|
||||
}
|
||||
}
|
||||
}]])[
|
||||
@@ -1891,7 +1887,7 @@ yyprocessOneStack (yyGLRStack* yystackp, size_t yyk,
|
||||
{
|
||||
yyStateNum yystate = yystackp->yytops.yystates[yyk]->yylrState;
|
||||
YYDPRINTF ((stderr, "Stack %lu Entering state %d\n",
|
||||
(unsigned long int) yyk, yystate));
|
||||
(unsigned long) yyk, yystate));
|
||||
|
||||
YYASSERT (yystate != YYFINAL);
|
||||
|
||||
@@ -1902,7 +1898,7 @@ yyprocessOneStack (yyGLRStack* yystackp, size_t yyk,
|
||||
if (yyrule == 0)
|
||||
{
|
||||
YYDPRINTF ((stderr, "Stack %lu dies.\n",
|
||||
(unsigned long int) yyk));
|
||||
(unsigned long) yyk));
|
||||
yymarkStackDeleted (yystackp, yyk);
|
||||
return yyok;
|
||||
}
|
||||
@@ -1912,7 +1908,7 @@ yyprocessOneStack (yyGLRStack* yystackp, size_t yyk,
|
||||
YYDPRINTF ((stderr,
|
||||
"Stack %lu dies "
|
||||
"(predicate failure or explicit user error).\n",
|
||||
(unsigned long int) yyk));
|
||||
(unsigned long) yyk));
|
||||
yymarkStackDeleted (yystackp, yyk);
|
||||
return yyok;
|
||||
}
|
||||
@@ -1923,7 +1919,7 @@ yyprocessOneStack (yyGLRStack* yystackp, size_t yyk,
|
||||
{
|
||||
yySymbol yytoken;
|
||||
int yyaction;
|
||||
const short int* yyconflicts;
|
||||
const short* yyconflicts;
|
||||
|
||||
yystackp->yytops.yylookaheadNeeds[yyk] = yytrue;
|
||||
if (yychar == YYEMPTY)
|
||||
@@ -1950,8 +1946,8 @@ yyprocessOneStack (yyGLRStack* yystackp, size_t yyk,
|
||||
YYRESULTTAG yyflag;
|
||||
size_t yynewStack = yysplitStack (yystackp, yyk);
|
||||
YYDPRINTF ((stderr, "Splitting off stack %lu from %lu.\n",
|
||||
(unsigned long int) yynewStack,
|
||||
(unsigned long int) yyk));
|
||||
(unsigned long) yynewStack,
|
||||
(unsigned long) yyk));
|
||||
yyflag = yyglrReduce (yystackp, yynewStack,
|
||||
*yyconflicts,
|
||||
yyimmediate[*yyconflicts]]b4_user_args[);
|
||||
@@ -1961,7 +1957,7 @@ yyprocessOneStack (yyGLRStack* yystackp, size_t yyk,
|
||||
else if (yyflag == yyerr)
|
||||
{
|
||||
YYDPRINTF ((stderr, "Stack %lu dies.\n",
|
||||
(unsigned long int) yynewStack));
|
||||
(unsigned long) yynewStack));
|
||||
yymarkStackDeleted (yystackp, yynewStack);
|
||||
}
|
||||
else
|
||||
@@ -1974,7 +1970,7 @@ yyprocessOneStack (yyGLRStack* yystackp, size_t yyk,
|
||||
else if (yyisErrorAction (yyaction))
|
||||
{
|
||||
YYDPRINTF ((stderr, "Stack %lu dies.\n",
|
||||
(unsigned long int) yyk));
|
||||
(unsigned long) yyk));
|
||||
yymarkStackDeleted (yystackp, yyk);
|
||||
break;
|
||||
}
|
||||
@@ -1987,7 +1983,7 @@ yyprocessOneStack (yyGLRStack* yystackp, size_t yyk,
|
||||
YYDPRINTF ((stderr,
|
||||
"Stack %lu dies "
|
||||
"(predicate failure or explicit user error).\n",
|
||||
(unsigned long int) yyk));
|
||||
(unsigned long) yyk));
|
||||
yymarkStackDeleted (yystackp, yyk);
|
||||
break;
|
||||
}
|
||||
@@ -2085,6 +2081,7 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
||||
case N: \
|
||||
yyformat = S; \
|
||||
break
|
||||
default: /* Avoid compiler warnings. */
|
||||
YYCASE_(0, YY_("syntax error"));
|
||||
YYCASE_(1, YY_("syntax error, unexpected %s"));
|
||||
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
|
||||
@@ -2295,7 +2292,7 @@ b4_dollar_popdef])[]dnl
|
||||
{
|
||||
yyRuleNum yyrule;
|
||||
int yyaction;
|
||||
const short int* yyconflicts;
|
||||
const short* yyconflicts;
|
||||
|
||||
yyStateNum yystate = yystack.yytops.yystates[0]->yylrState;
|
||||
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
|
||||
@@ -2305,8 +2302,8 @@ b4_dollar_popdef])[]dnl
|
||||
{
|
||||
yyrule = yydefaultAction (yystate);
|
||||
if (yyrule == 0)
|
||||
{
|
||||
]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
|
||||
{]b4_locations_if([[
|
||||
yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
|
||||
yyreportSyntaxError (&yystack]b4_user_args[);
|
||||
goto yyuser_error;
|
||||
}
|
||||
@@ -2345,8 +2342,8 @@ b4_dollar_popdef])[]dnl
|
||||
yystack.yyerrState -= 1;
|
||||
}
|
||||
else if (yyisErrorAction (yyaction))
|
||||
{
|
||||
]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
|
||||
{]b4_locations_if([[
|
||||
yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
|
||||
yyreportSyntaxError (&yystack]b4_user_args[);
|
||||
goto yyuser_error;
|
||||
}
|
||||
@@ -2391,8 +2388,8 @@ b4_dollar_popdef])[]dnl
|
||||
if (yystack.yytops.yysize == 0)
|
||||
yyFail (&yystack][]b4_lpure_args[, YY_("syntax error"));
|
||||
YYCHK1 (yyresolveStack (&yystack]b4_user_args[));
|
||||
YYDPRINTF ((stderr, "Returning to deterministic operation.\n"));
|
||||
]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
|
||||
YYDPRINTF ((stderr, "Returning to deterministic operation.\n"));]b4_locations_if([[
|
||||
yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
|
||||
yyreportSyntaxError (&yystack]b4_user_args[);
|
||||
goto yyuser_error;
|
||||
}
|
||||
@@ -2408,17 +2405,17 @@ b4_dollar_popdef])[]dnl
|
||||
for (yys = 0; yys < yystack.yytops.yysize; yys += 1)
|
||||
{
|
||||
int yyaction;
|
||||
const short int* yyconflicts;
|
||||
const short* yyconflicts;
|
||||
yyStateNum yystate = yystack.yytops.yystates[yys]->yylrState;
|
||||
yygetLRActions (yystate, yytoken_to_shift, &yyaction,
|
||||
&yyconflicts);
|
||||
/* Note that yyconflicts were handled by yyprocessOneStack. */
|
||||
YYDPRINTF ((stderr, "On stack %lu, ", (unsigned long int) yys));
|
||||
YYDPRINTF ((stderr, "On stack %lu, ", (unsigned long) yys));
|
||||
YY_SYMBOL_PRINT ("shifting", yytoken_to_shift, &yylval, &yylloc);
|
||||
yyglrShift (&yystack, yys, yyaction, yyposn,
|
||||
&yylval]b4_locations_if([, &yylloc])[);
|
||||
YYDPRINTF ((stderr, "Stack %lu now in state #%d\n",
|
||||
(unsigned long int) yys,
|
||||
(unsigned long) yys,
|
||||
yystack.yytops.yystates[yys]->yylrState));
|
||||
}
|
||||
|
||||
@@ -2473,9 +2470,9 @@ b4_dollar_popdef])[]dnl
|
||||
{
|
||||
while (yystates[yyk])
|
||||
{
|
||||
yyGLRState *yys = yystates[yyk];
|
||||
]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yys->yyloc;]]
|
||||
)[ if (yys->yypred != YY_NULLPTR)
|
||||
yyGLRState *yys = yystates[yyk];]b4_locations_if([[
|
||||
yystack.yyerror_range[1].yystate.yyloc = yys->yyloc;]])[
|
||||
if (yys->yypred != YY_NULLPTR)
|
||||
yydestroyGLRState ("Cleanup: popping", yys]b4_user_args[);
|
||||
yystates[yyk] = yys->yypred;
|
||||
yystack.yynextFree -= 1;
|
||||
@@ -2501,7 +2498,7 @@ yy_yypstack (yyGLRState* yys)
|
||||
YYFPRINTF (stderr, " -> ");
|
||||
}
|
||||
YYFPRINTF (stderr, "%d@@%lu", yys->yylrState,
|
||||
(unsigned long int) yys->yyposn);
|
||||
(unsigned long) yys->yyposn);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2532,18 +2529,18 @@ yypdumpstack (yyGLRStack* yystackp)
|
||||
for (yyp = yystackp->yyitems; yyp < yystackp->yynextFree; yyp += 1)
|
||||
{
|
||||
YYFPRINTF (stderr, "%3lu. ",
|
||||
(unsigned long int) (yyp - yystackp->yyitems));
|
||||
(unsigned long) (yyp - yystackp->yyitems));
|
||||
if (*(yybool *) yyp)
|
||||
{
|
||||
YYASSERT (yyp->yystate.yyisState);
|
||||
YYASSERT (yyp->yyoption.yyisState);
|
||||
YYFPRINTF (stderr, "Res: %d, LR State: %d, posn: %lu, pred: %ld",
|
||||
yyp->yystate.yyresolved, yyp->yystate.yylrState,
|
||||
(unsigned long int) yyp->yystate.yyposn,
|
||||
(long int) YYINDEX (yyp->yystate.yypred));
|
||||
(unsigned long) yyp->yystate.yyposn,
|
||||
(long) YYINDEX (yyp->yystate.yypred));
|
||||
if (! yyp->yystate.yyresolved)
|
||||
YYFPRINTF (stderr, ", firstVal: %ld",
|
||||
(long int) YYINDEX (yyp->yystate
|
||||
(long) YYINDEX (yyp->yystate
|
||||
.yysemantics.yyfirstVal));
|
||||
}
|
||||
else
|
||||
@@ -2552,15 +2549,15 @@ yypdumpstack (yyGLRStack* yystackp)
|
||||
YYASSERT (!yyp->yyoption.yyisState);
|
||||
YYFPRINTF (stderr, "Option. rule: %d, state: %ld, next: %ld",
|
||||
yyp->yyoption.yyrule - 1,
|
||||
(long int) YYINDEX (yyp->yyoption.yystate),
|
||||
(long int) YYINDEX (yyp->yyoption.yynext));
|
||||
(long) YYINDEX (yyp->yyoption.yystate),
|
||||
(long) YYINDEX (yyp->yyoption.yynext));
|
||||
}
|
||||
YYFPRINTF (stderr, "\n");
|
||||
}
|
||||
YYFPRINTF (stderr, "Tops:");
|
||||
for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1)
|
||||
YYFPRINTF (stderr, "%lu: %ld; ", (unsigned long int) yyi,
|
||||
(long int) YYINDEX (yystackp->yytops.yystates[yyi]));
|
||||
YYFPRINTF (stderr, "%lu: %ld; ", (unsigned long) yyi,
|
||||
(long) YYINDEX (yystackp->yytops.yystates[yyi]));
|
||||
YYFPRINTF (stderr, "\n");
|
||||
}
|
||||
#endif
|
||||
@@ -2582,4 +2579,4 @@ m4_if(b4_prefix, [yy], [],
|
||||
#define yylloc ]b4_prefix[lloc]])])[
|
||||
|
||||
]b4_epilogue[]dnl
|
||||
b4_output_end()
|
||||
b4_output_end
|
||||
|
||||
+17
-14
@@ -1,6 +1,6 @@
|
||||
# C++ GLR skeleton for Bison
|
||||
|
||||
# Copyright (C) 2002-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -177,7 +177,7 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
||||
| Print this symbol. |
|
||||
`--------------------*/
|
||||
|
||||
inline void
|
||||
void
|
||||
]b4_parser_class_name[::yy_symbol_value_print_ (int yytype,
|
||||
const semantic_type* yyvaluep]b4_locations_if([[,
|
||||
const location_type* yylocationp]])[)
|
||||
@@ -234,25 +234,28 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
||||
b4_namespace_close
|
||||
])
|
||||
|
||||
# b4_shared_declarations
|
||||
# ----------------------
|
||||
# Declaration that might either go into the header (if --defines)
|
||||
# or open coded in the parser body.
|
||||
|
||||
# b4_shared_declarations(hh|cc)
|
||||
# -----------------------------
|
||||
# Declaration that might either go into the header (if --defines, $1 = hh)
|
||||
# or in the implementation file.
|
||||
m4_define([b4_shared_declarations],
|
||||
[m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
||||
b4_percent_code_get([[requires]])[
|
||||
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <iostream>]b4_defines_if([
|
||||
b4_bison_locations_if([[#include "location.hh"]])])[
|
||||
|
||||
]m4_ifdef([b4_location_file],
|
||||
[[# include ]b4_location_include])[
|
||||
|
||||
]b4_null_define[
|
||||
|
||||
]b4_YYDEBUG_define[
|
||||
|
||||
]b4_namespace_open[
|
||||
]b4_defines_if([],
|
||||
[b4_bison_locations_if([b4_position_define
|
||||
b4_location_define])])[
|
||||
]b4_bison_locations_if([m4_ifndef([b4_location_file],
|
||||
[b4_location_define])])[
|
||||
|
||||
/// A Bison parser.
|
||||
class ]b4_parser_class_name[
|
||||
@@ -329,14 +332,14 @@ b4_percent_define_flag_if([[global_tokens_and_yystype]],
|
||||
b4_defines_if(
|
||||
[b4_output_begin([b4_spec_defines_file])
|
||||
b4_copyright([Skeleton interface for Bison GLR parsers in C++],
|
||||
[2002-2015])[
|
||||
[2002-2015, 2018])[
|
||||
|
||||
// C++ GLR parser skeleton written by Akim Demaille.
|
||||
|
||||
]b4_cpp_guard_open([b4_spec_defines_file])[
|
||||
]b4_shared_declarations[
|
||||
]b4_cpp_guard_close([b4_spec_defines_file])[
|
||||
]b4_output_end()])
|
||||
]b4_output_end])
|
||||
|
||||
# Let glr.c (and b4_shared_declarations) believe that the user
|
||||
# arguments include the parser itself.
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
# Java skeleton dispatching for Bison.
|
||||
|
||||
# Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2007, 2009-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
# Java language support for Bison
|
||||
|
||||
# Copyright (C) 2007-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
||||
+143
-105
@@ -1,6 +1,6 @@
|
||||
# C++ skeleton for Bison
|
||||
|
||||
# Copyright (C) 2002-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -20,6 +20,7 @@ m4_include(b4_pkgdatadir/[c++.m4])
|
||||
# api.value.type=variant is valid.
|
||||
m4_define([b4_value_type_setup_variant])
|
||||
|
||||
|
||||
# b4_integral_parser_table_declare(TABLE-NAME, CONTENT, COMMENT)
|
||||
# --------------------------------------------------------------
|
||||
# Declare "parser::yy<TABLE-NAME>_" whose contents is CONTENT.
|
||||
@@ -83,9 +84,14 @@ m4_define([b4_rhs_state],
|
||||
# --------------------------------------
|
||||
# Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
|
||||
# symbols on RHS.
|
||||
m4_define([b4_rhs_value],
|
||||
m4_define([_b4_rhs_value],
|
||||
[b4_symbol_value([b4_rhs_data([$1], [$2]).value], [$3])])
|
||||
|
||||
m4_define([b4_rhs_value],
|
||||
[b4_percent_define_ifdef([api.value.automove],
|
||||
[YY_MOVE (_b4_rhs_value($@))],
|
||||
[_b4_rhs_value($@)])])
|
||||
|
||||
|
||||
# b4_rhs_location(RULE-LENGTH, NUM)
|
||||
# ---------------------------------
|
||||
@@ -106,8 +112,8 @@ b4_dollar_pushdef([yysym.value],
|
||||
b4_symbol_if([$1], [has_type],
|
||||
[m4_dquote(b4_symbol([$1], [type]))]),
|
||||
[yysym.location])dnl
|
||||
b4_symbol_case_([$1])
|
||||
b4_syncline([b4_symbol([$1], [$2_line])], ["b4_symbol([$1], [$2_file])"])
|
||||
_b4_symbol_case([$1])
|
||||
b4_syncline([b4_symbol([$1], [$2_line])], [b4_symbol([$1], [$2_file])])
|
||||
b4_symbol([$1], [$2])
|
||||
b4_syncline([@oline@], [@ofile@])
|
||||
break;
|
||||
@@ -131,7 +137,7 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))])])
|
||||
|
||||
|
||||
m4_pushdef([b4_copyright_years],
|
||||
[2002-2015])
|
||||
[2002-2015, 2018])
|
||||
|
||||
m4_define([b4_parser_class_name],
|
||||
[b4_percent_define_get([[parser_class_name]])])
|
||||
@@ -142,30 +148,35 @@ b4_bison_locations_if([# Backward compatibility.
|
||||
m4_include(b4_pkgdatadir/[stack.hh])
|
||||
b4_variant_if([m4_include(b4_pkgdatadir/[variant.hh])])
|
||||
|
||||
# b4_shared_declarations
|
||||
# ----------------------
|
||||
# Declaration that might either go into the header (if --defines)
|
||||
# or open coded in the parser body.
|
||||
|
||||
# b4_shared_declarations(hh|cc)
|
||||
# -----------------------------
|
||||
# Declaration that might either go into the header (if --defines, $1 = hh)
|
||||
# or in the implementation file.
|
||||
m4_define([b4_shared_declarations],
|
||||
[b4_percent_code_get([[requires]])[
|
||||
]b4_parse_assert_if([# include <cassert>])[
|
||||
# include <vector>
|
||||
# include <cstdlib> // std::abort
|
||||
# include <iostream>
|
||||
# include <stdexcept>
|
||||
# include <string>]b4_defines_if([[
|
||||
# include "stack.hh"
|
||||
]b4_bison_locations_if([[# include "location.hh"]])])[
|
||||
# include <string>
|
||||
# include <vector>
|
||||
|
||||
]b4_cxx_portability[
|
||||
]m4_ifdef([b4_location_include],
|
||||
[[# include ]b4_location_include])[
|
||||
]b4_variant_if([b4_variant_includes])[
|
||||
|
||||
]b4_attribute_define[
|
||||
]b4_null_define[
|
||||
|
||||
]b4_YYDEBUG_define[
|
||||
|
||||
]b4_namespace_open[
|
||||
|
||||
]b4_defines_if([],
|
||||
[b4_stack_define
|
||||
b4_bison_locations_if([b4_position_define
|
||||
b4_location_define])])[
|
||||
]b4_stack_define[
|
||||
]b4_bison_locations_if([m4_ifndef([b4_location_file],
|
||||
[b4_location_define])])[
|
||||
|
||||
]b4_variant_if([b4_variant_define])[
|
||||
|
||||
@@ -174,6 +185,7 @@ b4_location_define])])[
|
||||
{
|
||||
public:
|
||||
]b4_public_types_declare[
|
||||
]b4_symbol_type_declare[
|
||||
/// Build a parser object.
|
||||
]b4_parser_class_name[ (]b4_parse_param_decl[);
|
||||
virtual ~]b4_parser_class_name[ ();
|
||||
@@ -204,6 +216,8 @@ b4_location_define])])[
|
||||
/// Report a syntax error.
|
||||
void error (const syntax_error& err);
|
||||
|
||||
]b4_symbol_constructor_declare[
|
||||
|
||||
private:
|
||||
/// This class is not copyable.
|
||||
]b4_parser_class_name[ (const ]b4_parser_class_name[&);
|
||||
@@ -313,10 +327,14 @@ b4_location_define])])[
|
||||
typedef basic_symbol<by_state> super_type;
|
||||
/// Construct an empty symbol.
|
||||
stack_symbol_type ();
|
||||
/// Move or copy construction.
|
||||
stack_symbol_type (YY_RVREF (stack_symbol_type) that);
|
||||
/// Steal the contents from \a sym to build this.
|
||||
stack_symbol_type (state_type s, symbol_type& sym);
|
||||
/// Assignment, needed by push_back.
|
||||
stack_symbol_type& operator= (const stack_symbol_type& that);
|
||||
stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) sym);
|
||||
#if defined __cplusplus && __cplusplus < 201103L
|
||||
/// Assignment, needed by push_back by some old implementations.
|
||||
stack_symbol_type& operator= (YY_MOVE_REF (stack_symbol_type) that);
|
||||
#endif
|
||||
};
|
||||
|
||||
/// Stack type.
|
||||
@@ -328,20 +346,20 @@ b4_location_define])])[
|
||||
/// Push a new state on the stack.
|
||||
/// \param m a debug message to display
|
||||
/// if null, no trace is output.
|
||||
/// \param s the symbol
|
||||
/// \param sym the symbol
|
||||
/// \warning the contents of \a s.value is stolen.
|
||||
void yypush_ (const char* m, stack_symbol_type& s);
|
||||
void yypush_ (const char* m, YY_MOVE_REF (stack_symbol_type) sym);
|
||||
|
||||
/// Push a new look ahead token on the state on the stack.
|
||||
/// \param m a debug message to display
|
||||
/// if null, no trace is output.
|
||||
/// \param s the state
|
||||
/// \param sym the symbol (for its value and location).
|
||||
/// \warning the contents of \a s.value is stolen.
|
||||
void yypush_ (const char* m, state_type s, symbol_type& sym);
|
||||
/// \warning the contents of \a sym.value is stolen.
|
||||
void yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type) sym);
|
||||
|
||||
/// Pop \a n symbols the three stacks.
|
||||
void yypop_ (unsigned int n = 1);
|
||||
void yypop_ (unsigned n = 1);
|
||||
|
||||
/// Constants.
|
||||
enum
|
||||
@@ -358,8 +376,8 @@ b4_location_define])])[
|
||||
]b4_parse_param_vars[
|
||||
};
|
||||
|
||||
]b4_token_ctor_if([b4_yytranslate_define
|
||||
b4_public_types_define])[
|
||||
]b4_token_ctor_if([b4_yytranslate_define([$1])[
|
||||
]b4_public_types_define([$1])])[
|
||||
]b4_namespace_close[
|
||||
|
||||
]b4_percent_define_flag_if([[global_tokens_and_yystype]],
|
||||
@@ -385,9 +403,9 @@ b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++])
|
||||
// C++ LALR(1) parser skeleton written by Akim Demaille.
|
||||
|
||||
]b4_cpp_guard_open([b4_spec_defines_file])[
|
||||
]b4_shared_declarations[
|
||||
]b4_shared_declarations(hh)[
|
||||
]b4_cpp_guard_close([b4_spec_defines_file])
|
||||
b4_output_end()
|
||||
b4_output_end
|
||||
])
|
||||
|
||||
|
||||
@@ -397,15 +415,13 @@ b4_percent_code_get([[top]])[]dnl
|
||||
m4_if(b4_prefix, [yy], [],
|
||||
[
|
||||
// Take the name prefix into account.
|
||||
#define yylex b4_prefix[]lex])[
|
||||
[#]define yylex b4_prefix[]lex])[
|
||||
|
||||
// First part of user declarations.
|
||||
]b4_user_pre_prologue[
|
||||
|
||||
]b4_null_define[
|
||||
|
||||
]b4_defines_if([[#include "@basename(]b4_spec_defines_file[@)"]],
|
||||
[b4_shared_declarations])[
|
||||
[b4_shared_declarations([cc])])[
|
||||
|
||||
// User implementation prologue.
|
||||
]b4_user_post_prologue[
|
||||
@@ -423,6 +439,15 @@ m4_if(b4_prefix, [yy], [],
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Whether we are compiled with exception support.
|
||||
#ifndef YY_EXCEPTIONS
|
||||
# if defined __GNUC__ && !defined __EXCEPTIONS
|
||||
# define YY_EXCEPTIONS 0
|
||||
# else
|
||||
# define YY_EXCEPTIONS 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
]b4_locations_if([dnl
|
||||
[#define YYRHSLOC(Rhs, K) ((Rhs)[K].location)
|
||||
]b4_yylloc_default_define])[
|
||||
@@ -442,7 +467,7 @@ m4_if(b4_prefix, [yy], [],
|
||||
{ \
|
||||
*yycdebug_ << Title << ' '; \
|
||||
yy_print_ (*yycdebug_, Symbol); \
|
||||
*yycdebug_ << std::endl; \
|
||||
*yycdebug_ << '\n'; \
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
@@ -461,9 +486,9 @@ m4_if(b4_prefix, [yy], [],
|
||||
#else // !]b4_api_PREFIX[DEBUG
|
||||
|
||||
# define YYCDEBUG if (false) std::cerr
|
||||
# define YY_SYMBOL_PRINT(Title, Symbol) YYUSE(Symbol)
|
||||
# define YY_REDUCE_PRINT(Rule) static_cast<void>(0)
|
||||
# define YY_STACK_PRINT() static_cast<void>(0)
|
||||
# define YY_SYMBOL_PRINT(Title, Symbol) YYUSE (Symbol)
|
||||
# define YY_REDUCE_PRINT(Rule) static_cast<void> (0)
|
||||
# define YY_STACK_PRINT() static_cast<void> (0)
|
||||
|
||||
#endif // !]b4_api_PREFIX[DEBUG
|
||||
|
||||
@@ -532,27 +557,23 @@ m4_if(b4_prefix, [yy], [],
|
||||
| Symbol types. |
|
||||
`---------------*/
|
||||
|
||||
]b4_token_ctor_if([], [b4_public_types_define])[
|
||||
]b4_token_ctor_if([], [b4_public_types_define([cc])])[
|
||||
|
||||
// by_state.
|
||||
inline
|
||||
]b4_parser_class_name[::by_state::by_state ()
|
||||
: state (empty_state)
|
||||
{}
|
||||
|
||||
inline
|
||||
]b4_parser_class_name[::by_state::by_state (const by_state& other)
|
||||
: state (other.state)
|
||||
{}
|
||||
|
||||
inline
|
||||
void
|
||||
]b4_parser_class_name[::by_state::clear ()
|
||||
{
|
||||
state = empty_state;
|
||||
}
|
||||
|
||||
inline
|
||||
void
|
||||
]b4_parser_class_name[::by_state::move (by_state& that)
|
||||
{
|
||||
@@ -560,49 +581,52 @@ m4_if(b4_prefix, [yy], [],
|
||||
that.clear ();
|
||||
}
|
||||
|
||||
inline
|
||||
]b4_parser_class_name[::by_state::by_state (state_type s)
|
||||
: state (s)
|
||||
{}
|
||||
|
||||
inline
|
||||
]b4_parser_class_name[::symbol_number_type
|
||||
]b4_parser_class_name[::by_state::type_get () const
|
||||
{
|
||||
return state == empty_state ? empty_symbol : yystos_[state];
|
||||
if (state == empty_state)
|
||||
return empty_symbol;
|
||||
else
|
||||
return yystos_[state];
|
||||
}
|
||||
|
||||
inline
|
||||
]b4_parser_class_name[::stack_symbol_type::stack_symbol_type ()
|
||||
{}
|
||||
|
||||
]b4_parser_class_name[::stack_symbol_type::stack_symbol_type (YY_RVREF (stack_symbol_type) that)
|
||||
: super_type (YY_MOVE (that.state)]b4_variant_if([], [, YY_MOVE (that.value)])b4_locations_if([, YY_MOVE (that.location)])[)
|
||||
{]b4_variant_if([
|
||||
b4_symbol_variant([that.type_get ()],
|
||||
[value], [YY_MOVE_OR_COPY], [YY_MOVE (that.value)])])[
|
||||
}
|
||||
|
||||
inline
|
||||
]b4_parser_class_name[::stack_symbol_type::stack_symbol_type (state_type s, symbol_type& that)
|
||||
: super_type (s]b4_locations_if([, that.location])[)
|
||||
{
|
||||
]b4_variant_if([b4_symbol_variant([that.type_get ()],
|
||||
[value], [move], [that.value])],
|
||||
[[value = that.value;]])[
|
||||
]b4_parser_class_name[::stack_symbol_type::stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) that)
|
||||
: super_type (s]b4_variant_if([], [, YY_MOVE (that.value)])[]b4_locations_if([, YY_MOVE (that.location)])[)
|
||||
{]b4_variant_if([
|
||||
b4_symbol_variant([that.type_get ()],
|
||||
[value], [move], [YY_MOVE (that.value)])])[
|
||||
// that is emptied.
|
||||
that.type = empty_symbol;
|
||||
}
|
||||
|
||||
inline
|
||||
#if defined __cplusplus && __cplusplus < 201103L
|
||||
]b4_parser_class_name[::stack_symbol_type&
|
||||
]b4_parser_class_name[::stack_symbol_type::operator= (const stack_symbol_type& that)
|
||||
]b4_parser_class_name[::stack_symbol_type::operator= (YY_MOVE_REF (stack_symbol_type) that)
|
||||
{
|
||||
state = that.state;
|
||||
]b4_variant_if([b4_symbol_variant([that.type_get ()],
|
||||
[value], [copy], [that.value])],
|
||||
[[value = that.value;]])[]b4_locations_if([
|
||||
location = that.location;])[
|
||||
[value], [move], [YY_MOVE (that.value)])],
|
||||
[[value = YY_MOVE (that.value);]])[]b4_locations_if([
|
||||
location = YY_MOVE (that.location);])[
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
template <typename Base>
|
||||
inline
|
||||
void
|
||||
]b4_parser_class_name[::yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const
|
||||
{
|
||||
@@ -622,6 +646,10 @@ m4_if(b4_prefix, [yy], [],
|
||||
std::ostream& yyoutput = yyo;
|
||||
YYUSE (yyoutput);
|
||||
symbol_number_type yytype = yysym.type_get ();
|
||||
// Avoid a (spurious) G++ 4.8 warning about "array subscript is
|
||||
// below array bounds".
|
||||
if (yysym.empty ())
|
||||
std::abort ();
|
||||
yyo << (yytype < yyntokens_ ? "token" : "nterm")
|
||||
<< ' ' << yytname_[yytype] << " ("]b4_locations_if([
|
||||
<< yysym.location << ": "])[;
|
||||
@@ -630,26 +658,27 @@ m4_if(b4_prefix, [yy], [],
|
||||
}
|
||||
#endif
|
||||
|
||||
inline
|
||||
void
|
||||
]b4_parser_class_name[::yypush_ (const char* m, state_type s, symbol_type& sym)
|
||||
{
|
||||
stack_symbol_type t (s, sym);
|
||||
yypush_ (m, t);
|
||||
}
|
||||
|
||||
inline
|
||||
void
|
||||
]b4_parser_class_name[::yypush_ (const char* m, stack_symbol_type& s)
|
||||
]b4_parser_class_name[::yypush_ (const char* m, YY_MOVE_REF (stack_symbol_type) sym)
|
||||
{
|
||||
if (m)
|
||||
YY_SYMBOL_PRINT (m, s);
|
||||
yystack_.push (s);
|
||||
YY_SYMBOL_PRINT (m, sym);
|
||||
yystack_.push (YY_MOVE (sym));
|
||||
}
|
||||
|
||||
inline
|
||||
void
|
||||
]b4_parser_class_name[::yypop_ (unsigned int n)
|
||||
]b4_parser_class_name[::yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type) sym)
|
||||
{
|
||||
#if defined __cplusplus && 201103L <= __cplusplus
|
||||
yypush_ (m, stack_symbol_type (s, YY_MOVE (sym)));
|
||||
#else
|
||||
stack_symbol_type ss (s, sym);
|
||||
yypush_ (m, ss);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
]b4_parser_class_name[::yypop_ (unsigned n)
|
||||
{
|
||||
yystack_.pop (n);
|
||||
}
|
||||
@@ -681,7 +710,7 @@ m4_if(b4_prefix, [yy], [],
|
||||
}
|
||||
#endif // ]b4_api_PREFIX[DEBUG
|
||||
|
||||
inline ]b4_parser_class_name[::state_type
|
||||
]b4_parser_class_name[::state_type
|
||||
]b4_parser_class_name[::yy_lr_goto_state_ (state_type yystate, int yysym)
|
||||
{
|
||||
int yyr = yypgoto_[yysym - yyntokens_] + yystate;
|
||||
@@ -691,13 +720,13 @@ m4_if(b4_prefix, [yy], [],
|
||||
return yydefgoto_[yysym - yyntokens_];
|
||||
}
|
||||
|
||||
inline bool
|
||||
bool
|
||||
]b4_parser_class_name[::yy_pact_value_is_default_ (int yyvalue)
|
||||
{
|
||||
return yyvalue == yypact_ninf_;
|
||||
}
|
||||
|
||||
inline bool
|
||||
bool
|
||||
]b4_parser_class_name[::yy_table_value_is_error_ (int yyvalue)
|
||||
{
|
||||
return yyvalue == yytable_ninf_;
|
||||
@@ -724,11 +753,11 @@ m4_if(b4_prefix, [yy], [],
|
||||
/// The return value of parse ().
|
||||
int yyresult;
|
||||
|
||||
// FIXME: This shoud be completely indented. It is not yet to
|
||||
// avoid gratuitous conflicts when merging into the master branch.
|
||||
#if YY_EXCEPTIONS
|
||||
try
|
||||
#endif // YY_EXCEPTIONS
|
||||
{
|
||||
YYCDEBUG << "Starting parse" << std::endl;
|
||||
YYCDEBUG << "Starting parse\n";
|
||||
|
||||
]m4_ifdef([b4_initial_action], [
|
||||
b4_dollar_pushdef([yyla.value], [], [yyla.location])dnl
|
||||
@@ -741,11 +770,11 @@ b4_dollar_popdef])[]dnl
|
||||
location values to have been already stored, initialize these
|
||||
stacks with a primary value. */
|
||||
yystack_.clear ();
|
||||
yypush_ (YY_NULLPTR, 0, yyla);
|
||||
yypush_ (YY_NULLPTR, 0, YY_MOVE (yyla));
|
||||
|
||||
// A new symbol was pushed on the stack.
|
||||
yynewstate:
|
||||
YYCDEBUG << "Entering state " << yystack_[0].state << std::endl;
|
||||
YYCDEBUG << "Entering state " << yystack_[0].state << '\n';
|
||||
|
||||
// Accept?
|
||||
if (yystack_[0].state == yyfinal_)
|
||||
@@ -755,7 +784,6 @@ b4_dollar_popdef])[]dnl
|
||||
|
||||
// Backup.
|
||||
yybackup:
|
||||
|
||||
// Try to take a decision without lookahead.
|
||||
yyn = yypact_[yystack_[0].state];
|
||||
if (yy_pact_value_is_default_ (yyn))
|
||||
@@ -765,17 +793,21 @@ b4_dollar_popdef])[]dnl
|
||||
if (yyla.empty ())
|
||||
{
|
||||
YYCDEBUG << "Reading a token: ";
|
||||
#if YY_EXCEPTIONS
|
||||
try
|
||||
#endif // YY_EXCEPTIONS
|
||||
{]b4_token_ctor_if([[
|
||||
symbol_type yylookahead (]b4_lex[);
|
||||
yyla.move (yylookahead);]], [[
|
||||
yyla.type = yytranslate_ (]b4_lex[);]])[
|
||||
}
|
||||
#if YY_EXCEPTIONS
|
||||
catch (const syntax_error& yyexc)
|
||||
{
|
||||
error (yyexc);
|
||||
goto yyerrlab1;
|
||||
}
|
||||
#endif // YY_EXCEPTIONS
|
||||
}
|
||||
YY_SYMBOL_PRINT ("Next token is", yyla);
|
||||
|
||||
@@ -800,7 +832,7 @@ b4_dollar_popdef])[]dnl
|
||||
--yyerrstatus_;
|
||||
|
||||
// Shift the lookahead token.
|
||||
yypush_ ("Shifting", yyn, yyla);
|
||||
yypush_ ("Shifting", yyn, YY_MOVE (yyla));
|
||||
goto yynewstate;
|
||||
|
||||
/*-----------------------------------------------------------.
|
||||
@@ -819,7 +851,7 @@ b4_dollar_popdef])[]dnl
|
||||
yylen = yyr2_[yyn];
|
||||
{
|
||||
stack_symbol_type yylhs;
|
||||
yylhs.state = yy_lr_goto_state_(yystack_[yylen].state, yyr1_[yyn]);]b4_variant_if([
|
||||
yylhs.state = yy_lr_goto_state_ (yystack_[yylen].state, yyr1_[yyn]);]b4_variant_if([
|
||||
/* Variants are always initialized to an empty instance of the
|
||||
correct type. The default '$$ = $1' action is NOT applied
|
||||
when using variants. */
|
||||
@@ -836,15 +868,18 @@ b4_dollar_popdef])[]dnl
|
||||
yylhs.value = yystack_@{0@}.value;])[
|
||||
]b4_locations_if([dnl
|
||||
[
|
||||
// Compute the default @@$.
|
||||
// Default location.
|
||||
{
|
||||
slice<stack_symbol_type, stack_type> slice (yystack_, yylen);
|
||||
YYLLOC_DEFAULT (yylhs.location, slice, yylen);
|
||||
yyerror_range[1].location = yylhs.location;
|
||||
}]])[
|
||||
|
||||
// Perform the reduction.
|
||||
YY_REDUCE_PRINT (yyn);
|
||||
#if YY_EXCEPTIONS
|
||||
try
|
||||
#endif // YY_EXCEPTIONS
|
||||
{
|
||||
switch (yyn)
|
||||
{
|
||||
@@ -853,18 +888,20 @@ b4_dollar_popdef])[]dnl
|
||||
break;
|
||||
}
|
||||
}
|
||||
#if YY_EXCEPTIONS
|
||||
catch (const syntax_error& yyexc)
|
||||
{
|
||||
error (yyexc);
|
||||
YYERROR;
|
||||
}
|
||||
#endif // YY_EXCEPTIONS
|
||||
YY_SYMBOL_PRINT ("-> $$ =", yylhs);
|
||||
yypop_ (yylen);
|
||||
yylen = 0;
|
||||
YY_STACK_PRINT ();
|
||||
|
||||
// Shift the result of the reduction.
|
||||
yypush_ (YY_NULLPTR, yylhs);
|
||||
yypush_ (YY_NULLPTR, YY_MOVE (yylhs));
|
||||
}
|
||||
goto yynewstate;
|
||||
|
||||
@@ -910,8 +947,7 @@ b4_dollar_popdef])[]dnl
|
||||
YYERROR and the label yyerrorlab therefore never appears in user
|
||||
code. */
|
||||
if (false)
|
||||
goto yyerrorlab;]b4_locations_if([[
|
||||
yyerror_range[1].location = yystack_[yylen - 1].location;]])[
|
||||
goto yyerrorlab;
|
||||
/* Do not reclaim the symbols of the rule whose action triggered
|
||||
this YYERROR. */
|
||||
yypop_ (yylen);
|
||||
@@ -954,7 +990,7 @@ b4_dollar_popdef])[]dnl
|
||||
|
||||
// Shift the error token.
|
||||
error_token.state = yyn;
|
||||
yypush_ ("Shifting", error_token);
|
||||
yypush_ ("Shifting", YY_MOVE (error_token));
|
||||
}
|
||||
goto yynewstate;
|
||||
|
||||
@@ -983,12 +1019,12 @@ b4_dollar_popdef])[]dnl
|
||||
|
||||
return yyresult;
|
||||
}
|
||||
#if YY_EXCEPTIONS
|
||||
catch (...)
|
||||
{
|
||||
YYCDEBUG << "Exception caught: cleaning lookahead and stack"
|
||||
<< std::endl;
|
||||
YYCDEBUG << "Exception caught: cleaning lookahead and stack\n";
|
||||
// Do not try to display the values of the reclaimed symbols,
|
||||
// as their printer might throw an exception.
|
||||
// as their printers might throw an exception.
|
||||
if (!yyla.empty ())
|
||||
yy_destroy_ (YY_NULLPTR, yyla);
|
||||
|
||||
@@ -999,13 +1035,14 @@ b4_dollar_popdef])[]dnl
|
||||
}
|
||||
throw;
|
||||
}
|
||||
#endif // YY_EXCEPTIONS
|
||||
}
|
||||
|
||||
void
|
||||
]b4_parser_class_name[::error (const syntax_error& yyexc)
|
||||
{
|
||||
error (]b4_join(b4_locations_if([yyexc.location]),
|
||||
[[yyexc.what()]])[);
|
||||
[[yyexc.what ()]])[);
|
||||
}
|
||||
|
||||
// Generate an error message.
|
||||
@@ -1083,12 +1120,13 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
|
||||
case N: \
|
||||
yyformat = S; \
|
||||
break
|
||||
YYCASE_(0, YY_("syntax error"));
|
||||
YYCASE_(1, YY_("syntax error, unexpected %s"));
|
||||
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
|
||||
YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
|
||||
YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
|
||||
YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
|
||||
default: // Avoid compiler warnings.
|
||||
YYCASE_ (0, YY_("syntax error"));
|
||||
YYCASE_ (1, YY_("syntax error, unexpected %s"));
|
||||
YYCASE_ (2, YY_("syntax error, unexpected %s, expecting %s"));
|
||||
YYCASE_ (3, YY_("syntax error, unexpected %s, expecting %s or %s"));
|
||||
YYCASE_ (4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
|
||||
YYCASE_ (5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
|
||||
#undef YYCASE_
|
||||
}
|
||||
|
||||
@@ -1136,18 +1174,18 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
|
||||
i_end = yystack_.end ();
|
||||
i != i_end; ++i)
|
||||
*yycdebug_ << ' ' << i->state;
|
||||
*yycdebug_ << std::endl;
|
||||
*yycdebug_ << '\n';
|
||||
}
|
||||
|
||||
// Report on the debug stream that the rule \a yyrule is going to be reduced.
|
||||
void
|
||||
]b4_parser_class_name[::yy_reduce_print_ (int yyrule)
|
||||
{
|
||||
unsigned int yylno = yyrline_[yyrule];
|
||||
unsigned yylno = yyrline_[yyrule];
|
||||
int yynrhs = yyr2_[yyrule];
|
||||
// Print the symbols being reduced, and their result.
|
||||
*yycdebug_ << "Reducing stack by rule " << yyrule - 1
|
||||
<< " (line " << yylno << "):" << std::endl;
|
||||
<< " (line " << yylno << "):\n";
|
||||
// The symbols being reduced.
|
||||
for (int yyi = 0; yyi < yynrhs; yyi++)
|
||||
YY_SYMBOL_PRINT (" $" << yyi + 1 << " =",
|
||||
@@ -1155,10 +1193,10 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
|
||||
}
|
||||
#endif // ]b4_api_PREFIX[DEBUG
|
||||
|
||||
]b4_token_ctor_if([], [b4_yytranslate_define])[
|
||||
]b4_token_ctor_if([], [b4_yytranslate_define([cc])])[
|
||||
]b4_namespace_close[
|
||||
]b4_epilogue[]dnl
|
||||
b4_output_end()
|
||||
b4_output_end
|
||||
|
||||
|
||||
m4_popdef([b4_copyright_years])dnl
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
# Java skeleton for Bison -*- autoconf -*-
|
||||
|
||||
# Copyright (C) 2007-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -84,7 +84,7 @@ m4_define([b4_define_state],[[
|
||||
|
||||
b4_output_begin([b4_parser_file_name])
|
||||
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java],
|
||||
[2007-2015])
|
||||
[2007-2015, 2018])
|
||||
|
||||
b4_percent_define_ifdef([package], [package b4_percent_define_get([package]);
|
||||
])[/* First part of user declarations. */
|
||||
@@ -1068,4 +1068,4 @@ b4_percent_code_get[]dnl
|
||||
}
|
||||
|
||||
b4_epilogue[]dnl
|
||||
b4_output_end()
|
||||
b4_output_end
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
## Copyright (C) 2002, 2005-2015 Free Software Foundation, Inc.
|
||||
## Copyright (C) 2002, 2005-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
## This program is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
|
||||
+88
-65
@@ -1,6 +1,6 @@
|
||||
# C++ skeleton for Bison
|
||||
|
||||
# Copyright (C) 2002-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -16,31 +16,67 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
m4_pushdef([b4_copyright_years],
|
||||
[2002-2015])
|
||||
[2002-2015, 2018])
|
||||
|
||||
# b4_position_define
|
||||
|
||||
# b4_position_file
|
||||
# ----------------
|
||||
# Name of the file containing the position class, if we want this file.
|
||||
b4_defines_if([b4_required_version_if([302], [],
|
||||
[m4_define([b4_position_file], [position.hh])])])])
|
||||
|
||||
|
||||
# b4_location_file
|
||||
# ----------------
|
||||
# Name of the file containing the position/location class,
|
||||
# if we want this file.
|
||||
b4_percent_define_check_file([b4_location_file],
|
||||
[[api.location.file]],
|
||||
b4_defines_if([[location.hh]]))
|
||||
|
||||
# b4_location_include
|
||||
# -------------------
|
||||
# If location.hh is to be generated, the name under which should it be
|
||||
# included.
|
||||
#
|
||||
# b4_location_path
|
||||
# ----------------
|
||||
# The path to use for the CPP guard.
|
||||
m4_ifdef([b4_location_file],
|
||||
[m4_define([b4_location_include],
|
||||
[b4_percent_define_get([[api.location.include]],
|
||||
["b4_location_file"])])
|
||||
m4_define([b4_location_path],
|
||||
b4_percent_define_get([[api.location.include]],
|
||||
["b4_dir_prefix[]b4_location_file"]))
|
||||
m4_define([b4_location_path],
|
||||
m4_substr(m4_defn([b4_location_path]), 1, m4_eval(m4_len(m4_defn([b4_location_path])) - 2)))
|
||||
])
|
||||
|
||||
|
||||
|
||||
# b4_location_define
|
||||
# ------------------
|
||||
# Define class position.
|
||||
m4_define([b4_position_define],
|
||||
# Define the position and location classes.
|
||||
m4_define([b4_location_define],
|
||||
[[ /// Abstract a position.
|
||||
class position
|
||||
{
|
||||
public:]m4_ifdef([b4_location_constructors], [[
|
||||
/// Construct a position.
|
||||
explicit position (]b4_percent_define_get([[filename_type]])[* f = YY_NULLPTR,
|
||||
unsigned int l = ]b4_location_initial_line[u,
|
||||
unsigned int c = ]b4_location_initial_column[u)
|
||||
unsigned l = ]b4_location_initial_line[u,
|
||||
unsigned c = ]b4_location_initial_column[u)
|
||||
: filename (f)
|
||||
, line (l)
|
||||
, column (c)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
]])[
|
||||
/// Initialization.
|
||||
void initialize (]b4_percent_define_get([[filename_type]])[* fn = YY_NULLPTR,
|
||||
unsigned int l = ]b4_location_initial_line[u,
|
||||
unsigned int c = ]b4_location_initial_column[u)
|
||||
unsigned l = ]b4_location_initial_line[u,
|
||||
unsigned c = ]b4_location_initial_column[u)
|
||||
{
|
||||
filename = fn;
|
||||
line = l;
|
||||
@@ -69,17 +105,16 @@ m4_define([b4_position_define],
|
||||
/// File name to which this position refers.
|
||||
]b4_percent_define_get([[filename_type]])[* filename;
|
||||
/// Current line number.
|
||||
unsigned int line;
|
||||
unsigned line;
|
||||
/// Current column number.
|
||||
unsigned int column;
|
||||
unsigned column;
|
||||
|
||||
private:
|
||||
/// Compute max(min, lhs+rhs) (provided min <= lhs).
|
||||
static unsigned int add_ (unsigned int lhs, int rhs, unsigned int min)
|
||||
/// Compute max (min, lhs+rhs).
|
||||
static unsigned add_ (unsigned lhs, int rhs, int min)
|
||||
{
|
||||
return (0 < rhs || -static_cast<unsigned int>(rhs) < lhs
|
||||
? rhs + lhs
|
||||
: min);
|
||||
return static_cast<unsigned> (std::max (min,
|
||||
static_cast<int> (lhs) + rhs));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -135,20 +170,15 @@ m4_define([b4_position_define],
|
||||
** \param pos a reference to the position to redirect
|
||||
*/
|
||||
template <typename YYChar>
|
||||
inline std::basic_ostream<YYChar>&
|
||||
std::basic_ostream<YYChar>&
|
||||
operator<< (std::basic_ostream<YYChar>& ostr, const position& pos)
|
||||
{
|
||||
if (pos.filename)
|
||||
ostr << *pos.filename << ':';
|
||||
return ostr << pos.line << '.' << pos.column;
|
||||
}
|
||||
]])
|
||||
|
||||
|
||||
# b4_location_define
|
||||
# ------------------
|
||||
m4_define([b4_location_define],
|
||||
[[ /// Abstract a location.
|
||||
/// Abstract a location.
|
||||
class location
|
||||
{
|
||||
public:
|
||||
@@ -157,30 +187,27 @@ m4_define([b4_location_define],
|
||||
location (const position& b, const position& e)
|
||||
: begin (b)
|
||||
, end (e)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
/// Construct a 0-width location in \a p.
|
||||
explicit location (const position& p = position ())
|
||||
: begin (p)
|
||||
, end (p)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
/// Construct a 0-width location in \a f, \a l, \a c.
|
||||
explicit location (]b4_percent_define_get([[filename_type]])[* f,
|
||||
unsigned int l = ]b4_location_initial_line[u,
|
||||
unsigned int c = ]b4_location_initial_column[u)
|
||||
unsigned l = ]b4_location_initial_line[u,
|
||||
unsigned c = ]b4_location_initial_column[u)
|
||||
: begin (f, l, c)
|
||||
, end (f, l, c)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
])[
|
||||
/// Initialization.
|
||||
void initialize (]b4_percent_define_get([[filename_type]])[* f = YY_NULLPTR,
|
||||
unsigned int l = ]b4_location_initial_line[u,
|
||||
unsigned int c = ]b4_location_initial_column[u)
|
||||
unsigned l = ]b4_location_initial_line[u,
|
||||
unsigned c = ]b4_location_initial_column[u)
|
||||
{
|
||||
begin.initialize (f, l, c);
|
||||
end = begin;
|
||||
@@ -275,10 +302,10 @@ m4_define([b4_location_define],
|
||||
** Avoid duplicate information.
|
||||
*/
|
||||
template <typename YYChar>
|
||||
inline std::basic_ostream<YYChar>&
|
||||
std::basic_ostream<YYChar>&
|
||||
operator<< (std::basic_ostream<YYChar>& ostr, const location& loc)
|
||||
{
|
||||
unsigned int end_col = 0 < loc.end.column ? loc.end.column - 1 : 0;
|
||||
unsigned end_col = 0 < loc.end.column ? loc.end.column - 1 : 0;
|
||||
ostr << loc.begin;
|
||||
if (loc.end.filename
|
||||
&& (!loc.begin.filename
|
||||
@@ -293,16 +320,31 @@ m4_define([b4_location_define],
|
||||
]])
|
||||
|
||||
|
||||
b4_defines_if([
|
||||
b4_output_begin([b4_dir_prefix[]position.hh])
|
||||
b4_copyright([Positions for Bison parsers in C++])[
|
||||
m4_ifdef([b4_position_file], [[
|
||||
]b4_output_begin([b4_dir_prefix], [b4_position_file])[
|
||||
// Starting with Bison 3.2, this file is useless: the structure it
|
||||
// used to define is now defined in "]b4_location_file[".
|
||||
//
|
||||
// To get rid of this file:
|
||||
// 1. add 'require "3.2"' (or newer) to your grammar file
|
||||
// 2. remove references to this file from your build system
|
||||
// 3. if you used to include it, include "]b4_location_file[" instead.
|
||||
|
||||
#include ]b4_location_include[
|
||||
]b4_output_end[
|
||||
]])
|
||||
|
||||
|
||||
m4_ifdef([b4_location_file], [[
|
||||
]b4_output_begin([b4_dir_prefix], [b4_location_file])[
|
||||
]b4_copyright([Locations for Bison parsers in C++])[
|
||||
|
||||
/**
|
||||
** \file ]b4_dir_prefix[position.hh
|
||||
** Define the ]b4_namespace_ref[::position class.
|
||||
** \file ]b4_location_path[
|
||||
** Define the ]b4_namespace_ref[::location class.
|
||||
*/
|
||||
|
||||
]b4_cpp_guard_open([b4_dir_prefix[]position.hh])[
|
||||
]b4_cpp_guard_open([b4_location_path])[
|
||||
|
||||
# include <algorithm> // std::max
|
||||
# include <iostream>
|
||||
@@ -310,31 +352,12 @@ b4_copyright([Positions for Bison parsers in C++])[
|
||||
|
||||
]b4_null_define[
|
||||
|
||||
]b4_namespace_open[
|
||||
]b4_position_define[
|
||||
]b4_namespace_close[
|
||||
]b4_cpp_guard_close([b4_dir_prefix[]position.hh])
|
||||
b4_output_end()
|
||||
|
||||
|
||||
b4_output_begin([b4_dir_prefix[]location.hh])
|
||||
b4_copyright([Locations for Bison parsers in C++])[
|
||||
|
||||
/**
|
||||
** \file ]b4_dir_prefix[location.hh
|
||||
** Define the ]b4_namespace_ref[::location class.
|
||||
*/
|
||||
|
||||
]b4_cpp_guard_open([b4_dir_prefix[]location.hh])[
|
||||
|
||||
# include "position.hh"
|
||||
|
||||
]b4_namespace_open[
|
||||
]b4_location_define[
|
||||
]b4_namespace_close[
|
||||
]b4_cpp_guard_close([b4_dir_prefix[]location.hh])
|
||||
b4_output_end()
|
||||
])
|
||||
]b4_cpp_guard_close([b4_location_path])[
|
||||
]b4_output_end[
|
||||
]])
|
||||
|
||||
|
||||
m4_popdef([b4_copyright_years])
|
||||
|
||||
+41
-49
@@ -1,6 +1,6 @@
|
||||
# C++ skeleton for Bison
|
||||
|
||||
# Copyright (C) 2002-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -15,40 +15,50 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
m4_pushdef([b4_copyright_years],
|
||||
[2002-2015])
|
||||
|
||||
# b4_stack_file
|
||||
# -------------
|
||||
# Name of the file containing the stack class, if we want this file.
|
||||
b4_defines_if([b4_required_version_if([302], [],
|
||||
[m4_define([b4_stack_file], [stack.hh])])])
|
||||
|
||||
|
||||
# b4_stack_define
|
||||
# ---------------
|
||||
m4_define([b4_stack_define],
|
||||
[[ template <class T, class S = std::vector<T> >
|
||||
[[ /// A stack with random access from its top.
|
||||
template <class T, class S = std::vector<T> >
|
||||
class stack
|
||||
{
|
||||
public:
|
||||
// Hide our reversed order.
|
||||
typedef typename S::reverse_iterator iterator;
|
||||
typedef typename S::const_reverse_iterator const_iterator;
|
||||
typedef typename S::size_type size_type;
|
||||
|
||||
stack ()
|
||||
: seq_ ()
|
||||
{
|
||||
seq_.reserve (200);
|
||||
}
|
||||
|
||||
stack (unsigned int n)
|
||||
stack (size_type n)
|
||||
: seq_ (n)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
inline
|
||||
/// Random access.
|
||||
///
|
||||
/// Index 0 returns the topmost element.
|
||||
T&
|
||||
operator[] (unsigned int i)
|
||||
operator[] (size_type i)
|
||||
{
|
||||
return seq_[seq_.size () - 1 - i];
|
||||
}
|
||||
|
||||
inline
|
||||
/// Random access.
|
||||
///
|
||||
/// Index 0 returns the topmost element.
|
||||
const T&
|
||||
operator[] (unsigned int i) const
|
||||
operator[] (size_type i) const
|
||||
{
|
||||
return seq_[seq_.size () - 1 - i];
|
||||
}
|
||||
@@ -56,17 +66,15 @@ m4_define([b4_stack_define],
|
||||
/// Steal the contents of \a t.
|
||||
///
|
||||
/// Close to move-semantics.
|
||||
inline
|
||||
void
|
||||
push (T& t)
|
||||
push (YY_MOVE_REF (T) t)
|
||||
{
|
||||
seq_.push_back (T());
|
||||
seq_.push_back (T ());
|
||||
operator[](0).move (t);
|
||||
}
|
||||
|
||||
inline
|
||||
void
|
||||
pop (unsigned int n = 1)
|
||||
pop (size_type n = 1)
|
||||
{
|
||||
for (; n; --n)
|
||||
seq_.pop_back ();
|
||||
@@ -78,21 +86,18 @@ m4_define([b4_stack_define],
|
||||
seq_.clear ();
|
||||
}
|
||||
|
||||
inline
|
||||
typename S::size_type
|
||||
size_type
|
||||
size () const
|
||||
{
|
||||
return seq_.size ();
|
||||
}
|
||||
|
||||
inline
|
||||
const_iterator
|
||||
begin () const
|
||||
{
|
||||
return seq_.rbegin ();
|
||||
}
|
||||
|
||||
inline
|
||||
const_iterator
|
||||
end () const
|
||||
{
|
||||
@@ -111,44 +116,31 @@ m4_define([b4_stack_define],
|
||||
class slice
|
||||
{
|
||||
public:
|
||||
slice (const S& stack, unsigned int range)
|
||||
typedef typename S::size_type size_type;
|
||||
slice (const S& stack, size_type range)
|
||||
: stack_ (stack)
|
||||
, range_ (range)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
inline
|
||||
const T&
|
||||
operator [] (unsigned int i) const
|
||||
operator[] (size_type i) const
|
||||
{
|
||||
return stack_[range_ - i];
|
||||
}
|
||||
|
||||
private:
|
||||
const S& stack_;
|
||||
unsigned int range_;
|
||||
size_type range_;
|
||||
};
|
||||
]])
|
||||
|
||||
b4_defines_if(
|
||||
[b4_output_begin([b4_dir_prefix[]stack.hh])
|
||||
b4_copyright([Stack handling for Bison parsers in C++])[
|
||||
|
||||
/**
|
||||
** \file ]b4_dir_prefix[stack.hh
|
||||
** Define the ]b4_namespace_ref[::stack class.
|
||||
*/
|
||||
|
||||
]b4_cpp_guard_open([b4_dir_prefix[]stack.hh])[
|
||||
|
||||
# include <vector>
|
||||
|
||||
]b4_namespace_open[
|
||||
]b4_stack_define[
|
||||
]b4_namespace_close[
|
||||
|
||||
]b4_cpp_guard_close([b4_dir_prefix[]stack.hh])
|
||||
b4_output_end()
|
||||
])
|
||||
|
||||
m4_popdef([b4_copyright_years])
|
||||
m4_ifdef([b4_stack_file],
|
||||
[b4_output_begin([b4_dir_prefix], [b4_stack_file])[
|
||||
// Starting with Bison 3.2, this file is useless: the structure it
|
||||
// used to define is now defined with the parser itself.
|
||||
//
|
||||
// To get rid of this file:
|
||||
// 1. add 'require "3.2"' (or newer) to your grammar file
|
||||
// 2. remove references to this file from your build system.
|
||||
]b4_output_end[
|
||||
]])
|
||||
|
||||
+60
-41
@@ -1,6 +1,6 @@
|
||||
# C++ skeleton for Bison
|
||||
|
||||
# Copyright (C) 2002-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -27,9 +27,9 @@
|
||||
m4_define([b4_symbol_variant],
|
||||
[m4_pushdef([b4_dollar_dollar],
|
||||
[$2.$3< $][3 > (m4_shift3($@))])dnl
|
||||
switch ($1)
|
||||
switch ($1)
|
||||
{
|
||||
b4_type_foreach([b4_type_action_])[]dnl
|
||||
b4_type_foreach([_b4_type_action])[]dnl
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -55,15 +55,15 @@ dummy[]_b4_char_sizeof_counter])
|
||||
# ---------------------------
|
||||
# To be mapped on the list of type names to produce:
|
||||
#
|
||||
# char dummy1[sizeof(type_name_1)];
|
||||
# char dummy2[sizeof(type_name_2)];
|
||||
# char dummy1[sizeof (type_name_1)];
|
||||
# char dummy2[sizeof (type_name_2)];
|
||||
#
|
||||
# for defined type names.
|
||||
m4_define([b4_char_sizeof],
|
||||
[b4_symbol_if([$1], [has_type],
|
||||
[
|
||||
m4_map([ b4_symbol_tag_comment], [$@])dnl
|
||||
char _b4_char_sizeof_dummy@{sizeof(b4_symbol([$1], [type]))@};
|
||||
char _b4_char_sizeof_dummy@{sizeof (b4_symbol([$1], [type]))@};
|
||||
])])
|
||||
|
||||
|
||||
@@ -94,17 +94,18 @@ m4_define([b4_variant_define],
|
||||
typedef variant<S> self_type;
|
||||
|
||||
/// Empty construction.
|
||||
variant ()]b4_parse_assert_if([
|
||||
: yytypeid_ (YY_NULLPTR)])[
|
||||
variant ()
|
||||
: yybuffer_ ()]b4_parse_assert_if([
|
||||
, yytypeid_ (YY_NULLPTR)])[
|
||||
{}
|
||||
|
||||
/// Construct and fill.
|
||||
template <typename T>
|
||||
variant (const T& t)]b4_parse_assert_if([
|
||||
variant (YY_RVREF (T) t)]b4_parse_assert_if([
|
||||
: yytypeid_ (&typeid (T))])[
|
||||
{
|
||||
YYASSERT (sizeof (T) <= S);
|
||||
new (yyas_<T> ()) T (t);
|
||||
new (yyas_<T> ()) T (YY_MOVE (t));
|
||||
}
|
||||
|
||||
/// Destruction, allowed only if empty.
|
||||
@@ -121,7 +122,7 @@ m4_define([b4_variant_define],
|
||||
YYASSERT (!yytypeid_);
|
||||
YYASSERT (sizeof (T) <= S);
|
||||
yytypeid_ = & typeid (T);])[
|
||||
return *new (yyas_<T> ()) T;
|
||||
return *new (yyas_<T> ()) T ();
|
||||
}
|
||||
|
||||
/// Instantiate a \a T in here from \a t.
|
||||
@@ -140,6 +141,7 @@ m4_define([b4_variant_define],
|
||||
T&
|
||||
as ()
|
||||
{]b4_parse_assert_if([
|
||||
YYASSERT (yytypeid_);
|
||||
YYASSERT (*yytypeid_ == typeid (T));
|
||||
YYASSERT (sizeof (T) <= S);])[
|
||||
return *yyas_<T> ();
|
||||
@@ -150,6 +152,7 @@ m4_define([b4_variant_define],
|
||||
const T&
|
||||
as () const
|
||||
{]b4_parse_assert_if([
|
||||
YYASSERT (yytypeid_);
|
||||
YYASSERT (*yytypeid_ == typeid (T));
|
||||
YYASSERT (sizeof (T) <= S);])[
|
||||
return *yyas_<T> ();
|
||||
@@ -160,7 +163,7 @@ m4_define([b4_variant_define],
|
||||
/// Both variants must be built beforehand, because swapping the actual
|
||||
/// data requires reading it (with as()), and this is not possible on
|
||||
/// unconstructed variants: it would require some dynamic testing, which
|
||||
/// should not be the variant's responsability.
|
||||
/// should not be the variant's responsibility.
|
||||
/// Swapping between built and (possibly) non-built is done with
|
||||
/// variant::move ().
|
||||
template <typename T>
|
||||
@@ -180,10 +183,26 @@ m4_define([b4_variant_define],
|
||||
move (self_type& other)
|
||||
{
|
||||
build<T> ();
|
||||
# if defined __cplusplus && 201103L <= __cplusplus
|
||||
as<T> () = YY_MOVE (other.as<T> ());
|
||||
# else
|
||||
swap<T> (other);
|
||||
# endif
|
||||
other.destroy<T> ();
|
||||
}
|
||||
|
||||
# if defined __cplusplus && 201103L <= __cplusplus
|
||||
/// Move the content of \a other to this.
|
||||
template <typename T>
|
||||
void
|
||||
move (self_type&& other)
|
||||
{
|
||||
build<T> ();
|
||||
as<T> () = YY_MOVE (other.as<T> ());
|
||||
other.destroy<T> ();
|
||||
}
|
||||
#endif
|
||||
|
||||
/// Copy the content of \a other to this.
|
||||
template <typename T>
|
||||
void
|
||||
@@ -203,7 +222,7 @@ m4_define([b4_variant_define],
|
||||
|
||||
private:
|
||||
/// Prohibit blind copies.
|
||||
self_type& operator=(const self_type&);
|
||||
self_type& operator= (const self_type&);
|
||||
variant (const self_type&);
|
||||
|
||||
/// Accessor to raw memory as \a T.
|
||||
@@ -252,7 +271,7 @@ m4_define([b4_value_type_declare],
|
||||
{]b4_type_foreach([b4_char_sizeof])[};
|
||||
|
||||
/// Symbol semantic values.
|
||||
typedef variant<sizeof(union_type)> semantic_type;][]dnl
|
||||
typedef variant<sizeof (union_type)> semantic_type;][]dnl
|
||||
])
|
||||
|
||||
|
||||
@@ -280,18 +299,18 @@ m4_define([b4_symbol_value_template],
|
||||
## ------------- ##
|
||||
|
||||
|
||||
# b4_symbol_constructor_declare_(SYMBOL-NUMBER)
|
||||
# _b4_symbol_constructor_declare(SYMBOL-NUMBER)
|
||||
# ---------------------------------------------
|
||||
# Declare the overloaded version of make_symbol for the (common) type of
|
||||
# these SYMBOL-NUMBERS. Use at class-level.
|
||||
m4_define([b4_symbol_constructor_declare_],
|
||||
m4_define([_b4_symbol_constructor_declare],
|
||||
[b4_symbol_if([$1], [is_token], [b4_symbol_if([$1], [has_id],
|
||||
[ static inline
|
||||
[ static
|
||||
symbol_type
|
||||
make_[]b4_symbol_([$1], [id]) (dnl
|
||||
make_[]_b4_symbol([$1], [id]) (dnl
|
||||
b4_join(b4_symbol_if([$1], [has_type],
|
||||
[const b4_symbol([$1], [type])& v]),
|
||||
b4_locations_if([const location_type& l])));
|
||||
[YY_COPY (b4_symbol([$1], [type])) v]),
|
||||
b4_locations_if([YY_COPY (location_type) l])));
|
||||
|
||||
])])])
|
||||
|
||||
@@ -302,24 +321,25 @@ b4_join(b4_symbol_if([$1], [has_type],
|
||||
# Use at class-level.
|
||||
m4_define([b4_symbol_constructor_declare],
|
||||
[ // Symbol constructors declarations.
|
||||
b4_symbol_foreach([b4_symbol_constructor_declare_])])
|
||||
b4_symbol_foreach([_b4_symbol_constructor_declare])])
|
||||
|
||||
|
||||
|
||||
# b4_symbol_constructor_define_(SYMBOL-NUMBER)
|
||||
# _b4_symbol_constructor_define(SYMBOL-NUMBER)
|
||||
# --------------------------------------------
|
||||
# Define symbol constructor for this SYMBOL-NUMBER.
|
||||
m4_define([b4_symbol_constructor_define_],
|
||||
m4_define([_b4_symbol_constructor_define],
|
||||
[b4_symbol_if([$1], [is_token], [b4_symbol_if([$1], [has_id],
|
||||
[ b4_parser_class_name::symbol_type
|
||||
b4_parser_class_name::make_[]b4_symbol_([$1], [id]) (dnl
|
||||
[ inline
|
||||
b4_parser_class_name::symbol_type
|
||||
b4_parser_class_name::make_[]_b4_symbol([$1], [id]) (dnl
|
||||
b4_join(b4_symbol_if([$1], [has_type],
|
||||
[const b4_symbol([$1], [type])& v]),
|
||||
b4_locations_if([const location_type& l])))
|
||||
[YY_COPY (b4_symbol([$1], [type])) v]),
|
||||
b4_locations_if([YY_COPY (location_type) l])))
|
||||
{
|
||||
return symbol_type (b4_join([token::b4_symbol([$1], [id])],
|
||||
b4_symbol_if([$1], [has_type], [v]),
|
||||
b4_locations_if([l])));
|
||||
b4_symbol_if([$1], [has_type], [YY_MOVE (v)]),
|
||||
b4_locations_if([YY_MOVE (l)])));
|
||||
}
|
||||
|
||||
])])])
|
||||
@@ -329,27 +349,26 @@ b4_join(b4_symbol_if([$1], [has_type],
|
||||
# -----------------------------------
|
||||
# Generate a constructor declaration for basic_symbol from given type.
|
||||
m4_define([b4_basic_symbol_constructor_declare],
|
||||
[[
|
||||
basic_symbol (]b4_join(
|
||||
[[ basic_symbol (]b4_join(
|
||||
[typename Base::kind_type t],
|
||||
b4_symbol_if([$1], [has_type], const b4_symbol([$1], [type])[ v]),
|
||||
b4_locations_if([const location_type& l]))[);
|
||||
b4_symbol_if([$1], [has_type], [YY_RVREF (b4_symbol([$1], [type])) v]),
|
||||
b4_locations_if([YY_RVREF (location_type) l]))[);
|
||||
]])
|
||||
|
||||
# b4_basic_symbol_constructor_define
|
||||
# ----------------------------------
|
||||
# Generate a constructor implementation for basic_symbol from given type.
|
||||
m4_define([b4_basic_symbol_constructor_define],
|
||||
[[
|
||||
template <typename Base>
|
||||
[[ template <typename Base>
|
||||
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join(
|
||||
[typename Base::kind_type t],
|
||||
b4_symbol_if([$1], [has_type], const b4_symbol([$1], [type])[ v]),
|
||||
b4_locations_if([const location_type& l]))[)
|
||||
: Base (t)
|
||||
, value (]b4_symbol_if([$1], [has_type], [v])[)]b4_locations_if([
|
||||
, location (l)])[
|
||||
b4_symbol_if([$1], [has_type], [YY_RVREF (b4_symbol([$1], [type])) v]),
|
||||
b4_locations_if([YY_RVREF (location_type) l]))[)
|
||||
: Base (t)]b4_symbol_if([$1], [has_type], [
|
||||
, value (YY_MOVE (v))])[]b4_locations_if([
|
||||
, location (YY_MOVE (l))])[
|
||||
{}
|
||||
|
||||
]])
|
||||
|
||||
# b4_symbol_constructor_define
|
||||
@@ -357,4 +376,4 @@ m4_define([b4_basic_symbol_constructor_define],
|
||||
# Define the overloaded versions of make_symbol for all the value types.
|
||||
m4_define([b4_symbol_constructor_define],
|
||||
[ // Implementation of make_symbol for each symbol type.
|
||||
b4_symbol_foreach([b4_symbol_constructor_define_])])
|
||||
b4_symbol_foreach([_b4_symbol_constructor_define])])
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
<!--
|
||||
bison.xsl - common templates for Bison XSLT.
|
||||
|
||||
Copyright (C) 2007-2015 Free Software Foundation, Inc.
|
||||
Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<!--
|
||||
xml2dot.xsl - transform Bison XML Report into DOT.
|
||||
|
||||
Copyright (C) 2007-2015 Free Software Foundation, Inc.
|
||||
Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<!--
|
||||
xml2text.xsl - transform Bison XML Report into plain text.
|
||||
|
||||
Copyright (C) 2007-2015 Free Software Foundation, Inc.
|
||||
Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<!--
|
||||
xml2html.xsl - transform Bison XML Report into XHTML.
|
||||
|
||||
Copyright (C) 2007-2015 Free Software Foundation, Inc.
|
||||
Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
<xsl:template match="/">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
|
||||
<title>
|
||||
<xsl:value-of select="bison-xml-report/filename"/>
|
||||
<xsl:text> - GNU Bison XML Automaton Report</xsl:text>
|
||||
|
||||
+35
-31
@@ -1,11 +1,11 @@
|
||||
-*- C -*-
|
||||
# Yacc compatible skeleton for Bison
|
||||
|
||||
# Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation,
|
||||
# Inc.
|
||||
# Copyright (C) 1984, 1989-1990, 2000-2015, 2018 Free Software
|
||||
# Foundation, Inc.
|
||||
|
||||
m4_pushdef([b4_copyright_years],
|
||||
[1984, 1989-1990, 2000-2015])
|
||||
[1984, 1989-1990, 2000-2015, 2018])
|
||||
|
||||
# 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
|
||||
@@ -118,7 +118,7 @@ m4_define([b4_int_type],
|
||||
b4_ints_in($@, [0], [65535]), [1], [yytype_uint16],
|
||||
b4_ints_in($@, [-32768], [32767]), [1], [yytype_int16],
|
||||
|
||||
m4_eval([0 <= $1]), [1], [unsigned int],
|
||||
m4_eval([0 <= $1]), [1], [unsigned],
|
||||
|
||||
[int])])
|
||||
|
||||
@@ -237,11 +237,11 @@ m4_define([b4_declare_parser_state_variables], [b4_pure_if([[
|
||||
YYSIZE_T yyes_capacity;]])])
|
||||
|
||||
|
||||
# b4_declare_yyparse_push_
|
||||
# _b4_declare_yyparse_push
|
||||
# ------------------------
|
||||
# Declaration of yyparse (and dependencies) when using the push parser
|
||||
# (including in pull mode).
|
||||
m4_define([b4_declare_yyparse_push_],
|
||||
m4_define([_b4_declare_yyparse_push],
|
||||
[[#ifndef YYPUSH_MORE_DEFINED
|
||||
# define YYPUSH_MORE_DEFINED
|
||||
enum { YYPUSH_MORE = 4 };
|
||||
@@ -265,18 +265,18 @@ b4_function_declare([b4_prefix[pstate_delete]], [[void]],
|
||||
[[b4_prefix[pstate *ps]], [[ps]]])dnl
|
||||
])
|
||||
|
||||
# b4_declare_yyparse_
|
||||
# _b4_declare_yyparse
|
||||
# -------------------
|
||||
# When not the push parser.
|
||||
m4_define([b4_declare_yyparse_],
|
||||
m4_define([_b4_declare_yyparse],
|
||||
[b4_function_declare(b4_prefix[parse], [int], b4_parse_param)])
|
||||
|
||||
|
||||
# b4_declare_yyparse
|
||||
# ------------------
|
||||
m4_define([b4_declare_yyparse],
|
||||
[b4_push_if([b4_declare_yyparse_push_],
|
||||
[b4_declare_yyparse_])[]dnl
|
||||
[b4_push_if([_b4_declare_yyparse_push],
|
||||
[_b4_declare_yyparse])[]dnl
|
||||
])
|
||||
|
||||
|
||||
@@ -377,13 +377,13 @@ typedef signed char yytype_int8;
|
||||
#ifdef YYTYPE_UINT16
|
||||
typedef YYTYPE_UINT16 yytype_uint16;
|
||||
#else
|
||||
typedef unsigned short int yytype_uint16;
|
||||
typedef unsigned short yytype_uint16;
|
||||
#endif
|
||||
|
||||
#ifdef YYTYPE_INT16
|
||||
typedef YYTYPE_INT16 yytype_int16;
|
||||
#else
|
||||
typedef short int yytype_int16;
|
||||
typedef short yytype_int16;
|
||||
#endif
|
||||
|
||||
#ifndef YYSIZE_T
|
||||
@@ -395,7 +395,7 @@ typedef short int yytype_int16;
|
||||
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
|
||||
# define YYSIZE_T size_t
|
||||
# else
|
||||
# define YYSIZE_T unsigned int
|
||||
# define YYSIZE_T unsigned
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@@ -571,7 +571,7 @@ union yyalloc
|
||||
#define YYMAXUTOK ]b4_user_token_number_max[
|
||||
|
||||
#define YYTRANSLATE(YYX) \
|
||||
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
|
||||
((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
|
||||
|
||||
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
|
||||
as returned by yylex, without out-of-bounds checking. */
|
||||
@@ -719,7 +719,7 @@ do { \
|
||||
])[[int yyrule], [yyrule]]m4_ifset([b4_parse_param], [,
|
||||
b4_parse_param]))[
|
||||
{
|
||||
unsigned long int yylno = yyrline[yyrule];
|
||||
unsigned long yylno = yyrline[yyrule];
|
||||
int yynrhs = yyr2[yyrule];
|
||||
int yyi;
|
||||
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
|
||||
@@ -827,7 +827,7 @@ yy_lac_stack_realloc (YYSIZE_T *yycapacity, YYSIZE_T yyadd,
|
||||
*yycapacity = yyalloc;]m4_if(b4_percent_define_get([[parse.lac.memory-trace]]),
|
||||
[full], [[
|
||||
YYDPRINTF ((stderr, "%srealloc to %lu%s", yydebug_prefix,
|
||||
(unsigned long int) yyalloc, yydebug_suffix));]])[
|
||||
(unsigned long) yyalloc, yydebug_suffix));]])[
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1207,6 +1207,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
||||
case N: \
|
||||
yyformat = S; \
|
||||
break
|
||||
default: /* Avoid compiler warnings. */
|
||||
YYCASE_(0, YY_("syntax error"));
|
||||
YYCASE_(1, YY_("syntax error, unexpected %s"));
|
||||
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
|
||||
@@ -1325,16 +1326,19 @@ b4_function_define([[yyparse]], [[int]], b4_parse_param)[
|
||||
]b4_function_define([[yypstate_delete]], [[void]],
|
||||
[[[yypstate *yyps]], [[yyps]]])[
|
||||
{
|
||||
if (yyps)
|
||||
{
|
||||
#ifndef yyoverflow
|
||||
/* If the stack was reallocated but the parse did not complete, then the
|
||||
stack still needs to be freed. */
|
||||
if (!yyps->yynew && yyps->yyss != yyps->yyssa)
|
||||
YYSTACK_FREE (yyps->yyss);
|
||||
/* If the stack was reallocated but the parse did not complete, then the
|
||||
stack still needs to be freed. */
|
||||
if (!yyps->yynew && yyps->yyss != yyps->yyssa)
|
||||
YYSTACK_FREE (yyps->yyss);
|
||||
#endif]b4_lac_if([[
|
||||
if (!yyps->yynew && yyps->yyes != yyps->yyesa)
|
||||
YYSTACK_FREE (yyps->yyes);]])[
|
||||
free (yyps);]b4_pure_if([], [[
|
||||
yypstate_allocated = 0;]])[
|
||||
if (!yyps->yynew && yyps->yyes != yyps->yyesa)
|
||||
YYSTACK_FREE (yyps->yyes);]])[
|
||||
free (yyps);]b4_pure_if([], [[
|
||||
yypstate_allocated = 0;]])[
|
||||
}
|
||||
}
|
||||
]b4_pure_if([[
|
||||
#define ]b4_prefix[nerrs yyps->]b4_prefix[nerrs]])[
|
||||
@@ -1509,7 +1513,7 @@ b4_locations_if([[ yylsp[0] = ]b4_push_if([b4_pure_if([*])yypushed_loc], [yyllo
|
||||
yylsp = yyls + yysize - 1;])[
|
||||
|
||||
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
|
||||
(unsigned long int) yystacksize));
|
||||
(unsigned long) yystacksize));
|
||||
|
||||
if (yyss + yystacksize - 1 <= yyssp)
|
||||
YYABORT;
|
||||
@@ -1641,8 +1645,9 @@ yyreduce:
|
||||
yyval = yyvsp[1-yylen];
|
||||
|
||||
]b4_locations_if(
|
||||
[[ /* Default location. */
|
||||
YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);]])[
|
||||
[[ /* Default location. */
|
||||
YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
|
||||
yyerror_range[1] = yyloc;]])[
|
||||
YY_REDUCE_PRINT (yyn);]b4_lac_if([[
|
||||
{
|
||||
int yychar_backup = yychar;
|
||||
@@ -1782,8 +1787,7 @@ yyerrorlab:
|
||||
if (/*CONSTCOND*/ 0)
|
||||
goto yyerrorlab;
|
||||
|
||||
]b4_locations_if([[ yyerror_range[1] = yylsp[1-yylen];
|
||||
]])[ /* Do not reclaim the symbols of the rule whose action triggered
|
||||
/* Do not reclaim the symbols of the rule whose action triggered
|
||||
this YYERROR. */
|
||||
YYPOPSTACK (yylen);
|
||||
yylen = 0;
|
||||
@@ -1904,12 +1908,12 @@ yypushreturn:]])[
|
||||
return yyresult;
|
||||
}
|
||||
]b4_epilogue[]dnl
|
||||
b4_output_end()
|
||||
b4_output_end
|
||||
|
||||
b4_defines_if(
|
||||
[b4_output_begin([b4_spec_defines_file])[
|
||||
]b4_copyright([Bison interface for Yacc-like parsers in C])[
|
||||
|
||||
]b4_shared_declarations[
|
||||
]b4_output_end()
|
||||
]b4_output_end
|
||||
])# b4_defines_if
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# DJGPP Maintainer's Makefile -*-Makefile-*-
|
||||
# Requires GNU sed
|
||||
|
||||
## Copyright (C) 2005-2015 Free Software Foundation, Inc.
|
||||
## Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
This is a port of GNU Bison @VERSION@ to MSDOS/DJGPP.
|
||||
|
||||
Copyright (C) 2005-2015 Free Software Foundation, Inc.
|
||||
Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
=======================
|
||||
|
||||
The DJGPP port of Bison offers LFN and SFN support depending on which
|
||||
OS it is running. If LFN support is available or not is determinated at
|
||||
OS it is running. If LFN support is available or not is determined at
|
||||
run time. If LFN support is available (DOS session under Win9X, Win2K,
|
||||
WinXP, etc.) the standard posix file name extensions will be used.
|
||||
These are: y.tab.c, y.tab.c++, y.tab.h, y.output, etc. If only SFN
|
||||
|
||||
+6
-6
@@ -4,7 +4,7 @@ Rem Configure Bison for DJGPP.
|
||||
Rem WARNING WARNING WARNING: This file needs to have DOS CRLF end-of-line
|
||||
Rem format, or else stock DOS/Windows shells will refuse to run it.
|
||||
|
||||
Rem Copyright (C) 2005-2015 Free Software Foundation, Inc.
|
||||
Rem Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
Rem This program is free software: you can redistribute it and/or modify
|
||||
Rem it under the terms of the GNU General Public License as published by
|
||||
@@ -80,10 +80,10 @@ goto NextArgument
|
||||
if "%1" == "no-dep" goto NextArgument
|
||||
if "%1" == "no-DEP" goto NextArgument
|
||||
if "%1" == "NO-DEP" goto NextArgument
|
||||
if "%1" == "dep" goto DependecyTraking
|
||||
if "%1" == "DEP" goto DependecyTraking
|
||||
if "%1" == "dep" goto DependecyTracking
|
||||
if "%1" == "DEP" goto DependecyTracking
|
||||
goto LibiconvPrefixOption
|
||||
:DependecyTraking
|
||||
:DependecyTracking
|
||||
if "%1" == "dep" set DEPENDENCY_TRACKING=enabled
|
||||
if "%1" == "DEP" set DEPENDENCY_TRACKING=enabled
|
||||
if not "%DEPENDENCY_TRACKING%" == "enabled" goto SmallEnv
|
||||
@@ -290,7 +290,7 @@ if errorlevel 1 goto SedError2
|
||||
mv -f config.hin %XSRC%/lib/config.hin
|
||||
|
||||
|
||||
Rem Fixing ilicit testsuite file name.
|
||||
Rem Fixing illicit testsuite file name.
|
||||
test -f %XSRC%/tests/c++.at
|
||||
if not errorlevel 1 mv -f %XSRC%/tests/c++.at %XSRC%/tests/cxx.at
|
||||
|
||||
@@ -300,7 +300,7 @@ sed -f %XSRC%/djgpp/testsuite.sed %XSRC%/tests/testsuite.org > testsuite.tmp
|
||||
if errorlevel 1 goto SedError3
|
||||
mv -f ./testsuite.tmp %XSRC%/tests/testsuite
|
||||
|
||||
Rem Fixing ilicit calc++ file names in the calc++ directory.
|
||||
Rem Fixing illicit calc++ file names in the calc++ directory.
|
||||
test -d %XSRC%/examples/calc++
|
||||
if not errorlevel 1 mv -f %XSRC%/examples/calc++ %XSRC%/examples/calcxx
|
||||
test -d %XSRC%/examples/calcxx
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
# Sed script for additional DJGPP specific editing
|
||||
# of the configure script generated by autoconf 2.62.
|
||||
|
||||
# Copyright (C) 2005-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
# This is the config.site file for configuring GNU packages
|
||||
# which are to be built with DJGPP tools.
|
||||
|
||||
# Copyright (C) 2005-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
# sed script for DJGPP specific editing of config.hin
|
||||
|
||||
# Copyright (C) 2005-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ Rem This batch file unpacks the Bison distribution while simultaneously
|
||||
Rem renaming some of the files whose names are invalid on DOS or conflict
|
||||
Rem with other file names after truncation to DOS 8+3 namespace.
|
||||
Rem
|
||||
Rem Copyright (C) 2005-2015 Free Software Foundation, Inc.
|
||||
Rem Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
||||
Rem
|
||||
Rem This program is free software: you can redistribute it and/or modify
|
||||
Rem it under the terms of the GNU General Public License as published by
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
## Copyright (C) 2008-2015 Free Software Foundation, Inc.
|
||||
## Copyright (C) 2008-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
## This program is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
/* Subprocesses with pipes.
|
||||
|
||||
Copyright (C) 2005-2015 Free Software Foundation, Inc.
|
||||
Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
/* Subprocesses with pipes.
|
||||
|
||||
Copyright (C) 2005-2015 Free Software Foundation, Inc.
|
||||
Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
# Sed script for additional DJGPP specific editing
|
||||
# of the testsuite script generated by autoconf 2.61.
|
||||
|
||||
# Copyright (C) 2007-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
||||
+1406
-961
File diff suppressed because it is too large
Load Diff
+777
-551
File diff suppressed because it is too large
Load Diff
+3
-4
@@ -1,4 +1,5 @@
|
||||
## Copyright (C) 2001-2003, 2005-2015 Free Software Foundation, Inc.
|
||||
## Copyright (C) 2001-2003, 2005-2015, 2018 Free Software Foundation,
|
||||
## Inc.
|
||||
|
||||
## This program is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
@@ -29,9 +30,7 @@ $(doc_bison).pdf: $(FIGS_GV:.gv=.pdf)
|
||||
$(doc_bison).html: $(FIGS_GV:.gv=.png)
|
||||
|
||||
TEXI2DVI = texi2dvi --build-dir=doc/bison.t2d -I doc
|
||||
CLEANDIRS = doc/bison.t2d
|
||||
clean-local:
|
||||
rm -rf $(CLEANDIRS)
|
||||
CLEANDIRS += doc/bison.t2d
|
||||
|
||||
MOSTLYCLEANFILES += $(top_srcdir)/doc/*.t
|
||||
|
||||
|
||||
+2
-1
@@ -19,7 +19,8 @@
|
||||
\def\finalout{\overfullrule=0pt}
|
||||
%\finalout
|
||||
|
||||
% Copyright (c) 1998, 2001, 2009-2015 Free Software Foundation, Inc.
|
||||
% Copyright (c) 1998, 2001, 2009-2015, 2018 Free Software Foundation,
|
||||
% Inc.
|
||||
%
|
||||
% This file is part of Bison.
|
||||
%
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ straightforward use of _build/src/bison would.)
|
||||
|
||||
--
|
||||
|
||||
Copyright (C) 2006, 2009-2015 Free Software Foundation, Inc.
|
||||
Copyright (C) 2006, 2009-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
#! /usr/bin/perl -w
|
||||
|
||||
# Copyright (C) 2006, 2008-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2006, 2008-2015, 2018 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is part of Bison, the GNU Compiler Compiler.
|
||||
#
|
||||
@@ -53,7 +53,7 @@ will generate eight different cases.
|
||||
|
||||
=item B<-b>, B<--bench>
|
||||
|
||||
Predefined benches, that is, combimation between a grammar and a I<directives>
|
||||
Predefined benches, that is, combination between a grammar and a I<directives>
|
||||
request.
|
||||
|
||||
=over 4
|
||||
@@ -738,7 +738,7 @@ yy::parser::token_type yylex(yy::parser::semantic_type* yylvalp,
|
||||
void
|
||||
yy::parser::error(const yy::parser::location_type& loc, const std::string& msg)
|
||||
{
|
||||
std::cerr << loc << ": " << msg << std::endl;
|
||||
std::cerr << loc << ": " << msg << '\n';
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
## Copyright (C) 2006, 2008-2015 Free Software Foundation, Inc.
|
||||
## Copyright (C) 2006, 2008-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
## This program is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
This directory contains examples of Bison grammar files.
|
||||
|
||||
* mfcalc
|
||||
A C example of a multi-function calculator. Extracted from the
|
||||
documentation.
|
||||
|
||||
* calc++
|
||||
A C++ version of the canonical example for parsers: a calculator. Also uses
|
||||
Flex for the scanner. Extracted from the documentation.
|
||||
|
||||
* variant.yy
|
||||
A C++ example that uses variants (they allow to use any C++ type as semantic
|
||||
value type) and symbol constructors (they ensure consistency between
|
||||
declared token type and effective semantic value).
|
||||
|
||||
* variant-11.yy
|
||||
Another C++ example, closely related to the previous one, but exhibiting
|
||||
support for C++11's move semantics.
|
||||
|
||||
-----
|
||||
|
||||
Local Variables:
|
||||
mode: outline
|
||||
fill-column: 76
|
||||
End:
|
||||
|
||||
Copyright (C) 2018 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||
any later version published by the Free Software Foundation; with no
|
||||
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
|
||||
Texts. A copy of the license is included in the "GNU Free
|
||||
Documentation License" file as part of this distribution.
|
||||
|
||||
# LocalWords: mfcalc calc parsers yy
|
||||
@@ -2,18 +2,18 @@
|
||||
/*.tmp
|
||||
/.deps
|
||||
/calc++
|
||||
/calc++-driver.cc
|
||||
/calc++-driver.hh
|
||||
/calc++-parser.cc
|
||||
/calc++-parser.hh
|
||||
/calc++-parser.output
|
||||
/calc++-parser.stamp
|
||||
/calc++-parser.yy
|
||||
/calc++-scanner.cc
|
||||
/calc++-scanner.ll
|
||||
/calc++.cc
|
||||
/calc++.exe
|
||||
/calc.stamp
|
||||
/driver.cc
|
||||
/driver.hh
|
||||
/location.hh
|
||||
/parser.cc
|
||||
/parser.hh
|
||||
/parser.output
|
||||
/parser.stamp
|
||||
/parser.yy
|
||||
/position.hh
|
||||
/scanner.cc
|
||||
/scanner.ll
|
||||
/stack.hh
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
# This Makefile is designed to be simple and readable. It does not
|
||||
# aim at portability. It requires GNU Make.
|
||||
|
||||
BISON = bison
|
||||
CXX = g++
|
||||
FLEX = flex
|
||||
|
||||
all: calc++
|
||||
|
||||
%.cc %.hh: %.yy
|
||||
$(BISON) $(BISONFLAGS) -o $*.cc $<
|
||||
|
||||
%.cc: %.ll
|
||||
$(FLEX) $(FLEXFLAGS) -o$@ $<
|
||||
|
||||
%.o: %.cc
|
||||
$(CXX) $(CXXFLAGS) -c -o$@ $<
|
||||
|
||||
calc++: calc++.o driver.o parser.o scanner.o
|
||||
$(CXX) -o $@ $^
|
||||
|
||||
calc++.o: parser.hh
|
||||
parser.o: parser.hh
|
||||
scanner.o: parser.hh
|
||||
|
||||
clean:
|
||||
rm -f calc++ *.o parser.hh parser.cc scanner.cc
|
||||
@@ -0,0 +1,51 @@
|
||||
This directory contains calc++, a simple Bison grammar file in C++.
|
||||
|
||||
Please, read the corresponding chapter in the documentation: "A Complete C++
|
||||
Example". It is also available on line (maybe with a different version of
|
||||
Bison):
|
||||
https://www.gnu.org/software/bison/manual/html_node/A-Complete-C_002b_002b-Example.html
|
||||
|
||||
To use it, copy this directory into some work directory, and run `make` to
|
||||
compile the executable, and try it. It is a simple calculator which accepts
|
||||
several variable definitions, one per line, and then a single expression to
|
||||
evaluate.
|
||||
|
||||
The program calc++ expects the file to parse as argument; pass `-` to read
|
||||
the standard input (and then hit <Ctrl-d>, control-d, to end your input).
|
||||
|
||||
$ ./calc++ -
|
||||
one := 1
|
||||
two := 2
|
||||
three := 3
|
||||
(one + two * three) * two * three
|
||||
<Ctrl-d>
|
||||
42
|
||||
|
||||
You may pass `-p` to activate the parser debug traces, and `-s` to activate
|
||||
the scanner's.
|
||||
|
||||
-----
|
||||
|
||||
Local Variables:
|
||||
mode: outline
|
||||
fill-column: 76
|
||||
End:
|
||||
|
||||
Copyright (C) 2018 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# LocalWords: mfcalc calc parsers yy MERCHANTABILITY
|
||||
@@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Copyright (C) 2005-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
||||
+20
-18
@@ -1,4 +1,5 @@
|
||||
# Copyright (C) 2005-2006, 2008-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2005-2006, 2008-2015, 2018 Free Software Foundation,
|
||||
# Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -19,7 +20,7 @@
|
||||
|
||||
# Don't depend on $(BISON) otherwise we would rebuild these files
|
||||
# in srcdir, including during distcheck, which is forbidden.
|
||||
%D%/calc++-parser.stamp: $(BISON_IN)
|
||||
%D%/parser.stamp: $(BISON_IN)
|
||||
SUFFIXES += .yy .stamp
|
||||
.yy.stamp:
|
||||
$(AM_V_YACC)rm -f $@
|
||||
@@ -27,15 +28,15 @@ SUFFIXES += .yy .stamp
|
||||
$(AM_V_at)$(YACCCOMPILE) -o $*.cc $<
|
||||
$(AM_V_at)mv -f $@.tmp $@
|
||||
|
||||
$(calcxx_sources_generated): %D%/calc++-parser.stamp
|
||||
@test -f $@ || rm -f %D%/calc++-parser.stamp
|
||||
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) %D%/calc++-parser.stamp
|
||||
CLEANFILES += \
|
||||
$(calcxx_sources_generated) \
|
||||
%D%/calc++-parser.output \
|
||||
%D%/calc++-parser.stamp \
|
||||
%D%/calc++-scanner.cc
|
||||
|
||||
$(calcxx_sources_generated): %D%/parser.stamp
|
||||
@test -f $@ || rm -f %D%/parser.stamp
|
||||
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) %D%/parser.stamp
|
||||
CLEANFILES += \
|
||||
$(calcxx_sources_generated) \
|
||||
%D%/parser.output \
|
||||
%D%/parser.stamp \
|
||||
%D%/scanner.cc
|
||||
CLEANDIRS += %D%/*.dSYM
|
||||
|
||||
## -------------------- ##
|
||||
## Building & testing. ##
|
||||
@@ -44,18 +45,18 @@ CLEANFILES += \
|
||||
# Avoid using BUILT_SOURCES which is too global.
|
||||
$(%C%_calc___OBJECTS): $(calcxx_sources_generated)
|
||||
|
||||
calcxx_sources_extracted = \
|
||||
%D%/calc++-driver.cc \
|
||||
%D%/calc++-driver.hh \
|
||||
%D%/calc++-scanner.ll \
|
||||
calcxx_sources_extracted = \
|
||||
%D%/driver.cc \
|
||||
%D%/driver.hh \
|
||||
%D%/scanner.ll \
|
||||
%D%/calc++.cc
|
||||
calcxx_extracted = \
|
||||
$(calcxx_sources_extracted) \
|
||||
%D%/calc++-parser.yy
|
||||
%D%/parser.yy
|
||||
extracted += $(calcxx_extracted)
|
||||
calcxx_sources_generated = \
|
||||
%D%/calc++-parser.cc \
|
||||
%D%/calc++-parser.hh \
|
||||
%D%/parser.cc \
|
||||
%D%/parser.hh \
|
||||
%D%/location.hh \
|
||||
%D%/position.hh \
|
||||
%D%/stack.hh
|
||||
@@ -82,3 +83,4 @@ endif
|
||||
|
||||
calcxxdir = $(docdir)/examples/calc++
|
||||
calcxx_DATA = $(calcxx_extracted)
|
||||
dist_calcxx_DATA = %D%/README %D%/Makefile
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
// Work around an Automake 1.11.2 bug: it asks for the creation of
|
||||
// y.tab.c and y.tab.h and then renames them as calc++-parser.cc and
|
||||
// calc++-parser.h, but in the former it does not convert the
|
||||
// #include "y.tab.h". We don't want this to show in the
|
||||
// documentation.
|
||||
#include "calc++-parser.hh"
|
||||
+40
-11
@@ -3,8 +3,8 @@
|
||||
|
||||
# This file is part of GNU Bison
|
||||
|
||||
# Copyright (C) 1992, 2000-2001, 2005-2006, 2009-2015 Free Software
|
||||
# Foundation, Inc.
|
||||
# Copyright (C) 1992, 2000-2001, 2005-2006, 2009-2015, 2018 Free
|
||||
# Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -32,9 +32,24 @@
|
||||
# output before block 2, even if the latter appears before). The same
|
||||
# number may be used several time, in which case the order of
|
||||
# appearance is used.
|
||||
#
|
||||
# Use @ignore for code to extract that must not be part of the
|
||||
# documentation. For instance:
|
||||
#
|
||||
# @ignore
|
||||
# @comment file: calc++/scanner.ll
|
||||
# @example
|
||||
# // Work around an incompatibility in Flex.
|
||||
# # undef yywrap
|
||||
# # define yywrap() 1
|
||||
# @end example
|
||||
# @end ignore
|
||||
|
||||
use strict;
|
||||
|
||||
use File::Basename qw(dirname);
|
||||
use File::Path qw(make_path);
|
||||
|
||||
# Whether we generate synclines.
|
||||
my $synclines = 0;
|
||||
|
||||
@@ -45,7 +60,7 @@ sub normalize($)
|
||||
{
|
||||
local ($_) = @_;
|
||||
|
||||
s/^\@(c |comment|dots|end (ignore|group)|ignore|group).*//mg;
|
||||
s/^\@(c |comment|dots|end (ignore|group)|ignore|group).*\n//mg;
|
||||
s/\@value\{VERSION\}/$ENV{VERSION}/g;
|
||||
s/^\@(error|result)\{\}//mg;
|
||||
s/\@([{}@])/$1/g;
|
||||
@@ -65,9 +80,24 @@ sub message($)
|
||||
}
|
||||
}
|
||||
|
||||
# basename => full file name for files we should extract.
|
||||
my %file_wanted;
|
||||
# The list of files we should extract.
|
||||
my @file_wanted;
|
||||
|
||||
# Whether we should extract that file, and then under which path.
|
||||
sub file_wanted ($)
|
||||
{
|
||||
my ($f) = @_;
|
||||
for my $file (@file_wanted)
|
||||
{
|
||||
# No endswith in Perl 5...
|
||||
return $file if $f eq substr($file, -length($f));
|
||||
}
|
||||
undef
|
||||
}
|
||||
|
||||
# process ($in)
|
||||
# -------------
|
||||
# Read input file $in, and generate the outputs.
|
||||
sub process ($)
|
||||
{
|
||||
my ($in) = @_;
|
||||
@@ -89,9 +119,9 @@ sub process ($)
|
||||
{
|
||||
my $f = $1;
|
||||
$block = $2 || 1;
|
||||
if ($file_wanted{$f})
|
||||
if (file_wanted($f))
|
||||
{
|
||||
$file = $file_wanted{$f};
|
||||
$file = file_wanted($f);
|
||||
message(" GEN $file");
|
||||
}
|
||||
else
|
||||
@@ -106,13 +136,13 @@ sub process ($)
|
||||
# Bison supports synclines, but not Flex.
|
||||
$input .= sprintf ("#line %s \"$in\"\n", $. + 1)
|
||||
if $synclines && $file =~ /\.[chy]*$/;
|
||||
next;
|
||||
}
|
||||
elsif (/^\@end (small)?example$/)
|
||||
{
|
||||
die "no contents: $file"
|
||||
if $input eq "";
|
||||
|
||||
$file{$file}{$block} .= "\n" if defined $file{$file}{$block};
|
||||
$file{$file}{$block} .= normalize($input);
|
||||
$file = $input = undef;
|
||||
++$block;
|
||||
@@ -127,7 +157,7 @@ sub process ($)
|
||||
# Output the files.
|
||||
for my $file (keys %file)
|
||||
{
|
||||
# No spurious end of line: use printf.
|
||||
make_path (dirname ($file));
|
||||
my $o = new IO::File(">$file")
|
||||
or die "$file: cannot create: $?";
|
||||
print $o $file{$file}{$_}
|
||||
@@ -141,8 +171,7 @@ for my $arg (@ARGV)
|
||||
{
|
||||
if ($seen_dash)
|
||||
{
|
||||
use File::Basename;
|
||||
$file_wanted{basename($arg)} = $arg;
|
||||
push @file_wanted, $arg;
|
||||
}
|
||||
elsif ($arg eq '--')
|
||||
{
|
||||
|
||||
+30
-3
@@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2005, 2008-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2005, 2008-2015, 2018 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -26,13 +26,14 @@ AM_CXXFLAGS = \
|
||||
doc = $(top_srcdir)/doc/bison.texi
|
||||
extexi = $(top_srcdir)/%D%/extexi
|
||||
if ENABLE_GCC_WARNINGS
|
||||
extexiFLAGS = --synclines
|
||||
EXTEXIFLAGS = --synclines
|
||||
endif
|
||||
extract = VERSION="$(VERSION)" $(PERL) $(extexi) $(extexiFLAGS) $(doc) --
|
||||
extract = VERSION="$(VERSION)" $(PERL) $(extexi) $(EXTEXIFLAGS) $(doc) --
|
||||
extracted =
|
||||
CLEANFILES += $(extracted) %D%/extracted.stamp
|
||||
%D%/extracted.stamp: $(doc) $(extexi)
|
||||
$(AM_V_GEN)rm -f $@ $@.tmp
|
||||
$(AM_V_at)$(MKDIR_P) %D%
|
||||
$(AM_V_at)touch $@.tmp
|
||||
$(AM_V_at)$(extract) $(extracted)
|
||||
$(AM_V_at)mv $@.tmp $@
|
||||
@@ -41,6 +42,32 @@ $(extracted): %D%/extracted.stamp
|
||||
@test -f $@ || rm -f %D%/extracted.stamp
|
||||
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) %D%/extracted.stamp
|
||||
|
||||
## ---------- ##
|
||||
## Examples. ##
|
||||
## ---------- ##
|
||||
|
||||
|
||||
examplesdir = $(docdir)/examples
|
||||
dist_examples_DATA = %D%/README %D%/variant.yy %D%/variant-11.yy
|
||||
|
||||
check_PROGRAMS += %D%/variant
|
||||
nodist_%C%_variant_SOURCES = %D%/variant.yy
|
||||
%C%_variant_CPPFLAGS = -I$(top_builddir)
|
||||
dist_TESTS += %D%/variant.test
|
||||
%D%/variant.cc: $(BISON_IN) $(dist_pkgdata_DATA)
|
||||
|
||||
if ENABLE_CXX11
|
||||
check_PROGRAMS += %D%/variant-11
|
||||
nodist_%C%_variant_11_SOURCES = %D%/variant-11.yy
|
||||
%C%_variant_11_CXXFLAGS = $(CXX11_CXXFLAGS)
|
||||
%C%_variant_11_CPPFLAGS = -I$(top_builddir)
|
||||
dist_TESTS += %D%/variant-11.test
|
||||
%D%/variant-11.cc: $(BISON_IN) $(dist_pkgdata_DATA)
|
||||
endif
|
||||
|
||||
CLEANFILES += %D%/variant.output %D%/variant-11.output
|
||||
CLEANDIRS += %D%/*.dSYM
|
||||
|
||||
include %D%/calc++/local.mk
|
||||
include %D%/mfcalc/local.mk
|
||||
include %D%/rpcalc/local.mk
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# Copyright (C) 2005-2006, 2008-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2005-2006, 2008-2015, 2018 Free Software Foundation,
|
||||
# Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -19,16 +20,17 @@
|
||||
|
||||
BUILT_SOURCES += $(mfcalc_sources)
|
||||
CLEANFILES += %D%/mfcalc.[ch] %D%/mfcalc.output
|
||||
CLEANDIRS += %D%/*.dSYM
|
||||
|
||||
mfcalc_extracted = %D%/calc.h %D%/mfcalc.y
|
||||
mfcalc_sources = $(mfcalc_extracted)
|
||||
extracted += $(mfcalc_extracted)
|
||||
|
||||
check_PROGRAMS += %D%/mfcalc
|
||||
%C%_mfcalc_LDADD = -lm
|
||||
nodist_%C%_mfcalc_SOURCES = $(mfcalc_sources)
|
||||
|
||||
%C%_mfcalc_CPPFLAGS = -I$(top_builddir)/%D%
|
||||
%C%_mfcalc_LDADD = -lm
|
||||
|
||||
dist_TESTS += %D%/mfcalc.test
|
||||
|
||||
## ------------ ##
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Copyright (C) 2005-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# Copyright (C) 2005-2006, 2008-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2005-2006, 2008-2015, 2018 Free Software Foundation,
|
||||
# Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -19,16 +20,17 @@
|
||||
|
||||
BUILT_SOURCES += $(rpcalc_sources)
|
||||
CLEANFILES += %D%/rpcalc.[ch] %D%/rpcalc.output
|
||||
CLEANDIRS += %D%/*.dSYM
|
||||
|
||||
rpcalc_extracted = %D%/rpcalc.y
|
||||
rpcalc_sources = $(rpcalc_extracted)
|
||||
extracted += $(rpcalc_extracted)
|
||||
|
||||
check_PROGRAMS += %D%/rpcalc
|
||||
%C%_rpcalc_LDADD = -lm
|
||||
nodist_%C%_rpcalc_SOURCES = $(rpcalc_sources)
|
||||
|
||||
%C%_rpcalc_CPPFLAGS = -I$(top_builddir)/%D%
|
||||
%C%_rpcalc_LDADD = -lm
|
||||
|
||||
dist_TESTS += %D%/rpcalc.test
|
||||
|
||||
## ------------ ##
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Copyright (C) 2005-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
||||
+17
-6
@@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Copyright (C) 2005-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -23,11 +23,22 @@ number=1
|
||||
# Exit status of this script.
|
||||
exit=true
|
||||
|
||||
# top_buiddir.
|
||||
# top_builddir.
|
||||
cwd=`pwd`
|
||||
|
||||
# The exercised program.
|
||||
prog=$cwd/examples/$me/$me
|
||||
for p in $cwd/examples/$me/$me $cwd/examples/$me
|
||||
do
|
||||
if test -x "$p"; then
|
||||
prog=$p
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test x"$prog" = x; then
|
||||
echo "$me: ERROR: cannot find program to exercise"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# cleanup
|
||||
# -------
|
||||
@@ -49,16 +60,16 @@ cd $$.dir
|
||||
run ()
|
||||
{
|
||||
# Expected exit status.
|
||||
local sta_exp=$1
|
||||
local sta_exp="$1"
|
||||
shift
|
||||
# Expected output.
|
||||
local out_exp=$1
|
||||
local out_exp="$1"
|
||||
shift
|
||||
# Effective exit status.
|
||||
local sta_eff=0
|
||||
$prog "$@" - <input >out_eff || sta_eff=$?
|
||||
# Effective output.
|
||||
local out_eff=`cat out_eff`
|
||||
local out_eff="`cat out_eff`"
|
||||
if test $sta_eff -eq $sta_exp; then
|
||||
if test "$out_eff" = "$out_exp"; then
|
||||
echo "$me: PASS: $number"
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Copyright (C) 2018 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
: >input
|
||||
run 0 "{I have three numbers for you., 1, 2, 3, And that's all!}"
|
||||
@@ -0,0 +1,161 @@
|
||||
/*
|
||||
Copyright (C) 2008-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
%require "3.2"
|
||||
%debug
|
||||
%language "c++"
|
||||
%define api.token.constructor
|
||||
%define api.value.type variant
|
||||
%define api.value.automove
|
||||
%define api.location.file none
|
||||
%define parse.assert
|
||||
%locations
|
||||
|
||||
%code requires // *.hh
|
||||
{
|
||||
#include <memory> // std::unique_ptr
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
using string_uptr = std::unique_ptr<std::string>;
|
||||
using string_uptrs = std::vector<string_uptr>;
|
||||
}
|
||||
|
||||
%code // *.cc
|
||||
{
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <sstream>
|
||||
|
||||
namespace yy
|
||||
{
|
||||
// Prototype of the yylex function providing subsequent tokens.
|
||||
static parser::symbol_type yylex ();
|
||||
|
||||
// Print a vector of strings.
|
||||
std::ostream&
|
||||
operator<< (std::ostream& o, const string_uptrs& ss)
|
||||
{
|
||||
o << '{';
|
||||
const char *sep = "";
|
||||
for (const auto& s: ss)
|
||||
{
|
||||
o << sep << *s;
|
||||
sep = ", ";
|
||||
}
|
||||
return o << '}';
|
||||
}
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
string_uptr
|
||||
make_string_uptr (Args&&... args)
|
||||
{
|
||||
// std::make_unique is C++14.
|
||||
return string_uptr (new std::string{std::forward<Args> (args)...});
|
||||
}
|
||||
|
||||
// Convert to string.
|
||||
template <typename T>
|
||||
std::string
|
||||
to_string (const T& t)
|
||||
{
|
||||
auto&& o = std::ostringstream{};
|
||||
o << t;
|
||||
return o.str ();
|
||||
}
|
||||
}
|
||||
|
||||
%token <string_uptr> TEXT;
|
||||
%token <int> NUMBER;
|
||||
%printer { yyo << '(' << &$$ << ") " << $$; } <*>;
|
||||
%printer { yyo << *$$; } <string_uptr>;
|
||||
%token END_OF_FILE 0;
|
||||
|
||||
%type <string_uptr> item;
|
||||
%type <string_uptrs> list;
|
||||
|
||||
%%
|
||||
|
||||
result:
|
||||
list { std::cout << $1 << '\n'; }
|
||||
;
|
||||
|
||||
list:
|
||||
%empty { /* Generates an empty string list */ }
|
||||
| list item { $$ = $1; $$.emplace_back ($2); }
|
||||
;
|
||||
|
||||
item:
|
||||
TEXT
|
||||
| NUMBER { $$ = make_string_uptr (to_string ($1)); }
|
||||
;
|
||||
%%
|
||||
|
||||
namespace yy
|
||||
{
|
||||
// The yylex function providing subsequent tokens:
|
||||
// TEXT "I have three numbers for you."
|
||||
// NUMBER 1
|
||||
// NUMBER 2
|
||||
// NUMBER 3
|
||||
// TEXT "And that's all!"
|
||||
// END_OF_FILE
|
||||
|
||||
static
|
||||
parser::symbol_type
|
||||
yylex ()
|
||||
{
|
||||
static auto count = 0u;
|
||||
auto stage = count;
|
||||
++count;
|
||||
auto loc = parser::location_type{nullptr, stage + 1, stage + 1};
|
||||
switch (stage)
|
||||
{
|
||||
case 0:
|
||||
return parser::make_TEXT (make_string_uptr ("I have three numbers for you."), std::move (loc));
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
return parser::make_NUMBER (stage, std::move (loc));
|
||||
case 4:
|
||||
return parser::make_TEXT (make_string_uptr ("And that's all!"), std::move (loc));
|
||||
default:
|
||||
return parser::make_END_OF_FILE (std::move (loc));
|
||||
}
|
||||
}
|
||||
|
||||
// Mandatory error function
|
||||
void
|
||||
parser::error (const parser::location_type& loc, const std::string& msg)
|
||||
{
|
||||
std::cerr << loc << ": " << msg << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
auto&& p = yy::parser{};
|
||||
p.set_debug_level (!!getenv ("YYDEBUG"));
|
||||
return p.parse ();
|
||||
}
|
||||
|
||||
// Local Variables:
|
||||
// mode: C++
|
||||
// End:
|
||||
@@ -0,0 +1,19 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Copyright (C) 2018 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
: >input
|
||||
run 0 "{I have three numbers for you., 1, 2, 3, And that's all!}"
|
||||
+21
-25
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 2008-2015 Free Software Foundation, Inc.
|
||||
Copyright (C) 2008-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -15,19 +15,20 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
%require "3.2"
|
||||
%debug
|
||||
%language "c++"
|
||||
%defines
|
||||
%define api.token.constructor
|
||||
%define api.value.type variant
|
||||
%define api.location.file none
|
||||
%define parse.assert
|
||||
%locations
|
||||
|
||||
%code requires // *.hh
|
||||
{
|
||||
#include <list>
|
||||
#include <string>
|
||||
typedef std::list<std::string> strings_type;
|
||||
#include <vector>
|
||||
typedef std::vector<std::string> strings_type;
|
||||
}
|
||||
|
||||
%code // *.cc
|
||||
@@ -37,36 +38,31 @@ typedef std::list<std::string> strings_type;
|
||||
#include <iterator>
|
||||
#include <sstream>
|
||||
|
||||
// Prototype of the yylex function providing subsequent tokens.
|
||||
namespace yy
|
||||
{
|
||||
// Prototype of the yylex function providing subsequent tokens.
|
||||
static parser::symbol_type yylex ();
|
||||
}
|
||||
|
||||
// Printing a list of strings.
|
||||
// Koening look up will look into std, since that's an std::list.
|
||||
namespace std
|
||||
{
|
||||
// Print a vector of strings.
|
||||
std::ostream&
|
||||
operator<< (std::ostream& o, const strings_type& ss)
|
||||
{
|
||||
o << "(" << &ss << ") {";
|
||||
o << '{';
|
||||
const char *sep = "";
|
||||
for (strings_type::const_iterator i = ss.begin(), end = ss.end();
|
||||
for (strings_type::const_iterator i = ss.begin (), end = ss.end ();
|
||||
i != end; ++i)
|
||||
{
|
||||
o << sep << *i;
|
||||
sep = ", ";
|
||||
}
|
||||
return o << "}";
|
||||
return o << '}';
|
||||
}
|
||||
}
|
||||
|
||||
// Conversion to string.
|
||||
// Convert to string.
|
||||
template <typename T>
|
||||
inline
|
||||
std::string
|
||||
string_cast (const T& t)
|
||||
to_string (const T& t)
|
||||
{
|
||||
std::ostringstream o;
|
||||
o << t;
|
||||
@@ -76,26 +72,26 @@ typedef std::list<std::string> strings_type;
|
||||
|
||||
%token <::std::string> TEXT;
|
||||
%token <int> NUMBER;
|
||||
%printer { yyoutput << $$; } <*>;
|
||||
%printer { yyo << '(' << &$$ << ") " << $$; } <*>;
|
||||
%token END_OF_FILE 0;
|
||||
|
||||
%type <::std::string> item;
|
||||
%type <::std::list<std::string>> list;
|
||||
%type <::std::vector<std::string>> list;
|
||||
|
||||
%%
|
||||
|
||||
result:
|
||||
list { std::cout << $1 << std::endl; }
|
||||
list { std::cout << $1 << '\n'; }
|
||||
;
|
||||
|
||||
list:
|
||||
/* nothing */ { /* Generates an empty string list */ }
|
||||
| list item { std::swap ($$, $1); $$.push_back ($2); }
|
||||
%empty { /* Generates an empty string list */ }
|
||||
| list item { std::swap ($$, $1); $$.push_back ($2); }
|
||||
;
|
||||
|
||||
item:
|
||||
TEXT { std::swap ($$, $1); }
|
||||
| NUMBER { $$ = string_cast ($1); }
|
||||
TEXT
|
||||
| NUMBER { $$ = to_string ($1); }
|
||||
;
|
||||
%%
|
||||
|
||||
@@ -115,7 +111,7 @@ namespace yy
|
||||
{
|
||||
static int stage = -1;
|
||||
++stage;
|
||||
parser::location_type loc(0, stage + 1, stage + 1);
|
||||
parser::location_type loc (YY_NULLPTR, stage + 1, stage + 1);
|
||||
switch (stage)
|
||||
{
|
||||
case 0:
|
||||
@@ -135,7 +131,7 @@ namespace yy
|
||||
void
|
||||
parser::error (const parser::location_type& loc, const std::string& msg)
|
||||
{
|
||||
std::cerr << loc << ": " << msg << std::endl;
|
||||
std::cerr << loc << ": " << msg << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
Submodule gnulib updated: 7585eb3f16...a79f2a2871
+43
-30
@@ -4,8 +4,7 @@
|
||||
/*~
|
||||
/.deps
|
||||
/.dirstamp
|
||||
/Makefile
|
||||
/Makefile.in
|
||||
/_Noreturn.h
|
||||
/alignof.h
|
||||
/alloca.h
|
||||
/alloca.in.h
|
||||
@@ -15,7 +14,9 @@
|
||||
/asnprintf.c
|
||||
/basename-lgpl.c
|
||||
/basename.c
|
||||
/binary-io.c
|
||||
/binary-io.h
|
||||
/bitrotate.c
|
||||
/bitrotate.h
|
||||
/c++defs.h
|
||||
/c-ctype.c
|
||||
@@ -28,8 +29,6 @@
|
||||
/charset.alias
|
||||
/cloexec.c
|
||||
/cloexec.h
|
||||
/close-hook.c
|
||||
/close-hook.h
|
||||
/close-stream.c
|
||||
/close-stream.h
|
||||
/close.c
|
||||
@@ -37,7 +36,6 @@
|
||||
/closeout.h
|
||||
/concat-filename.c
|
||||
/concat-filename.h
|
||||
/config.charset
|
||||
/config.h
|
||||
/config.in.h
|
||||
/configmake.h
|
||||
@@ -56,7 +54,6 @@
|
||||
/exitfail.h
|
||||
/fatal-signal.c
|
||||
/fatal-signal.h
|
||||
/fclose.c
|
||||
/fcntl.c
|
||||
/fcntl.h
|
||||
/fcntl.in.h
|
||||
@@ -81,19 +78,27 @@
|
||||
/fseterr.h
|
||||
/fstat.c
|
||||
/getdtablesize.c
|
||||
/getopt-cdefs.in.h
|
||||
/getopt-core.h
|
||||
/getopt-ext.h
|
||||
/getopt-pfx-core.h
|
||||
/getopt-pfx-ext.h
|
||||
/getopt.c
|
||||
/getopt.h
|
||||
/getopt.in.h
|
||||
/getopt1.c
|
||||
/getopt_int.h
|
||||
/getprogname.c
|
||||
/getprogname.h
|
||||
/gettext.h
|
||||
/gnulib.mk
|
||||
/hard-locale.c
|
||||
/hard-locale.h
|
||||
/hash.c
|
||||
/hash.h
|
||||
/intprops.h
|
||||
/inttypes.h
|
||||
/inttypes.in.h
|
||||
/ioctl.c
|
||||
/isnan.c
|
||||
/isnand-nolibm.h
|
||||
/isnand.c
|
||||
@@ -103,9 +108,15 @@
|
||||
/isnanl.c
|
||||
/itold.c
|
||||
/ldexpl.c
|
||||
/limits.h
|
||||
/limits.in.h
|
||||
/localcharset.c
|
||||
/localcharset.h
|
||||
/lstat.c
|
||||
/malloc.c
|
||||
/malloca.c
|
||||
/malloca.h
|
||||
/math.c
|
||||
/math.h
|
||||
/math.in.h
|
||||
/mbrtowc.c
|
||||
@@ -114,12 +125,11 @@
|
||||
/mbswidth.h
|
||||
/memchr.c
|
||||
/memchr.valgrind
|
||||
/minmax.h
|
||||
/msvc-inval.c
|
||||
/msvc-inval.h
|
||||
/msvc-nothrow.c
|
||||
/msvc-nothrow.h
|
||||
/nonblocking.c
|
||||
/nonblocking.h
|
||||
/obstack.c
|
||||
/obstack.h
|
||||
/obstack_printf.c
|
||||
@@ -140,7 +150,6 @@
|
||||
/printf.c
|
||||
/progname.c
|
||||
/progname.h
|
||||
/quote.c
|
||||
/quote.h
|
||||
/quotearg.c
|
||||
/quotearg.h
|
||||
@@ -149,11 +158,10 @@
|
||||
/rawmemchr.valgrind
|
||||
/realloc.c
|
||||
/ref-add.sed
|
||||
/ref-add.sin
|
||||
/ref-del.sed
|
||||
/ref-del.sin
|
||||
/sched.h
|
||||
/sched.in.h
|
||||
/sig-handler.c
|
||||
/sig-handler.h
|
||||
/sigaction.c
|
||||
/signal.h
|
||||
@@ -182,6 +190,8 @@
|
||||
/spawnp.c
|
||||
/sprintf.c
|
||||
/stamp-h1
|
||||
/stat-w32.c
|
||||
/stat-w32.h
|
||||
/stat.c
|
||||
/stdbool.h
|
||||
/stdbool.in.h
|
||||
@@ -192,7 +202,6 @@
|
||||
/stdio--.h
|
||||
/stdio-impl.h
|
||||
/stdio-safer.h
|
||||
/stdio-write.c
|
||||
/stdio.h
|
||||
/stdio.in.h
|
||||
/stdlib.h
|
||||
@@ -211,24 +220,19 @@
|
||||
/stripslash.c
|
||||
/strndup.c
|
||||
/strnlen.c
|
||||
/strtol.c
|
||||
/strtoul.c
|
||||
/strverscmp.c
|
||||
/sys
|
||||
/sys_ioctl.h
|
||||
/sys_ioctl.in.h
|
||||
/sys_socket.h
|
||||
/sys_socket.in.h
|
||||
/sys_stat.h
|
||||
/sys_stat.in.h
|
||||
/sys_types.in.h
|
||||
/sys_wait.h
|
||||
/sys_wait.in.h
|
||||
/sysexits.in.h
|
||||
/time.h
|
||||
/time.in.h
|
||||
/unistd--.h
|
||||
/unistd-safer.h
|
||||
/unistd.c
|
||||
/unistd.h
|
||||
/unistd.in.h
|
||||
/unitypes.h
|
||||
@@ -236,6 +240,7 @@
|
||||
/uniwidth
|
||||
/uniwidth.h
|
||||
/uniwidth.in.h
|
||||
/unlink.c
|
||||
/unlocked-io.h
|
||||
/unsetenv.c
|
||||
/vasnprintf.c
|
||||
@@ -244,7 +249,6 @@
|
||||
/vfprintf.c
|
||||
/vsnprintf.c
|
||||
/vsprintf.c
|
||||
/w32sock.h
|
||||
/w32spawn.h
|
||||
/wait-process.c
|
||||
/wait-process.h
|
||||
@@ -252,6 +256,7 @@
|
||||
/warn-on-use.h
|
||||
/wchar.h
|
||||
/wchar.in.h
|
||||
/wctype-h.c
|
||||
/wctype.h
|
||||
/wctype.in.h
|
||||
/wcwidth.c
|
||||
@@ -262,17 +267,25 @@
|
||||
/xmalloc.c
|
||||
/xmemdup0.c
|
||||
/xmemdup0.h
|
||||
/xsize.c
|
||||
/xsize.h
|
||||
/xstrndup.c
|
||||
/xstrndup.h
|
||||
/binary-io.c
|
||||
/xsize.c
|
||||
/bitrotate.c
|
||||
/math.c
|
||||
/sig-handler.c
|
||||
/unistd.c
|
||||
/wctype-h.c
|
||||
/lstat.c
|
||||
/unlink.c
|
||||
/gettimeofday.c
|
||||
/stat-time.c
|
||||
/stat-time.h
|
||||
/timevar.c
|
||||
/timevar.h
|
||||
/sys_time.in.h
|
||||
/sys_times.in.h
|
||||
/gethrxtime.c
|
||||
/gethrxtime.h
|
||||
/getrusage.c
|
||||
/gettime.c
|
||||
/gettimeofday.c
|
||||
/localtime-buffer.c
|
||||
/localtime-buffer.h
|
||||
/sys_resource.in.h
|
||||
/timespec.c
|
||||
/timespec.h
|
||||
/xtime.c
|
||||
/xtime.h
|
||||
|
||||
+60
-103
@@ -1,7 +1,7 @@
|
||||
/* Array bitsets.
|
||||
|
||||
Copyright (C) 2002-2003, 2006, 2009-2015 Free Software Foundation,
|
||||
Inc.
|
||||
Copyright (C) 2002-2003, 2006, 2009-2015, 2018 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||
|
||||
@@ -36,10 +36,10 @@ static bitset_bindex
|
||||
abitset_resize (bitset src, bitset_bindex size)
|
||||
{
|
||||
/* These bitsets have a fixed size. */
|
||||
if (BITSET_SIZE_ (src) != size)
|
||||
abort ();
|
||||
if (BITSET_SIZE_ (src) != size)
|
||||
abort ();
|
||||
|
||||
return size;
|
||||
return size;
|
||||
}
|
||||
|
||||
/* Find list of up to NUM bits set in BSET starting from and including
|
||||
@@ -49,19 +49,14 @@ static bitset_bindex
|
||||
abitset_small_list (bitset src, bitset_bindex *list,
|
||||
bitset_bindex num, bitset_bindex *next)
|
||||
{
|
||||
bitset_bindex bitno;
|
||||
bitset_bindex count;
|
||||
bitset_windex size;
|
||||
bitset_word word;
|
||||
|
||||
word = ABITSET_WORDS (src)[0];
|
||||
bitset_word word = ABITSET_WORDS (src)[0];
|
||||
|
||||
/* Short circuit common case. */
|
||||
if (!word)
|
||||
return 0;
|
||||
|
||||
size = BITSET_SIZE_ (src);
|
||||
bitno = *next;
|
||||
bitset_windex size = BITSET_SIZE_ (src);
|
||||
bitset_bindex bitno = *next;
|
||||
if (bitno >= size)
|
||||
return 0;
|
||||
|
||||
@@ -70,6 +65,7 @@ abitset_small_list (bitset src, bitset_bindex *list,
|
||||
/* If num is 1, we could speed things up with a binary search
|
||||
of the word of interest. */
|
||||
|
||||
bitset_bindex count;
|
||||
if (num >= BITSET_WORD_BITS)
|
||||
{
|
||||
for (count = 0; word; bitno++)
|
||||
@@ -142,16 +138,10 @@ static bitset_bindex
|
||||
abitset_list_reverse (bitset src, bitset_bindex *list,
|
||||
bitset_bindex num, bitset_bindex *next)
|
||||
{
|
||||
bitset_bindex bitno;
|
||||
bitset_bindex rbitno;
|
||||
bitset_bindex count;
|
||||
bitset_windex windex;
|
||||
unsigned int bitcnt;
|
||||
bitset_bindex bitoff;
|
||||
bitset_word *srcp = ABITSET_WORDS (src);
|
||||
bitset_bindex n_bits = BITSET_SIZE_ (src);
|
||||
|
||||
rbitno = *next;
|
||||
bitset_bindex rbitno = *next;
|
||||
|
||||
/* If num is 1, we could speed things up with a binary search
|
||||
of the word of interest. */
|
||||
@@ -159,19 +149,17 @@ abitset_list_reverse (bitset src, bitset_bindex *list,
|
||||
if (rbitno >= n_bits)
|
||||
return 0;
|
||||
|
||||
count = 0;
|
||||
bitset_bindex count = 0;
|
||||
|
||||
bitno = n_bits - (rbitno + 1);
|
||||
bitset_bindex bitno = n_bits - (rbitno + 1);
|
||||
|
||||
windex = bitno / BITSET_WORD_BITS;
|
||||
bitcnt = bitno % BITSET_WORD_BITS;
|
||||
bitoff = windex * BITSET_WORD_BITS;
|
||||
bitset_windex windex = bitno / BITSET_WORD_BITS;
|
||||
unsigned bitcnt = bitno % BITSET_WORD_BITS;
|
||||
bitset_bindex bitoff = windex * BITSET_WORD_BITS;
|
||||
|
||||
do
|
||||
{
|
||||
bitset_word word;
|
||||
|
||||
word = srcp[windex] << (BITSET_WORD_BITS - 1 - bitcnt);
|
||||
bitset_word word = srcp[windex] << (BITSET_WORD_BITS - 1 - bitcnt);
|
||||
for (; word; bitcnt--)
|
||||
{
|
||||
if (word & BITSET_MSB)
|
||||
@@ -196,23 +184,21 @@ abitset_list_reverse (bitset src, bitset_bindex *list,
|
||||
|
||||
|
||||
/* Find list of up to NUM bits set in BSET starting from and including
|
||||
*NEXT and store in array LIST. Return with actual number of bits
|
||||
found and with *NEXT indicating where search stopped. */
|
||||
*NEXT and store in array LIST. Return with actual number of bits
|
||||
found and with *NEXT indicating where search stopped. */
|
||||
static bitset_bindex
|
||||
abitset_list (bitset src, bitset_bindex *list,
|
||||
bitset_bindex num, bitset_bindex *next)
|
||||
{
|
||||
bitset_bindex bitno;
|
||||
bitset_bindex count;
|
||||
bitset_windex windex;
|
||||
bitset_bindex bitoff;
|
||||
bitset_windex size = src->b.csize;
|
||||
bitset_word *srcp = ABITSET_WORDS (src);
|
||||
bitset_word word;
|
||||
|
||||
bitno = *next;
|
||||
bitset_bindex bitno = *next;
|
||||
|
||||
count = 0;
|
||||
bitset_bindex count = 0;
|
||||
if (!bitno)
|
||||
{
|
||||
/* Many bitsets are zero, so make this common case fast. */
|
||||
@@ -302,9 +288,7 @@ abitset_list (bitset src, bitset_bindex *list,
|
||||
static inline void
|
||||
abitset_unused_clear (bitset dst)
|
||||
{
|
||||
unsigned int last_bit;
|
||||
|
||||
last_bit = BITSET_SIZE_ (dst) % BITSET_WORD_BITS;
|
||||
unsigned last_bit = BITSET_SIZE_ (dst) % BITSET_WORD_BITS;
|
||||
if (last_bit)
|
||||
ABITSET_WORDS (dst)[dst->b.csize - 1] &=
|
||||
((bitset_word) 1 << last_bit) - 1;
|
||||
@@ -315,9 +299,7 @@ static void
|
||||
abitset_ones (bitset dst)
|
||||
{
|
||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||
size_t bytes;
|
||||
|
||||
bytes = sizeof (bitset_word) * dst->b.csize;
|
||||
size_t bytes = sizeof (bitset_word) * dst->b.csize;
|
||||
|
||||
memset (dstp, -1, bytes);
|
||||
abitset_unused_clear (dst);
|
||||
@@ -328,9 +310,7 @@ static void
|
||||
abitset_zero (bitset dst)
|
||||
{
|
||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||
size_t bytes;
|
||||
|
||||
bytes = sizeof (bitset_word) * dst->b.csize;
|
||||
size_t bytes = sizeof (bitset_word) * dst->b.csize;
|
||||
|
||||
memset (dstp, 0, bytes);
|
||||
}
|
||||
@@ -339,10 +319,9 @@ abitset_zero (bitset dst)
|
||||
static bool
|
||||
abitset_empty_p (bitset dst)
|
||||
{
|
||||
bitset_windex i;
|
||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||
|
||||
for (i = 0; i < dst->b.csize; i++)
|
||||
for (bitset_windex i = 0; i < dst->b.csize; i++)
|
||||
if (dstp[i])
|
||||
return false;
|
||||
|
||||
@@ -366,13 +345,12 @@ abitset_copy1 (bitset dst, bitset src)
|
||||
static void
|
||||
abitset_not (bitset dst, bitset src)
|
||||
{
|
||||
bitset_windex i;
|
||||
bitset_word *srcp = ABITSET_WORDS (src);
|
||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||
bitset_windex size = dst->b.csize;
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
*dstp++ = ~(*srcp++);
|
||||
for (bitset_windex i = 0; i < size; i++)
|
||||
*dstp++ = ~(*srcp++);
|
||||
abitset_unused_clear (dst);
|
||||
}
|
||||
|
||||
@@ -380,14 +358,13 @@ abitset_not (bitset dst, bitset src)
|
||||
static bool
|
||||
abitset_equal_p (bitset dst, bitset src)
|
||||
{
|
||||
bitset_windex i;
|
||||
bitset_word *srcp = ABITSET_WORDS (src);
|
||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||
bitset_windex size = dst->b.csize;
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
if (*srcp++ != *dstp++)
|
||||
return false;
|
||||
for (bitset_windex i = 0; i < size; i++)
|
||||
if (*srcp++ != *dstp++)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -395,14 +372,13 @@ abitset_equal_p (bitset dst, bitset src)
|
||||
static bool
|
||||
abitset_subset_p (bitset dst, bitset src)
|
||||
{
|
||||
bitset_windex i;
|
||||
bitset_word *srcp = ABITSET_WORDS (src);
|
||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||
bitset_windex size = dst->b.csize;
|
||||
|
||||
for (i = 0; i < size; i++, dstp++, srcp++)
|
||||
if (*dstp != (*srcp | *dstp))
|
||||
return false;
|
||||
for (bitset_windex i = 0; i < size; i++, dstp++, srcp++)
|
||||
if (*dstp != (*srcp | *dstp))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -410,14 +386,13 @@ abitset_subset_p (bitset dst, bitset src)
|
||||
static bool
|
||||
abitset_disjoint_p (bitset dst, bitset src)
|
||||
{
|
||||
bitset_windex i;
|
||||
bitset_word *srcp = ABITSET_WORDS (src);
|
||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||
bitset_windex size = dst->b.csize;
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
if (*srcp++ & *dstp++)
|
||||
return false;
|
||||
for (bitset_windex i = 0; i < size; i++)
|
||||
if (*srcp++ & *dstp++)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -426,28 +401,26 @@ abitset_disjoint_p (bitset dst, bitset src)
|
||||
static void
|
||||
abitset_and (bitset dst, bitset src1, bitset src2)
|
||||
{
|
||||
bitset_windex i;
|
||||
bitset_word *src1p = ABITSET_WORDS (src1);
|
||||
bitset_word *src2p = ABITSET_WORDS (src2);
|
||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||
bitset_windex size = dst->b.csize;
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
*dstp++ = *src1p++ & *src2p++;
|
||||
for (bitset_windex i = 0; i < size; i++)
|
||||
*dstp++ = *src1p++ & *src2p++;
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
abitset_and_cmp (bitset dst, bitset src1, bitset src2)
|
||||
{
|
||||
bitset_windex i;
|
||||
bool changed = false;
|
||||
bitset_word *src1p = ABITSET_WORDS (src1);
|
||||
bitset_word *src2p = ABITSET_WORDS (src2);
|
||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||
bitset_windex size = dst->b.csize;
|
||||
|
||||
for (i = 0; i < size; i++, dstp++)
|
||||
for (bitset_windex i = 0; i < size; i++, dstp++)
|
||||
{
|
||||
bitset_word tmp = *src1p++ & *src2p++;
|
||||
|
||||
@@ -464,28 +437,26 @@ abitset_and_cmp (bitset dst, bitset src1, bitset src2)
|
||||
static void
|
||||
abitset_andn (bitset dst, bitset src1, bitset src2)
|
||||
{
|
||||
bitset_windex i;
|
||||
bitset_word *src1p = ABITSET_WORDS (src1);
|
||||
bitset_word *src2p = ABITSET_WORDS (src2);
|
||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||
bitset_windex size = dst->b.csize;
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
*dstp++ = *src1p++ & ~(*src2p++);
|
||||
for (bitset_windex i = 0; i < size; i++)
|
||||
*dstp++ = *src1p++ & ~(*src2p++);
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
abitset_andn_cmp (bitset dst, bitset src1, bitset src2)
|
||||
{
|
||||
bitset_windex i;
|
||||
bool changed = false;
|
||||
bitset_word *src1p = ABITSET_WORDS (src1);
|
||||
bitset_word *src2p = ABITSET_WORDS (src2);
|
||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||
bitset_windex size = dst->b.csize;
|
||||
|
||||
for (i = 0; i < size; i++, dstp++)
|
||||
for (bitset_windex i = 0; i < size; i++, dstp++)
|
||||
{
|
||||
bitset_word tmp = *src1p++ & ~(*src2p++);
|
||||
|
||||
@@ -502,28 +473,26 @@ abitset_andn_cmp (bitset dst, bitset src1, bitset src2)
|
||||
static void
|
||||
abitset_or (bitset dst, bitset src1, bitset src2)
|
||||
{
|
||||
bitset_windex i;
|
||||
bitset_word *src1p = ABITSET_WORDS (src1);
|
||||
bitset_word *src2p = ABITSET_WORDS (src2);
|
||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||
bitset_windex size = dst->b.csize;
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
*dstp++ = *src1p++ | *src2p++;
|
||||
for (bitset_windex i = 0; i < size; i++)
|
||||
*dstp++ = *src1p++ | *src2p++;
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
abitset_or_cmp (bitset dst, bitset src1, bitset src2)
|
||||
{
|
||||
bitset_windex i;
|
||||
bool changed = false;
|
||||
bitset_word *src1p = ABITSET_WORDS (src1);
|
||||
bitset_word *src2p = ABITSET_WORDS (src2);
|
||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||
bitset_windex size = dst->b.csize;
|
||||
|
||||
for (i = 0; i < size; i++, dstp++)
|
||||
for (bitset_windex i = 0; i < size; i++, dstp++)
|
||||
{
|
||||
bitset_word tmp = *src1p++ | *src2p++;
|
||||
|
||||
@@ -540,13 +509,12 @@ abitset_or_cmp (bitset dst, bitset src1, bitset src2)
|
||||
static void
|
||||
abitset_xor (bitset dst, bitset src1, bitset src2)
|
||||
{
|
||||
bitset_windex i;
|
||||
bitset_word *src1p = ABITSET_WORDS (src1);
|
||||
bitset_word *src2p = ABITSET_WORDS (src2);
|
||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||
bitset_windex size = dst->b.csize;
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
for (bitset_windex i = 0; i < size; i++)
|
||||
*dstp++ = *src1p++ ^ *src2p++;
|
||||
}
|
||||
|
||||
@@ -554,14 +522,13 @@ abitset_xor (bitset dst, bitset src1, bitset src2)
|
||||
static bool
|
||||
abitset_xor_cmp (bitset dst, bitset src1, bitset src2)
|
||||
{
|
||||
bitset_windex i;
|
||||
bool changed = false;
|
||||
bitset_word *src1p = ABITSET_WORDS (src1);
|
||||
bitset_word *src2p = ABITSET_WORDS (src2);
|
||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||
bitset_windex size = dst->b.csize;
|
||||
|
||||
for (i = 0; i < size; i++, dstp++)
|
||||
for (bitset_windex i = 0; i < size; i++, dstp++)
|
||||
{
|
||||
bitset_word tmp = *src1p++ ^ *src2p++;
|
||||
|
||||
@@ -578,22 +545,20 @@ abitset_xor_cmp (bitset dst, bitset src1, bitset src2)
|
||||
static void
|
||||
abitset_and_or (bitset dst, bitset src1, bitset src2, bitset src3)
|
||||
{
|
||||
bitset_windex i;
|
||||
bitset_word *src1p = ABITSET_WORDS (src1);
|
||||
bitset_word *src2p = ABITSET_WORDS (src2);
|
||||
bitset_word *src3p = ABITSET_WORDS (src3);
|
||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||
bitset_windex size = dst->b.csize;
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
*dstp++ = (*src1p++ & *src2p++) | *src3p++;
|
||||
for (bitset_windex i = 0; i < size; i++)
|
||||
*dstp++ = (*src1p++ & *src2p++) | *src3p++;
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
abitset_and_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
|
||||
{
|
||||
bitset_windex i;
|
||||
bool changed = false;
|
||||
bitset_word *src1p = ABITSET_WORDS (src1);
|
||||
bitset_word *src2p = ABITSET_WORDS (src2);
|
||||
@@ -601,7 +566,7 @@ abitset_and_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
|
||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||
bitset_windex size = dst->b.csize;
|
||||
|
||||
for (i = 0; i < size; i++, dstp++)
|
||||
for (bitset_windex i = 0; i < size; i++, dstp++)
|
||||
{
|
||||
bitset_word tmp = (*src1p++ & *src2p++) | *src3p++;
|
||||
|
||||
@@ -618,22 +583,20 @@ abitset_and_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
|
||||
static void
|
||||
abitset_andn_or (bitset dst, bitset src1, bitset src2, bitset src3)
|
||||
{
|
||||
bitset_windex i;
|
||||
bitset_word *src1p = ABITSET_WORDS (src1);
|
||||
bitset_word *src2p = ABITSET_WORDS (src2);
|
||||
bitset_word *src3p = ABITSET_WORDS (src3);
|
||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||
bitset_windex size = dst->b.csize;
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
*dstp++ = (*src1p++ & ~(*src2p++)) | *src3p++;
|
||||
for (bitset_windex i = 0; i < size; i++)
|
||||
*dstp++ = (*src1p++ & ~(*src2p++)) | *src3p++;
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
abitset_andn_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
|
||||
{
|
||||
bitset_windex i;
|
||||
bool changed = false;
|
||||
bitset_word *src1p = ABITSET_WORDS (src1);
|
||||
bitset_word *src2p = ABITSET_WORDS (src2);
|
||||
@@ -641,7 +604,7 @@ abitset_andn_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
|
||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||
bitset_windex size = dst->b.csize;
|
||||
|
||||
for (i = 0; i < size; i++, dstp++)
|
||||
for (bitset_windex i = 0; i < size; i++, dstp++)
|
||||
{
|
||||
bitset_word tmp = (*src1p++ & ~(*src2p++)) | *src3p++;
|
||||
|
||||
@@ -658,22 +621,20 @@ abitset_andn_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
|
||||
static void
|
||||
abitset_or_and (bitset dst, bitset src1, bitset src2, bitset src3)
|
||||
{
|
||||
bitset_windex i;
|
||||
bitset_word *src1p = ABITSET_WORDS (src1);
|
||||
bitset_word *src2p = ABITSET_WORDS (src2);
|
||||
bitset_word *src3p = ABITSET_WORDS (src3);
|
||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||
bitset_windex size = dst->b.csize;
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
*dstp++ = (*src1p++ | *src2p++) & *src3p++;
|
||||
for (bitset_windex i = 0; i < size; i++)
|
||||
*dstp++ = (*src1p++ | *src2p++) & *src3p++;
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
abitset_or_and_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
|
||||
{
|
||||
bitset_windex i;
|
||||
bool changed = false;
|
||||
bitset_word *src1p = ABITSET_WORDS (src1);
|
||||
bitset_word *src2p = ABITSET_WORDS (src2);
|
||||
@@ -681,7 +642,7 @@ abitset_or_and_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
|
||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||
bitset_windex size = dst->b.csize;
|
||||
|
||||
for (i = 0; i < size; i++, dstp++)
|
||||
for (bitset_windex i = 0; i < size; i++, dstp++)
|
||||
{
|
||||
bitset_word tmp = (*src1p++ | *src2p++) & *src3p++;
|
||||
|
||||
@@ -699,9 +660,9 @@ static void
|
||||
abitset_copy (bitset dst, bitset src)
|
||||
{
|
||||
if (BITSET_COMPATIBLE_ (dst, src))
|
||||
abitset_copy1 (dst, src);
|
||||
abitset_copy1 (dst, src);
|
||||
else
|
||||
bitset_copy_ (dst, src);
|
||||
bitset_copy_ (dst, src);
|
||||
}
|
||||
|
||||
|
||||
@@ -784,14 +745,12 @@ struct bitset_vtable abitset_vtable = {
|
||||
size_t
|
||||
abitset_bytes (bitset_bindex n_bits)
|
||||
{
|
||||
bitset_windex size;
|
||||
size_t bytes;
|
||||
size_t header_size = offsetof (union bitset_union, a.words);
|
||||
struct bitset_align_struct { char a; union bitset_union b; };
|
||||
size_t bitset_alignment = offsetof (struct bitset_align_struct, b);
|
||||
|
||||
size = ABITSET_N_WORDS (n_bits);
|
||||
bytes = header_size + size * sizeof (bitset_word);
|
||||
bitset_windex size = ABITSET_N_WORDS (n_bits);
|
||||
size_t bytes = header_size + size * sizeof (bitset_word);
|
||||
|
||||
/* Align the size properly for a vector of abitset objects. */
|
||||
if (header_size % bitset_alignment != 0
|
||||
@@ -808,9 +767,7 @@ abitset_bytes (bitset_bindex n_bits)
|
||||
bitset
|
||||
abitset_init (bitset bset, bitset_bindex n_bits)
|
||||
{
|
||||
bitset_windex size;
|
||||
|
||||
size = ABITSET_N_WORDS (n_bits);
|
||||
bitset_windex size = ABITSET_N_WORDS (n_bits);
|
||||
BITSET_NBITS_ (bset) = n_bits;
|
||||
|
||||
/* Use optimized routines if bitset fits within a single word.
|
||||
|
||||
+4
-3
@@ -1,6 +1,7 @@
|
||||
/* Functions to support abitsets.
|
||||
|
||||
Copyright (C) 2002, 2004, 2009-2015 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2004, 2009-2015, 2018 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||
|
||||
@@ -22,8 +23,8 @@
|
||||
|
||||
#include "bitset.h"
|
||||
|
||||
extern size_t abitset_bytes (bitset_bindex);
|
||||
size_t abitset_bytes (bitset_bindex);
|
||||
|
||||
extern bitset abitset_init (bitset, bitset_bindex);
|
||||
bitset abitset_init (bitset, bitset_bindex);
|
||||
|
||||
#endif
|
||||
|
||||
+14
-14
@@ -1,7 +1,7 @@
|
||||
/* Base bitset stuff.
|
||||
|
||||
Copyright (C) 2002-2004, 2006, 2009-2015 Free Software Foundation,
|
||||
Inc.
|
||||
Copyright (C) 2002-2004, 2006, 2009-2015, 2018 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||
|
||||
@@ -50,8 +50,8 @@ extern const char * const bitset_type_names[];
|
||||
enum bitset_alloc_type {BITSET_MALLOC, BITSET_OBALLOC};
|
||||
|
||||
/* Data type used to store a word of bits. */
|
||||
typedef unsigned long int bitset_word;
|
||||
#define BITSET_WORD_BITS ((unsigned int) (CHAR_BIT * sizeof (bitset_word)))
|
||||
typedef unsigned long bitset_word;
|
||||
#define BITSET_WORD_BITS ((unsigned) (CHAR_BIT * sizeof (bitset_word)))
|
||||
|
||||
/* Bit index. In theory we might need a type wider than size_t, but
|
||||
in practice we lose at most a factor of CHAR_BIT by going with
|
||||
@@ -281,24 +281,24 @@ if (!BITSET_COMPATIBLE_ (DST, SRC1) || !BITSET_COMPATIBLE_ (DST, SRC2) \
|
||||
|
||||
/* Private functions for bitset implementations. */
|
||||
|
||||
extern bool bitset_toggle_ (bitset, bitset_bindex);
|
||||
bool bitset_toggle_ (bitset, bitset_bindex);
|
||||
|
||||
extern bitset_bindex bitset_count_ (bitset);
|
||||
bitset_bindex bitset_count_ (bitset);
|
||||
|
||||
extern bitset_bindex bitset_size_ (bitset);
|
||||
bitset_bindex bitset_size_ (bitset);
|
||||
|
||||
extern bool bitset_copy_ (bitset, bitset);
|
||||
bool bitset_copy_ (bitset, bitset);
|
||||
|
||||
extern void bitset_and_or_ (bitset, bitset, bitset, bitset);
|
||||
void bitset_and_or_ (bitset, bitset, bitset, bitset);
|
||||
|
||||
extern bool bitset_and_or_cmp_ (bitset, bitset, bitset, bitset);
|
||||
bool bitset_and_or_cmp_ (bitset, bitset, bitset, bitset);
|
||||
|
||||
extern void bitset_andn_or_ (bitset, bitset, bitset, bitset);
|
||||
void bitset_andn_or_ (bitset, bitset, bitset, bitset);
|
||||
|
||||
extern bool bitset_andn_or_cmp_ (bitset, bitset, bitset, bitset);
|
||||
bool bitset_andn_or_cmp_ (bitset, bitset, bitset, bitset);
|
||||
|
||||
extern void bitset_or_and_ (bitset, bitset, bitset, bitset);
|
||||
void bitset_or_and_ (bitset, bitset, bitset, bitset);
|
||||
|
||||
extern bool bitset_or_and_cmp_ (bitset, bitset, bitset, bitset);
|
||||
bool bitset_or_and_cmp_ (bitset, bitset, bitset, bitset);
|
||||
|
||||
#endif /* _BBITSET_H */
|
||||
|
||||
+22
-39
@@ -1,6 +1,7 @@
|
||||
/* General bitsets.
|
||||
|
||||
Copyright (C) 2002-2006, 2009-2015 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002-2006, 2009-2015, 2018 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||
|
||||
@@ -38,11 +39,10 @@ const char * const bitset_type_names[] = BITSET_TYPE_NAMES;
|
||||
size_t
|
||||
bitset_bytes (enum bitset_type type, bitset_bindex n_bits)
|
||||
{
|
||||
size_t bytes;
|
||||
|
||||
if (bitset_stats_enabled)
|
||||
return bitset_stats_bytes ();
|
||||
|
||||
size_t bytes;
|
||||
switch (type)
|
||||
{
|
||||
default:
|
||||
@@ -100,7 +100,7 @@ bitset_init (bitset bset, bitset_bindex n_bits, enum bitset_type type)
|
||||
specified by ATTR. For variable size bitsets, N_BITS is only a
|
||||
hint and may be zero. */
|
||||
enum bitset_type
|
||||
bitset_type_choose (bitset_bindex n_bits ATTRIBUTE_UNUSED, unsigned int attr)
|
||||
bitset_type_choose (bitset_bindex n_bits ATTRIBUTE_UNUSED, unsigned attr)
|
||||
{
|
||||
/* Check attributes. */
|
||||
if (attr & BITSET_FIXED && attr & BITSET_VARIABLE)
|
||||
@@ -133,12 +133,9 @@ bitset_type_choose (bitset_bindex n_bits ATTRIBUTE_UNUSED, unsigned int attr)
|
||||
bitset
|
||||
bitset_alloc (bitset_bindex n_bits, enum bitset_type type)
|
||||
{
|
||||
size_t bytes;
|
||||
bitset bset;
|
||||
size_t bytes = bitset_bytes (type, n_bits);
|
||||
|
||||
bytes = bitset_bytes (type, n_bits);
|
||||
|
||||
bset = xcalloc (1, bytes);
|
||||
bitset bset = xcalloc (1, bytes);
|
||||
|
||||
/* The cache is disabled until some elements are allocated. If we
|
||||
have variable length arrays, then we may need to allocate a dummy
|
||||
@@ -153,12 +150,9 @@ bitset
|
||||
bitset_obstack_alloc (struct obstack *bobstack,
|
||||
bitset_bindex n_bits, enum bitset_type type)
|
||||
{
|
||||
size_t bytes;
|
||||
bitset bset;
|
||||
size_t bytes = bitset_bytes (type, n_bits);
|
||||
|
||||
bytes = bitset_bytes (type, n_bits);
|
||||
|
||||
bset = obstack_alloc (bobstack, bytes);
|
||||
bitset bset = obstack_alloc (bobstack, bytes);
|
||||
memset (bset, 0, bytes);
|
||||
|
||||
return bitset_init (bset, n_bits, type);
|
||||
@@ -168,11 +162,9 @@ bitset_obstack_alloc (struct obstack *bobstack,
|
||||
/* Create a bitset of N_BITS and with attribute hints specified by
|
||||
ATTR. */
|
||||
bitset
|
||||
bitset_create (bitset_bindex n_bits, unsigned int attr)
|
||||
bitset_create (bitset_bindex n_bits, unsigned attr)
|
||||
{
|
||||
enum bitset_type type;
|
||||
|
||||
type = bitset_type_choose (n_bits, attr);
|
||||
enum bitset_type type = bitset_type_choose (n_bits, attr);
|
||||
|
||||
return bitset_alloc (n_bits, type);
|
||||
}
|
||||
@@ -199,9 +191,7 @@ bitset_obstack_free (bitset bset)
|
||||
enum bitset_type
|
||||
bitset_type_get (bitset bset)
|
||||
{
|
||||
enum bitset_type type;
|
||||
|
||||
type = BITSET_TYPE_ (bset);
|
||||
enum bitset_type type = BITSET_TYPE_ (bset);
|
||||
if (type != BITSET_STATS)
|
||||
return type;
|
||||
|
||||
@@ -213,9 +203,7 @@ bitset_type_get (bitset bset)
|
||||
const char *
|
||||
bitset_type_name_get (bitset bset)
|
||||
{
|
||||
enum bitset_type type;
|
||||
|
||||
type = bitset_type_get (bset);
|
||||
enum bitset_type type = bitset_type_get (bset);
|
||||
|
||||
return bitset_type_names[type];
|
||||
}
|
||||
@@ -239,7 +227,7 @@ bitset_next (bitset src, bitset_bindex bitno)
|
||||
extern bool
|
||||
bitset_compatible_p (bitset bset1, bitset bset2)
|
||||
{
|
||||
return BITSET_COMPATIBLE_ (bset1, bset2);
|
||||
return BITSET_COMPATIBLE_ (bset1, bset2);
|
||||
}
|
||||
|
||||
|
||||
@@ -290,15 +278,13 @@ bitset_only_set_p (bitset src, bitset_bindex bitno)
|
||||
static void
|
||||
bitset_print (FILE *file, bitset bset, bool verbose)
|
||||
{
|
||||
unsigned int pos;
|
||||
bitset_bindex i;
|
||||
bitset_iterator iter;
|
||||
|
||||
if (verbose)
|
||||
fprintf (file, "n_bits = %lu, set = {",
|
||||
(unsigned long int) bitset_size (bset));
|
||||
(unsigned long) bitset_size (bset));
|
||||
|
||||
pos = 30;
|
||||
unsigned pos = 30;
|
||||
bitset_bindex i;
|
||||
bitset_iterator iter;
|
||||
BITSET_FOR_EACH (iter, bset, i, 0)
|
||||
{
|
||||
if (pos > 70)
|
||||
@@ -307,7 +293,7 @@ bitset_print (FILE *file, bitset bset, bool verbose)
|
||||
pos = 0;
|
||||
}
|
||||
|
||||
fprintf (file, "%lu ", (unsigned long int) i);
|
||||
fprintf (file, "%lu ", (unsigned long) i);
|
||||
pos += 1 + (i >= 10) + (i >= 100);
|
||||
};
|
||||
|
||||
@@ -356,7 +342,7 @@ bitset_toggle_ (bitset bset, bitset_bindex bitno)
|
||||
bitset_bindex
|
||||
bitset_size_ (bitset src)
|
||||
{
|
||||
return BITSET_NBITS_ (src);
|
||||
return BITSET_NBITS_ (src);
|
||||
}
|
||||
|
||||
|
||||
@@ -365,7 +351,6 @@ bitset_bindex
|
||||
bitset_count_ (bitset src)
|
||||
{
|
||||
bitset_bindex list[BITSET_LIST_SIZE];
|
||||
bitset_bindex next;
|
||||
bitset_bindex num;
|
||||
bitset_bindex count;
|
||||
|
||||
@@ -373,7 +358,7 @@ bitset_count_ (bitset src)
|
||||
bitset implementation that uses a direct technique (based on
|
||||
masks) for counting the number of bits set in a word. */
|
||||
|
||||
next = 0;
|
||||
bitset_bindex next = 0;
|
||||
for (count = 0; (num = bitset_list (src, list, BITSET_LIST_SIZE, &next));
|
||||
count += num)
|
||||
continue;
|
||||
@@ -410,13 +395,11 @@ bitset_op4_cmp (bitset dst, bitset src1, bitset src2, bitset src3,
|
||||
enum bitset_ops op)
|
||||
{
|
||||
bool changed = false;
|
||||
bool stats_enabled_save;
|
||||
bitset tmp;
|
||||
|
||||
/* Create temporary bitset. */
|
||||
stats_enabled_save = bitset_stats_enabled;
|
||||
bool stats_enabled_save = bitset_stats_enabled;
|
||||
bitset_stats_enabled = false;
|
||||
tmp = bitset_alloc (0, bitset_type_get (dst));
|
||||
bitset tmp = bitset_alloc (0, bitset_type_get (dst));
|
||||
bitset_stats_enabled = stats_enabled_save;
|
||||
|
||||
switch (op)
|
||||
|
||||
+30
-29
@@ -1,6 +1,7 @@
|
||||
/* Generic bitsets.
|
||||
|
||||
Copyright (C) 2002-2004, 2009-2015 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002-2004, 2009-2015, 2018 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||
|
||||
@@ -39,7 +40,7 @@ enum bitset_attr {BITSET_FIXED = 1, /* Bitset size fixed. */
|
||||
BITSET_FRUGAL = 16, /* Prefer most compact. */
|
||||
BITSET_GREEDY = 32}; /* Prefer fastest at memory expense. */
|
||||
|
||||
typedef unsigned int bitset_attrs;
|
||||
typedef unsigned bitset_attrs;
|
||||
|
||||
/* The contents of the union should be considered to be private.
|
||||
While I would like to make this union opaque, it needs to be
|
||||
@@ -98,37 +99,37 @@ typedef struct
|
||||
|
||||
|
||||
/* Return bytes required for bitset of desired type and size. */
|
||||
extern size_t bitset_bytes (enum bitset_type, bitset_bindex);
|
||||
size_t bitset_bytes (enum bitset_type, bitset_bindex);
|
||||
|
||||
/* Initialise a bitset with desired type and size. */
|
||||
extern bitset bitset_init (bitset, bitset_bindex, enum bitset_type);
|
||||
bitset bitset_init (bitset, bitset_bindex, enum bitset_type);
|
||||
|
||||
/* Select an implementation type based on the desired bitset size
|
||||
and attributes. */
|
||||
extern enum bitset_type bitset_type_choose (bitset_bindex, bitset_attrs);
|
||||
enum bitset_type bitset_type_choose (bitset_bindex, bitset_attrs);
|
||||
|
||||
/* Create a bitset of desired type and size. The bitset is zeroed. */
|
||||
extern bitset bitset_alloc (bitset_bindex, enum bitset_type);
|
||||
bitset bitset_alloc (bitset_bindex, enum bitset_type);
|
||||
|
||||
/* Free bitset. */
|
||||
extern void bitset_free (bitset);
|
||||
void bitset_free (bitset);
|
||||
|
||||
/* Create a bitset of desired type and size using an obstack. The
|
||||
bitset is zeroed. */
|
||||
extern bitset bitset_obstack_alloc (struct obstack *bobstack,
|
||||
bitset_bindex, enum bitset_type);
|
||||
bitset bitset_obstack_alloc (struct obstack *bobstack,
|
||||
bitset_bindex, enum bitset_type);
|
||||
|
||||
/* Free bitset allocated on obstack. */
|
||||
extern void bitset_obstack_free (bitset);
|
||||
void bitset_obstack_free (bitset);
|
||||
|
||||
/* Create a bitset of desired size and attributes. The bitset is zeroed. */
|
||||
extern bitset bitset_create (bitset_bindex, bitset_attrs);
|
||||
bitset bitset_create (bitset_bindex, bitset_attrs);
|
||||
|
||||
/* Return bitset type. */
|
||||
extern enum bitset_type bitset_type_get (bitset);
|
||||
enum bitset_type bitset_type_get (bitset);
|
||||
|
||||
/* Return bitset type name. */
|
||||
extern const char *bitset_type_name_get (bitset);
|
||||
const char *bitset_type_name_get (bitset);
|
||||
|
||||
|
||||
/* Set bit BITNO in bitset BSET. */
|
||||
@@ -180,7 +181,7 @@ bitset_test (bitset bset, bitset_bindex bitno)
|
||||
#define bitset_size(SRC) BITSET_SIZE_ (SRC)
|
||||
|
||||
/* Change size of bitset. */
|
||||
extern void bitset_resize (bitset, bitset_bindex);
|
||||
void bitset_resize (bitset, bitset_bindex);
|
||||
|
||||
/* Return number of bits set in bitset SRC. */
|
||||
#define bitset_count(SRC) BITSET_COUNT_ (SRC)
|
||||
@@ -280,25 +281,25 @@ extern void bitset_resize (bitset, bitset_bindex);
|
||||
BITSET_LIST_REVERSE_ (BSET, LIST, NUM, NEXT)
|
||||
|
||||
/* Return true if both bitsets are of the same type and size. */
|
||||
extern bool bitset_compatible_p (bitset bset1, bitset bset2);
|
||||
bool bitset_compatible_p (bitset bset1, bitset bset2);
|
||||
|
||||
/* Find next set bit from the given bit index. */
|
||||
extern bitset_bindex bitset_next (bitset, bitset_bindex);
|
||||
bitset_bindex bitset_next (bitset, bitset_bindex);
|
||||
|
||||
/* Find previous set bit from the given bit index. */
|
||||
extern bitset_bindex bitset_prev (bitset, bitset_bindex);
|
||||
bitset_bindex bitset_prev (bitset, bitset_bindex);
|
||||
|
||||
/* Find first set bit. */
|
||||
extern bitset_bindex bitset_first (bitset);
|
||||
bitset_bindex bitset_first (bitset);
|
||||
|
||||
/* Find last set bit. */
|
||||
extern bitset_bindex bitset_last (bitset);
|
||||
bitset_bindex bitset_last (bitset);
|
||||
|
||||
/* Return nonzero if this is the only set bit. */
|
||||
extern bool bitset_only_set_p (bitset, bitset_bindex);
|
||||
bool bitset_only_set_p (bitset, bitset_bindex);
|
||||
|
||||
/* Dump bitset. */
|
||||
extern void bitset_dump (FILE *, bitset);
|
||||
void bitset_dump (FILE *, bitset);
|
||||
|
||||
/* Loop over all elements of BSET, starting with MIN, setting INDEX
|
||||
to the index of each set bit. For example, the following will print
|
||||
@@ -309,7 +310,7 @@ extern void bitset_dump (FILE *, bitset);
|
||||
|
||||
BITSET_FOR_EACH (iter, src, i, 0)
|
||||
{
|
||||
printf ("%lu ", (unsigned long int) i);
|
||||
printf ("%lu ", (unsigned long) i);
|
||||
};
|
||||
*/
|
||||
#define BITSET_FOR_EACH(ITER, BSET, INDEX, MIN) \
|
||||
@@ -331,7 +332,7 @@ extern void bitset_dump (FILE *, bitset);
|
||||
|
||||
BITSET_FOR_EACH_REVERSE (iter, src, i, 0)
|
||||
{
|
||||
printf ("%lu ", (unsigned long int) i);
|
||||
printf ("%lu ", (unsigned long) i);
|
||||
};
|
||||
*/
|
||||
#define BITSET_FOR_EACH_REVERSE(ITER, BSET, INDEX, MIN) \
|
||||
@@ -367,13 +368,13 @@ extern void bitset_dump (FILE *, bitset);
|
||||
|
||||
|
||||
/* Release any memory tied up with bitsets. */
|
||||
extern void bitset_release_memory (void);
|
||||
void bitset_release_memory (void);
|
||||
|
||||
/* Enable bitset stats gathering. */
|
||||
extern void bitset_stats_enable (void);
|
||||
void bitset_stats_enable (void);
|
||||
|
||||
/* Disable bitset stats gathering. */
|
||||
extern void bitset_stats_disable (void);
|
||||
void bitset_stats_disable (void);
|
||||
|
||||
/* Read bitset stats file of accummulated stats. */
|
||||
void bitset_stats_read (const char *file_name);
|
||||
@@ -382,12 +383,12 @@ void bitset_stats_read (const char *file_name);
|
||||
void bitset_stats_write (const char *file_name);
|
||||
|
||||
/* Dump bitset stats. */
|
||||
extern void bitset_stats_dump (FILE *);
|
||||
void bitset_stats_dump (FILE *);
|
||||
|
||||
/* Function to debug bitset from debugger. */
|
||||
extern void debug_bitset (bitset);
|
||||
void debug_bitset (bitset);
|
||||
|
||||
/* Function to debug bitset stats from debugger. */
|
||||
extern void debug_bitset_stats (void);
|
||||
void debug_bitset_stats (void);
|
||||
|
||||
#endif /* _BITSET_H */
|
||||
|
||||
+53
-61
@@ -1,6 +1,7 @@
|
||||
/* Bitset statistics.
|
||||
|
||||
Copyright (C) 2002-2006, 2009-2015 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002-2006, 2009-2015, 2018 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||
|
||||
@@ -76,23 +77,23 @@
|
||||
|
||||
struct bitset_type_info_struct
|
||||
{
|
||||
unsigned int allocs;
|
||||
unsigned int frees;
|
||||
unsigned int lists;
|
||||
unsigned int sets;
|
||||
unsigned int cache_sets;
|
||||
unsigned int resets;
|
||||
unsigned int cache_resets;
|
||||
unsigned int tests;
|
||||
unsigned int cache_tests;
|
||||
unsigned int list_counts[BITSET_LOG_COUNT_BINS];
|
||||
unsigned int list_sizes[BITSET_LOG_SIZE_BINS];
|
||||
unsigned int list_density[BITSET_DENSITY_BINS];
|
||||
unsigned allocs;
|
||||
unsigned frees;
|
||||
unsigned lists;
|
||||
unsigned sets;
|
||||
unsigned cache_sets;
|
||||
unsigned resets;
|
||||
unsigned cache_resets;
|
||||
unsigned tests;
|
||||
unsigned cache_tests;
|
||||
unsigned list_counts[BITSET_LOG_COUNT_BINS];
|
||||
unsigned list_sizes[BITSET_LOG_SIZE_BINS];
|
||||
unsigned list_density[BITSET_DENSITY_BINS];
|
||||
};
|
||||
|
||||
struct bitset_stats_info_struct
|
||||
{
|
||||
unsigned int runs;
|
||||
unsigned runs;
|
||||
struct bitset_type_info_struct types[BITSET_TYPE_NUM];
|
||||
};
|
||||
|
||||
@@ -105,20 +106,17 @@ bool bitset_stats_enabled = false;
|
||||
/* Print a percentage histogram with message MSG to FILE. */
|
||||
static void
|
||||
bitset_percent_histogram_print (FILE *file, const char *name, const char *msg,
|
||||
unsigned int n_bins, unsigned int *bins)
|
||||
unsigned n_bins, unsigned *bins)
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned int total;
|
||||
|
||||
total = 0;
|
||||
for (i = 0; i < n_bins; i++)
|
||||
unsigned total = 0;
|
||||
for (unsigned i = 0; i < n_bins; i++)
|
||||
total += bins[i];
|
||||
|
||||
if (!total)
|
||||
return;
|
||||
|
||||
fprintf (file, "%s %s", name, msg);
|
||||
for (i = 0; i < n_bins; i++)
|
||||
for (unsigned i = 0; i < n_bins; i++)
|
||||
fprintf (file, "%.0f-%.0f%%\t%8u (%5.1f%%)\n",
|
||||
i * 100.0 / n_bins,
|
||||
(i + 1) * 100.0 / n_bins, bins[i],
|
||||
@@ -129,39 +127,41 @@ bitset_percent_histogram_print (FILE *file, const char *name, const char *msg,
|
||||
/* Print a log histogram with message MSG to FILE. */
|
||||
static void
|
||||
bitset_log_histogram_print (FILE *file, const char *name, const char *msg,
|
||||
unsigned int n_bins, unsigned int *bins)
|
||||
unsigned n_bins, unsigned *bins)
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned int total;
|
||||
unsigned int max_width;
|
||||
|
||||
total = 0;
|
||||
for (i = 0; i < n_bins; i++)
|
||||
unsigned total = 0;
|
||||
for (unsigned i = 0; i < n_bins; i++)
|
||||
total += bins[i];
|
||||
|
||||
if (!total)
|
||||
return;
|
||||
|
||||
/* Determine number of useful bins. */
|
||||
for (i = n_bins; i > 3 && ! bins[i - 1]; i--)
|
||||
continue;
|
||||
n_bins = i;
|
||||
{
|
||||
unsigned i;
|
||||
for (i = n_bins; i > 3 && ! bins[i - 1]; i--)
|
||||
continue;
|
||||
n_bins = i;
|
||||
}
|
||||
|
||||
/* 2 * ceil (log10 (2) * (N - 1)) + 1. */
|
||||
max_width = 2 * (unsigned int) (0.30103 * (n_bins - 1) + 0.9999) + 1;
|
||||
unsigned max_width = 2 * (unsigned) (0.30103 * (n_bins - 1) + 0.9999) + 1;
|
||||
|
||||
fprintf (file, "%s %s", name, msg);
|
||||
for (i = 0; i < 2; i++)
|
||||
fprintf (file, "%*d\t%8u (%5.1f%%)\n",
|
||||
max_width, i, bins[i], 100.0 * bins[i] / total);
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < 2; i++)
|
||||
fprintf (file, "%*d\t%8u (%5.1f%%)\n",
|
||||
max_width, i, bins[i], 100.0 * bins[i] / total);
|
||||
|
||||
for (; i < n_bins; i++)
|
||||
fprintf (file, "%*lu-%lu\t%8u (%5.1f%%)\n",
|
||||
max_width - ((unsigned int) (0.30103 * (i) + 0.9999) + 1),
|
||||
1UL << (i - 1),
|
||||
(1UL << i) - 1,
|
||||
bins[i],
|
||||
(100.0 * bins[i]) / total);
|
||||
for (; i < n_bins; i++)
|
||||
fprintf (file, "%*lu-%lu\t%8u (%5.1f%%)\n",
|
||||
max_width - ((unsigned) (0.30103 * (i) + 0.9999) + 1),
|
||||
1UL << (i - 1),
|
||||
(1UL << i) - 1,
|
||||
bins[i],
|
||||
(100.0 * bins[i]) / total);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -204,8 +204,6 @@ bitset_stats_print_1 (FILE *file, const char *name,
|
||||
static void
|
||||
bitset_stats_print (FILE *file, bool verbose ATTRIBUTE_UNUSED)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!bitset_stats_info)
|
||||
return;
|
||||
|
||||
@@ -214,7 +212,7 @@ bitset_stats_print (FILE *file, bool verbose ATTRIBUTE_UNUSED)
|
||||
if (bitset_stats_info->runs > 1)
|
||||
fprintf (file, _("Accumulated runs = %u\n"), bitset_stats_info->runs);
|
||||
|
||||
for (i = 0; i < BITSET_TYPE_NUM; i++)
|
||||
for (int i = 0; i < BITSET_TYPE_NUM; i++)
|
||||
bitset_stats_print_1 (file, bitset_type_names[i],
|
||||
&bitset_stats_info->types[i]);
|
||||
}
|
||||
@@ -241,15 +239,13 @@ bitset_stats_disable (void)
|
||||
void
|
||||
bitset_stats_read (const char *file_name)
|
||||
{
|
||||
FILE *file;
|
||||
|
||||
if (!bitset_stats_info)
|
||||
return;
|
||||
|
||||
if (!file_name)
|
||||
file_name = BITSET_STATS_FILE;
|
||||
|
||||
file = fopen (file_name, "r");
|
||||
FILE *file = fopen (file_name, "r");
|
||||
if (file)
|
||||
{
|
||||
if (fread (&bitset_stats_info_data, sizeof (bitset_stats_info_data),
|
||||
@@ -271,15 +267,13 @@ bitset_stats_read (const char *file_name)
|
||||
void
|
||||
bitset_stats_write (const char *file_name)
|
||||
{
|
||||
FILE *file;
|
||||
|
||||
if (!bitset_stats_info)
|
||||
return;
|
||||
|
||||
if (!file_name)
|
||||
file_name = BITSET_STATS_FILE;
|
||||
|
||||
file = fopen (file_name, "w");
|
||||
FILE *file = fopen (file_name, "w");
|
||||
if (file)
|
||||
{
|
||||
if (fwrite (&bitset_stats_info_data, sizeof (bitset_stats_info_data),
|
||||
@@ -351,7 +345,7 @@ bitset_stats_reset (bitset dst, bitset_bindex bitno)
|
||||
static bool
|
||||
bitset_stats_toggle (bitset src, bitset_bindex bitno)
|
||||
{
|
||||
return BITSET_TOGGLE_ (src->s.bset, bitno);
|
||||
return BITSET_TOGGLE_ (src->s.bset, bitno);
|
||||
}
|
||||
|
||||
|
||||
@@ -572,15 +566,14 @@ static bitset_bindex
|
||||
bitset_stats_list (bitset bset, bitset_bindex *list,
|
||||
bitset_bindex num, bitset_bindex *next)
|
||||
{
|
||||
bitset_bindex count;
|
||||
bitset_bindex count = BITSET_LIST_ (bset->s.bset, list, num, next);
|
||||
|
||||
BITSET_STATS_LISTS_INC (bset->s.bset);
|
||||
|
||||
bitset_bindex tmp;
|
||||
bitset_bindex size;
|
||||
bitset_bindex i;
|
||||
|
||||
count = BITSET_LIST_ (bset->s.bset, list, num, next);
|
||||
|
||||
BITSET_STATS_LISTS_INC (bset->s.bset);
|
||||
|
||||
/* Log histogram of number of set bits. */
|
||||
for (i = 0, tmp = count; tmp; tmp >>= 1, i++)
|
||||
continue;
|
||||
@@ -662,7 +655,7 @@ struct bitset_vtable bitset_stats_vtable = {
|
||||
enum bitset_type
|
||||
bitset_stats_type_get (bitset bset)
|
||||
{
|
||||
return BITSET_TYPE_ (bset->s.bset);
|
||||
return BITSET_TYPE_ (bset->s.bset);
|
||||
}
|
||||
|
||||
|
||||
@@ -676,9 +669,6 @@ bitset_stats_bytes (void)
|
||||
bitset
|
||||
bitset_stats_init (bitset bset, bitset_bindex n_bits, enum bitset_type type)
|
||||
{
|
||||
size_t bytes;
|
||||
bitset sbset;
|
||||
|
||||
bset->b.vtable = &bitset_stats_vtable;
|
||||
|
||||
/* Disable cache. */
|
||||
@@ -690,6 +680,8 @@ bitset_stats_init (bitset bset, bitset_bindex n_bits, enum bitset_type type)
|
||||
|
||||
/* Set up the actual bitset implementation that
|
||||
we are a wrapper over. */
|
||||
size_t bytes;
|
||||
bitset sbset;
|
||||
switch (type)
|
||||
{
|
||||
default:
|
||||
|
||||
+5
-4
@@ -1,6 +1,7 @@
|
||||
/* Functions to support bitset statistics.
|
||||
|
||||
Copyright (C) 2002-2004, 2009-2015 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002-2004, 2009-2015, 2018 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||
|
||||
@@ -24,10 +25,10 @@
|
||||
|
||||
extern bool bitset_stats_enabled;
|
||||
|
||||
extern enum bitset_type bitset_stats_type_get (bitset);
|
||||
enum bitset_type bitset_stats_type_get (bitset);
|
||||
|
||||
extern size_t bitset_stats_bytes (void);
|
||||
size_t bitset_stats_bytes (void);
|
||||
|
||||
extern bitset bitset_stats_init (bitset, bitset_bindex, enum bitset_type);
|
||||
bitset bitset_stats_init (bitset, bitset_bindex, enum bitset_type);
|
||||
|
||||
#endif
|
||||
|
||||
+8
-9
@@ -1,6 +1,6 @@
|
||||
/* Bitset vectors.
|
||||
|
||||
Copyright (C) 2001-2002, 2004, 2006, 2009-2015 Free Software
|
||||
Copyright (C) 2001-2002, 2004, 2006, 2009-2015, 2018 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -29,7 +29,6 @@
|
||||
void
|
||||
bitsetv_matrix_dump (FILE * out, const char *title, bitsetv bset)
|
||||
{
|
||||
bitset_bindex i, j;
|
||||
bitset_bindex hsize = bitset_size (bset[0]);
|
||||
|
||||
/* Title. */
|
||||
@@ -37,32 +36,32 @@ bitsetv_matrix_dump (FILE * out, const char *title, bitsetv bset)
|
||||
|
||||
/* Column numbers. */
|
||||
fputs (" ", out);
|
||||
for (i = 0; i < hsize; ++i)
|
||||
for (bitset_bindex i = 0; i < hsize; ++i)
|
||||
putc (i / 10 ? '0' + i / 10 : ' ', out);
|
||||
putc ('\n', out);
|
||||
fputs (" ", out);
|
||||
for (i = 0; i < hsize; ++i)
|
||||
for (bitset_bindex i = 0; i < hsize; ++i)
|
||||
fprintf (out, "%d", (int) (i % 10));
|
||||
putc ('\n', out);
|
||||
|
||||
/* Bar. */
|
||||
fputs (" .", out);
|
||||
for (i = 0; i < hsize; ++i)
|
||||
for (bitset_bindex i = 0; i < hsize; ++i)
|
||||
putc ('-', out);
|
||||
fputs (".\n", out);
|
||||
|
||||
/* Contents. */
|
||||
for (i = 0; bset[i]; ++i)
|
||||
for (bitset_bindex i = 0; bset[i]; ++i)
|
||||
{
|
||||
fprintf (out, "%2lu|", (unsigned long int) i);
|
||||
for (j = 0; j < hsize; ++j)
|
||||
fprintf (out, "%2lu|", (unsigned long) i);
|
||||
for (bitset_bindex j = 0; j < hsize; ++j)
|
||||
fputs (bitset_test (bset[i], j) ? "1" : " ", out);
|
||||
fputs ("|\n", out);
|
||||
}
|
||||
|
||||
/* Bar. */
|
||||
fputs (" `", out);
|
||||
for (i = 0; i < hsize; ++i)
|
||||
for (bitset_bindex i = 0; i < hsize; ++i)
|
||||
putc ('-', out);
|
||||
fputs ("'\n", out);
|
||||
|
||||
|
||||
+3
-2
@@ -1,6 +1,7 @@
|
||||
/* Bitset vectors.
|
||||
|
||||
Copyright (C) 2002, 2004, 2009-2015 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2004, 2009-2015, 2018 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
Contributed by Akim Demaille (akim@freefriends.org).
|
||||
|
||||
@@ -23,6 +24,6 @@
|
||||
#include "bitsetv.h"
|
||||
|
||||
/* Dump vector of bitsets as a matrix. */
|
||||
extern void bitsetv_matrix_dump (FILE *, const char *, bitsetv);
|
||||
void bitsetv_matrix_dump (FILE *, const char *, bitsetv);
|
||||
|
||||
#endif /* _BITSETV_H */
|
||||
|
||||
+18
-39
@@ -1,6 +1,6 @@
|
||||
/* Bitset vectors.
|
||||
|
||||
Copyright (C) 2001-2002, 2004-2006, 2009-2015 Free Software
|
||||
Copyright (C) 2001-2002, 2004-2006, 2009-2015, 2018 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -29,23 +29,19 @@ bitset *
|
||||
bitsetv_alloc (bitset_bindex n_vecs, bitset_bindex n_bits,
|
||||
enum bitset_type type)
|
||||
{
|
||||
size_t vector_bytes;
|
||||
size_t bytes;
|
||||
bitset *bsetv;
|
||||
bitset_bindex i;
|
||||
|
||||
/* Determine number of bytes for each set. */
|
||||
bytes = bitset_bytes (type, n_bits);
|
||||
size_t bytes = bitset_bytes (type, n_bits);
|
||||
|
||||
/* If size calculation overflows, memory is exhausted. */
|
||||
if (BITSET_SIZE_MAX / (sizeof (bitset) + bytes) <= n_vecs)
|
||||
xalloc_die ();
|
||||
|
||||
/* Allocate vector table at head of bitset array. */
|
||||
vector_bytes = (n_vecs + 1) * sizeof (bitset) + bytes - 1;
|
||||
size_t vector_bytes = (n_vecs + 1) * sizeof (bitset) + bytes - 1;
|
||||
vector_bytes -= vector_bytes % bytes;
|
||||
bsetv = xcalloc (1, vector_bytes + bytes * n_vecs);
|
||||
bitset *bsetv = xcalloc (1, vector_bytes + bytes * n_vecs);
|
||||
|
||||
bitset_bindex i = 0;
|
||||
for (i = 0; i < n_vecs; i++)
|
||||
{
|
||||
bsetv[i] = (bitset) (void *) ((char *) bsetv + vector_bytes + i * bytes);
|
||||
@@ -62,11 +58,9 @@ bitsetv_alloc (bitset_bindex n_vecs, bitset_bindex n_bits,
|
||||
/* Create a vector of N_VECS bitsets, each of N_BITS, and with
|
||||
attribute hints specified by ATTR. */
|
||||
bitset *
|
||||
bitsetv_create (bitset_bindex n_vecs, bitset_bindex n_bits, unsigned int attr)
|
||||
bitsetv_create (bitset_bindex n_vecs, bitset_bindex n_bits, unsigned attr)
|
||||
{
|
||||
enum bitset_type type;
|
||||
|
||||
type = bitset_type_choose (n_bits, attr);
|
||||
enum bitset_type type = bitset_type_choose (n_bits, attr);
|
||||
return bitsetv_alloc (n_vecs, n_bits, type);
|
||||
}
|
||||
|
||||
@@ -75,10 +69,8 @@ bitsetv_create (bitset_bindex n_vecs, bitset_bindex n_bits, unsigned int attr)
|
||||
void
|
||||
bitsetv_free (bitsetv bsetv)
|
||||
{
|
||||
bitset_bindex i;
|
||||
|
||||
for (i = 0; bsetv[i]; i++)
|
||||
BITSET_FREE_ (bsetv[i]);
|
||||
for (bitset_bindex i = 0; bsetv[i]; i++)
|
||||
BITSET_FREE_ (bsetv[i]);
|
||||
free (bsetv);
|
||||
}
|
||||
|
||||
@@ -87,9 +79,7 @@ bitsetv_free (bitsetv bsetv)
|
||||
void
|
||||
bitsetv_zero (bitsetv bsetv)
|
||||
{
|
||||
bitset_bindex i;
|
||||
|
||||
for (i = 0; bsetv[i]; i++)
|
||||
for (bitset_bindex i = 0; bsetv[i]; i++)
|
||||
bitset_zero (bsetv[i]);
|
||||
}
|
||||
|
||||
@@ -98,9 +88,7 @@ bitsetv_zero (bitsetv bsetv)
|
||||
void
|
||||
bitsetv_ones (bitsetv bsetv)
|
||||
{
|
||||
bitset_bindex i;
|
||||
|
||||
for (i = 0; bsetv[i]; i++)
|
||||
for (bitset_bindex i = 0; bsetv[i]; i++)
|
||||
bitset_ones (bsetv[i]);
|
||||
}
|
||||
|
||||
@@ -110,11 +98,8 @@ bitsetv_ones (bitsetv bsetv)
|
||||
void
|
||||
bitsetv_transitive_closure (bitsetv bsetv)
|
||||
{
|
||||
bitset_bindex i;
|
||||
bitset_bindex j;
|
||||
|
||||
for (i = 0; bsetv[i]; i++)
|
||||
for (j = 0; bsetv[j]; j++)
|
||||
for (bitset_bindex i = 0; bsetv[i]; i++)
|
||||
for (bitset_bindex j = 0; bsetv[j]; j++)
|
||||
if (bitset_test (bsetv[j], i))
|
||||
bitset_or (bsetv[j], bsetv[j], bsetv[i]);
|
||||
}
|
||||
@@ -127,10 +112,8 @@ bitsetv_transitive_closure (bitsetv bsetv)
|
||||
void
|
||||
bitsetv_reflexive_transitive_closure (bitsetv bsetv)
|
||||
{
|
||||
bitset_bindex i;
|
||||
|
||||
bitsetv_transitive_closure (bsetv);
|
||||
for (i = 0; bsetv[i]; i++)
|
||||
for (bitset_bindex i = 0; bsetv[i]; i++)
|
||||
bitset_set (bsetv[i], i);
|
||||
}
|
||||
|
||||
@@ -141,12 +124,10 @@ void
|
||||
bitsetv_dump (FILE *file, char const *title, char const *subtitle,
|
||||
bitsetv bsetv)
|
||||
{
|
||||
bitset_windex i;
|
||||
|
||||
fprintf (file, "%s\n", title);
|
||||
for (i = 0; bsetv[i]; i++)
|
||||
for (bitset_windex i = 0; bsetv[i]; i++)
|
||||
{
|
||||
fprintf (file, "%s %lu\n", subtitle, (unsigned long int) i);
|
||||
fprintf (file, "%s %lu\n", subtitle, (unsigned long) i);
|
||||
bitset_dump (file, bsetv[i]);
|
||||
}
|
||||
|
||||
@@ -157,11 +138,9 @@ bitsetv_dump (FILE *file, char const *title, char const *subtitle,
|
||||
void
|
||||
debug_bitsetv (bitsetv bsetv)
|
||||
{
|
||||
bitset_windex i;
|
||||
|
||||
for (i = 0; bsetv[i]; i++)
|
||||
for (bitset_windex i = 0; bsetv[i]; i++)
|
||||
{
|
||||
fprintf (stderr, "%lu: ", (unsigned long int) i);
|
||||
fprintf (stderr, "%lu: ", (unsigned long) i);
|
||||
debug_bitset (bsetv[i]);
|
||||
}
|
||||
|
||||
|
||||
+11
-10
@@ -1,6 +1,7 @@
|
||||
/* Bitset vectors.
|
||||
|
||||
Copyright (C) 2002, 2004, 2009-2015 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2004, 2009-2015, 2018 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||
|
||||
@@ -26,35 +27,35 @@ typedef bitset * bitsetv;
|
||||
|
||||
/* Create a vector of N_VECS bitsets, each of N_BITS, and of
|
||||
type TYPE. */
|
||||
extern bitsetv bitsetv_alloc (bitset_bindex, bitset_bindex, enum bitset_type);
|
||||
bitsetv bitsetv_alloc (bitset_bindex, bitset_bindex, enum bitset_type);
|
||||
|
||||
/* Create a vector of N_VECS bitsets, each of N_BITS, and with
|
||||
attribute hints specified by ATTR. */
|
||||
extern bitsetv bitsetv_create (bitset_bindex, bitset_bindex, unsigned int);
|
||||
bitsetv bitsetv_create (bitset_bindex, bitset_bindex, unsigned);
|
||||
|
||||
/* Free vector of bitsets. */
|
||||
extern void bitsetv_free (bitsetv);
|
||||
void bitsetv_free (bitsetv);
|
||||
|
||||
/* Zero vector of bitsets. */
|
||||
extern void bitsetv_zero (bitsetv);
|
||||
void bitsetv_zero (bitsetv);
|
||||
|
||||
/* Set vector of bitsets. */
|
||||
extern void bitsetv_ones (bitsetv);
|
||||
void bitsetv_ones (bitsetv);
|
||||
|
||||
/* Given a vector BSETV of N bitsets of size N, modify its contents to
|
||||
be the transitive closure of what was given. */
|
||||
extern void bitsetv_transitive_closure (bitsetv);
|
||||
void bitsetv_transitive_closure (bitsetv);
|
||||
|
||||
/* Given a vector BSETV of N bitsets of size N, modify its contents to
|
||||
be the reflexive transitive closure of what was given. This is
|
||||
the same as transitive closure but with all bits on the diagonal
|
||||
of the bit matrix set. */
|
||||
extern void bitsetv_reflexive_transitive_closure (bitsetv);
|
||||
void bitsetv_reflexive_transitive_closure (bitsetv);
|
||||
|
||||
/* Dump vector of bitsets. */
|
||||
extern void bitsetv_dump (FILE *, const char *, const char *, bitsetv);
|
||||
void bitsetv_dump (FILE *, const char *, const char *, bitsetv);
|
||||
|
||||
/* Function to debug vector of bitsets from debugger. */
|
||||
extern void debug_bitsetv (bitsetv);
|
||||
void debug_bitsetv (bitsetv);
|
||||
|
||||
#endif /* _BITSETV_H */
|
||||
|
||||
+120
-244
@@ -1,6 +1,7 @@
|
||||
/* Functions to support expandable bitsets.
|
||||
|
||||
Copyright (C) 2002-2006, 2009-2015 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002-2006, 2009-2015, 2018 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||
|
||||
@@ -51,7 +52,7 @@
|
||||
|
||||
/* Number of bits stored in each element. */
|
||||
#define EBITSET_ELT_BITS \
|
||||
((unsigned int) (EBITSET_ELT_WORDS * BITSET_WORD_BITS))
|
||||
((unsigned) (EBITSET_ELT_WORDS * BITSET_WORD_BITS))
|
||||
|
||||
/* Ebitset element. We use an array of bits. */
|
||||
typedef struct ebitset_elt_struct
|
||||
@@ -122,14 +123,11 @@ static ebitset_elt *ebitset_free_list; /* Free list of bitset elements. */
|
||||
static bitset_bindex
|
||||
ebitset_resize (bitset src, bitset_bindex n_bits)
|
||||
{
|
||||
bitset_windex oldsize;
|
||||
bitset_windex newsize;
|
||||
|
||||
if (n_bits == BITSET_NBITS_ (src))
|
||||
return n_bits;
|
||||
|
||||
oldsize = EBITSET_SIZE (src);
|
||||
newsize = EBITSET_N_ELTS (n_bits);
|
||||
bitset_windex oldsize = EBITSET_SIZE (src);
|
||||
bitset_windex newsize = EBITSET_N_ELTS (n_bits);
|
||||
|
||||
if (oldsize < newsize)
|
||||
{
|
||||
@@ -233,9 +231,7 @@ ebitset_elt_alloc (void)
|
||||
static inline ebitset_elt *
|
||||
ebitset_elt_calloc (void)
|
||||
{
|
||||
ebitset_elt *elt;
|
||||
|
||||
elt = ebitset_elt_alloc ();
|
||||
ebitset_elt *elt = ebitset_elt_alloc ();
|
||||
memset (EBITSET_WORDS (elt), 0, sizeof (EBITSET_WORDS (elt)));
|
||||
return elt;
|
||||
}
|
||||
@@ -253,12 +249,8 @@ ebitset_elt_free (ebitset_elt *elt)
|
||||
static inline void
|
||||
ebitset_elt_remove (bitset bset, bitset_windex eindex)
|
||||
{
|
||||
ebitset_elts *elts;
|
||||
ebitset_elt *elt;
|
||||
|
||||
elts = EBITSET_ELTS (bset);
|
||||
|
||||
elt = elts[eindex];
|
||||
ebitset_elts *elts = EBITSET_ELTS (bset);
|
||||
ebitset_elt *elt = elts[eindex];
|
||||
|
||||
elts[eindex] = 0;
|
||||
ebitset_elt_free (elt);
|
||||
@@ -269,9 +261,7 @@ ebitset_elt_remove (bitset bset, bitset_windex eindex)
|
||||
static inline void
|
||||
ebitset_elt_add (bitset bset, ebitset_elt *elt, bitset_windex eindex)
|
||||
{
|
||||
ebitset_elts *elts;
|
||||
|
||||
elts = EBITSET_ELTS (bset);
|
||||
ebitset_elts *elts = EBITSET_ELTS (bset);
|
||||
/* Assume that the elts entry not allocated. */
|
||||
elts[eindex] = elt;
|
||||
}
|
||||
@@ -281,9 +271,7 @@ ebitset_elt_add (bitset bset, ebitset_elt *elt, bitset_windex eindex)
|
||||
static inline bool
|
||||
ebitset_elt_zero_p (ebitset_elt *elt)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < EBITSET_ELT_WORDS; i++)
|
||||
for (int i = 0; i < EBITSET_ELT_WORDS; i++)
|
||||
if (EBITSET_WORDS (elt)[i])
|
||||
return false;
|
||||
|
||||
@@ -295,24 +283,18 @@ static ebitset_elt *
|
||||
ebitset_elt_find (bitset bset, bitset_bindex bindex,
|
||||
enum ebitset_find_mode mode)
|
||||
{
|
||||
ebitset_elt *elt;
|
||||
bitset_windex size;
|
||||
bitset_windex eindex;
|
||||
ebitset_elts *elts;
|
||||
bitset_windex eindex = bindex / EBITSET_ELT_BITS;
|
||||
|
||||
eindex = bindex / EBITSET_ELT_BITS;
|
||||
|
||||
elts = EBITSET_ELTS (bset);
|
||||
size = EBITSET_SIZE (bset);
|
||||
ebitset_elts *elts = EBITSET_ELTS (bset);
|
||||
bitset_windex size = EBITSET_SIZE (bset);
|
||||
|
||||
if (eindex < size)
|
||||
{
|
||||
if ((elt = elts[eindex]))
|
||||
ebitset_elt *elt = elts[eindex];
|
||||
if (elt)
|
||||
{
|
||||
if (EBITSET_WORDS (elt) == bset->b.cdata)
|
||||
return elt;
|
||||
|
||||
EBITSET_CACHE_SET (bset, eindex);
|
||||
if (EBITSET_WORDS (elt) != bset->b.cdata)
|
||||
EBITSET_CACHE_SET (bset, eindex);
|
||||
return elt;
|
||||
}
|
||||
}
|
||||
@@ -332,10 +314,12 @@ ebitset_elt_find (bitset bset, bitset_bindex bindex,
|
||||
ebitset_resize (bset, bindex);
|
||||
|
||||
/* Create a new element. */
|
||||
elt = ebitset_elt_calloc ();
|
||||
ebitset_elt_add (bset, elt, eindex);
|
||||
EBITSET_CACHE_SET (bset, eindex);
|
||||
return elt;
|
||||
{
|
||||
ebitset_elt *elt = ebitset_elt_calloc ();
|
||||
ebitset_elt_add (bset, elt, eindex);
|
||||
EBITSET_CACHE_SET (bset, eindex);
|
||||
return elt;
|
||||
}
|
||||
|
||||
case EBITSET_SUBST:
|
||||
return &ebitset_zero_elts[0];
|
||||
@@ -347,15 +331,12 @@ ebitset_elt_find (bitset bset, bitset_bindex bindex,
|
||||
static inline bitset_windex
|
||||
ebitset_weed (bitset bset)
|
||||
{
|
||||
ebitset_elts *elts;
|
||||
bitset_windex j;
|
||||
bitset_windex count;
|
||||
|
||||
if (EBITSET_ZERO_P (bset))
|
||||
return 0;
|
||||
|
||||
elts = EBITSET_ELTS (bset);
|
||||
count = 0;
|
||||
ebitset_elts *elts = EBITSET_ELTS (bset);
|
||||
bitset_windex count = 0;
|
||||
bitset_windex j;
|
||||
for (j = 0; j < EBITSET_SIZE (bset); j++)
|
||||
{
|
||||
ebitset_elt *elt = elts[j];
|
||||
@@ -390,14 +371,11 @@ ebitset_weed (bitset bset)
|
||||
static inline void
|
||||
ebitset_zero (bitset bset)
|
||||
{
|
||||
ebitset_elts *elts;
|
||||
bitset_windex j;
|
||||
|
||||
if (EBITSET_ZERO_P (bset))
|
||||
return;
|
||||
|
||||
elts = EBITSET_ELTS (bset);
|
||||
for (j = 0; j < EBITSET_SIZE (bset); j++)
|
||||
ebitset_elts *elts = EBITSET_ELTS (bset);
|
||||
for (bitset_windex j = 0; j < EBITSET_SIZE (bset); j++)
|
||||
{
|
||||
ebitset_elt *elt = elts[j];
|
||||
|
||||
@@ -414,10 +392,6 @@ ebitset_zero (bitset bset)
|
||||
static inline bool
|
||||
ebitset_equal_p (bitset dst, bitset src)
|
||||
{
|
||||
ebitset_elts *selts;
|
||||
ebitset_elts *delts;
|
||||
bitset_windex j;
|
||||
|
||||
if (src == dst)
|
||||
return true;
|
||||
|
||||
@@ -427,12 +401,11 @@ ebitset_equal_p (bitset dst, bitset src)
|
||||
if (EBITSET_SIZE (src) != EBITSET_SIZE (dst))
|
||||
return false;
|
||||
|
||||
selts = EBITSET_ELTS (src);
|
||||
delts = EBITSET_ELTS (dst);
|
||||
ebitset_elts *selts = EBITSET_ELTS (src);
|
||||
ebitset_elts *delts = EBITSET_ELTS (dst);
|
||||
|
||||
for (j = 0; j < EBITSET_SIZE (src); j++)
|
||||
for (bitset_windex j = 0; j < EBITSET_SIZE (src); j++)
|
||||
{
|
||||
unsigned int i;
|
||||
ebitset_elt *selt = selts[j];
|
||||
ebitset_elt *delt = delts[j];
|
||||
|
||||
@@ -441,7 +414,7 @@ ebitset_equal_p (bitset dst, bitset src)
|
||||
if ((selt && !delt) || (!selt && delt))
|
||||
return false;
|
||||
|
||||
for (i = 0; i < EBITSET_ELT_WORDS; i++)
|
||||
for (unsigned i = 0; i < EBITSET_ELT_WORDS; i++)
|
||||
if (EBITSET_WORDS (selt)[i] != EBITSET_WORDS (delt)[i])
|
||||
return false;
|
||||
}
|
||||
@@ -453,10 +426,6 @@ ebitset_equal_p (bitset dst, bitset src)
|
||||
static inline void
|
||||
ebitset_copy_ (bitset dst, bitset src)
|
||||
{
|
||||
ebitset_elts *selts;
|
||||
ebitset_elts *delts;
|
||||
bitset_windex j;
|
||||
|
||||
if (src == dst)
|
||||
return;
|
||||
|
||||
@@ -465,17 +434,15 @@ ebitset_copy_ (bitset dst, bitset src)
|
||||
if (BITSET_NBITS_ (dst) != BITSET_NBITS_ (src))
|
||||
ebitset_resize (dst, BITSET_NBITS_ (src));
|
||||
|
||||
selts = EBITSET_ELTS (src);
|
||||
delts = EBITSET_ELTS (dst);
|
||||
for (j = 0; j < EBITSET_SIZE (src); j++)
|
||||
ebitset_elts *selts = EBITSET_ELTS (src);
|
||||
ebitset_elts *delts = EBITSET_ELTS (dst);
|
||||
for (bitset_windex j = 0; j < EBITSET_SIZE (src); j++)
|
||||
{
|
||||
ebitset_elt *selt = selts[j];
|
||||
|
||||
if (selt)
|
||||
{
|
||||
ebitset_elt *tmp;
|
||||
|
||||
tmp = ebitset_elt_alloc ();
|
||||
ebitset_elt *tmp = ebitset_elt_alloc ();
|
||||
delts[j] = tmp;
|
||||
memcpy (EBITSET_WORDS (tmp), EBITSET_WORDS (selt),
|
||||
sizeof (EBITSET_WORDS (selt)));
|
||||
@@ -566,60 +533,41 @@ static bitset_bindex
|
||||
ebitset_list_reverse (bitset bset, bitset_bindex *list,
|
||||
bitset_bindex num, bitset_bindex *next)
|
||||
{
|
||||
bitset_bindex n_bits;
|
||||
bitset_bindex bitno;
|
||||
bitset_bindex rbitno;
|
||||
unsigned int bcount;
|
||||
bitset_bindex boffset;
|
||||
bitset_windex windex;
|
||||
bitset_windex eindex;
|
||||
bitset_windex woffset;
|
||||
bitset_bindex count;
|
||||
bitset_windex size;
|
||||
ebitset_elts *elts;
|
||||
|
||||
if (EBITSET_ZERO_P (bset))
|
||||
return 0;
|
||||
|
||||
size = EBITSET_SIZE (bset);
|
||||
n_bits = size * EBITSET_ELT_BITS;
|
||||
rbitno = *next;
|
||||
bitset_windex size = EBITSET_SIZE (bset);
|
||||
bitset_bindex n_bits = size * EBITSET_ELT_BITS;
|
||||
bitset_bindex rbitno = *next;
|
||||
|
||||
if (rbitno >= n_bits)
|
||||
return 0;
|
||||
|
||||
elts = EBITSET_ELTS (bset);
|
||||
ebitset_elts *elts = EBITSET_ELTS (bset);
|
||||
|
||||
bitno = n_bits - (rbitno + 1);
|
||||
bitset_bindex bitno = n_bits - (rbitno + 1);
|
||||
|
||||
windex = bitno / BITSET_WORD_BITS;
|
||||
eindex = bitno / EBITSET_ELT_BITS;
|
||||
woffset = windex - eindex * EBITSET_ELT_WORDS;
|
||||
bitset_windex windex = bitno / BITSET_WORD_BITS;
|
||||
bitset_windex eindex = bitno / EBITSET_ELT_BITS;
|
||||
bitset_windex woffset = windex - eindex * EBITSET_ELT_WORDS;
|
||||
|
||||
/* If num is 1, we could speed things up with a binary search
|
||||
of the word of interest. */
|
||||
|
||||
count = 0;
|
||||
bcount = bitno % BITSET_WORD_BITS;
|
||||
boffset = windex * BITSET_WORD_BITS;
|
||||
bitset_bindex count = 0;
|
||||
unsigned bcount = bitno % BITSET_WORD_BITS;
|
||||
bitset_bindex boffset = windex * BITSET_WORD_BITS;
|
||||
|
||||
do
|
||||
{
|
||||
ebitset_elt *elt;
|
||||
bitset_word *srcp;
|
||||
|
||||
elt = elts[eindex];
|
||||
ebitset_elt *elt = elts[eindex];
|
||||
if (elt)
|
||||
{
|
||||
srcp = EBITSET_WORDS (elt);
|
||||
bitset_word *srcp = EBITSET_WORDS (elt);
|
||||
|
||||
do
|
||||
{
|
||||
bitset_word word;
|
||||
|
||||
word = srcp[woffset] << (BITSET_WORD_BITS - 1 - bcount);
|
||||
|
||||
for (; word; bcount--)
|
||||
for (bitset_word word = srcp[woffset] << (BITSET_WORD_BITS - 1 - bcount);
|
||||
word; bcount--)
|
||||
{
|
||||
if (word & BITSET_MSB)
|
||||
{
|
||||
@@ -655,41 +603,32 @@ static bitset_bindex
|
||||
ebitset_list (bitset bset, bitset_bindex *list,
|
||||
bitset_bindex num, bitset_bindex *next)
|
||||
{
|
||||
bitset_bindex bitno;
|
||||
bitset_windex windex;
|
||||
bitset_windex eindex;
|
||||
bitset_bindex count;
|
||||
bitset_windex size;
|
||||
ebitset_elt *elt;
|
||||
bitset_word word;
|
||||
ebitset_elts *elts;
|
||||
|
||||
if (EBITSET_ZERO_P (bset))
|
||||
return 0;
|
||||
|
||||
bitno = *next;
|
||||
count = 0;
|
||||
bitset_bindex bitno = *next;
|
||||
bitset_bindex count = 0;
|
||||
|
||||
elts = EBITSET_ELTS (bset);
|
||||
size = EBITSET_SIZE (bset);
|
||||
eindex = bitno / EBITSET_ELT_BITS;
|
||||
ebitset_elts *elts = EBITSET_ELTS (bset);
|
||||
bitset_windex size = EBITSET_SIZE (bset);
|
||||
bitset_windex eindex = bitno / EBITSET_ELT_BITS;
|
||||
|
||||
if (bitno % EBITSET_ELT_BITS)
|
||||
{
|
||||
/* We need to start within an element. This is not very common. */
|
||||
|
||||
elt = elts[eindex];
|
||||
ebitset_elt *elt = elts[eindex];
|
||||
if (elt)
|
||||
{
|
||||
bitset_windex woffset;
|
||||
bitset_word *srcp = EBITSET_WORDS (elt);
|
||||
|
||||
windex = bitno / BITSET_WORD_BITS;
|
||||
bitset_windex windex = bitno / BITSET_WORD_BITS;
|
||||
woffset = eindex * EBITSET_ELT_WORDS;
|
||||
|
||||
for (; (windex - woffset) < EBITSET_ELT_WORDS; windex++)
|
||||
{
|
||||
word = srcp[windex - woffset] >> (bitno % BITSET_WORD_BITS);
|
||||
bitset_word word = srcp[windex - woffset] >> (bitno % BITSET_WORD_BITS);
|
||||
|
||||
for (; word; bitno++)
|
||||
{
|
||||
@@ -717,22 +656,21 @@ ebitset_list (bitset bset, bitset_bindex *list,
|
||||
|
||||
for (; eindex < size; eindex++)
|
||||
{
|
||||
int i;
|
||||
bitset_word *srcp;
|
||||
|
||||
elt = elts[eindex];
|
||||
ebitset_elt *elt = elts[eindex];
|
||||
if (!elt)
|
||||
continue;
|
||||
|
||||
srcp = EBITSET_WORDS (elt);
|
||||
windex = eindex * EBITSET_ELT_WORDS;
|
||||
bitset_windex windex = eindex * EBITSET_ELT_WORDS;
|
||||
|
||||
if ((count + EBITSET_ELT_BITS) < num)
|
||||
{
|
||||
/* The coast is clear, plant boot! */
|
||||
|
||||
#if EBITSET_ELT_WORDS == 2
|
||||
word = srcp[0];
|
||||
bitset_word word = srcp[0];
|
||||
if (word)
|
||||
{
|
||||
if (!(word & 0xffff))
|
||||
@@ -773,7 +711,7 @@ ebitset_list (bitset bset, bitset_bindex *list,
|
||||
windex++;
|
||||
bitno = windex * BITSET_WORD_BITS;
|
||||
#else
|
||||
for (i = 0; i < EBITSET_ELT_WORDS; i++, windex++)
|
||||
for (int i = 0; i < EBITSET_ELT_WORDS; i++, windex++)
|
||||
{
|
||||
bitno = windex * BITSET_WORD_BITS;
|
||||
|
||||
@@ -805,11 +743,11 @@ ebitset_list (bitset bset, bitset_bindex *list,
|
||||
/* Tread more carefully since we need to check
|
||||
if array overflows. */
|
||||
|
||||
for (i = 0; i < EBITSET_ELT_WORDS; i++, windex++)
|
||||
for (int i = 0; i < EBITSET_ELT_WORDS; i++, windex++)
|
||||
{
|
||||
bitno = windex * BITSET_WORD_BITS;
|
||||
|
||||
for (word = srcp[i]; word; bitno++)
|
||||
for (bitset_word word = srcp[i]; word; bitno++)
|
||||
{
|
||||
if (word & 1)
|
||||
{
|
||||
@@ -835,31 +773,22 @@ ebitset_list (bitset bset, bitset_bindex *list,
|
||||
static inline void
|
||||
ebitset_unused_clear (bitset dst)
|
||||
{
|
||||
unsigned int last_bit;
|
||||
bitset_bindex n_bits;
|
||||
|
||||
n_bits = BITSET_NBITS_ (dst);
|
||||
last_bit = n_bits % EBITSET_ELT_BITS;
|
||||
bitset_bindex n_bits = BITSET_NBITS_ (dst);
|
||||
unsigned last_bit = n_bits % EBITSET_ELT_BITS;
|
||||
|
||||
if (last_bit)
|
||||
{
|
||||
bitset_windex eindex;
|
||||
ebitset_elts *elts;
|
||||
ebitset_elt *elt;
|
||||
ebitset_elts *elts = EBITSET_ELTS (dst);
|
||||
|
||||
elts = EBITSET_ELTS (dst);
|
||||
bitset_windex eindex = n_bits / EBITSET_ELT_BITS;
|
||||
|
||||
eindex = n_bits / EBITSET_ELT_BITS;
|
||||
|
||||
elt = elts[eindex];
|
||||
ebitset_elt *elt = elts[eindex];
|
||||
if (elt)
|
||||
{
|
||||
bitset_windex windex;
|
||||
bitset_windex woffset;
|
||||
bitset_word *srcp = EBITSET_WORDS (elt);
|
||||
|
||||
windex = n_bits / BITSET_WORD_BITS;
|
||||
woffset = eindex * EBITSET_ELT_WORDS;
|
||||
bitset_windex windex = n_bits / BITSET_WORD_BITS;
|
||||
bitset_windex woffset = eindex * EBITSET_ELT_WORDS;
|
||||
|
||||
srcp[windex - woffset] &= ((bitset_word) 1 << last_bit) - 1;
|
||||
windex++;
|
||||
@@ -873,14 +802,11 @@ ebitset_unused_clear (bitset dst)
|
||||
static void
|
||||
ebitset_ones (bitset dst)
|
||||
{
|
||||
bitset_windex j;
|
||||
ebitset_elt *elt;
|
||||
|
||||
for (j = 0; j < EBITSET_SIZE (dst); j++)
|
||||
for (bitset_windex j = 0; j < EBITSET_SIZE (dst); j++)
|
||||
{
|
||||
/* Create new elements if they cannot be found. Perhaps
|
||||
we should just add pointers to a ones element? */
|
||||
elt =
|
||||
ebitset_elt *elt =
|
||||
ebitset_elt_find (dst, j * EBITSET_ELT_BITS, EBITSET_CREATE);
|
||||
memset (EBITSET_WORDS (elt), -1, sizeof (EBITSET_WORDS (elt)));
|
||||
}
|
||||
@@ -892,14 +818,11 @@ ebitset_ones (bitset dst)
|
||||
static bool
|
||||
ebitset_empty_p (bitset dst)
|
||||
{
|
||||
ebitset_elts *elts;
|
||||
bitset_windex j;
|
||||
|
||||
if (EBITSET_ZERO_P (dst))
|
||||
return 1;
|
||||
|
||||
elts = EBITSET_ELTS (dst);
|
||||
for (j = 0; j < EBITSET_SIZE (dst); j++)
|
||||
ebitset_elts *elts = EBITSET_ELTS (dst);
|
||||
for (bitset_windex j = 0; j < EBITSET_SIZE (dst); j++)
|
||||
{
|
||||
ebitset_elt *elt = elts[j];
|
||||
|
||||
@@ -922,23 +845,18 @@ ebitset_empty_p (bitset dst)
|
||||
static void
|
||||
ebitset_not (bitset dst, bitset src)
|
||||
{
|
||||
unsigned int i;
|
||||
ebitset_elt *selt;
|
||||
ebitset_elt *delt;
|
||||
bitset_windex j;
|
||||
|
||||
ebitset_resize (dst, BITSET_NBITS_ (src));
|
||||
|
||||
for (j = 0; j < EBITSET_SIZE (src); j++)
|
||||
for (bitset_windex j = 0; j < EBITSET_SIZE (src); j++)
|
||||
{
|
||||
/* Create new elements for dst if they cannot be found
|
||||
or substitute zero elements if src elements not found. */
|
||||
selt =
|
||||
ebitset_elt *selt =
|
||||
ebitset_elt_find (dst, j * EBITSET_ELT_BITS, EBITSET_SUBST);
|
||||
delt =
|
||||
ebitset_elt *delt =
|
||||
ebitset_elt_find (dst, j * EBITSET_ELT_BITS, EBITSET_CREATE);
|
||||
|
||||
for (i = 0; i < EBITSET_ELT_WORDS; i++)
|
||||
for (unsigned i = 0; i < EBITSET_ELT_WORDS; i++)
|
||||
EBITSET_WORDS (delt)[i] = ~EBITSET_WORDS (selt)[i];
|
||||
}
|
||||
EBITSET_NONZERO_SET (dst);
|
||||
@@ -950,26 +868,16 @@ ebitset_not (bitset dst, bitset src)
|
||||
static bool
|
||||
ebitset_subset_p (bitset dst, bitset src)
|
||||
{
|
||||
bitset_windex j;
|
||||
ebitset_elts *selts;
|
||||
ebitset_elts *delts;
|
||||
bitset_windex ssize;
|
||||
bitset_windex dsize;
|
||||
ebitset_elts *selts = EBITSET_ELTS (src);
|
||||
ebitset_elts *delts = EBITSET_ELTS (dst);
|
||||
|
||||
selts = EBITSET_ELTS (src);
|
||||
delts = EBITSET_ELTS (dst);
|
||||
bitset_windex ssize = EBITSET_SIZE (src);
|
||||
bitset_windex dsize = EBITSET_SIZE (dst);
|
||||
|
||||
ssize = EBITSET_SIZE (src);
|
||||
dsize = EBITSET_SIZE (dst);
|
||||
|
||||
for (j = 0; j < ssize; j++)
|
||||
for (bitset_windex j = 0; j < ssize; j++)
|
||||
{
|
||||
unsigned int i;
|
||||
ebitset_elt *selt;
|
||||
ebitset_elt *delt;
|
||||
|
||||
selt = j < ssize ? selts[j] : 0;
|
||||
delt = j < dsize ? delts[j] : 0;
|
||||
ebitset_elt *selt = j < ssize ? selts[j] : 0;
|
||||
ebitset_elt *delt = j < dsize ? delts[j] : 0;
|
||||
|
||||
if (!selt && !delt)
|
||||
continue;
|
||||
@@ -979,7 +887,7 @@ ebitset_subset_p (bitset dst, bitset src)
|
||||
if (!delt)
|
||||
delt = &ebitset_zero_elts[0];
|
||||
|
||||
for (i = 0; i < EBITSET_ELT_WORDS; i++)
|
||||
for (unsigned i = 0; i < EBITSET_ELT_WORDS; i++)
|
||||
if (EBITSET_WORDS (delt)[i]
|
||||
!= (EBITSET_WORDS (selt)[i] | EBITSET_WORDS (delt)[i]))
|
||||
return false;
|
||||
@@ -992,31 +900,21 @@ ebitset_subset_p (bitset dst, bitset src)
|
||||
static bool
|
||||
ebitset_disjoint_p (bitset dst, bitset src)
|
||||
{
|
||||
bitset_windex j;
|
||||
ebitset_elts *selts;
|
||||
ebitset_elts *delts;
|
||||
bitset_windex ssize;
|
||||
bitset_windex dsize;
|
||||
ebitset_elts *selts = EBITSET_ELTS (src);
|
||||
ebitset_elts *delts = EBITSET_ELTS (dst);
|
||||
|
||||
selts = EBITSET_ELTS (src);
|
||||
delts = EBITSET_ELTS (dst);
|
||||
bitset_windex ssize = EBITSET_SIZE (src);
|
||||
bitset_windex dsize = EBITSET_SIZE (dst);
|
||||
|
||||
ssize = EBITSET_SIZE (src);
|
||||
dsize = EBITSET_SIZE (dst);
|
||||
|
||||
for (j = 0; j < ssize; j++)
|
||||
for (bitset_windex j = 0; j < ssize; j++)
|
||||
{
|
||||
unsigned int i;
|
||||
ebitset_elt *selt;
|
||||
ebitset_elt *delt;
|
||||
|
||||
selt = j < ssize ? selts[j] : 0;
|
||||
delt = j < dsize ? delts[j] : 0;
|
||||
ebitset_elt *selt = j < ssize ? selts[j] : 0;
|
||||
ebitset_elt *delt = j < dsize ? delts[j] : 0;
|
||||
|
||||
if (!selt || !delt)
|
||||
continue;
|
||||
|
||||
for (i = 0; i < EBITSET_ELT_WORDS; i++)
|
||||
for (unsigned i = 0; i < EBITSET_ELT_WORDS; i++)
|
||||
if ((EBITSET_WORDS (selt)[i] & EBITSET_WORDS (delt)[i]))
|
||||
return false;
|
||||
}
|
||||
@@ -1028,42 +926,27 @@ ebitset_disjoint_p (bitset dst, bitset src)
|
||||
static bool
|
||||
ebitset_op3_cmp (bitset dst, bitset src1, bitset src2, enum bitset_ops op)
|
||||
{
|
||||
bitset_windex ssize1;
|
||||
bitset_windex ssize2;
|
||||
bitset_windex dsize;
|
||||
bitset_windex size;
|
||||
ebitset_elts *selts1;
|
||||
ebitset_elts *selts2;
|
||||
ebitset_elts *delts;
|
||||
bitset_word *srcp1;
|
||||
bitset_word *srcp2;
|
||||
bitset_word *dstp;
|
||||
bool changed = false;
|
||||
unsigned int i;
|
||||
bitset_windex j;
|
||||
|
||||
ebitset_resize (dst, max (BITSET_NBITS_ (src1), BITSET_NBITS_ (src2)));
|
||||
|
||||
ssize1 = EBITSET_SIZE (src1);
|
||||
ssize2 = EBITSET_SIZE (src2);
|
||||
dsize = EBITSET_SIZE (dst);
|
||||
size = ssize1;
|
||||
bitset_windex ssize1 = EBITSET_SIZE (src1);
|
||||
bitset_windex ssize2 = EBITSET_SIZE (src2);
|
||||
bitset_windex dsize = EBITSET_SIZE (dst);
|
||||
bitset_windex size = ssize1;
|
||||
if (size < ssize2)
|
||||
size = ssize2;
|
||||
|
||||
selts1 = EBITSET_ELTS (src1);
|
||||
selts2 = EBITSET_ELTS (src2);
|
||||
delts = EBITSET_ELTS (dst);
|
||||
ebitset_elts *selts1 = EBITSET_ELTS (src1);
|
||||
ebitset_elts *selts2 = EBITSET_ELTS (src2);
|
||||
ebitset_elts *delts = EBITSET_ELTS (dst);
|
||||
|
||||
bitset_windex j = 0;
|
||||
for (j = 0; j < size; j++)
|
||||
{
|
||||
ebitset_elt *selt1;
|
||||
ebitset_elt *selt2;
|
||||
ebitset_elt *delt;
|
||||
|
||||
selt1 = j < ssize1 ? selts1[j] : 0;
|
||||
selt2 = j < ssize2 ? selts2[j] : 0;
|
||||
delt = j < dsize ? delts[j] : 0;
|
||||
ebitset_elt *selt1 = j < ssize1 ? selts1[j] : 0;
|
||||
ebitset_elt *selt2 = j < ssize2 ? selts2[j] : 0;
|
||||
ebitset_elt *delt = j < dsize ? delts[j] : 0;
|
||||
|
||||
if (!selt1 && !selt2)
|
||||
{
|
||||
@@ -1084,16 +967,16 @@ ebitset_op3_cmp (bitset dst, bitset src1, bitset src2, enum bitset_ops op)
|
||||
else
|
||||
delts[j] = 0;
|
||||
|
||||
srcp1 = EBITSET_WORDS (selt1);
|
||||
srcp2 = EBITSET_WORDS (selt2);
|
||||
dstp = EBITSET_WORDS (delt);
|
||||
bitset_word *srcp1 = EBITSET_WORDS (selt1);
|
||||
bitset_word *srcp2 = EBITSET_WORDS (selt2);
|
||||
bitset_word *dstp = EBITSET_WORDS (delt);
|
||||
switch (op)
|
||||
{
|
||||
default:
|
||||
abort ();
|
||||
|
||||
case BITSET_OP_OR:
|
||||
for (i = 0; i < EBITSET_ELT_WORDS; i++, dstp++)
|
||||
for (unsigned i = 0; i < EBITSET_ELT_WORDS; i++, dstp++)
|
||||
{
|
||||
bitset_word tmp = *srcp1++ | *srcp2++;
|
||||
|
||||
@@ -1106,7 +989,7 @@ ebitset_op3_cmp (bitset dst, bitset src1, bitset src2, enum bitset_ops op)
|
||||
break;
|
||||
|
||||
case BITSET_OP_AND:
|
||||
for (i = 0; i < EBITSET_ELT_WORDS; i++, dstp++)
|
||||
for (unsigned i = 0; i < EBITSET_ELT_WORDS; i++, dstp++)
|
||||
{
|
||||
bitset_word tmp = *srcp1++ & *srcp2++;
|
||||
|
||||
@@ -1119,7 +1002,7 @@ ebitset_op3_cmp (bitset dst, bitset src1, bitset src2, enum bitset_ops op)
|
||||
break;
|
||||
|
||||
case BITSET_OP_XOR:
|
||||
for (i = 0; i < EBITSET_ELT_WORDS; i++, dstp++)
|
||||
for (unsigned i = 0; i < EBITSET_ELT_WORDS; i++, dstp++)
|
||||
{
|
||||
bitset_word tmp = *srcp1++ ^ *srcp2++;
|
||||
|
||||
@@ -1132,7 +1015,7 @@ ebitset_op3_cmp (bitset dst, bitset src1, bitset src2, enum bitset_ops op)
|
||||
break;
|
||||
|
||||
case BITSET_OP_ANDN:
|
||||
for (i = 0; i < EBITSET_ELT_WORDS; i++, dstp++)
|
||||
for (unsigned i = 0; i < EBITSET_ELT_WORDS; i++, dstp++)
|
||||
{
|
||||
bitset_word tmp = *srcp1++ & ~(*srcp2++);
|
||||
|
||||
@@ -1158,12 +1041,9 @@ ebitset_op3_cmp (bitset dst, bitset src1, bitset src2, enum bitset_ops op)
|
||||
/* If we have elements of DST left over, free them all. */
|
||||
for (; j < dsize; j++)
|
||||
{
|
||||
ebitset_elt *delt;
|
||||
|
||||
changed = true;
|
||||
|
||||
delt = delts[j];
|
||||
|
||||
ebitset_elt *delt = delts[j];
|
||||
if (delt)
|
||||
ebitset_elt_remove (dst, j);
|
||||
}
|
||||
@@ -1176,19 +1056,17 @@ ebitset_op3_cmp (bitset dst, bitset src1, bitset src2, enum bitset_ops op)
|
||||
static bool
|
||||
ebitset_and_cmp (bitset dst, bitset src1, bitset src2)
|
||||
{
|
||||
bool changed;
|
||||
|
||||
if (EBITSET_ZERO_P (src2))
|
||||
{
|
||||
ebitset_weed (dst);
|
||||
changed = EBITSET_ZERO_P (dst);
|
||||
bool changed = EBITSET_ZERO_P (dst);
|
||||
ebitset_zero (dst);
|
||||
return changed;
|
||||
}
|
||||
else if (EBITSET_ZERO_P (src1))
|
||||
{
|
||||
ebitset_weed (dst);
|
||||
changed = EBITSET_ZERO_P (dst);
|
||||
bool changed = EBITSET_ZERO_P (dst);
|
||||
ebitset_zero (dst);
|
||||
return changed;
|
||||
}
|
||||
@@ -1206,8 +1084,6 @@ ebitset_and (bitset dst, bitset src1, bitset src2)
|
||||
static bool
|
||||
ebitset_andn_cmp (bitset dst, bitset src1, bitset src2)
|
||||
{
|
||||
bool changed;
|
||||
|
||||
if (EBITSET_ZERO_P (src2))
|
||||
{
|
||||
return ebitset_copy_cmp (dst, src1);
|
||||
@@ -1215,7 +1091,7 @@ ebitset_andn_cmp (bitset dst, bitset src1, bitset src2)
|
||||
else if (EBITSET_ZERO_P (src1))
|
||||
{
|
||||
ebitset_weed (dst);
|
||||
changed = EBITSET_ZERO_P (dst);
|
||||
bool changed = EBITSET_ZERO_P (dst);
|
||||
ebitset_zero (dst);
|
||||
return changed;
|
||||
}
|
||||
@@ -1278,9 +1154,9 @@ static void
|
||||
ebitset_copy (bitset dst, bitset src)
|
||||
{
|
||||
if (BITSET_COMPATIBLE_ (dst, src))
|
||||
ebitset_copy_ (dst, src);
|
||||
ebitset_copy_ (dst, src);
|
||||
else
|
||||
bitset_copy_ (dst, src);
|
||||
bitset_copy_ (dst, src);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+5
-4
@@ -1,6 +1,7 @@
|
||||
/* Functions to support ebitsets.
|
||||
|
||||
Copyright (C) 2002, 2004, 2009-2015 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2004, 2009-2015, 2018 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||
|
||||
@@ -22,10 +23,10 @@
|
||||
|
||||
#include "bitset.h"
|
||||
|
||||
extern size_t ebitset_bytes (bitset_bindex);
|
||||
size_t ebitset_bytes (bitset_bindex);
|
||||
|
||||
extern bitset ebitset_init (bitset, bitset_bindex);
|
||||
bitset ebitset_init (bitset, bitset_bindex);
|
||||
|
||||
extern void ebitset_release_memory (void);
|
||||
void ebitset_release_memory (void);
|
||||
|
||||
#endif
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
/* get-errno.c - get and set errno.
|
||||
|
||||
Copyright (C) 2002, 2006, 2009-2015 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2006, 2009-2015, 2018 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user