[Spice-commits] 7 commits - common/backtrace.c common/canvas_base.c common/log.c common/lz.c common/quic.c common/verify.h tests/test-logging.c tests/test-marshallers.h

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Mar 29 16:41:54 UTC 2019


 common/backtrace.c       |    2 ++
 common/canvas_base.c     |    8 ++++----
 common/log.c             |    1 +
 common/lz.c              |    2 +-
 common/quic.c            |    4 ++--
 common/verify.h          |   22 +++++++++++++---------
 tests/test-logging.c     |    1 +
 tests/test-marshallers.h |    7 ++++---
 8 files changed, 28 insertions(+), 19 deletions(-)

New commits:
commit 1fbac71c84509e29c73bfb5a8595f354ce007fd4
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Thu Mar 14 15:50:07 2019 +0100

    quic: Fix QUIC_VERSION definition
    
    QUIC_VERSION_MINOR is never used.. Set QUIC_VERSION_MINOR to the same
    version as QUIC_VERSION_MAJOR to avoid breaking backwards compatibility,
    and fix the QUIC_VERSION macro.
    
    Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/common/quic.c b/common/quic.c
index 1760274..f91b23f 100644
--- a/common/quic.c
+++ b/common/quic.c
@@ -31,8 +31,8 @@
 /* ASCII "QUIC" */
 #define QUIC_MAGIC 0x43495551
 #define QUIC_VERSION_MAJOR 0U
-#define QUIC_VERSION_MINOR 1U
-#define QUIC_VERSION ((QUIC_VERSION_MAJOR << 16) | (QUIC_VERSION_MAJOR & 0xffff))
+#define QUIC_VERSION_MINOR 0U
+#define QUIC_VERSION ((QUIC_VERSION_MAJOR << 16) | (QUIC_VERSION_MINOR & 0xffff))
 
 typedef uint8_t BYTE;
 
commit e123f94939d5441f39383102e2af59088889fb96
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Thu Mar 14 15:00:21 2019 +0100

    test-marshallers: Fix header guard
    
    test-marshallers.h is missing a #define _H_TEST_MARSHALLERS in order to
    prevent multiple #include for the same header.
    
    Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/tests/test-marshallers.h b/tests/test-marshallers.h
index 4eab90f..7686067 100644
--- a/tests/test-marshallers.h
+++ b/tests/test-marshallers.h
@@ -1,6 +1,7 @@
-#include <stdint.h>
+#ifndef H_SPICE_COMMON_TEST_MARSHALLERS
+#define H_SPICE_COMMON_TEST_MARSHALLERS
 
-#ifndef _H_TEST_MARSHALLERS
+#include <stdint.h>
 
 typedef struct {
     uint32_t data_size;
@@ -26,5 +27,5 @@ typedef struct {
     uint8_t data[0];
 } SpiceMsgMainLenMessage;
 
-#endif /* _H_TEST_MARSHALLERS */
+#endif /* H_SPICE_COMMON_TEST_MARSHALLERS */
 
commit a294cad01cc11b0128657ce5929cfb9d9574a394
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Thu Mar 14 15:00:10 2019 +0100

    build: Update verify.h to latest version
    
    Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/common/verify.h b/common/verify.h
index 267de29..ecd8cdb 100644
--- a/common/verify.h
+++ b/common/verify.h
@@ -1,6 +1,6 @@
 /* Compile-time assert-like macros.
 
-   Copyright (C) 2005-2006, 2009-2016 Free Software Foundation, Inc.
+   Copyright (C) 2005-2006, 2009-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -13,7 +13,7 @@
    GNU Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
 
 /* Written by Paul Eggert, Bruno Haible, and Jim Meyering.  */
 
@@ -26,7 +26,7 @@
    here generates easier-to-read diagnostics when verify (R) fails.
 
    Define _GL_HAVE_STATIC_ASSERT to 1 if static_assert works as per C++11.
-   This will likely be supported by future GCC versions, in C++ mode.
+   This is supported by GCC 6.1.0 and later, in C++ mode.
 
    Use this only with GCC.  If we were willing to slow 'configure'
    down we could also use it with other compilers, but since this
@@ -36,9 +36,7 @@
      && !defined __cplusplus)
 # define _GL_HAVE__STATIC_ASSERT 1
 #endif
-/* The condition (99 < __GNUC__) is temporary, until we know about the
-   first G++ release that supports static_assert.  */
-#if (99 < __GNUC__) && defined __cplusplus
+#if (6 <= __GNUC__) && defined __cplusplus
 # define _GL_HAVE_STATIC_ASSERT 1
 #endif
 
@@ -248,7 +246,12 @@ template <int w>
 /* Verify requirement R at compile-time, as a declaration without a
    trailing ';'.  */
 
-#define verify(R) _GL_VERIFY (R, "verify (" #R ")")
+#ifdef __GNUC__
+# define verify(R) _GL_VERIFY (R, "verify (" #R ")")
+#else
+/* PGI barfs if R is long.  Play it safe.  */
+# define verify(R) _GL_VERIFY (R, "verify (...)")
+#endif
 
 #ifndef __has_builtin
 # define __has_builtin(x) 0
@@ -263,7 +266,7 @@ template <int w>
 # define assume(R) ((R) ? (void) 0 : __builtin_unreachable ())
 #elif 1200 <= _MSC_VER
 # define assume(R) __assume (R)
-#elif (defined lint \
+#elif ((defined GCC_LINT || defined lint) \
        && (__has_builtin (__builtin_trap) \
            || 3 < __GNUC__ + (3 < __GNUC_MINOR__ + (4 <= __GNUC_PATCHLEVEL__))))
   /* Doing it this way helps various packages when configured with
@@ -271,7 +274,8 @@ template <int w>
      when 'assume' silences warnings even with older GCCs.  */
 # define assume(R) ((R) ? (void) 0 : __builtin_trap ())
 #else
-# define assume(R) ((void) (0 && (R)))
+  /* Some tools grok NOTREACHED, e.g., Oracle Studio 12.6.  */
+# define assume(R) ((R) ? (void) 0 : /*NOTREACHED*/ (void) 0)
 #endif
 
 /* @assert.h omit end@  */
commit 5ef652b7e33b2c1fa37f15f7c3765536b541eaab
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Thu Mar 14 14:59:10 2019 +0100

    build: Add missing G_GNUC_PRINTF annotations
    
    They were suggested by gcc when using -Wsuggest-attribute=format
    
    Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/common/log.c b/common/log.c
index b73da71..ce162a1 100644
--- a/common/log.c
+++ b/common/log.c
@@ -33,6 +33,7 @@ SPICE_CONSTRUCTOR_FUNC(spice_log_init)
     recorder_dump_on_common_signals(0, 0);
 }
 
+G_GNUC_PRINTF(5, 0)
 static void spice_logv(const char *log_domain,
                        GLogLevelFlags log_level,
                        const char *strloc,
diff --git a/tests/test-logging.c b/tests/test-logging.c
index 6a79ca9..32b0c33 100644
--- a/tests/test-logging.c
+++ b/tests/test-logging.c
@@ -27,6 +27,7 @@
 
 #define OTHER_LOG_DOMAIN "Other"
 #define LOG_OTHER_HELPER(suffix, level)                                          \
+    G_GNUC_PRINTF(1, 2)                                                          \
     static void G_PASTE(other_, suffix)(const gchar *format, ...)                \
     {                                                                            \
         va_list args;                                                            \
commit 2f64e2edbb8e2f54cc12885b607844fa69d46774
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Thu Mar 14 14:28:38 2019 +0100

    lz: Don't try to print uninitialized variable
    
    encoder->type is only going to be set by lz_set_sizes() after the
    error() call. We can use 'type' directly which is what encoder->type is
    going to be set to.
    
    Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/common/lz.c b/common/lz.c
index 167e118..f92c638 100644
--- a/common/lz.c
+++ b/common/lz.c
@@ -616,7 +616,7 @@ void lz_decode_begin(LzContext *lz, uint8_t *io_ptr, unsigned int num_io_bytes,
 
     int type = decode_32(encoder);
     if (type <= LZ_IMAGE_TYPE_INVALID || type > LZ_IMAGE_TYPE_A8) {
-        encoder->usr->error(encoder->usr, "invalid lz type %d\n", encoder->type);
+        encoder->usr->error(encoder->usr, "invalid lz type %d\n", type);
     }
     int width = decode_32(encoder);
     int height = decode_32(encoder);
commit 187df0cfdbfad49ba5657ae9a0e38b0c9337efc6
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Thu Mar 14 14:28:23 2019 +0100

    backtrace: Add missing include
    
    This fixes a warning about missing prototype for backtrace()
    
    Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/common/backtrace.c b/common/backtrace.c
index c4edde1..ff72d1b 100644
--- a/common/backtrace.c
+++ b/common/backtrace.c
@@ -25,6 +25,8 @@
 #include <config.h>
 #endif
 
+#include "backtrace.h"
+
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
commit 79a9fad3a278470c3b71d1170c65bfb7f9313a25
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Fri Mar 15 16:34:34 2019 +0100

    canvas_base: Fix variable shadowing warning
    
    canvas_base.c is #included by spice-common users. They currently don't
    enable this warning, but if/when they do, we don't want code from
    spice-common to trigger it.
    
    Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/common/canvas_base.c b/common/canvas_base.c
index 9ffca3e..00a8801 100644
--- a/common/canvas_base.c
+++ b/common/canvas_base.c
@@ -1880,11 +1880,11 @@ static void canvas_clip_pixman(CanvasBase *canvas,
         uint32_t n = clip->rects->num_rects;
         SpiceRect *now = clip->rects->rects;
 
-        pixman_region32_t clip;
+        pixman_region32_t pixman_clip;
 
-        if (spice_pixman_region32_init_rects(&clip, now, n)) {
-            pixman_region32_intersect(dest_region, dest_region, &clip);
-            pixman_region32_fini(&clip);
+        if (spice_pixman_region32_init_rects(&pixman_clip, now, n)) {
+            pixman_region32_intersect(dest_region, dest_region, &pixman_clip);
+            pixman_region32_fini(&pixman_clip);
         }
 
         break;


More information about the Spice-commits mailing list