From 50da3fa2a9fde4ff42cf20d3994c1095060b4ff7 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 21 Feb 2020 12:41:33 -0800 Subject: [PATCH] =?UTF-8?q?Add=20=E2=80=98extern=20"C"=E2=80=99=20to=20cou?= =?UTF-8?q?nt-one-bits.h=20etc.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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"’. --- ChangeLog | 9 +++++++++ lib/count-leading-zeros.h | 8 ++++++++ lib/count-one-bits.h | 8 ++++++++ lib/count-trailing-zeros.h | 8 ++++++++ 4 files changed, 33 insertions(+) diff --git a/ChangeLog b/ChangeLog index 8649b9110..89beae3d7 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 b548754e1..7e88c8cb9 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 78770e424..eea56d859 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 2169f6262..1eb5fb919 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 -- 2.24.1