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:02 UTC
[qpid-proton] 02/02: PROTON-2207/PROTON-2208: Remove vestiges of
compiling with pre C99 compilers - Including a long unused internal
replacement for atoll
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