Skip to content

Commit

Permalink
Fix F14*Fallback.h headers in modular builds
Browse files Browse the repository at this point in the history
Summary:
The `F14*Fallback.h` headers are meant to be included textually
from `F14*.h` headers and currently fail to compile in modular
builds, as a) they have references to items defined in their intended
enclosing header and b) even if successfully compiled alone would
provide conflicting definitions of the `F14*` structures.

This diff adds the `FOLLY_F14_VECTOR_INTRINSICS_AVAILABLE`
gate in the `F14*Fallback.h` headers so that they won't get compiled
when they're not used.

Reviewed By: yfeldblum, luciang

Differential Revision: D22568097

fbshipit-source-id: a75b3a4a687e3034dd9c4c3f7fd0a41bfd465272
  • Loading branch information
andrewjcg authored and facebook-github-bot committed Jul 24, 2020
1 parent 98eb49f commit bddd247
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
4 changes: 1 addition & 3 deletions folly/container/F14Map.h
Original file line number Diff line number Diff line change
Expand Up @@ -1298,13 +1298,11 @@ class F14FastMap : public std::conditional_t<
};
} // namespace folly

#else // !if FOLLY_F14_VECTOR_INTRINSICS_AVAILABLE
#endif // if FOLLY_F14_VECTOR_INTRINSICS_AVAILABLE

//////// Compatibility for unsupported platforms (not x86_64 and not aarch64)
#include <folly/container/detail/F14MapFallback.h>

#endif // if FOLLY_F14_VECTOR_INTRINSICS_AVAILABLE else

namespace folly {
namespace f14 {
namespace detail {
Expand Down
4 changes: 1 addition & 3 deletions folly/container/F14Set.h
Original file line number Diff line number Diff line change
Expand Up @@ -1022,13 +1022,11 @@ class F14FastSet
};
} // namespace folly

#else // !if FOLLY_F14_VECTOR_INTRINSICS_AVAILABLE
#endif // if FOLLY_F14_VECTOR_INTRINSICS_AVAILABLE

//////// Compatibility for unsupported platforms (not x86_64 and not aarch64)
#include <folly/container/detail/F14SetFallback.h>

#endif // if FOLLY_F14_VECTOR_INTRINSICS_AVAILABLE else

namespace folly {
namespace f14 {
namespace detail {
Expand Down
6 changes: 6 additions & 0 deletions folly/container/detail/F14MapFallback.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,16 @@

#pragma once

#include <folly/container/detail/F14IntrinsicsAvailability.h>

/**
* This file is intended to be included only by F14Map.h. It contains fallback
* implementations of F14Map types for platforms that do not support the
* required SIMD instructions, based on std::unordered_map.
*/

#if !FOLLY_F14_VECTOR_INTRINSICS_AVAILABLE

#include <unordered_map>

#include <algorithm>
Expand Down Expand Up @@ -638,3 +642,5 @@ class F14FastMap
};

} // namespace folly

#endif // !if FOLLY_F14_VECTOR_INTRINSICS_AVAILABLE
6 changes: 6 additions & 0 deletions folly/container/detail/F14SetFallback.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,16 @@

#pragma once

#include <folly/container/detail/F14IntrinsicsAvailability.h>

/**
* This file is intended to be included only by F14Set.h. It contains fallback
* implementations of F14Set types for platforms that do not support the
* required SIMD instructions, based on std::unordered_set.
*/

#if !FOLLY_F14_VECTOR_INTRINSICS_AVAILABLE

#include <algorithm>
#include <unordered_set>

Expand Down Expand Up @@ -431,3 +435,5 @@ class F14FastSet
};

} // namespace folly

#endif // !if FOLLY_F14_VECTOR_INTRINSICS_AVAILABLE

0 comments on commit bddd247

Please sign in to comment.