ut: fixed warnings in unit test's sources 89/158189/4
authorKonstantin Drabeniuk <k.drabeniuk@samsung.com>
Tue, 11 Oct 2016 08:12:45 +0000 (11:12 +0300)
committerSooChan Lim <sc1.lim@samsung.com>
Mon, 30 Oct 2017 09:47:24 +0000 (18:47 +0900)
Change-Id: I890ecf66c8951e24e885d5f06436e6e8697ebabe
Signed-off-by: Konstantin Drabeniuk <k.drabeniuk@samsung.com>
ut/Makefile.am
ut/src/stubs.h [deleted file]
ut/src/ut_tbm_bufmgr.cpp
ut/src/ut_tbm_bufmgr_backend.cpp
ut/src/ut_tbm_surface.cpp
ut/src/ut_tbm_surface_internal.cpp
ut/src/ut_tbm_surface_queue.cpp
ut/stubs/pthread_stubs.cpp [new file with mode: 0644]
ut/stubs/pthread_stubs.h
ut/stubs/tbm_bufmgr_stubs.h

index cfb7fa1b051b3bd7137a6b6e056393313d6b4131..9e24c9384c5550f733f8bc548eada20f79e6c0e5 100644 (file)
@@ -7,7 +7,8 @@ tbm_utests_SOURCES = \
        src/ut_tbm_surface.cpp \
        src/ut_tbm_surface_queue.cpp \
        src/ut_tbm_surface_internal.cpp \
-       stubs/stdlib_stubs.cpp
+       stubs/stdlib_stubs.cpp \
+       stubs/pthread_stubs.cpp
 
 tbm_utests_CXXFLAGS = \
        ${CXXFLAGS} \
@@ -18,6 +19,9 @@ tbm_utests_CXXFLAGS = \
        -I./gtest/googletest/include \
        -fpermissive \
        -w
+# The flag -w is used, because there are many warnings in libtbm's sources.
+# Warnings occur because we build project with g++.
+# In C++ we need to use explicit types conversion.
 
 tbm_utests_LDADD = \
        gtest/googletest/lib/.libs/libgtest.a
diff --git a/ut/src/stubs.h b/ut/src/stubs.h
deleted file mode 100644 (file)
index 15d59c4..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2016 Samsung Electronics co., Ltd. All Rights Reserved.
- *
- * Contact: Konstantin Drabeniuk <k.drabeniuk@samsung.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
-**************************************************************************/
-
-#ifndef _STUBS_H
-#define _STUBS_H
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "tbm_bufmgr_tgl.h"
-
-#define IOCTL_FD_ERROR_NONE 1
-#define IOCTL_FD_ERROR 2
-#define IOCTL_FD_GET 3
-
-FILE g_file;
-FILE g_error_file;
-int CALLOC_ERROR;
-int free_called;
-int DLOPEN_ERROR;
-
-int ut_fclose(FILE *stream)
-{
-       return 0;
-}
-
-FILE *ut_fopen(const char *filename, const char *mode)
-{
-       if (!filename || !mode)
-               return NULL;
-
-       if (!strcmp(filename, "/proc/111/cmdline"))
-               return NULL;
-
-       if (!strcmp(filename, "/proc/222/cmdline"))
-               return &g_error_file;
-
-       return &g_file;
-}
-
-char *ut_fgets(char *str, int num, FILE *stream)
-{
-       if (!str || num < 1 || !stream)
-               return NULL;
-
-       if (stream == &g_error_file)
-               return NULL;
-
-       strncpy(str, "application", 255);
-
-       return "application";
-}
-
-int pthread_mutex_unlock(pthread_mutex_t *mutex)
-{
-       return 0;
-}
-
-int dup2(int old_handle, int new_handle)
-{
-       if (old_handle == new_handle)
-               return -1;
-
-       return 0;
-}
-
-int dup(int handle)
-{
-       if (1 == handle)
-               return -1;
-
-       return 0;
-}
-
-int ioctl(int fd, unsigned long int request, ...)
-{
-       if (IOCTL_FD_ERROR == fd)
-               return 1;
-
-       if (IOCTL_FD_GET == fd) {
-               va_list argList;
-               va_start(argList, request);
-               struct tgl_user_data *arg = va_arg(argList, struct tgl_user_data *);
-               arg->data1 = 1;
-               arg->locked = 1;
-               va_end(argList);
-       }
-
-       return 0;
-}
-
-void *ut_calloc(size_t nmemb, size_t size)
-{
-       if (CALLOC_ERROR)
-               return NULL;
-
-       return calloc(nmemb, size);
-}
-
-void ut_free(void *ptr)
-{
-       free_called = 1;
-       free(ptr);
-}
-
-#endif /* _STUBS_H */
index 46bf065ebab664d3d313bc9e57260e4e51c60c78..78e07364c509a86ce72dcbb32907bec2b907b697 100644 (file)
@@ -261,7 +261,7 @@ TEST(tbm_bo_delete_user_data, work_flow_success_4)
        LIST_ADD(&bo.item_link, &bufmgr.bo_list);
        gBufMgr = &bufmgr;
        LIST_INITHEAD(&bo.user_data_list);
-       tbm_user_data *user_data = calloc(1, sizeof(tbm_user_data));
+       tbm_user_data *user_data = (tbm_user_data *)calloc(1, sizeof(tbm_user_data));
        user_data->data = &expected_data;
        user_data->key = key;
        user_data->free_func = NULL;
index f3b75c115bc96632e2cef314036782300b065a0d..cb0a78d59aeefe4bad748b88d247f3d8abd7b222 100644 (file)
@@ -205,7 +205,7 @@ TEST(tbm_backend_init, null_ptr_fail_1)
 
 TEST(tbm_backend_free, work_flow_success_1)
 {
-       tbm_bufmgr_backend backend = calloc(1, sizeof(*backend));
+       tbm_bufmgr_backend backend = (tbm_bufmgr_backend)calloc(1, sizeof(*backend));
 
        _init_test();
 
index df8e014e3cc786e5be8a7b2f32df82bb596a589c..cdc271beeed0576cf3ad900274b05c76e751d477 100644 (file)
@@ -46,7 +46,8 @@ static int ut_ret_height = 100;
 static int ut_ret_format = 10;
 
 static int
-ut_tbm_surface_internal_query_supported_formats(uint32_t **formats, uint32_t *num)
+ut_tbm_surface_internal_query_supported_formats(uint32_t __attribute__((unused)) **formats,
+                                                                                               uint32_t __attribute__((unused)) *num)
 {
        if (TBM_SURFACE_ERROR) {
                return 0;
@@ -56,8 +57,10 @@ ut_tbm_surface_internal_query_supported_formats(uint32_t **formats, uint32_t *nu
 }
 
 static tbm_surface_h
-ut_tbm_surface_internal_create_with_flags(int width, int height,
-                                          int format, int flags)
+ut_tbm_surface_internal_create_with_flags(int __attribute__((unused)) width,
+                                                                                 int __attribute__((unused)) height,
+                                                                                 int __attribute__((unused)) format,
+                                                                                 int __attribute__((unused))flags)
 {
        if (TBM_SURFACE_ERROR) {
                return NULL;
@@ -66,24 +69,16 @@ ut_tbm_surface_internal_create_with_flags(int width, int height,
        return &ut_ret_surface;
 }
 
-static int
-ut_tbm_surface_is_valid(tbm_surface_h surface)
-{
-       if (TBM_SURFACE_VALID_ERROR) {
-               return 0;
-       }
-
-       return 1;
-}
-
 static void
-ut_tbm_surface_internal_destroy(tbm_surface_h surface)
+ut_tbm_surface_internal_destroy(tbm_surface_h __attribute__((unused)) surface)
 {
 }
 
 static int
-ut_tbm_surface_internal_get_info(tbm_surface_h surface, int opt,
-                                 tbm_surface_info_s *info, int map)
+ut_tbm_surface_internal_get_info(tbm_surface_h __attribute__((unused)) surface,
+                                                                int __attribute__((unused)) opt,
+                                                                tbm_surface_info_s __attribute__((unused)) *info,
+                                                                int __attribute__((unused)) map)
 {
        if (TBM_SURFACE_ERROR) {
                return 0;
@@ -93,24 +88,24 @@ ut_tbm_surface_internal_get_info(tbm_surface_h surface, int opt,
 }
 
 static void
-ut_tbm_surface_internal_unmap(tbm_surface_h surface)
+ut_tbm_surface_internal_unmap(tbm_surface_h __attribute__((unused)) surface)
 {
 }
 
 static unsigned int
-ut_tbm_surface_internal_get_width(tbm_surface_h surface)
+ut_tbm_surface_internal_get_width(tbm_surface_h __attribute__((unused)) surface)
 {
        return ut_ret_width;
 }
 
 unsigned int
-ut_tbm_surface_internal_get_height(tbm_surface_h surface)
+ut_tbm_surface_internal_get_height(tbm_surface_h __attribute__((unused)) surface)
 {
        return ut_ret_height;
 }
 
 static tbm_format
-ut_tbm_surface_internal_get_format(tbm_surface_h surface)
+ut_tbm_surface_internal_get_format(tbm_surface_h __attribute__((unused)) surface)
 {
        return ut_ret_format;
 }
@@ -124,7 +119,6 @@ ut_tbm_surface_internal_get_format(tbm_surface_h surface)
        ut_tbm_surface_internal_query_supported_formats
 #define tbm_surface_internal_create_with_flags \
        ut_tbm_surface_internal_create_with_flags
-#define tbm_surface_internal_is_valid ut_tbm_surface_is_valid
 #define tbm_surface_internal_destroy ut_tbm_surface_internal_destroy
 #define tbm_surface_internal_get_info ut_tbm_surface_internal_get_info
 #define tbm_surface_internal_unmap ut_tbm_surface_internal_unmap
index 2d48a11cfd0f68afe89adc5bd9972a87e73dbe07..ec71a4df7f609a11ac1406487ea86a2911b11b10 100644 (file)
@@ -42,14 +42,15 @@ static struct _tbm_bufmgr ut_ret_bufmgr;
 static int ut_tbm_bo_unmap_count = 0;
 static int ut_tbm_data_free_called = 0;
 
-static tbm_bufmgr ut_tbm_bufmgr_init(int fd)
+static tbm_bufmgr ut_tbm_bufmgr_init(int __attribute__((unused)) fd)
 {
        return &ut_ret_bufmgr;
 }
 
-static void ut_tbm_bufmgr_deinit(tbm_bufmgr bufmgr) {}
+static void ut_tbm_bufmgr_deinit(tbm_bufmgr __attribute__((unused)) bufmgr) {}
 
-static int ut_surface_supported_format(uint32_t **formats, uint32_t *num)
+static int ut_surface_supported_format(uint32_t __attribute__((unused)) **formats,
+                                                                          uint32_t __attribute__((unused)) *num)
 {
        if (UT_TBM_SURFACE_INTERNAL_ERROR) {
                return 0;
@@ -58,18 +59,22 @@ static int ut_surface_supported_format(uint32_t **formats, uint32_t *num)
        return 1;
 }
 
-static tbm_bo_handle ut_tbm_bo_get_handle(tbm_bo bo, int device)
+static tbm_bo_handle ut_tbm_bo_get_handle(tbm_bo __attribute__((unused)) bo,
+                                                                                 int __attribute__((unused)) device)
 {
        tbm_bo_handle ut_ret_handle;
+
        return ut_ret_handle;
 }
 
-static int ut_tbm_bo_unmap(tbm_bo bo)
+static int ut_tbm_bo_unmap(tbm_bo __attribute__((unused)) bo)
 {
        ut_tbm_bo_unmap_count++;
+
+       return 0;
 }
 
-static void ut_tbm_data_free(void *user_data)
+static void ut_tbm_data_free(void __attribute__((unused)) *user_data)
 {
        ut_tbm_data_free_called = 1;
 }
@@ -120,7 +125,7 @@ TEST(tbm_surface_internal_delete_user_data, work_flow_success_4)
        LIST_ADD(&surface.item_link, &bufmgr.surf_list);
        LIST_INITHEAD(&surface.user_data_list);
 
-       tbm_user_data *old_data = calloc(1, sizeof(*old_data));
+       tbm_user_data *old_data = (tbm_user_data *)calloc(1, sizeof(*old_data));
        old_data->data = &data;
        old_data->free_func = ut_tbm_data_free;
        old_data->key = key;
@@ -1159,7 +1164,7 @@ TEST(tbm_surface_internal_get_num_bos, work_flow_success_1)
 
 TEST(tbm_surface_internal_unref, work_flow_success_2)
 {
-       tbm_surface_h surface = calloc(1, sizeof(*surface));
+       tbm_surface_h surface = (tbm_surface_h)calloc(1, sizeof(*surface));
        surface->refcnt = 1;
        struct _tbm_bufmgr bufmgr;
 
@@ -1221,7 +1226,7 @@ TEST(tbm_surface_internal_ref, work_flow_success_1)
 
 TEST(tbm_surface_internal_destroy, work_flow_success_2)
 {
-       tbm_surface_h surface = calloc(1, sizeof(*surface));
+       tbm_surface_h surface = (tbm_surface_h)calloc(1, sizeof(*surface));
        struct _tbm_bufmgr bufmgr;
 
        _init_test();
@@ -2816,7 +2821,7 @@ TEST(tbm_surface_internal_query_supported_formats, work_flow_success_3)
 {
        int ret = 0;
        int expecte_ret = 1;
-       uint32_t *formats, num;
+       uint32_t *formats, num = 0;
        struct _tbm_bufmgr bufmgr;
        struct _tbm_bufmgr_backend backend;
 
@@ -2827,7 +2832,7 @@ TEST(tbm_surface_internal_query_supported_formats, work_flow_success_3)
        ut_ret_bufmgr.backend = &backend;
        backend.surface_supported_format = ut_surface_supported_format;
 
-       ret = tbm_surface_internal_query_supported_formats(&formats, num);
+       ret = tbm_surface_internal_query_supported_formats(&formats, &num);
 
        ASSERT_EQ(ret, expecte_ret);
 }
@@ -2836,7 +2841,7 @@ TEST(tbm_surface_internal_query_supported_formats, work_flow_success_2)
 {
        int ret = 0;
        int expecte_ret = 0;
-       uint32_t *formats, num;
+       uint32_t *formats, num = 0;
        struct _tbm_bufmgr bufmgr;
        struct _tbm_bufmgr_backend backend;
 
@@ -2848,7 +2853,7 @@ TEST(tbm_surface_internal_query_supported_formats, work_flow_success_2)
        backend.surface_supported_format = ut_surface_supported_format;
        UT_TBM_SURFACE_INTERNAL_ERROR = 1;
 
-       ret = tbm_surface_internal_query_supported_formats(&formats, num);
+       ret = tbm_surface_internal_query_supported_formats(&formats, &num);
 
        ASSERT_EQ(ret, expecte_ret);
 }
@@ -2857,7 +2862,7 @@ TEST(tbm_surface_internal_query_supported_formats, work_flow_success_1)
 {
        int ret = 0;
        int expecte_ret = 0;
-       uint32_t *formats, num;
+       uint32_t *formats, num = 0;
        struct _tbm_bufmgr bufmgr;
        struct _tbm_bufmgr_backend backend;
 
@@ -2868,7 +2873,7 @@ TEST(tbm_surface_internal_query_supported_formats, work_flow_success_1)
        ut_ret_bufmgr.backend = &backend;
        backend.surface_supported_format = NULL;
 
-       ret = tbm_surface_internal_query_supported_formats(&formats, num);
+       ret = tbm_surface_internal_query_supported_formats(&formats, &num);
 
        ASSERT_EQ(ret, expecte_ret);
 }
index 95fb461902d46503de1537dc70022fd62c2d769d..04711b555ef7a6c214e61d440d91c5b0bbecde76 100644 (file)
@@ -46,25 +46,38 @@ typedef struct _tbm_surface tbm_surface_s;
 
 /* HELPER FUNCTIONS */
 
-static void ut_tbm_surface_queue_notify_cb(tbm_surface_queue_h surface_queue,
-                                                                                  void *data) {}
+static void
+ut_tbm_surface_queue_notify_cb(tbm_surface_queue_h __attribute__((unused)) surface_queue,
+                                                          void __attribute__((unused)) *data) {}
 
-static tbm_surface_h ut_tbm_surface_alloc_cb(tbm_surface_queue_h surface_queue,
-                                                                                        void *data) {}
+static tbm_surface_h
+ut_tbm_surface_alloc_cb(tbm_surface_queue_h __attribute__((unused)) surface_queue,
+                                               void __attribute__((unused)) *data)
+{
+       return NULL;
+}
 
-static void ut_tbm_surface_free_cb(tbm_surface_queue_h surface_queue,
-                                                                  void *data, tbm_surface_h surface) {}
+static void
+ut_tbm_surface_free_cb(tbm_surface_queue_h __attribute__((unused)) surface_queue,
+                                          void __attribute__((unused)) *data,
+                                          tbm_surface_h __attribute__((unused)) surface) {}
 
-static void ut_enqueue(tbm_surface_queue_h queue, queue_node *node) {}
+static void
+ut_enqueue(tbm_surface_queue_h __attribute__((unused)) queue,
+                  queue_node __attribute__((unused)) *node) {}
 
-static queue_node *ut_dequeue(tbm_surface_queue_h queue)
+static queue_node *
+ut_dequeue(tbm_surface_queue_h __attribute__((unused)) queue)
 {
        return NULL;
 }
 
-static void ut_release(tbm_surface_queue_h queue, queue_node *node) {}
+static void
+ut_release(tbm_surface_queue_h __attribute__((unused)) queue,
+                  queue_node __attribute__((unused)) *node) {}
 
-static queue_node *ut_acquire(tbm_surface_queue_h queue)
+static queue_node *
+ut_acquire(tbm_surface_queue_h __attribute__((unused)) queue)
 {
        return NULL;
 }
@@ -424,7 +437,7 @@ TEST(tbm_surface_queue_reset, null_ptr_fail_1)
 
 TEST(tbm_surface_queue_destroy, work_flow_success_1)
 {
-       tbm_surface_queue_h surface_queue = calloc(1, sizeof(*surface_queue));
+       tbm_surface_queue_h surface_queue;
        queue_notify *destory_item1;
        queue_notify *destory_item2;
        queue_notify *acquirable_item1;
@@ -434,17 +447,19 @@ TEST(tbm_surface_queue_destroy, work_flow_success_1)
        queue_notify *reset_item1;
        queue_notify *reset_item2;
 
+       surface_queue = (tbm_surface_queue_h)calloc(1, sizeof(*surface_queue));
+
        _init_test();
 
        surface_queue->impl = NULL;
-       destory_item1 = calloc(1, sizeof(*destory_item1));
-       destory_item2 = calloc(1, sizeof(*destory_item2));
-       acquirable_item1 = calloc(1, sizeof(*acquirable_item1));
-       acquirable_item2 = calloc(1, sizeof(*acquirable_item2));
-       dequeuable_item1 = calloc(1, sizeof(*dequeuable_item1));
-       dequeuable_item2 = calloc(1, sizeof(*dequeuable_item2));
-       reset_item1 = calloc(1, sizeof(*reset_item1));
-       reset_item2 = calloc(1, sizeof(*reset_item2));
+       destory_item1 = (queue_notify *)calloc(1, sizeof(*destory_item1));
+       destory_item2 = (queue_notify *)calloc(1, sizeof(*destory_item2));
+       acquirable_item1 = (queue_notify *)calloc(1, sizeof(*acquirable_item1));
+       acquirable_item2 = (queue_notify *)calloc(1, sizeof(*acquirable_item2));
+       dequeuable_item1 = (queue_notify *)calloc(1, sizeof(*dequeuable_item1));
+       dequeuable_item2 = (queue_notify *)calloc(1, sizeof(*dequeuable_item2));
+       reset_item1 = (queue_notify *)calloc(1, sizeof(*reset_item1));
+       reset_item2 = (queue_notify *)calloc(1, sizeof(*reset_item2));
        destory_item1->cb = ut_tbm_surface_queue_notify_cb;
        destory_item2->cb = ut_tbm_surface_queue_notify_cb;
        LIST_INITHEAD(&surface_queue->destory_noti);
@@ -1161,7 +1176,7 @@ TEST(tbm_surface_queue_add_reset_cb, work_flow_success_1)
                        TBM_SURFACE_QUEUE_ERROR_NONE;
        tbm_surface_queue_s surface;
        int data;
-       queue_notify *item;
+       queue_notify *item = NULL;
        queue_notify *tmp;
 
        _init_test();
@@ -1410,7 +1425,7 @@ TEST(tbm_surface_queue_add_acquirable_cb, work_flow_success_1)
                        TBM_SURFACE_QUEUE_ERROR_NONE;
        tbm_surface_queue_s surface;
        int data;
-       queue_notify *item;
+       queue_notify *item = NULL;
        queue_notify *tmp;
        tbm_surface_queue_notify_cb cb;
        tbm_surface_queue_notify_cb expected_cb;
@@ -1514,7 +1529,7 @@ TEST(tbm_surface_queue_add_dequeuable_cb, work_flow_success_1)
                        TBM_SURFACE_QUEUE_ERROR_NONE;
        tbm_surface_queue_s surface;
        int data;
-       queue_notify *item;
+       queue_notify *item = NULL;
        queue_notify *tmp;
 
        _init_test();
@@ -1616,8 +1631,8 @@ TEST(tbm_surface_queue_add_destroy_cb, work_flow_success_1)
                        TBM_SURFACE_QUEUE_ERROR_NONE;
        tbm_surface_queue_s surface;
        int data;
-       queue_notify *item;
-       queue_notify *tmp;
+       queue_notify *item = NULL;
+       queue_notify *tmp = NULL;
        tbm_surface_queue_notify_cb cb;
        tbm_surface_queue_notify_cb expected_cb;
 
diff --git a/ut/stubs/pthread_stubs.cpp b/ut/stubs/pthread_stubs.cpp
new file mode 100644 (file)
index 0000000..2a203f2
--- /dev/null
@@ -0,0 +1,65 @@
+/**************************************************************************
+ *
+ * Copyright 2016 Samsung Electronics co., Ltd. All Rights Reserved.
+ *
+ * Contact: Konstantin Drabeniuk <k.drabeniuk@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+**************************************************************************/
+#include "pthread_stubs.h"
+
+int PTHREAD_MUTEX_INIT_ERROR;
+
+int
+ut_pthread_mutex_lock(pthread_mutex_t __attribute__((unused)) *mutex)
+{
+       return 0;
+}
+
+int
+ut_pthread_mutex_unlock(pthread_mutex_t __attribute__((unused)) *mutex)
+{
+       return 0;
+}
+
+int
+ut_pthread_mutex_init(pthread_mutex_t __attribute__((unused)) *mutex,
+                                         const pthread_mutexattr_t __attribute__((unused)) *mutexattr)
+{
+       if (PTHREAD_MUTEX_INIT_ERROR)
+               return PTHREAD_MUTEX_INIT_ERROR;
+
+       return 0;
+}
+
+int
+ut_pthread_cond_signal(pthread_cond_t __attribute__((unused)) *cond)
+{
+       return 0;
+}
+
+int
+ut_pthread_cond_wait(pthread_cond_t __attribute__((unused)) *cond,
+                                        pthread_mutex_t __attribute__((unused)) *mutex)
+{
+       return 0;
+}
index 3767162e3040b313fe043eb1ac85f9f58f87e095..53adbb1a896f56be84cbf357d99648293dae3bea 100644 (file)
 #include <pthread.h>
 #include <stdio.h>
 
-static int PTHREAD_MUTEX_INIT_ERROR;
+extern int PTHREAD_MUTEX_INIT_ERROR;
 
-static int ut_pthread_mutex_lock(pthread_mutex_t * __mutex) {}
+int ut_pthread_mutex_lock(pthread_mutex_t *mutex);
 
-static int ut_pthread_mutex_unlock(pthread_mutex_t * __mutex) {}
+int ut_pthread_mutex_unlock(pthread_mutex_t *mutex);
 
-static int ut_pthread_mutex_init(pthread_mutex_t * __mutex,
-                                                                const pthread_mutexattr_t * __mutexattr)
-{
-       if (PTHREAD_MUTEX_INIT_ERROR)
-               return PTHREAD_MUTEX_INIT_ERROR;
+int ut_pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *mutexattr);
 
-       return 0;
-}
+int ut_pthread_cond_signal(pthread_cond_t *cond);
 
-static int ut_pthread_cond_signal(pthread_cond_t *cond) {}
-
-static int ut_pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) {}
+int ut_pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex);
 
 #endif /* _PTHREAD_STUBS_H */
index 4c1012e9c34efd0ea715bf16b106982cea974c69..06a3a202d3a4fd17eaa50bcd990c47770086da15 100644 (file)
 
 static int bo_size = 100;
 static int bo2_size = 100;
-static void *ret_bo = "bo_alloc";
+static void *ret_bo = (void *)"bo_alloc";
 static int UT_TBM_ERROR = 0;
 static int TBM_BO_ALLOC_ERROR = 0;
 static int TBM_BO_IMPORT_ERROR = 0;
 static int bo_ret_flags = TBM_BO_SCANOUT;
 
-static int ut_bo_size(tbm_bo bo)
+static int ut_bo_size(tbm_bo __attribute__ ((unused)) bo)
 {
        return bo_size;
 }
 
-static int ut_bo2_size(tbm_bo bo)
+static int ut_bo2_size(tbm_bo __attribute__ ((unused)) bo)
 {
        return bo2_size;
 }
 
-static void *ut_bo_alloc(tbm_bo bo, int size, int flags)
+static void *ut_bo_alloc(tbm_bo __attribute__ ((unused)) bo,
+                                                int __attribute__ ((unused)) size,
+                                                int __attribute__ ((unused)) flags)
 {
        if (TBM_BO_ALLOC_ERROR)
                return NULL;
@@ -59,7 +61,8 @@ static void *ut_bo_alloc(tbm_bo bo, int size, int flags)
        return ret_bo;
 }
 
-static void *ut_bo_import(tbm_bo bo, unsigned int key)
+static void *ut_bo_import(tbm_bo __attribute__ ((unused)) bo,
+                                                 unsigned int __attribute__ ((unused)) key)
 {
        if (TBM_BO_IMPORT_ERROR)
                return NULL;
@@ -67,12 +70,13 @@ static void *ut_bo_import(tbm_bo bo, unsigned int key)
        return ret_bo;
 }
 
-static int ut_bo_get_flags(tbm_bo bo)
+static int ut_bo_get_flags(tbm_bo __attribute__ ((unused)) bo)
 {
        return bo_ret_flags;
 }
 
-static void *ut_bo_import_fd(tbm_bo bo, tbm_fd fd)
+static void *ut_bo_import_fd(tbm_bo __attribute__ ((unused)) bo,
+                                                        tbm_fd __attribute__ ((unused)) fd)
 {
        if (TBM_BO_IMPORT_ERROR)
                return NULL;
@@ -80,7 +84,7 @@ static void *ut_bo_import_fd(tbm_bo bo, tbm_fd fd)
        return ret_bo;
 }
 
-static unsigned int ut_bo_export(tbm_bo bo)
+static unsigned int ut_bo_export(tbm_bo __attribute__ ((unused)) bo)
 {
        if (UT_TBM_ERROR)
                return 0;
@@ -88,7 +92,7 @@ static unsigned int ut_bo_export(tbm_bo bo)
        return 1;
 }
 
-static tbm_fd ut_bo_export_fd(tbm_bo bo)
+static tbm_fd ut_bo_export_fd(tbm_bo __attribute__ ((unused)) bo)
 {
        if (UT_TBM_ERROR)
                return -1;
@@ -96,7 +100,8 @@ static tbm_fd ut_bo_export_fd(tbm_bo bo)
        return 1;
 }
 
-static tbm_bo_handle ut_bo_get_handle(tbm_bo bo, int device)
+static tbm_bo_handle ut_bo_get_handle(tbm_bo __attribute__ ((unused)) bo,
+                                                                         int __attribute__ ((unused)) device)
 {
        tbm_bo_handle ret;
 
@@ -108,7 +113,9 @@ static tbm_bo_handle ut_bo_get_handle(tbm_bo bo, int device)
        return ret;
 }
 
-static tbm_bo_handle ut_bo_map(tbm_bo bo, int device, int opt)
+static tbm_bo_handle ut_bo_map(tbm_bo __attribute__ ((unused)) bo,
+                                                          int __attribute__ ((unused)) device,
+                                                          int __attribute__ ((unused)) opt)
 {
        tbm_bo_handle ret;
 
@@ -120,7 +127,7 @@ static tbm_bo_handle ut_bo_map(tbm_bo bo, int device, int opt)
        return ret;
 }
 
-static int ut_bo_unmap(tbm_bo bo)
+static int ut_bo_unmap(tbm_bo __attribute__ ((unused)) bo)
 {
        if (UT_TBM_ERROR)
                return 0;
@@ -128,9 +135,10 @@ static int ut_bo_unmap(tbm_bo bo)
        return 1;
 }
 
-static void ut_tbm_data_free(void *user_data) {}
+static void ut_tbm_data_free(void __attribute__ ((unused)) *user_data) {}
 
-static int ut_bufmgr_bind_native_display(tbm_bufmgr bufmgr, void *NativeDisplay)
+static int ut_bufmgr_bind_native_display(tbm_bufmgr __attribute__ ((unused)) bufmgr,
+                                                                                void __attribute__ ((unused)) *NativeDisplay)
 {
        if (UT_TBM_ERROR)
                return 0;