# define ZSTD_CET_ENDBRANCH
#endif
+/**
+ * ZSTD_IS_DETERMINISTIC_BUILD must be set to 0 if any compilation macro is
+ * active that impacts the compressed output.
+ *
+ * NOTE: ZSTD_MULTITHREAD is allowed to be set or unset.
+ */
+#if defined(ZSTD_CLEVEL_DEFAULT) \
+ || defined(ZSTD_EXCLUDE_DFAST_BLOCK_COMPRESSOR) \
+ || defined(ZSTD_EXCLUDE_GREEDY_BLOCK_COMPRESSOR) \
+ || defined(ZSTD_EXCLUDE_LAZY_BLOCK_COMPRESSOR) \
+ || defined(ZSTD_EXCLUDE_LAZY2_BLOCK_COMPRESSOR) \
+ || defined(ZSTD_EXCLUDE_BTLAZY2_BLOCK_COMPRESSOR) \
+ || defined(ZSTD_EXCLUDE_BTOPT_BLOCK_COMPRESSOR) \
+ || defined(ZSTD_EXCLUDE_BTULTRA_BLOCK_COMPRESSOR)
+# define ZSTD_IS_DETERMINISTIC_BUILD 0
+#else
+# define ZSTD_IS_DETERMINISTIC_BUILD 1
+#endif
+
#endif /* ZSTD_PORTABILITY_MACROS_H */
/*! ZSTD_getErrorString() :
* provides error code string from enum */
const char* ZSTD_getErrorString(ZSTD_ErrorCode code) { return ERR_getErrorString(code); }
+
+int ZSTD_isDeterministicBuild(void)
+{
+#if ZSTD_IS_DETERMINISTIC_BUILD
+ return 1;
+#else
+ return 0;
+#endif
+}
+/*! ZSTD_isDeterministicBuild() :
+ * Returns 1 if the library is built using standard compilation flags,
+ * and participates in determinism guarantees with other builds of the
+ * same version.
+ * If this function returns 0, it means the library was compiled with
+ * non-standard compilation flags that change the output of the
+ * compressor.
+ * This is mainly used for Zstd's determinism test suite, which is only
+ * run when this function returns 1.
+ */
+ZSTDLIB_API int ZSTD_isDeterministicBuild(void);
+
/* ========================================= */
/** Block level API (DEPRECATED) */
#ifdef PLATFORM_POSIX_VERSION
DISPLAYOUT("PLATFORM_POSIX_VERSION defined: %ldL\n", (long) PLATFORM_POSIX_VERSION);
#endif
- } }
+
+ if (!ZSTD_isDeterministicBuild()) {
+ DISPLAYOUT("non-deterministic build\n");
+ } } }
}
#define ZSTD_NB_STRATEGIES 9