lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 0a8b140 2/3: Always push before and pop after


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 0a8b140 2/3: Always push before and pop after "pragma...diagnostic"
Date: Fri, 16 Apr 2021 20:17:59 -0400 (EDT)

branch: master
commit 0a8b140faaddde10878242d7ecd32373188c0781
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Always push before and pop after "pragma...diagnostic"
    
    Even if an entire file is exempted from some diagnostics, it's always
    best to surround the exempting pragmata with push and pop unless there's
    a solid reason not to (as is the case for 'pchfile_wx.hpp', e.g.).
---
 md5.cpp    |  5 +++++
 unwind.cpp | 21 ++++++++++++++-------
 2 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/md5.cpp b/md5.cpp
index 7c4e94c..a83d001 100644
--- a/md5.cpp
+++ b/md5.cpp
@@ -89,6 +89,7 @@
 #endif // !defined WORDS_BIGENDIAN
 
 #if defined LMI_GCC
+#   pragma GCC diagnostic push
 #   pragma GCC diagnostic ignored "-Wold-style-cast"
 #   pragma GCC diagnostic ignored "-Wuseless-cast"
 #endif // defined LMI_GCC
@@ -506,3 +507,7 @@ md5_process_block (void const* buffer, std::size_t a_len, 
struct md5_ctx* ctx)
   ctx->C = C;
   ctx->D = D;
 }
+
+#if defined LMI_GCC
+#   pragma GCC diagnostic pop
+#endif // defined LMI_GCC
diff --git a/unwind.cpp b/unwind.cpp
index 7a1b16d..a47baec 100644
--- a/unwind.cpp
+++ b/unwind.cpp
@@ -39,13 +39,16 @@ bool g_unwind = true;
 #include <libunwind.h>
 #include <typeinfo>                     // type_info
 
-// Calls to low-level C functions may as well use "0" for
-// terseness instead of "nullptr".
-#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
-// Casting dlsym objects to function pointers is allowed
-// only as a conditional extension.
-#pragma GCC diagnostic ignored "-Wconditionally-supported"
-#pragma GCC diagnostic ignored "-Wold-style-cast"
+#   if defined LMI_GCC
+#       pragma GCC diagnostic push
+    // Calls to low-level C functions may as well use "0" for
+    // terseness instead of "nullptr".
+#       pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
+    // Casting dlsym objects to function pointers is allowed
+    // only as a conditional extension.
+#       pragma GCC diagnostic ignored "-Wconditionally-supported"
+#       pragma GCC diagnostic ignored "-Wold-style-cast"
+#   endif // defined LMI_GCC
 
 // For reference, the ABI specifies this prototype:
 // extern "C" void __cxa_throw
@@ -196,4 +199,8 @@ void __cxa_throw(void* thrown_exception, std::type_info* 
tinfo, void (*dest)(voi
     original_cxa_throw(thrown_exception, tinfo, dest);
 }
 
+#   if defined LMI_GCC
+#       pragma GCC diagnostic pop
+#   endif // defined LMI_GCC
+
 #endif // defined LMI_X86_64 && defined LMI_POSIX && defined __GLIBCXX__



reply via email to

[Prev in Thread] Current Thread [Next in Thread]