internal/refcount.h: allow non-atomic build
Configure with -DOPENSSL_DEV_NO_ATOMICS and you get refcount without
atomics.  This is intended for internal development only, to check the
refcounting is properly coded.  It should never become a configuration
option, hence the name of the macro.
# endif
# endif
+# ifndef OPENSSL_DEV_NO_ATOMICS
# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L \
&& !defined(__STDC_NO_ATOMICS__)
# include <stdatomic.h>
@@ -114,7 +115,15 @@ static __inline int CRYPTO_DOWN_REF(volatile int *val, int *ret, void *lock)
}
# endif
-# else
+# endif
+# endif /* !OPENSSL_DEV_NO_ATOMICS */
+
+/*
+ * All the refcounting implementations above define HAVE_ATOMICS, so if it's
+ * still undefined here (such as when OPENSSL_DEV_NO_ATMOICS is defined), it
+ * means we need to implement a fallback. This fallback uses locks.
+ */
+# ifndef HAVE_ATOMICS
typedef int CRYPTO_REF_COUNT;
