You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2020/07/10 21:35:00 UTC

[qpid-proton] branch master updated (7075502 -> f909e79)

This is an automated email from the ASF dual-hosted git repository.

astitcher pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git.


    from 7075502  PROTON-2077 Remove pni_snprintf; not needed with Visual Studio 2015 and up
     new 9c1ab44  PROTON-2208: Remove ability to compile proton-c as C++ - No longer needed with windows minimum VS2015 as it supports sufficient C99   to compile proton-c as C.
     new f909e79  PROTON-2207/PROTON-2208: Remove vestiges of compiling with pre C99 compilers - Including a long unused internal replacement for atoll

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 CMakeLists.txt                               | 22 ++--------
 c/CMakeLists.txt                             | 43 ++----------------
 c/src/platform/platform.c                    | 14 ------
 c/src/platform/platform.h                    |  9 ----
 c/tests/fuzz/CMakeLists.txt                  |  9 ----
 c/tools/CMakeLists.txt                       |  4 --
 tools/cmake/Modules/WindowsC99CheckDef.cmake | 35 ---------------
 tools/cmake/Modules/WindowsC99SymbolCheck.py | 66 ----------------------------
 8 files changed, 6 insertions(+), 196 deletions(-)
 delete mode 100644 tools/cmake/Modules/WindowsC99CheckDef.cmake
 delete mode 100644 tools/cmake/Modules/WindowsC99SymbolCheck.py


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


[qpid-proton] 02/02: PROTON-2207/PROTON-2208: Remove vestiges of compiling with pre C99 compilers - Including a long unused internal replacement for atoll

Posted by as...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

astitcher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git

commit f909e79ed1f864bf24ed4a1e126607e535170bdd
Author: Andrew Stitcher <as...@apache.org>
AuthorDate: Fri Jul 10 17:32:39 2020 -0400

    PROTON-2207/PROTON-2208: Remove vestiges of compiling with pre C99 compilers
    - Including a long unused internal replacement for atoll
---
 c/CMakeLists.txt                             | 31 ++-----------
 c/src/platform/platform.c                    | 14 ------
 c/src/platform/platform.h                    |  9 ----
 tools/cmake/Modules/WindowsC99CheckDef.cmake | 35 ---------------
 tools/cmake/Modules/WindowsC99SymbolCheck.py | 66 ----------------------------
 5 files changed, 3 insertions(+), 152 deletions(-)

diff --git a/c/CMakeLists.txt b/c/CMakeLists.txt
index bb1d480..797f25d 100644
--- a/c/CMakeLists.txt
+++ b/c/CMakeLists.txt
@@ -160,18 +160,6 @@ else (PN_WINAPI)
   endif (STRERROR_R_IN_LIBC)
 endif (PN_WINAPI)
 
-CHECK_SYMBOL_EXISTS(atoll "stdlib.h" C99_ATOLL)
-if (C99_ATOLL)
-  list(APPEND PLATFORM_DEFINITIONS "USE_ATOLL")
-else (C99_ATOLL)
-  CHECK_SYMBOL_EXISTS(_atoi64 "stdlib.h" WINAPI_ATOI64)
-  if (WINAPI_ATOI64)
-    list(APPEND PLATFORM_DEFINITIONS "USE_ATOI64")
-  else (WINAPI_ATOI64)
-    message(FATAL_ERROR "No atoll API found")
-  endif (WINAPI_ATOI64)
-endif (C99_ATOLL)
-
 if (PN_WINAPI)
   set (PLATFORM_LIBS ws2_32 Rpcrt4)
   list(APPEND PLATFORM_DEFINITIONS "PN_WINAPI")
@@ -187,9 +175,9 @@ if (MSVC)
     )
 endif (MSVC)
 
-# Ensure that examples build with c90 on gcc/clang, to deal with older c++03-as-c compilers.
-set(C_EXAMPLE_FLAGS_GNU "-std=iso9899:1990 -pedantic")
-set(C_EXAMPLE_FLAGS_Clang "-std=iso9899:1990 -pedantic")
+# Ensure that examples build with c99 on gcc/clang
+set(C_EXAMPLE_FLAGS_GNU "-std=c99 -pedantic")
+set(C_EXAMPLE_FLAGS_Clang "-std=c99 -pedantic")
 
 # Flags for example self-test build
 set(C_EXAMPLE_FLAGS "${COMPILE_WARNING_FLAGS} ${C_EXAMPLE_FLAGS_${CMAKE_C_COMPILER_ID}}")
@@ -460,19 +448,6 @@ if (BUILD_STATIC_LIBS)
   add_library(qpid-proton-static STATIC ${qpid-proton-core-src} ${qpid-proton-noncore-src})
 endif(BUILD_STATIC_LIBS)
 
-if (MSVC)
-  # Add a phony dependency for Windows builds to serialize creation
-  # of generated files. See issue PROTON-1376.
-  # When a Windows build creates src/encodings.h and src/protocol.h
-  # only once then this can be removed.
-  add_dependencies(qpid-proton qpid-proton-core)
-endif (MSVC)
-
-if (MSVC)
-  # guard against use of C99 violating functions on Windows
-  include(WindowsC99CheckDef)
-endif(MSVC)
-
 if (qpid-proton-proactor)
   set(HAS_PROACTOR True)
   add_library (qpid-proton-proactor SHARED ${qpid-proton-proactor})
diff --git a/c/src/platform/platform.c b/c/src/platform/platform.c
index 5cdb0a7..5e6a3ac 100644
--- a/c/src/platform/platform.c
+++ b/c/src/platform/platform.c
@@ -106,17 +106,3 @@ int pn_i_error_from_errno(pn_error_t *error, const char *msg)
       code = PN_INTR;
   return pn_error_format(error, code, "%s: %s", msg, err);
 }
-
-#ifdef USE_ATOLL
-#include <stdlib.h>
-int64_t pn_i_atoll(const char* num) {
-  return atoll(num);
-}
-#elif USE_ATOI64
-#include <stdlib.h>
-int64_t pn_i_atoll(const char* num) {
-  return _atoi64(num);
-}
-#else
-#error "Don't know how to convert int64_t values on this platform"
-#endif
diff --git a/c/src/platform/platform.h b/c/src/platform/platform.h
index 30d29a6..9ec6ada 100644
--- a/c/src/platform/platform.h
+++ b/c/src/platform/platform.h
@@ -60,15 +60,6 @@ pn_timestamp_t pn_i_now(void);
  */
 int pn_i_error_from_errno(pn_error_t *error, const char *msg);
 
-/** Provide C99 atoll functinality.
- *
- * @param[in] num the string representation of the number.
- * @return the integer value.
- *
- * @internal
- */
-int64_t pn_i_atoll(const char* num);
-
 #ifdef _MSC_VER
 
 #if !defined(S_ISDIR)
diff --git a/tools/cmake/Modules/WindowsC99CheckDef.cmake b/tools/cmake/Modules/WindowsC99CheckDef.cmake
deleted file mode 100644
index 6375c3b..0000000
--- a/tools/cmake/Modules/WindowsC99CheckDef.cmake
+++ /dev/null
@@ -1,35 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-#
-# Check qpid-proton.dll after linking for dangerous calls to
-# Windows functions that suggest but deviate from C99 behavior:
-#   _snprintf, vsnprintf, _vsnprintf
-# See platform.h for safe wrapper calls.
-#
-
-set(obj_dir ${CMAKE_CURRENT_BINARY_DIR}/qpid-proton.dir/${CMAKE_CFG_INTDIR})
-
-add_custom_command(
-    TARGET qpid-proton
-	PRE_LINK
-    COMMAND ${PYTHON_EXECUTABLE}
-            ${CMAKE_CURRENT_LIST_DIR}/WindowsC99SymbolCheck.py
-            $<TARGET_FILE_DIR:qpid-proton>
-    COMMENT "Checking for dangerous use of C99-violating functions")
diff --git a/tools/cmake/Modules/WindowsC99SymbolCheck.py b/tools/cmake/Modules/WindowsC99SymbolCheck.py
deleted file mode 100644
index dd1f8f9..0000000
--- a/tools/cmake/Modules/WindowsC99SymbolCheck.py
+++ /dev/null
@@ -1,66 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-#
-# Stop cmake build if pn_i_xxx substitute functions aren't used for
-# the dangerous non-complying [v]snprintf family.  A source of
-# painful bug-hunting.
-#
-# Each obj must be checked instead of just the dll since Visual Studio
-# sometimes inserts references to vsnprintf in DllMainCRTStartup,
-# causing false positives.
-#
-# bad: vsnprintf, __vsnprintf, _imp__vsnprintf, ...,  same for snprintf
-# OK:  vsnprintf_s, pn_i_vsnprintf
-#
-
-import sys
-import os
-import subprocess
-import glob
-import re
-
-def symcheck(objfile):
-
-    symfile = objfile.replace('.obj', '.sym')
-    cmd = ['dumpbin.exe', '/SYMBOLS', objfile, '/OUT:' + symfile]
-
-    # /dev/null standin
-    junk = open('junk', 'w')
-    p = subprocess.Popen(cmd, stdout=junk)
-    n = p.wait()
-    if n != 0 :
-        raise Exception("dumpbin call failure")
-
-    f = open(symfile, 'r')
-    for line in f :
-        m = re.search(r'UNDEF.*\b([a-zA-Z_]*snprintf)\b', line)
-        if m :
-            sym = m.group(1)
-            if re.match(r'_*pni_v?snprintf', sym) is None :
-                raise Exception('Unsafe use of C99 violating function in  ' + objfile + ' : ' + sym)
-
-def main():
-    os.chdir(sys.argv[1])
-    objs = glob.glob('*.obj')
-    for obj in glob.glob('*.obj'):
-        symcheck(obj)
-
-if __name__ == "__main__":
-    sys.exit(main())


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


[qpid-proton] 01/02: PROTON-2208: Remove ability to compile proton-c as C++ - No longer needed with windows minimum VS2015 as it supports sufficient C99 to compile proton-c as C.

Posted by as...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

astitcher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git

commit 9c1ab44237af8684693eeb1f14f035e0c3258989
Author: Andrew Stitcher <as...@apache.org>
AuthorDate: Fri Jul 10 17:10:57 2020 -0400

    PROTON-2208: Remove ability to compile proton-c as C++
    - No longer needed with windows minimum VS2015 as it supports sufficient C99
      to compile proton-c as C.
---
 CMakeLists.txt              | 22 +++-------------------
 c/CMakeLists.txt            | 12 ------------
 c/tests/fuzz/CMakeLists.txt |  9 ---------
 c/tools/CMakeLists.txt      |  4 ----
 4 files changed, 3 insertions(+), 44 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c596219..cd63da1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -50,23 +50,11 @@ set (PN_C_LIBRARY_DIR "${CMAKE_BINARY_DIR}/c")
 set (PN_C_SOURCE_DIR "${CMAKE_BINARY_DIR}/c/src")
 
 ## C++
-
 check_language (CXX)
-
 if (CMAKE_CXX_COMPILER)
   enable_language(CXX)
 endif()
 
-# TODO - Should change this test to take account of recent MSVC that does support C99
-if (MSVC)
-  # No C99 capability, use C++
-  set(DEFAULT_BUILD_WITH_CXX ON)
-endif (MSVC)
-
-if (CMAKE_CXX_COMPILER)
-  option(BUILD_WITH_CXX "Compile Proton using C++" ${DEFAULT_BUILD_WITH_CXX})
-endif()
-
 # Build static C and C++ libraries in addition to shared libraries.
 option(BUILD_STATIC_LIBS "Build static libraries as well as shared libraries" OFF)
 
@@ -145,13 +133,9 @@ if (CMAKE_COMPILER_IS_GNUCC)
   set (COMPILE_WARNING_FLAGS "${WERROR} -Wall -pedantic-errors")
   # C++ allow "%z" format specifier and variadic macros
   set (CXX_WARNING_FLAGS "${COMPILE_WARNING_FLAGS} -Wno-format -Wno-variadic-macros")
-  if (NOT BUILD_WITH_CXX)
-    set (COMPILE_WARNING_FLAGS "${COMPILE_WARNING_FLAGS} -Wstrict-prototypes -Wc++-compat -Wvla -Wsign-compare -Wwrite-strings")
-    set (COMPILE_LANGUAGE_FLAGS "-std=c99")
-    set (COMPILE_PLATFORM_FLAGS "-std=gnu99")
-  else (NOT BUILD_WITH_CXX)
-    set (COMPILE_WARNING_FLAGS "${CXX_WARNING_FLAGS}")
-  endif (NOT BUILD_WITH_CXX)
+  set (COMPILE_WARNING_FLAGS "${COMPILE_WARNING_FLAGS} -Wstrict-prototypes -Wc++-compat -Wvla -Wsign-compare -Wwrite-strings")
+  set (COMPILE_LANGUAGE_FLAGS "-std=c99")
+  set (COMPILE_PLATFORM_FLAGS "-std=gnu99")
 
   if (ENABLE_UNDEFINED_ERROR)
     set (CATCH_UNDEFINED "-Wl,--no-undefined")
diff --git a/c/CMakeLists.txt b/c/CMakeLists.txt
index f0f7f83..bb1d480 100644
--- a/c/CMakeLists.txt
+++ b/c/CMakeLists.txt
@@ -405,18 +405,6 @@ set_source_files_properties (
   COMPILE_DEFINITIONS "${PLATFORM_DEFINITIONS}"
   )
 
-if (BUILD_WITH_CXX)
-  set_source_files_properties (
-    ${qpid-proton-core}
-    ${qpid-proton-proactor}
-    ${qpid-proton-layers}
-    ${qpid-proton-extra}
-    ${qpid-proton-platform}
-    ${qpid-proton-platform-io}
-    PROPERTIES LANGUAGE CXX
-    )
-endif (BUILD_WITH_CXX)
-
 set(qpid-proton-core-src
   ${qpid-proton-core}
   ${qpid-proton-layers}
diff --git a/c/tests/fuzz/CMakeLists.txt b/c/tests/fuzz/CMakeLists.txt
index d84a250..163a9db 100644
--- a/c/tests/fuzz/CMakeLists.txt
+++ b/c/tests/fuzz/CMakeLists.txt
@@ -96,12 +96,3 @@ endif()
 
 # pni_sniff_header is internal so it has to be compiled specially
 pn_add_fuzz_test (fuzz-sniff-header fuzz-sniff-header.c ${PN_C_SOURCE_DIR}/core/autodetect.c)
-
-if (BUILD_WITH_CXX)
-  set_source_files_properties (
-    StandaloneFuzzTargetMain.c
-    StandaloneFuzzTargetInit.c
-    ${fuzz_test_src}
-    PROPERTIES LANGUAGE CXX
-  )
-endif (BUILD_WITH_CXX)
diff --git a/c/tools/CMakeLists.txt b/c/tools/CMakeLists.txt
index 7a577cb..82df6d8 100644
--- a/c/tools/CMakeLists.txt
+++ b/c/tools/CMakeLists.txt
@@ -47,7 +47,3 @@ set_target_properties (
   COMPILE_FLAGS "${COMPILE_WARNING_FLAGS} ${COMPILE_LANGUAGE_FLAGS}"
   COMPILE_DEFINITIONS "${PLATFORM_DEFINITIONS}"
 )
-
-if (BUILD_WITH_CXX)
-  set_source_files_properties (msgr-recv.c msgr-send.c msgr-common.c reactor-recv.c reactor-send.c PROPERTIES LANGUAGE CXX)
-endif (BUILD_WITH_CXX)


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