Go to file
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
build-aux build-sys: make it a seperately buildable spice-common library 2012-03-22 20:21:05 +01:00
common log: Let gcc know about the logging macros which abort 2019-04-01 17:33:17 +01:00
docs docs: add spice URI scheme 2019-02-21 14:22:18 +00:00
m4 Remove obsolete Autoconf macros 2019-01-30 13:14:40 +00:00
python_modules codegen: Allows to generate C declarations automatically 2019-03-18 13:01:58 +00:00
tests test-marshallers: Fix header guard 2019-03-29 16:58:16 +01:00
.gitlab-ci.yml ci: Remove dependencies from copr build 2019-03-12 12:43:38 +00:00
.gitmodules Integrate recorder library 2019-01-23 14:44:19 +00:00
.gitpublish Add a .gitpublish 2019-01-15 17:35:51 +04:00
autogen.sh Remove files moved to spice-protocol 2015-08-11 10:26:06 +02:00
configure.ac Integrate recorder library 2019-01-23 14:44:19 +00:00
COPYING Remove trailing whitespace 2015-12-18 11:41:15 +01:00
git.mk build: Update git.mk to latest version 2018-06-18 14:08:03 +01:00
Makefile.am proto: Remove support for SPICE version 1 2018-09-28 09:00:03 +01:00
meson_options.txt meson: switch smartcard option to auto feature 2019-02-13 14:20:03 -02:00
meson.build meson: Remove some useless checks 2019-03-15 15:45:57 +00:00
spice_codegen.py codegen: Allows to generate C declarations automatically 2019-03-18 13:01:58 +00:00
spice.proto Generate automatically most C message declarations 2019-03-18 13:02:03 +00:00