Skip to content

Commit

Permalink
Don't define CRYPTO_addc_* and CRYPTO_subc_* in C++
Browse files Browse the repository at this point in the history
GCC does not support C11 _Generic in C++ mode.

Change-Id: I974a0b04bbe4900419736044d0d8050f2b856d56
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/68507
Auto-Submit: David Benjamin <[email protected]>
Commit-Queue: David Benjamin <[email protected]>
Reviewed-by: Adam Langley <[email protected]>
  • Loading branch information
davidben authored and Boringssl LUCI CQ committed May 16, 2024
1 parent 7662e58 commit c701903
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions crypto/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -1174,6 +1174,11 @@ static inline uint64_t CRYPTO_rotr_u64(uint64_t value, int shift) {

// Arithmetic functions.

// The most efficient versions of these functions on GCC and Clang depend on C11
// |_Generic|. If we ever need to call these from C++, we'll need to add a
// variant that uses C++ overloads instead.
#if !defined(__cplusplus)

// CRYPTO_addc_* returns |x + y + carry|, and sets |*out_carry| to the carry
// bit. |carry| must be zero or one.
#if OPENSSL_HAS_BUILTIN(__builtin_addc)
Expand Down Expand Up @@ -1275,6 +1280,8 @@ static inline uint64_t CRYPTO_subc_u64(uint64_t x, uint64_t y, uint64_t borrow,
#define CRYPTO_subc_w CRYPTO_subc_u32
#endif

#endif // !__cplusplus


// FIPS functions.

Expand Down

0 comments on commit c701903

Please sign in to comment.