Re: [PATCH] tools/lib/thermal: fix misplaced extern "C" closing brace
Daniel Lezcano <[email protected]>
| Newsgroups | org.kernel.vger.linux-pm,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On 7/21/26 10:32, Andreas Haufler wrote:
> The public libthermal header opens the C++ 'extern "C" {' block inside
> the __LIBTHERMAL_H include guard, but places the closing brace after
> the guard has already ended:
>
> #endif /* __LIBTHERMAL_H */
>
> #ifdef __cplusplus
> }
> #endif
>
> On a single inclusion the braces still balance, so the problem is
> invisible. On the second inclusion of the header in the same C++
> translation unit the include guard skips the opening 'extern "C" {',
> while the closing '}' lives outside the guard and is emitted anyway.
> This leaves a stray '}' and breaks compilation for any C++ consumer
> that includes the header more than once.
>
> Move the closing block inside the include guard so both halves of the
> 'extern "C"' declaration are guarded consistently.
>
> Signed-off-by: Andreas Haufler <[email protected]>
> ---
Applied, thanks for the fix