You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by cl...@apache.org on 2017/07/01 01:07:22 UTC

[3/3] qpid-proton git commit: PROTON-1349: partial implementation that compiles but does not yet pass tests. Added so that C++ proactor changes could be checked in.

PROTON-1349: partial implementation that compiles but does not yet pass tests.
Added so that C++ proactor changes could be checked in.


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

Branch: refs/heads/master
Commit: e1c3cd0315513f5a58d1aefbc9878cead62a7441
Parents: 0822dd9
Author: Clifford Jansen <cl...@apache.org>
Authored: Fri Jun 30 18:05:55 2017 -0700
Committer: Clifford Jansen <cl...@apache.org>
Committed: Fri Jun 30 18:05:55 2017 -0700

----------------------------------------------------------------------
 examples/c/CMakeLists.txt                 |    6 +-
 proton-c/CMakeLists.txt                   |   16 +-
 proton-c/src/compiler/msvc/snprintf.c     |    4 +
 proton-c/src/proactor/proactor-internal.c |    6 +
 proton-c/src/proactor/win_iocp.c          | 3289 ++++++++++++++++++++++++
 proton-c/src/tests/CMakeLists.txt         |   10 +-
 proton-c/src/tests/proactor.c             |   21 +-
 7 files changed, 3344 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e1c3cd03/examples/c/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/c/CMakeLists.txt b/examples/c/CMakeLists.txt
index c78e04c..12867be 100644
--- a/examples/c/CMakeLists.txt
+++ b/examples/c/CMakeLists.txt
@@ -22,7 +22,11 @@ include(CheckCCompilerFlag)
 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
 
 if(Proton_Proactor_FOUND)
-  add_subdirectory(proactor)
+  if(WIN32)
+    message(STATUS "Windows IOCP proactor examples temporarily disabled for build")
+  else(WIN32)
+    add_subdirectory(proactor)
+  endif(WIN32)
 endif()
 add_subdirectory(messenger)
 add_subdirectory(reactor)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e1c3cd03/proton-c/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/CMakeLists.txt b/proton-c/CMakeLists.txt
index 612da1c..054a054 100644
--- a/proton-c/CMakeLists.txt
+++ b/proton-c/CMakeLists.txt
@@ -482,7 +482,7 @@ set (qpid-proton-include-extra
 # The default is the first one that passes its build test, in order listed below.
 # "none" disables the proactor even if a default is available.
 #
-set(PROACTOR "" CACHE STRING "Override default proactor, one of: epoll, libuv, none")
+set(PROACTOR "" CACHE STRING "Override default proactor, one of: epoll, libuv, iocp, none")
 string(TOLOWER "${PROACTOR}" PROACTOR)
 
 if (PROACTOR STREQUAL "epoll" OR (NOT PROACTOR AND NOT BUILD_PROACTOR))
@@ -497,6 +497,18 @@ if (PROACTOR STREQUAL "epoll" OR (NOT PROACTOR AND NOT BUILD_PROACTOR))
   endif()
 endif()
 
+if (PROACTOR STREQUAL "iocp" OR (NOT PROACTOR AND NOT PROACTOR_OK))
+  if(WIN32 AND NOT CYGWIN)
+    message(WARNING "Windows IOCP proactor will be built as a prototype but does not yet pass tests")
+    set (PROACTOR_OK iocp)
+    set (qpid-proton-proactor src/proactor/win_iocp.c src/proactor/proactor-internal.c)
+    set_source_files_properties (${qpid-proton-proactor} PROPERTIES
+      COMPILE_FLAGS "${COMPILE_WARNING_FLAGS} ${COMPILE_PLATFORM_FLAGS} ${LTO}"
+      COMPILE_DEFINITIONS "${PLATFORM_DEFINITIONS}"
+      )
+  endif(WIN32 AND NOT CYGWIN)
+endif()
+
 if (PROACTOR STREQUAL "libuv" OR (NOT PROACTOR AND NOT PROACTOR_OK))
   find_package(Libuv)
   if (LIBUV_FOUND)
@@ -617,7 +629,7 @@ if (qpid-proton-proactor)
   add_library (
     qpid-proton-proactor SHARED ${qpid-proton-proactor})
   target_link_libraries (qpid-proton-proactor  LINK_PUBLIC qpid-proton-core)
-  target_link_libraries (qpid-proton-proactor  LINK_PRIVATE ${PROACTOR_LIBS})
+  target_link_libraries (qpid-proton-proactor  LINK_PRIVATE ${PLATFORM_LIBS} ${PROACTOR_LIBS})
   list(APPEND LIB_TARGETS qpid-proton-proactor)
   set_target_properties (
     qpid-proton-proactor

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e1c3cd03/proton-c/src/compiler/msvc/snprintf.c
----------------------------------------------------------------------
diff --git a/proton-c/src/compiler/msvc/snprintf.c b/proton-c/src/compiler/msvc/snprintf.c
index f9c14eb..49a853c 100644
--- a/proton-c/src/compiler/msvc/snprintf.c
+++ b/proton-c/src/compiler/msvc/snprintf.c
@@ -25,6 +25,10 @@
 #include <stdio.h>
 
 // [v]snprintf on Windows only matches C99 when no errors or overflow.
+// Note: [v]snprintf behavior changed in VS2015 to be C99 compliant.
+// vsnprintf_s is unchanged.  This platform code can go away some day.
+
+
 int pni_vsnprintf(char *buf, size_t count, const char *fmt, va_list ap) {
   if (fmt == NULL)
     return -1;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e1c3cd03/proton-c/src/proactor/proactor-internal.c
----------------------------------------------------------------------
diff --git a/proton-c/src/proactor/proactor-internal.c b/proton-c/src/proactor/proactor-internal.c
index 0c82573..d870e77 100644
--- a/proton-c/src/proactor/proactor-internal.c
+++ b/proton-c/src/proactor/proactor-internal.c
@@ -36,9 +36,15 @@ static const char *AMQPS_PORT_NAME = "amqps";
 
 const char *PNI_IO_CONDITION = "proton:io";
 
+#ifndef _WIN32
+/*
+ * Common implementation for C99-friendly compilers.  Windows is
+ * not and implements its own.
+ */
 int pn_proactor_addr(char *buf, size_t len, const char *host, const char *port) {
   return snprintf(buf, len, "%s:%s", host ? host : "", port ? port : "");
 }
+#endif
 
 int pni_parse_addr(const char *addr, char *buf, size_t len, const char **host, const char **port)
 {


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