Move extern "C" down in include/urcu/urcu-bp.h
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 17 Aug 2022 16:49:50 +0000 (12:49 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 17 Aug 2022 17:42:24 +0000 (13:42 -0400)
commitbf178c7f5ab7ef4cc0d6dca6195af387281d44af
treefd579619c078f35496a892cc9e85859f5fd08792
parent474b4fbfe408d2626800f48c905b36c1c0f50b82
Move extern "C" down in include/urcu/urcu-bp.h

A following patch adds a <type_traits> include in
urcu/compiler.h.  However, compiler.h gets included by urcu/pointer.h,
which gets included by urcu/urcu-bp.h inside an extern "C" scope.
Including the C++ header file <type_traits> inside an extern "C" scope
doesn't work:

    In file included from /home/simark/src/urcu/include/urcu/compiler.h:25,
                     from /home/simark/src/urcu/include/urcu/pointer.h:29,
                     from /home/simark/src/urcu/include/urcu/urcu-bp.h:58,
                     from /home/simark/src/urcu/include/urcu-bp.h:2,
                     from /home/simark/src/urcu/tests/unit/test_urcu_multiflavor-bp.c:28,
                     from /home/simark/src/urcu/tests/unit/test_urcu_multiflavor-bp_cxx.cpp:3:
    /usr/include/c++/12.1.1/type_traits:44:3: error: template with C linkage
       44 |   template<typename _Tp>
          |   ^~~~~~~~
    /home/simark/src/urcu/include/urcu/urcu-bp.h:41:1: note: ‘extern "C"’ linkage started here
       41 | extern "C" {
          | ^~~~~~~~~~

Move the extern "C" in urcu-bp.h down, so that the includes are not
inside it.  Each header file is responsible to use extern "C" where
relevant, and we should avoid including files inside such a scope.

Change-Id: I42bdfa6ab445e8c40f5bcac1c1ae0786d443626c
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/urcu/urcu-bp.h
This page took 0.025937 seconds and 4 git commands to generate.