From 4ff0c4f15476f3b99fc5fd86109bedfc839242a6 Mon Sep 17 00:00:00 2001 From: greatx Date: Thu, 27 Oct 2022 14:04:14 +0800 Subject: [PATCH] fix pragma-pack warning on macos --- cmake/flags.cmake | 3 ++- paddle/fluid/operators/math/bloomfilter.h | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cmake/flags.cmake b/cmake/flags.cmake index 4c26366c5acf1..0267f251e490f 100644 --- a/cmake/flags.cmake +++ b/cmake/flags.cmake @@ -221,7 +221,8 @@ if(APPLE) -Werror=braced-scalar-init -Werror=uninitialized -Werror=tautological-constant-out-of-range-compare - -Werror=literal-conversion) + -Werror=literal-conversion + -Werror=pragma-pack) endif() if(WITH_HETERPS AND WITH_PSLIB) diff --git a/paddle/fluid/operators/math/bloomfilter.h b/paddle/fluid/operators/math/bloomfilter.h index ba907b5012b3c..ce019a30ed9f5 100644 --- a/paddle/fluid/operators/math/bloomfilter.h +++ b/paddle/fluid/operators/math/bloomfilter.h @@ -26,7 +26,7 @@ namespace paddle { namespace operators { namespace math { -#pragma pack(4) +#pragma pack(push, 4) struct bloomfilter { uint64_t magic_num; uint64_t m; @@ -34,6 +34,8 @@ struct bloomfilter { uint64_t count; unsigned char bit_vector[1]; }; +#pragma pack(pop) + int bloomfilter_get(const struct bloomfilter *bloomfilter, const void *key, size_t len);