11// SPDX-License-Identifier: Apache-2.0 OR MIT
22
3+ #![ allow( missing_docs) ]
4+
35#[ cfg( not( all(
46 portable_atomic_no_atomic_load_store,
57 not( any(
1214) ) ) ]
1315#[ macro_use]
1416mod atomic_8_16_macros {
15- #[ doc( hidden) ] // Not public API. (please submit an issue if you want this to be public API)
1617 #[ macro_export]
1718 macro_rules! cfg_has_atomic_8 {
1819 ( $( $tt: tt) * ) => {
1920 $( $tt) *
2021 } ;
2122 }
22- #[ doc( hidden) ] // Not public API. (please submit an issue if you want this to be public API)
23+ #[ macro_export]
24+ macro_rules! cfg_no_atomic_8 {
25+ ( $( $tt: tt) * ) => { } ;
26+ }
2327 #[ macro_export]
2428 macro_rules! cfg_has_atomic_16 {
2529 ( $( $tt: tt) * ) => {
2630 $( $tt) *
2731 } ;
2832 }
33+ #[ macro_export]
34+ macro_rules! cfg_no_atomic_16 {
35+ ( $( $tt: tt) * ) => { } ;
36+ }
2937}
3038#[ cfg( all(
3139 portable_atomic_no_atomic_load_store,
@@ -39,16 +47,26 @@ mod atomic_8_16_macros {
3947) ) ]
4048#[ macro_use]
4149mod atomic_8_16_macros {
42- #[ doc( hidden) ] // Not public API. (please submit an issue if you want this to be public API)
4350 #[ macro_export]
4451 macro_rules! cfg_has_atomic_8 {
4552 ( $( $tt: tt) * ) => { } ;
4653 }
47- #[ doc( hidden) ] // Not public API. (please submit an issue if you want this to be public API)
54+ #[ macro_export]
55+ macro_rules! cfg_no_atomic_8 {
56+ ( $( $tt: tt) * ) => {
57+ $( $tt) *
58+ } ;
59+ }
4860 #[ macro_export]
4961 macro_rules! cfg_has_atomic_16 {
5062 ( $( $tt: tt) * ) => { } ;
5163 }
64+ #[ macro_export]
65+ macro_rules! cfg_no_atomic_16 {
66+ ( $( $tt: tt) * ) => {
67+ $( $tt) *
68+ } ;
69+ }
5270}
5371
5472#[ cfg( all(
@@ -66,13 +84,16 @@ mod atomic_8_16_macros {
6684) ) ]
6785#[ macro_use]
6886mod atomic_32_macros {
69- #[ doc( hidden) ] // Not public API. (please submit an issue if you want this to be public API)
7087 #[ macro_export]
7188 macro_rules! cfg_has_atomic_32 {
7289 ( $( $tt: tt) * ) => {
7390 $( $tt) *
7491 } ;
7592 }
93+ #[ macro_export]
94+ macro_rules! cfg_no_atomic_32 {
95+ ( $( $tt: tt) * ) => { } ;
96+ }
7697}
7798#[ cfg( not( all(
7899 any( not( target_pointer_width = "16" ) , feature = "fallback" ) ,
@@ -89,11 +110,16 @@ mod atomic_32_macros {
89110) ) ) ]
90111#[ macro_use]
91112mod atomic_32_macros {
92- #[ doc( hidden) ] // Not public API. (please submit an issue if you want this to be public API)
93113 #[ macro_export]
94114 macro_rules! cfg_has_atomic_32 {
95115 ( $( $tt: tt) * ) => { } ;
96116 }
117+ #[ macro_export]
118+ macro_rules! cfg_no_atomic_32 {
119+ ( $( $tt: tt) * ) => {
120+ $( $tt) *
121+ } ;
122+ }
97123}
98124
99125#[ cfg_attr(
@@ -132,13 +158,16 @@ mod atomic_32_macros {
132158) ]
133159#[ macro_use]
134160mod atomic_64_macros {
135- #[ doc( hidden) ] // Not public API. (please submit an issue if you want this to be public API)
136161 #[ macro_export]
137162 macro_rules! cfg_has_atomic_64 {
138163 ( $( $tt: tt) * ) => {
139164 $( $tt) *
140165 } ;
141166 }
167+ #[ macro_export]
168+ macro_rules! cfg_no_atomic_64 {
169+ ( $( $tt: tt) * ) => { } ;
170+ }
142171}
143172#[ cfg_attr(
144173 portable_atomic_no_cfg_target_has_atomic,
@@ -176,11 +205,16 @@ mod atomic_64_macros {
176205) ]
177206#[ macro_use]
178207mod atomic_64_macros {
179- #[ doc( hidden) ] // Not public API. (please submit an issue if you want this to be public API)
180208 #[ macro_export]
181209 macro_rules! cfg_has_atomic_64 {
182210 ( $( $tt: tt) * ) => { } ;
183211 }
212+ #[ macro_export]
213+ macro_rules! cfg_no_atomic_64 {
214+ ( $( $tt: tt) * ) => {
215+ $( $tt) *
216+ } ;
217+ }
184218}
185219
186220#[ cfg_attr(
@@ -258,13 +292,16 @@ mod atomic_64_macros {
258292) ]
259293#[ macro_use]
260294mod atomic_128_macros {
261- #[ doc( hidden) ] // Not public API. (please submit an issue if you want this to be public API)
262295 #[ macro_export]
263296 macro_rules! cfg_has_atomic_128 {
264297 ( $( $tt: tt) * ) => {
265298 $( $tt) *
266299 } ;
267300 }
301+ #[ macro_export]
302+ macro_rules! cfg_no_atomic_128 {
303+ ( $( $tt: tt) * ) => { } ;
304+ }
268305}
269306#[ cfg_attr(
270307 not( feature = "fallback" ) ,
@@ -341,11 +378,16 @@ mod atomic_128_macros {
341378) ]
342379#[ macro_use]
343380mod atomic_128_macros {
344- #[ doc( hidden) ] // Not public API. (please submit an issue if you want this to be public API)
345381 #[ macro_export]
346382 macro_rules! cfg_has_atomic_128 {
347383 ( $( $tt: tt) * ) => { } ;
348384 }
385+ #[ macro_export]
386+ macro_rules! cfg_no_atomic_128 {
387+ ( $( $tt: tt) * ) => {
388+ $( $tt) *
389+ } ;
390+ }
349391}
350392
351393#[ cfg_attr(
@@ -370,13 +412,16 @@ mod atomic_128_macros {
370412) ]
371413#[ macro_use]
372414mod atomic_cas_macros {
373- #[ doc( hidden) ] // Not public API. (please submit an issue if you want this to be public API)
374415 #[ macro_export]
375416 macro_rules! cfg_has_atomic_cas {
376417 ( $( $tt: tt) * ) => {
377418 $( $tt) *
378419 } ;
379420 }
421+ #[ macro_export]
422+ macro_rules! cfg_no_atomic_cas {
423+ ( $( $tt: tt) * ) => { } ;
424+ }
380425}
381426#[ cfg_attr(
382427 portable_atomic_no_cfg_target_has_atomic,
@@ -400,9 +445,37 @@ mod atomic_cas_macros {
400445) ]
401446#[ macro_use]
402447mod atomic_cas_macros {
403- #[ doc( hidden) ] // Not public API. (please submit an issue if you want this to be public API)
404448 #[ macro_export]
405449 macro_rules! cfg_has_atomic_cas {
406450 ( $( $tt: tt) * ) => { } ;
407451 }
452+ #[ macro_export]
453+ macro_rules! cfg_no_atomic_cas {
454+ ( $( $tt: tt) * ) => {
455+ $( $tt) *
456+ } ;
457+ }
458+ }
459+
460+ // Check that all cfg_ macros work.
461+ mod check {
462+ crate :: cfg_has_atomic_8! { type _Atomic8 = ( ) ; }
463+ crate :: cfg_no_atomic_8! { type _Atomic8 = ( ) ; }
464+ crate :: cfg_has_atomic_16! { type _Atomic16 = ( ) ; }
465+ crate :: cfg_no_atomic_16! { type _Atomic16 = ( ) ; }
466+ crate :: cfg_has_atomic_32! { type _Atomic32 = ( ) ; }
467+ crate :: cfg_no_atomic_32! { type _Atomic32 = ( ) ; }
468+ crate :: cfg_has_atomic_64! { type _Atomic64 = ( ) ; }
469+ crate :: cfg_no_atomic_64! { type _Atomic64 = ( ) ; }
470+ crate :: cfg_has_atomic_128! { type _Atomic128 = ( ) ; }
471+ crate :: cfg_no_atomic_128! { type _Atomic128 = ( ) ; }
472+ crate :: cfg_has_atomic_ptr! { type _AtomicPtr = ( ) ; }
473+ crate :: cfg_no_atomic_ptr! { type _AtomicPtr = ( ) ; }
474+ crate :: cfg_has_atomic_cas! { type __AtomicPtr = ( ) ; }
475+ crate :: cfg_no_atomic_cas! { type __AtomicPtr = ( ) ; }
476+ #[ allow( unused_imports) ]
477+ use {
478+ _Atomic128 as _, _Atomic16 as _, _Atomic32 as _, _Atomic64 as _, _Atomic8 as _,
479+ _AtomicPtr as _, __AtomicPtr as _,
480+ } ;
408481}
0 commit comments