qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject qpid-proton git commit: PROTON-1472: Fix compile errors on Ubuntu
Date Wed, 03 May 2017 03:48:50 GMT
Repository: qpid-proton
Updated Branches:
  refs/heads/master 4cf619cf5 -> f8997c083


PROTON-1472: Fix compile errors on Ubuntu


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/f8997c08
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/f8997c08
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/f8997c08

Branch: refs/heads/master
Commit: f8997c083c1120c5971c71a6809371b1b9d6d9c9
Parents: 4cf619c
Author: Alan Conway <aconway@redhat.com>
Authored: Tue May 2 23:27:56 2017 -0400
Committer: Alan Conway <aconway@redhat.com>
Committed: Tue May 2 23:41:13 2017 -0400

----------------------------------------------------------------------
 examples/c/proactor/CMakeLists.txt  |  2 +-
 examples/c/proactor/broker.c        |  4 ++--
 proton-c/CMakeLists.txt             | 10 +++-------
 proton-c/src/proactor/epoll.c       |  3 +++
 proton-c/src/proactor/libuv.c       |  3 +++
 tools/cmake/Modules/FindLibuv.cmake | 17 +++++++++++++----
 6 files changed, 25 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/f8997c08/examples/c/proactor/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/c/proactor/CMakeLists.txt b/examples/c/proactor/CMakeLists.txt
index c87cb21..9759a7c 100644
--- a/examples/c/proactor/CMakeLists.txt
+++ b/examples/c/proactor/CMakeLists.txt
@@ -23,7 +23,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${Proton_INCLUDE_DIRS})
 
 if(HAS_PROACTOR)
 
-add_definitions(${COMPILE_WARNING_FLAGS} ${WERROR} ${COMPILE_PLATFORM_FLAGS} ${LINK_TIME_OPTIMIZATION})
+add_definitions(${COMPILE_LANGUAGE_FLAGS} ${COMPILE_WARNING_FLAGS} ${WERROR} ${COMPILE_PLATFORM_FLAGS}
${LINK_TIME_OPTIMIZATION})
 
 # Add a test with the correct environment to find test executables and valgrind.
 if(WIN32)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/f8997c08/examples/c/proactor/broker.c
----------------------------------------------------------------------
diff --git a/examples/c/proactor/broker.c b/examples/c/proactor/broker.c
index 05c5552..7d95e7f 100644
--- a/examples/c/proactor/broker.c
+++ b/examples/c/proactor/broker.c
@@ -61,7 +61,7 @@
 /* Simple thread-safe queue implementation */
 typedef struct queue_t {
   pthread_mutex_t lock;
-  char* name;
+  char name[256];
   VEC(pn_rwbytes_t) messages;   /* Messages on the queue_t */
   VEC(pn_connection_t*) waiting; /* Connections waiting to send messages from this queue
*/
   struct queue_t *next;            /* Next queue in chain */
@@ -70,7 +70,7 @@ typedef struct queue_t {
 
 static void queue_init(queue_t *q, const char* name, queue_t *next) {
   pthread_mutex_init(&q->lock, NULL);
-  q->name = strdup(name);
+  strncpy(q->name, name, sizeof(q->name));
   VEC_INIT(q->messages);
   VEC_INIT(q->waiting);
   q->next = next;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/f8997c08/proton-c/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/CMakeLists.txt b/proton-c/CMakeLists.txt
index c5b65d7..4bc7666 100644
--- a/proton-c/CMakeLists.txt
+++ b/proton-c/CMakeLists.txt
@@ -322,9 +322,6 @@ set (qpid-proton-platform-all
   src/reactor/io/windows/selector.c
   src/reactor/io/posix/io.c
   src/reactor/io/posix/selector.c
-  src/proactor/libuv.c
-  src/proactor/epoll.c
-  src/proactor/proactor.c
   )
 
 # platform specific library build:
@@ -493,9 +490,8 @@ if (PROACTOR STREQUAL "epoll") # OR (NOT PROACTOR AND NOT PROACTOR_OK))
     set (PROACTOR_OK epoll)
     set (qpid-proton-proactor src/proactor/epoll.c src/proactor/proactor.c)
     set (PROACTOR_LIBS "")
-    # Skip COMPILE_LANGUAGE_FLAGS, uses post-c99 pthread APIs.
     set_source_files_properties (${qpid-proton-proactor} PROPERTIES
-      COMPILE_FLAGS "${COMPILE_WARNING_FLAGS} ${LTO}"
+      COMPILE_FLAGS "${COMPILE_WARNING_FLAGS} ${COMPILE_LANGUAGE_FLAGS} ${LTO}"
       )
   endif()
 endif()
@@ -507,9 +503,9 @@ if (PROACTOR STREQUAL "libuv" OR (NOT PROACTOR AND NOT PROACTOR_OK))
     set (qpid-proton-proactor src/proactor/libuv.c src/proactor/proactor.c)
     set (PROACTOR_LIBS ${Libuv_LIBRARIES})
     set_source_files_properties (${qpid-proton-proactor} PROPERTIES
-      # Skip COMPILE_LANGUAGE_FLAGS, libuv.h won't compile with --std=c99
-      COMPILE_FLAGS "${COMPILE_WARNING_FLAGS} ${LTO} "
+      COMPILE_FLAGS "${COMPILE_WARNING_FLAGS} ${COMPILE_LANGUAGE_FLAGS} ${LTO}"
       )
+    include_directories(${Libuv_INCLUDE_DIRS})
   endif()
 endif()
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/f8997c08/proton-c/src/proactor/epoll.c
----------------------------------------------------------------------
diff --git a/proton-c/src/proactor/epoll.c b/proton-c/src/proactor/epoll.c
index 72fcac7..0f09c7c 100644
--- a/proton-c/src/proactor/epoll.c
+++ b/proton-c/src/proactor/epoll.c
@@ -19,6 +19,9 @@
  *
  */
 
+/* Enable POSIX features for pthread.h */
+#define _POSIX_C_SOURCE 200809L
+
 #include "../core/log_private.h"
 #include "proactor-internal.h"
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/f8997c08/proton-c/src/proactor/libuv.c
----------------------------------------------------------------------
diff --git a/proton-c/src/proactor/libuv.c b/proton-c/src/proactor/libuv.c
index dce6dba..2c1f835 100644
--- a/proton-c/src/proactor/libuv.c
+++ b/proton-c/src/proactor/libuv.c
@@ -19,6 +19,9 @@
  *
  */
 
+/* Enable POSIX features for uv.h */
+#define _POSIX_C_SOURCE 200809L
+
 #include "../core/log_private.h"
 #include "proactor-internal.h"
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/f8997c08/tools/cmake/Modules/FindLibuv.cmake
----------------------------------------------------------------------
diff --git a/tools/cmake/Modules/FindLibuv.cmake b/tools/cmake/Modules/FindLibuv.cmake
index 048025d..1cefe36 100644
--- a/tools/cmake/Modules/FindLibuv.cmake
+++ b/tools/cmake/Modules/FindLibuv.cmake
@@ -21,7 +21,7 @@
 #
 # Sets the following variables:
 #
-#   Libuv_FOUND            - True if headers and requested libraries were found
+#   LIBUV_FOUND            - True if headers and requested libraries were found
 #   Libuv_INCLUDE_DIRS     - Libuv include directories
 #   Libuv_LIBRARIES        - Link these to use libuv.
 #
@@ -30,8 +30,17 @@
 #   LIBUV_INCLUDEDIR       - Preferred include directory e.g. <prefix>/include
 #   LIBUV_LIBRARYDIR       - Preferred library directory e.g. <prefix>/lib
 
-find_library(Libuv_LIBRARIES Names uv libuv HINTS ${LIBUV_LIBRARYDIR} ${LIBUV_ROOT})
-find_path(Libuv_INCLUDE_DIRS NAMES uv.h HINTS ${LIBUV_INCLUDEDIR} ${LIBUV_ROOT} ${LIBUV_ROOT}/include
${CMAKE_INSTALL_PREFIX}/include PATHS /usr/include)
+find_library(Libuv_LIBRARY NAMES uv libuv
+  HINTS ${LIBUV_LIBRARYDIR} ${LIBUV_ROOT}/lib ${CMAKE_INSTALL_PREFIX}/lib)
+
+find_path(Libuv_INCLUDE_DIR NAMES uv.h
+  HINTS ${LIBUV_INCLUDEDIR} ${LIBUV_ROOT}/include ${CMAKE_INSTALL_PREFIX}/include
+  PATHS /usr/include)
 
 include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(Libuv REQUIRED_VARS Libuv_LIBRARIES Libuv_INCLUDE_DIRS)
+find_package_handle_standard_args(Libuv REQUIRED_VARS Libuv_LIBRARY Libuv_INCLUDE_DIR)
+
+if (LIBUV_FOUND)
+  set(Libuv_INCLUDE_DIRS ${Libuv_INCLUDE_DIR})
+  set(Libuv_LIBRARIES ${Libuv_LIBRARY})
+endif ()


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message