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/14 21:52:54 UTC

[qpid-proton] branch master updated: PROTON-2207/PROTON-2080: More changes that rely on a C99 minimum compiler version. - This should fix the issue with -Wformat-security as we no longer ever specify -Wno-format for C (but still need to for C++ as we still support pre C++11)

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


The following commit(s) were added to refs/heads/master by this push:
     new 3a27419  PROTON-2207/PROTON-2080: More changes that rely on a C99 minimum compiler version. - This should fix the issue with -Wformat-security as we no longer ever specify -Wno-format   for C (but still need to for C++ as we still support pre C++11)
3a27419 is described below

commit 3a27419b6e669d73ae25ba5cc67959b15980f61e
Author: Andrew Stitcher <as...@apache.org>
AuthorDate: Tue Jul 14 17:24:00 2020 -0400

    PROTON-2207/PROTON-2080: More changes that rely on a C99 minimum compiler version.
    - This should fix the issue with -Wformat-security as we no longer ever specify -Wno-format
      for C (but still need to for C++ as we still support pre C++11)
---
 c/src/platform/platform_fmt.h | 30 +-----------------------------
 c/tools/CMakeLists.txt        | 10 ----------
 c/tools/msgr-common.h         | 23 -----------------------
 3 files changed, 1 insertion(+), 62 deletions(-)

diff --git a/c/src/platform/platform_fmt.h b/c/src/platform/platform_fmt.h
index 17f95f3..ff18d0e 100644
--- a/c/src/platform/platform_fmt.h
+++ b/c/src/platform/platform_fmt.h
@@ -30,9 +30,7 @@
  * Visual studio uses "%I" for size_t instead of "%z".
  */
 
-#ifndef __cplusplus
-
-// normal case
+#define __STDC_FORMAT_MACROS
 #include <inttypes.h>
 #define PN_ZI "zi"
 #define PN_ZU "zu"
@@ -56,30 +54,4 @@
 
 #endif /* _OPENVMS */
 
-#else
-
-#ifdef _MSC_VER
-#define PRIu8 "u"
-#define PRIu16 "u"
-#define PRIu32 "u"
-#define PRIu64 "I64u"
-
-#define PRIi8 "i"
-#define PRIi16 "i"
-#define PRIi32 "i"
-#define PRIi64 "I64i"
-
-#define PN_ZI "Ii"
-#define PN_ZU "Iu"
-#else
-// Normal C++
-#define __STDC_FORMAT_MACROS
-#include <inttypes.h>
-#define PN_ZI "zi"
-#define PN_ZU "zu"
-
-#endif /* _MSC_VER */
-
-#endif /* __cplusplus */
-
 #endif /* platform_fmt.h */
diff --git a/c/tools/CMakeLists.txt b/c/tools/CMakeLists.txt
index 82df6d8..d58e4b4 100644
--- a/c/tools/CMakeLists.txt
+++ b/c/tools/CMakeLists.txt
@@ -21,16 +21,6 @@ include(CheckIncludeFiles)
 
 include_directories (${PN_C_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/include)
 
-CHECK_INCLUDE_FILES("inttypes.h" INTTYPES_AVAILABLE)
-if (INTTYPES_AVAILABLE)
-  list(APPEND PLATFORM_DEFINITIONS "USE_INTTYPES")
-else (INTTYPES_AVAILABLE)
-  if (CMAKE_COMPILER_IS_GNUCC)
-    # since inttypes.h provides portable printf format macros
-    set (COMPILE_WARNING_FLAGS "${COMPILE_WARNING_FLAGS} -Wno-format")
-  endif (CMAKE_COMPILER_IS_GNUCC)
-endif (INTTYPES_AVAILABLE)
-
 add_executable(msgr-recv msgr-recv.c msgr-common.c)
 add_executable(msgr-send msgr-send.c msgr-common.c)
 add_executable(reactor-recv reactor-recv.c msgr-common.c)
diff --git a/c/tools/msgr-common.h b/c/tools/msgr-common.h
index d3f483a..6fefce7 100644
--- a/c/tools/msgr-common.h
+++ b/c/tools/msgr-common.h
@@ -20,30 +20,7 @@
 
 #include "pncompat/misc_defs.h"
 
-#if defined(USE_INTTYPES)
-#ifdef __cplusplus
-#define __STDC_FORMAT_MACROS
-#endif
 #include <inttypes.h>
-#endif
-
-#ifdef _MSC_VER
-#if !defined(PRIu64)
-#define PRIu64 "I64u"
-#endif
-#if !defined(SCNu64)
-#define SCNu64 "I64u"
-#endif
-#endif
-
-/* If still not defined, best guess */
-#if !defined(SCNu64)
-#define SCNu64 "ul"
-#endif
-#if !defined(PRIu64)
-#define PRIu64 "ul"
-#endif
-
 
 #include "proton/types.h"
 #include "proton/message.h"


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