@@ -436,12 +436,14 @@ rbimpl_atomic_size_fetch_add(volatile size_t *ptr, size_t val)
436
436
RBIMPL_ASSERT_OR_ASSUME(val <= LONG_MAX);
437
437
atomic_add_long(ptr, val);
438
438
439
- #else
439
+ #elif defined(__sun) && defined(HAVE_ATOMIC_H)
440
440
RBIMPL_STATIC_ASSERT(size_of_rb_atomic_t, sizeof *ptr == sizeof(rb_atomic_t));
441
441
442
442
volatile rb_atomic_t *const tmp = RBIMPL_CAST((volatile rb_atomic_t *)ptr);
443
443
rbimpl_atomic_fetch_add(tmp, val);
444
444
445
+ #else
446
+ # error Unsupported platform.
445
447
#endif
446
448
}
447
449
@@ -505,12 +507,14 @@ rbimpl_atomic_size_add(volatile size_t *ptr, size_t val)
505
507
RBIMPL_ASSERT_OR_ASSUME(val <= LONG_MAX);
506
508
atomic_add_long(ptr, val);
507
509
508
- #else
510
+ #elif defined(_WIN32) || (defined(__sun) && defined(HAVE_ATOMIC_H))
509
511
RBIMPL_STATIC_ASSERT(size_of_rb_atomic_t, sizeof *ptr == sizeof(rb_atomic_t));
510
512
511
513
volatile rb_atomic_t *const tmp = RBIMPL_CAST((volatile rb_atomic_t *)ptr);
512
514
rbimpl_atomic_add(tmp, val);
513
515
516
+ #else
517
+ # error Unsupported platform.
514
518
#endif
515
519
}
516
520
@@ -532,8 +536,7 @@ rbimpl_atomic_inc(volatile rb_atomic_t *ptr)
532
536
atomic_inc_uint(ptr);
533
537
534
538
#else
535
- rbimpl_atomic_add (ptr, 1 );
536
-
539
+ # error Unsupported platform.
537
540
#endif
538
541
}
539
542
@@ -554,11 +557,13 @@ rbimpl_atomic_size_inc(volatile size_t *ptr)
554
557
#elif defined(__sun) && defined(HAVE_ATOMIC_H) && (defined(_LP64) || defined(_I32LPx))
555
558
atomic_inc_ulong(ptr);
556
559
557
- #else
560
+ #elif defined(_WIN32) || (defined(__sun) && defined(HAVE_ATOMIC_H))
558
561
RBIMPL_STATIC_ASSERT(size_of_size_t, sizeof *ptr == sizeof(rb_atomic_t));
559
562
560
563
rbimpl_atomic_size_add(ptr, 1);
561
564
565
+ #else
566
+ # error Unsupported platform.
562
567
#endif
563
568
}
564
569
@@ -641,12 +646,14 @@ rbimpl_atomic_size_sub(volatile size_t *ptr, size_t val)
641
646
RBIMPL_ASSERT_OR_ASSUME(val <= LONG_MAX);
642
647
atomic_add_long(ptr, neg * val);
643
648
644
- #else
649
+ #elif defined(_WIN32) || (defined(__sun) && defined(HAVE_ATOMIC_H))
645
650
RBIMPL_STATIC_ASSERT(size_of_rb_atomic_t, sizeof *ptr == sizeof(rb_atomic_t));
646
651
647
652
volatile rb_atomic_t *const tmp = RBIMPL_CAST((volatile rb_atomic_t *)ptr);
648
653
rbimpl_atomic_sub(tmp, val);
649
654
655
+ #else
656
+ # error Unsupported platform.
650
657
#endif
651
658
}
652
659
@@ -668,8 +675,7 @@ rbimpl_atomic_dec(volatile rb_atomic_t *ptr)
668
675
atomic_dec_uint(ptr);
669
676
670
677
#else
671
- rbimpl_atomic_sub (ptr, 1 );
672
-
678
+ # error Unsupported platform.
673
679
#endif
674
680
}
675
681
@@ -690,11 +696,13 @@ rbimpl_atomic_size_dec(volatile size_t *ptr)
690
696
#elif defined(__sun) && defined(HAVE_ATOMIC_H) && (defined(_LP64) || defined(_I32LPx))
691
697
atomic_dec_ulong(ptr);
692
698
693
- #else
699
+ #elif defined(_WIN32) || (defined(__sun) && defined(HAVE_ATOMIC_H))
694
700
RBIMPL_STATIC_ASSERT(size_of_size_t, sizeof *ptr == sizeof(rb_atomic_t));
695
701
696
702
rbimpl_atomic_size_sub(ptr, 1);
697
703
704
+ #else
705
+ # error Unsupported platform.
698
706
#endif
699
707
}
700
708
@@ -790,13 +798,15 @@ rbimpl_atomic_size_exchange(volatile size_t *ptr, size_t val)
790
798
#elif defined(__sun) && defined(HAVE_ATOMIC_H) && (defined(_LP64) || defined(_I32LPx))
791
799
return atomic_swap_ulong(ptr, val);
792
800
793
- #else
801
+ #elif defined(_WIN32) || (defined(__sun) && defined(HAVE_ATOMIC_H))
794
802
RBIMPL_STATIC_ASSERT(size_of_size_t, sizeof *ptr == sizeof(rb_atomic_t));
795
803
796
804
volatile rb_atomic_t *const tmp = RBIMPL_CAST((volatile rb_atomic_t *)ptr);
797
805
const rb_atomic_t ret = rbimpl_atomic_exchange(tmp, val);
798
806
return RBIMPL_CAST((size_t)ret);
799
807
808
+ #else
809
+ # error Unsupported platform.
800
810
#endif
801
811
}
802
812
@@ -983,12 +993,14 @@ rbimpl_atomic_size_cas(volatile size_t *ptr, size_t oldval, size_t newval)
983
993
#elif defined(__sun) && defined(HAVE_ATOMIC_H) && (defined(_LP64) || defined(_I32LPx))
984
994
return atomic_cas_ulong(ptr, oldval, newval);
985
995
986
- #else
996
+ #elif defined(_WIN32) || (defined(__sun) && defined(HAVE_ATOMIC_H))
987
997
RBIMPL_STATIC_ASSERT(size_of_size_t, sizeof *ptr == sizeof(rb_atomic_t));
988
998
989
999
volatile rb_atomic_t *tmp = RBIMPL_CAST((volatile rb_atomic_t *)ptr);
990
1000
return rbimpl_atomic_cas(tmp, oldval, newval);
991
1001
1002
+ #else
1003
+ # error Unsupported platform.
992
1004
#endif
993
1005
}
994
1006
0 commit comments