[libcamera-devel,v2] backtrace: Include cxxabi.h without HAVE_DW
diff mbox series

Message ID 20211201201548.2023225-1-raj.khem@gmail.com
State Accepted
Headers show
Series
  • [libcamera-devel,v2] backtrace: Include cxxabi.h without HAVE_DW
Related show

Commit Message

Khem Raj Dec. 1, 2021, 8:15 p.m. UTC
Since its used in code without HAVE_DW, it fails to compile on such
systems e.g. linux/musl

Fixes
src/libcamera/base/backtrace.cpp:235:16: error: use of undeclared identifier 'abi'
                char *name = abi::__cxa_demangle(symbol, nullptr, nullptr, nullptr);
                             ^
1 error generated.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
v2: Fix typo in subject

 src/libcamera/base/backtrace.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Laurent Pinchart Dec. 1, 2021, 10:49 p.m. UTC | #1
Hi Khem,

Thank you for the patch.

On Wed, Dec 01, 2021 at 12:15:48PM -0800, Khem Raj wrote:
> Since its used in code without HAVE_DW, it fails to compile on such

s/its/it's/

> systems e.g. linux/musl
> 
> Fixes
> src/libcamera/base/backtrace.cpp:235:16: error: use of undeclared identifier 'abi'
>                 char *name = abi::__cxa_demangle(symbol, nullptr, nullptr, nullptr);
>                              ^
> 1 error generated.
> 
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
> v2: Fix typo in subject
> 
>  src/libcamera/base/backtrace.cpp | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/libcamera/base/backtrace.cpp b/src/libcamera/base/backtrace.cpp
> index d93e5518..42c60f7c 100644
> --- a/src/libcamera/base/backtrace.cpp
> +++ b/src/libcamera/base/backtrace.cpp
> @@ -13,11 +13,12 @@
>  #endif
>  
>  #ifdef HAVE_DW
> -#include <cxxabi.h>
>  #include <elfutils/libdwfl.h>
>  #include <unistd.h>
>  #endif
>  
> +#include <cxxabi.h>
> +

Let's move it a bit further down, after the HAVE_UNWIND block, just
before #include <sstream>. I can do this when merging the patch.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

>  #if HAVE_UNWIND
>  /*
>   * Disable support for remote unwinding to enable a more optimized
Kieran Bingham Dec. 2, 2021, 12:28 p.m. UTC | #2
Quoting Laurent Pinchart (2021-12-01 22:49:32)
> Hi Khem,
> 
> Thank you for the patch.
> 
> On Wed, Dec 01, 2021 at 12:15:48PM -0800, Khem Raj wrote:
> > Since its used in code without HAVE_DW, it fails to compile on such
> 
> s/its/it's/
> 
> > systems e.g. linux/musl
> > 
> > Fixes
> > src/libcamera/base/backtrace.cpp:235:16: error: use of undeclared identifier 'abi'
> >                 char *name = abi::__cxa_demangle(symbol, nullptr, nullptr, nullptr);
> >                              ^
> > 1 error generated.
> > 
> > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > ---
> > v2: Fix typo in subject
> > 
> >  src/libcamera/base/backtrace.cpp | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/src/libcamera/base/backtrace.cpp b/src/libcamera/base/backtrace.cpp
> > index d93e5518..42c60f7c 100644
> > --- a/src/libcamera/base/backtrace.cpp
> > +++ b/src/libcamera/base/backtrace.cpp
> > @@ -13,11 +13,12 @@
> >  #endif
> >  
> >  #ifdef HAVE_DW
> > -#include <cxxabi.h>
> >  #include <elfutils/libdwfl.h>
> >  #include <unistd.h>
> >  #endif
> >  
> > +#include <cxxabi.h>
> > +
> 
> Let's move it a bit further down, after the HAVE_UNWIND block, just
> before #include <sstream>. I can do this when merging the patch.
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Fine with me.


Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> 
> >  #if HAVE_UNWIND
> >  /*
> >   * Disable support for remote unwinding to enable a more optimized
> 
> -- 
> Regards,
> 
> Laurent Pinchart

Patch
diff mbox series

diff --git a/src/libcamera/base/backtrace.cpp b/src/libcamera/base/backtrace.cpp
index d93e5518..42c60f7c 100644
--- a/src/libcamera/base/backtrace.cpp
+++ b/src/libcamera/base/backtrace.cpp
@@ -13,11 +13,12 @@ 
 #endif
 
 #ifdef HAVE_DW
-#include <cxxabi.h>
 #include <elfutils/libdwfl.h>
 #include <unistd.h>
 #endif
 
+#include <cxxabi.h>
+
 #if HAVE_UNWIND
 /*
  * Disable support for remote unwinding to enable a more optimized