Re: [PATCH] Fix two build errors for clang

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2018-07-17 at 14:10 +0200, Christophe de Dinechin wrote:
> From: Christophe de Dinechin <dinechin@xxxxxxxxxx>
> 
> Clang complains about:
> 1. [[noreturn]] used on implementation instead of header
> 2. errno used without <errno.h>
> 
> Details:
> 
> clang complains about [[noreturn]] not being on the first declaration.
> 
> cursor-updater.cpp:77:3: error: function declared '[[noreturn]]' after its first declaration
> [[noreturn]] void CursorUpdater::operator()()
>   ^
> ./cursor-updater.hpp:24:10: note: declaration missing '[[noreturn]]' attribute is here
>     void operator()();
>          ^
> 1 error generated.
> 
> Indeed, it makes no sense to mark a function as [[noreturn]] at a
> point which the call sites cannot see.
> 
> Also add missing <errno.h> before use of errno
> 
> frame-log.cpp:27:96: error: use of undeclared identifier 'errno'
>             throw Error(std::string("Failed to open log file '") + log_name + "': " + strerror(errno));

Sorry about the issues, I was a bit clueless about the attribute.

This should really be split into two patches though...

> Signed-off-by: Christophe de Dinechin <dinechin@xxxxxxxxxx>
> ---
>  src/cursor-updater.cpp | 2 +-
>  src/cursor-updater.hpp | 2 +-
>  src/frame-log.cpp      | 1 +
>  3 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/src/cursor-updater.cpp b/src/cursor-updater.cpp
> index 8f65e83..9f39c7b 100644
> --- a/src/cursor-updater.cpp
> +++ b/src/cursor-updater.cpp
> @@ -74,7 +74,7 @@ CursorUpdater::CursorUpdater(StreamPort *stream_port) : stream_port(stream_port)
>      XFixesSelectCursorInput(display, DefaultRootWindow(display), XFixesDisplayCursorNotifyMask);
>  }
>  
> -[[noreturn]] void CursorUpdater::operator()()
> +void CursorUpdater::operator()()
>  {
>      unsigned long last_serial = 0;
>  
> diff --git a/src/cursor-updater.hpp b/src/cursor-updater.hpp
> index d5f00af..6dbadac 100644
> --- a/src/cursor-updater.hpp
> +++ b/src/cursor-updater.hpp
> @@ -21,7 +21,7 @@ class CursorUpdater
>  public:
>      CursorUpdater(StreamPort *stream_port);
>  
> -    void operator()();
> +    [[noreturn]] void operator()();
>  
>  private:
>      StreamPort *stream_port;
> diff --git a/src/frame-log.cpp b/src/frame-log.cpp
> index 63a8ac0..cc993cd 100644
> --- a/src/frame-log.cpp
> +++ b/src/frame-log.cpp
> @@ -12,6 +12,7 @@
>  #include <chrono>
>  #include <cstdarg>
>  #include <string.h>
> +#include <errno.h>
>  
>  
>  namespace spice {
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]