spice-common/common
Christophe Fergeau 4951c71553 log: Let gcc know about the logging macros which abort
This commit adds a SPICE_UNREACHABLE macro (courtesy of Frediano)
so that gcc does not think that code control can go past
spice_return_{val_,}if_fail(), spice_critical() and spice_error()

This avoids this kind of warnings:

fallthrough.c:

 #include "log.h"

int main(int argc, char **argv)
{
    switch(argc) {
        case 1:
            spice_critical("foo");
       default:
            return 0;
    }
}

$ gcc  -c    $(pkg-config --cflags --libs glib-2.0 spice-protocol)
       -I common   -Wimplicit-fallthrough=5 ./fallthrough.c
In file included from ./fallthrough.c:1:
./fallthrough.c: In function 'main':
common/log.h:73:5: warning: this statement may fall through [-Wimplicit-fallthrough=]
   73 |     spice_log(G_LOG_LEVEL_CRITICAL, SPICE_STRLOC, __FUNCTION__, "" format, ## __VA_ARGS__); \
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./fallthrough.c:8:25: note: in expansion of macro 'spice_critical'
    8 |                         spice_critical("foo");
      |                         ^~~~~~~~~~~~~~
./fallthrough.c:9:17: note: here
    9 |                 default:
      |                 ^~~~~~~

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-04-01 17:33:17 +01:00
..
recorder@10b178762e recorder: Update 2019-03-29 17:58:21 +00:00
backtrace.c backtrace: Add missing include 2019-03-29 11:29:25 +01:00
backtrace.h Unify headers guard names 2018-11-26 11:20:57 +00:00
canvas_base.c canvas_base: Fix variable shadowing warning 2019-03-29 11:29:25 +01:00
canvas_base.h Unify headers guard names 2018-11-26 11:20:57 +00:00
canvas_utils.c build: Remove spice_common.h 2018-07-06 06:46:15 +01:00
canvas_utils.h Unify headers guard names 2018-11-26 11:20:57 +00:00
client_marshallers.h codegen: Generate headers while generating code 2019-03-18 13:01:52 +00:00
demarshallers.h Unify headers guard names 2018-11-26 11:20:57 +00:00
draw.h Unify headers guard names 2018-11-26 11:20:57 +00:00
lines.c miLineArc(): initialize edge1, edge2 2018-05-10 10:05:41 -05:00
lines.h Unify headers guard names 2018-11-26 11:20:57 +00:00
log.c build: Add missing G_GNUC_PRINTF annotations 2019-03-29 16:58:07 +01:00
log.h log: Let gcc know about the logging macros which abort 2019-04-01 17:33:17 +01:00
lz_common.h Unify headers guard names 2018-11-26 11:20:57 +00:00
lz_compress_tmpl.c lz: Inline GET_{r,g,b} macros 2018-05-25 11:54:18 +01:00
lz_config.h Unify headers guard names 2018-11-26 11:20:57 +00:00
lz_decompress_tmpl.c lz: Simplify code 2018-01-18 10:08:43 +00:00
lz.c lz: Don't try to print uninitialized variable 2019-03-29 11:29:25 +01:00
lz.h Unify headers guard names 2018-11-26 11:20:57 +00:00
macros.h log: Let gcc know about the logging macros which abort 2019-04-01 17:33:17 +01:00
Makefile.am Allow to generate C declarations for spice.proto 2019-03-18 13:02:01 +00:00
marshaller.c codegen: Remove support for --ptrsize 2019-03-08 11:09:02 +00:00
marshaller.h codegen: Remove support for --ptrsize 2019-03-08 11:09:02 +00:00
mem.c mem: Fix compile error if alignment-checks option is used 2019-02-21 13:44:07 +00:00
mem.h Unify headers guard names 2018-11-26 11:20:57 +00:00
meson.build Allow to generate C declarations for spice.proto 2019-03-18 13:02:01 +00:00
messages.h Generate automatically most C message declarations 2019-03-18 13:02:03 +00:00
pixman_utils.c pixman: Use g_error() rather than g_abort() 2018-07-06 18:11:54 +02:00
pixman_utils.h Unify headers guard names 2018-11-26 11:20:57 +00:00
quic_config.h Unify headers guard names 2018-11-26 11:20:57 +00:00
quic_family_tmpl.c quic: Call encode from golomb_coding 2018-07-03 19:37:39 +01:00
quic_tmpl.c quic: Unify rgb/non-rgb macro declarations 2018-07-10 10:34:57 +01:00
quic.c quic: Fix QUIC_VERSION definition 2019-03-29 16:58:20 +01:00
quic.h Unify headers guard names 2018-11-26 11:20:57 +00:00
recorder.h Integrate recorder library 2019-01-23 14:44:19 +00:00
rect.h Unify headers guard names 2018-11-26 11:20:57 +00:00
region.c test-region: Create proper test for region from source code 2018-06-27 13:17:41 +01:00
region.h Unify headers guard names 2018-11-26 11:20:57 +00:00
ring.h Unify headers guard names 2018-11-26 11:20:57 +00:00
rop3.c build: Remove spice_common.h 2018-07-06 06:46:15 +01:00
rop3.h Unify headers guard names 2018-11-26 11:20:57 +00:00
snd_codec.c snd: Replace spice_printerr() use with g_warning 2018-06-28 13:39:52 +02:00
snd_codec.h Unify headers guard names 2018-11-26 11:20:57 +00:00
ssl_verify.c Use a single copy of subject string 2018-12-19 11:31:13 +00:00
ssl_verify.h Unify headers guard names 2018-11-26 11:20:57 +00:00
sw_canvas.c swcanvas: Remove canvas_create() 2018-07-04 10:04:02 +02:00
sw_canvas.h Unify headers guard names 2018-11-26 11:20:57 +00:00
utils.c utils: Add genum -> string helpers 2018-11-23 10:25:01 +00:00
utils.h utils: Add genum -> string helpers 2018-11-23 10:25:01 +00:00
verify.h build: Update verify.h to latest version 2019-03-29 16:58:14 +01:00