[Git][NTPsec/ntpsec][master] 2 commits: Fix warnings on OpenBSD 5.8 related to gcc pragma diagnostics

Eric S. Raymond gitlab at mg.gitlab.com
Sat Jul 23 21:22:17 UTC 2016


Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
45949dcb by Matt Selsky at 2016-07-23T16:37:19-04:00
Fix warnings on OpenBSD 5.8 related to gcc pragma diagnostics

gcc 4.6 added support for push/pop of diagnostics per
https://gcc.gnu.org/gcc-4.6/changes.html

Resolves:
../../tests/libntp/msyslog.c:142: warning: expected [error|warning|ignored] after '#pragma GCC diagnostic'
../../tests/libntp/msyslog.c:171: warning: expected [error|warning|ignored] after '#pragma GCC diagnostic'

- - - - -
0fba97f7 by Matt Selsky at 2016-07-23T16:37:19-04:00
Fix up pragma warning related to "-Wformat-contains-nul"

"-Wformat-contains-nul" was added in gcc 4.4

Compare:
https://gcc.gnu.org/onlinedocs/gcc-4.3.6/gcc/Warning-Options.html#Warning-Options
https://gcc.gnu.org/onlinedocs/gcc-4.4.7/gcc/Warning-Options.html#Warning-Options

Warning on OpenBSD 5.8:
../../tests/libntp/msyslog.c:145: warning: unknown option after '#pragma GCC diagnostic' kind

- - - - -


1 changed file:

- tests/libntp/msyslog.c


Changes:

=====================================
tests/libntp/msyslog.c
=====================================
--- a/tests/libntp/msyslog.c
+++ b/tests/libntp/msyslog.c
@@ -126,22 +126,17 @@ TEST(msyslog, msnprintfTruncate)
 	TEST_ASSERT_EQUAL_STRING(act_buf + 3, undist);
 }
 
-/* NetBSD 7.0, gcc 4.8.4 is OK.
- * FreeBSD 10.0 uses clang
- * NetBSD 6.1.5, gcc 4.5.3 doesn't support pragma inside procedures.
- * NetBSD 6.1.5, gcc 4.5.3 doesn't support push/pop.
- * FreeBSD 9.3, gcc 4.2.1 doesn't support pragma inside procedures.
- * FreeBSD 9.3, gcc 4.2.1 doesn't support push/pop.
- * FreeBSD 9.3, gcc 4.2.1 doesn't support ignoring -Wformat-contains-nul.
+/* gcc 4.6 added support for push/pop
+ * gcc 4.4 added support for -Wformat-contains-nul
  * Put this test last since we can't undo turning off some warnings. */
 #ifdef __clang__
 #  pragma clang diagnostic push
 #  pragma clang diagnostic ignored "-Wformat"
 #else /* GCC */
-#if ! defined(__NetBSD__) && ! defined(__FreeBSD__)
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
 # pragma GCC diagnostic push
 #endif
-#ifndef __FreeBSD__
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
 # pragma GCC diagnostic ignored "-Wformat-contains-nul"
 #endif
 #pragma GCC diagnostic ignored "-Wformat="
@@ -167,7 +162,7 @@ TEST(msyslog, msnprintfHangingPercent)
 #ifdef __clang__
 #  pragma clang diagnostic pop
 #else
-#if ! defined(__NetBSD__) && ! defined(__FreeBSD__)
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
 # pragma GCC diagnostic pop
 #endif
 #endif



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/7604fdac18304f6ca844c5a4d71ee5baff5bd4b5...0fba97f7b354f6c1fac5cbba8514e4594f360269
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20160723/f551819a/attachment.html>


More information about the vc mailing list