From: Paul Eggert Date: Fri, 21 Feb 2020 20:41:33 +0000 (-0800) Subject: Add ‘extern "C"’ to count-one-bits.h etc. X-Git-Tag: v1.0~4240 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=e22cd2677a4b7beacbf30b93bb0559f7b89f96ce;p=gnulib.git Add ‘extern "C"’ to count-one-bits.h etc. This ports these .h files to C++. Problem reported by Simon Marchi in: https://lists.gnu.org/r/bug-gnulib/2020-02/msg00110.html * lib/count-leading-zeros.h, lib/count-one-bits.h: * lib/count-trailing-zeros.h: Add ‘extern "C"’. --- diff --git a/ChangeLog b/ChangeLog index 8649b91108..89beae3d74 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2020-02-21 Paul Eggert + + Add ‘extern "C"’ to count-one-bits.h etc. + This ports these .h files to C++. + Problem reported by Simon Marchi in: + https://lists.gnu.org/r/bug-gnulib/2020-02/msg00110.html + * lib/count-leading-zeros.h, lib/count-one-bits.h: + * lib/count-trailing-zeros.h: Add ‘extern "C"’. + 2020-02-19 Bruno Haible uninorm/decompose-internal: Avoid "no previous prototype" warning. diff --git a/lib/count-leading-zeros.h b/lib/count-leading-zeros.h index b548754e18..7e88c8cb9d 100644 --- a/lib/count-leading-zeros.h +++ b/lib/count-leading-zeros.h @@ -30,6 +30,10 @@ _GL_INLINE_HEADER_BEGIN # define COUNT_LEADING_ZEROS_INLINE _GL_INLINE #endif +#ifdef __cplusplus +extern "C" { +#endif + /* Assuming the GCC builtin is BUILTIN and the MSC builtin is MSC_BUILTIN, expand to code that computes the number of leading zeros of the local variable 'x' of type TYPE (an unsigned integer type) and return it @@ -108,6 +112,10 @@ count_leading_zeros_ll (unsigned long long int x) unsigned long long int); } +#ifdef __cplusplus +} +#endif + _GL_INLINE_HEADER_END #endif /* COUNT_LEADING_ZEROS_H */ diff --git a/lib/count-one-bits.h b/lib/count-one-bits.h index 78770e4240..eea56d8591 100644 --- a/lib/count-one-bits.h +++ b/lib/count-one-bits.h @@ -30,6 +30,10 @@ _GL_INLINE_HEADER_BEGIN # define COUNT_ONE_BITS_INLINE _GL_INLINE #endif +#ifdef __cplusplus +extern "C" { +#endif + /* Expand to code that computes the number of 1-bits of the local variable 'x' of type TYPE (an unsigned integer type) and return it from the current function. */ @@ -129,6 +133,10 @@ count_one_bits_ll (unsigned long long int x) COUNT_ONE_BITS (__builtin_popcountll, __popcnt64, unsigned long long int); } +#ifdef __cplusplus +} +#endif + _GL_INLINE_HEADER_END #endif /* COUNT_ONE_BITS_H */ diff --git a/lib/count-trailing-zeros.h b/lib/count-trailing-zeros.h index 2169f62625..1eb5fb919f 100644 --- a/lib/count-trailing-zeros.h +++ b/lib/count-trailing-zeros.h @@ -30,6 +30,10 @@ _GL_INLINE_HEADER_BEGIN # define COUNT_TRAILING_ZEROS_INLINE _GL_INLINE #endif +#ifdef __cplusplus +extern "C" { +#endif + /* Assuming the GCC builtin is BUILTIN and the MSC builtin is MSC_BUILTIN, expand to code that computes the number of trailing zeros of the local variable 'x' of type TYPE (an unsigned integer type) and return it @@ -100,6 +104,10 @@ count_trailing_zeros_ll (unsigned long long int x) unsigned long long int); } +#ifdef __cplusplus +} +#endif + _GL_INLINE_HEADER_END #endif