Commit 378f6cd 1 parent 67ac8d1 commit 378f6cd Copy full SHA for 378f6cd
File tree 10 files changed +26
-26
lines changed
10 files changed +26
-26
lines changed Original file line number Diff line number Diff line change 47
47
"dictionaries" : [" bash" , " rust" ]
48
48
}
49
49
],
50
- "ignorePaths" : [
51
- " target-specs/**" ,
52
- " tests/helper/src/gen/**" ,
53
- " tools/codegen/patches/**" ,
54
- " **/*.ld"
55
- ]
50
+ "ignorePaths" : [" target-specs/**" , " **/*.ld" ]
56
51
}
Original file line number Diff line number Diff line change 1
1
* text =auto eol =lf
2
2
.github /.cspell /rust-dependencies.txt linguist-generated
3
- tests / helper / src /gen /** linguist-generated
3
+ src /gen /** linguist-generated
Original file line number Diff line number Diff line change @@ -793,7 +793,6 @@ jobs:
793
793
steps :
794
794
- uses : taiki-e/checkout-action@v1
795
795
- uses : taiki-e/github-actions/install-rust@nightly
796
- - run : tools/no_atomic.sh
797
796
- run : tools/gen.sh
798
797
- id : diff
799
798
run : tools/ci/gen.sh
Original file line number Diff line number Diff line change 10
10
portable-atomic/
11
11
├── bench/ -- simple benchmarks
12
12
├── build.rs -- build script
13
- ├── no_atomic.rs -- definitions of statics used by build script (auto-generated)
14
13
├── version.rs -- rustc version detection code used by build script
15
14
├── portable-atomic-util/ -- crate that defines synchronization primitives built with portable-atomic
16
15
├── src/
17
16
│ ├── cfgs.rs -- definitions of cfg_{has,no}_* macros
17
+ │ ├── gen/ -- code generated by tools/gen.sh
18
18
│ ├── imp/
19
19
│ │ ├── atomic128/ -- 128-bit atomic implementations on 64-bit architectures (mainly by asm)
20
20
│ │ ├── atomic64/ -- 64-bit atomic implementations on 32-bit architectures (mainly by asm)
Original file line number Diff line number Diff line change 8
8
mod version;
9
9
use self :: version:: { rustc_version, Version } ;
10
10
11
- use std:: { env, str} ;
11
+ #[ path = "src/gen/build.rs" ]
12
+ mod generated;
12
13
13
- include ! ( "no_atomic.rs" ) ;
14
+ use std :: { env , str } ;
14
15
15
16
fn main ( ) {
16
17
println ! ( "cargo:rerun-if-changed=build.rs" ) ;
17
- println ! ( "cargo:rerun-if-changed=no_atomic .rs" ) ;
18
+ println ! ( "cargo:rerun-if-changed=src/gen/build .rs" ) ;
18
19
println ! ( "cargo:rerun-if-changed=version.rs" ) ;
19
20
20
21
#[ cfg( feature = "unsafe-assume-single-core" ) ]
@@ -191,18 +192,18 @@ fn main() {
191
192
} else {
192
193
println ! ( "cargo:rustc-cfg=portable_atomic_no_cfg_target_has_atomic" ) ;
193
194
let target = & * convert_custom_linux_target ( target) ;
194
- if NO_ATOMIC_CAS . contains ( & target) {
195
+ if generated :: NO_ATOMIC_CAS . contains ( & target) {
195
196
println ! ( "cargo:rustc-cfg=portable_atomic_no_atomic_cas" ) ;
196
197
}
197
- if NO_ATOMIC_64 . contains ( & target) {
198
+ if generated :: NO_ATOMIC_64 . contains ( & target) {
198
199
println ! ( "cargo:rustc-cfg=portable_atomic_no_atomic_64" ) ;
199
200
} else {
200
201
// Otherwise, assuming `"max-atomic-width" == 64` or `"max-atomic-width" == 128`.
201
202
}
202
203
}
203
204
}
204
205
// We don't need to use convert_custom_linux_target here because all linux targets have atomics.
205
- if NO_ATOMIC . contains ( & target) {
206
+ if generated :: NO_ATOMIC . contains ( & target) {
206
207
println ! ( "cargo:rustc-cfg=portable_atomic_no_atomic_load_store" ) ;
207
208
}
208
209
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ git config user.name 'Taiki Endo'
18
18
git config user.email
' [email protected] '
19
19
20
20
has_update=' '
21
- for path in no_atomic.rs src/gen/* ; do
21
+ for path in src/gen/* ; do
22
22
git add -N " ${path} "
23
23
if ! git diff --exit-code -- " ${path} " ; then
24
24
git add " ${path} "
Original file line number Diff line number Diff line change @@ -12,4 +12,6 @@ cd -- "$(dirname -- "$0")"/..
12
12
13
13
set -x
14
14
15
+ ./tools/no_atomic.sh
16
+
15
17
./tools/target_spec.sh
Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ cd -- "$(dirname -- "$0")"/..
10
10
#
11
11
# USAGE:
12
12
# ./tools/no_atomic.sh
13
+ #
14
+ # This script is intended to be called by gen.sh, but can be called separately.
13
15
14
16
retry () {
15
17
for i in {1..10}; do
@@ -26,7 +28,8 @@ bail() {
26
28
exit 1
27
29
}
28
30
29
- file=no_atomic.rs
31
+ file=src/gen/build.rs
32
+ mkdir -p -- " $( dirname -- " ${file} " ) "
30
33
31
34
# We don't refer to NO_ATOMIC_CAS and NO_ATOMIC_64 in nightly-2022-02-11+
32
35
# because feature(cfg_target_has_atomic) stabilized. So, we get the list
@@ -77,19 +80,19 @@ cat >|"${file}" <<EOF
77
80
// Note: This is the list as of nightly-2022-02-10. We don't refer to this in
78
81
// nightly-2022-02-11+ because feature(cfg_target_has_atomic) stabilized.
79
82
#[rustfmt::skip]
80
- static NO_ATOMIC_CAS: &[&str] = &[
83
+ pub(crate) static NO_ATOMIC_CAS: &[&str] = &[
81
84
${no_atomic_cas[*]}
82
85
];
83
86
84
87
// Note: This is the list as of nightly-2022-02-10. We don't refer to this in
85
88
// nightly-2022-02-11+ because feature(cfg_target_has_atomic) stabilized.
86
89
#[rustfmt::skip]
87
- static NO_ATOMIC_64: &[&str] = &[
90
+ pub(crate) static NO_ATOMIC_64: &[&str] = &[
88
91
${no_atomic_64[*]}
89
92
];
90
93
91
94
#[rustfmt::skip]
92
- static NO_ATOMIC: &[&str] = &[
95
+ pub(crate) static NO_ATOMIC: &[&str] = &[
93
96
${no_atomic}
94
97
];
95
98
EOF
Original file line number Diff line number Diff line change @@ -13,12 +13,12 @@ cd -- "$(dirname -- "$0")"/..
13
13
#
14
14
# This script is intended to be called by gen.sh, but can be called separately.
15
15
16
- utils_file =src/gen/utils.rs
17
- mkdir -p -- " $( dirname -- " ${utils_file } " ) "
16
+ file =src/gen/utils.rs
17
+ mkdir -p -- " $( dirname -- " ${file } " ) "
18
18
19
19
known_64_bit_arch=($( rustc -Z unstable-options --print all-target-specs-json | jq -r ' . | to_entries[].value | if ."target-pointer-width" == "64" then .arch else empty end' | LC_ALL=C sort -u) )
20
20
21
- cat > | " ${utils_file } " << EOF
21
+ cat > | " ${file } " << EOF
22
22
// SPDX-License-Identifier: Apache-2.0 OR MIT
23
23
// This file is @generated by ${0##*/ } .
24
24
// It is not intended for manual editing.
You can’t perform that action at this time.
0 commit comments