From ef78242e19e8d0599c74aa34fad0fbb5a56cdb20 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Wed, 25 Apr 2012 11:29:43 +0100 Subject: Add some more 'noreturn' annotations Methods which longjump, unconditionally raise an exception, or call _exit() cannot return control to the caller so should be annotated with 'noreturn' Signed-off-by: Daniel P. Berrange --- client/canvas.h | 2 +- client/jpeg_decoder.cpp | 3 +-- client/red_client.h | 2 +- client/red_peer.cpp | 2 +- client/x11/platform.cpp | 3 +-- 5 files changed, 5 insertions(+), 7 deletions(-) (limited to 'client') diff --git a/client/canvas.h b/client/canvas.h index cd6a89b9..77025687 100644 --- a/client/canvas.h +++ b/client/canvas.h @@ -252,7 +252,7 @@ public: /* TODO: unite with the window debug callbacks? */ class GlzDecoderCanvasDebug: public GlzDecoderDebug { public: - virtual void error(const std::string& str) + virtual SPICE_GNUC_NORETURN void error(const std::string& str) { throw Exception(str); } diff --git a/client/jpeg_decoder.cpp b/client/jpeg_decoder.cpp index 2b2d5e47..c85902f5 100644 --- a/client/jpeg_decoder.cpp +++ b/client/jpeg_decoder.cpp @@ -52,10 +52,9 @@ extern "C" { { } - static jpeg_boolean jpeg_decoder_fill_input_buffer(j_decompress_ptr cinfo) + static SPICE_GNUC_NORETURN jpeg_boolean jpeg_decoder_fill_input_buffer(j_decompress_ptr cinfo) { PANIC("no more data for jpeg"); - return FALSE; } static void jpeg_decoder_skip_input_data(j_decompress_ptr cinfo, long num_bytes) diff --git a/client/red_client.h b/client/red_client.h index a2f00c41..c4b418a2 100644 --- a/client/red_client.h +++ b/client/red_client.h @@ -99,7 +99,7 @@ private: class GlzDecoderWindowDebug: public GlzDecoderDebug { public: - virtual void error(const std::string& str) + virtual SPICE_GNUC_NORETURN void error(const std::string& str) { throw Exception(str); } diff --git a/client/red_peer.cpp b/client/red_peer.cpp index 10640c8d..d2a60987 100644 --- a/client/red_peer.cpp +++ b/client/red_peer.cpp @@ -33,7 +33,7 @@ #include "debug.h" #include "platform_utils.h" -static void ssl_error() +static void SPICE_GNUC_NORETURN ssl_error() { unsigned long last_error = ERR_peek_last_error(); diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp index 0669b69f..14c6e0cd 100644 --- a/client/x11/platform.cpp +++ b/client/x11/platform.cpp @@ -3167,11 +3167,10 @@ static int x_error_handler(Display* display, XErrorEvent* error_event) return 0; } -static int x_io_error_handler(Display* display) +static SPICE_GNUC_NORETURN int x_io_error_handler(Display* display) { LOG_ERROR("x io error on %s", XDisplayString(display)); _exit(-1); - return 0; } static XVisualInfo* get_x_vis_info(int screen) -- cgit