<html lang='en'>
<head>
<meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
<title>
GitLab
</title>
</meta>
</head>
<style>
img {
max-width: 100%;
height: auto;
}
p.details {
font-style:italic;
color:#777
}
.footer p {
font-size:small;
color:#777
}
pre.commit-message {
white-space: pre-wrap;
}
.file-stats a {
text-decoration: none;
}
.file-stats .new-file {
color: #090;
}
.file-stats .deleted-file {
color: #B00;
}
</style>
<body>
<div class='content'>
<h3>
Hal Murray pushed to branch master
at <a href="https://gitlab.com/NTPsec/ntpsec">NTPsec / ntpsec</a>
</h3>
<h4>
Commits:
</h4>
<ul>
<li>
<strong><a href="https://gitlab.com/NTPsec/ntpsec/commit/876473a046f28c6c15ad9e4320fd9211aab88f82">876473a0</a></strong>
<div>
<span>by Hal Murray</span>
<i>at 2015-12-17T21:12:19Z</i>
</div>
<pre class='commit-message'>Fixup pragmas on NetBSD and FreeBSD</pre>
</li>
</ul>
<h4>1 changed file:</h4>
<ul>
<li class='file-stats'>
<a href='#diff-0'>
tests/libntp/msyslog.c
</a>
</li>
</ul>
<h4>Changes:</h4>
<li id='diff-0'>
<a href='https://gitlab.com/NTPsec/ntpsec/commit/876473a046f28c6c15ad9e4320fd9211aab88f82#diff-0'>
<strong>
tests/libntp/msyslog.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/tests/libntp/msyslog.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/tests/libntp/msyslog.c
</span><span style="color: #aaaaaa">@@ -80,40 +80,6 @@ TEST(msyslog, msnprintfBackslashPercent)
</span> TEST_ASSERT_EQUAL_STRING(exp_buf, act_buf);
}
<span style="color: #000000;background-color: #ffdddd">-TEST(msyslog, msnprintfHangingPercent)
-{
- char exp_buf[64];
- char act_buf[64];
- int exp_cnt;
- int act_cnt;
-
- ZERO(exp_buf);
- ZERO(act_buf);
-/* warning: format string contains '\0' within the string body [-Wformat] */
-#ifdef __clang__
-# pragma clang diagnostic push
-# pragma clang diagnostic ignored "-Wformat"
-#else /* GCC */
-#ifndef __netbsd__
-# pragma GCC diagnostic push
-# pragma GCC diagnostic ignored "-Wformat-contains-nul"
-# pragma GCC diagnostic ignored "-Wformat="
-# pragma GCC diagnostic ignored "-Wformat"
-#endif
-#endif
- exp_cnt = snprintf(exp_buf, sizeof(exp_buf), "percent then nul term then non-nul %\0oops!");
- act_cnt = msnprintf(act_buf, sizeof(act_buf), "percent then nul term then non-nul %\0oops!");
-#ifdef __clang__
-# pragma clang diagnostic pop
-#else
-#pragma GCC diagnostic pop
-#endif
-
- TEST_ASSERT_EQUAL(exp_cnt, act_cnt);
- TEST_ASSERT_EQUAL_STRING(exp_buf, act_buf);
- TEST_ASSERT_EQUAL_STRING("", act_buf + 1 + strlen(act_buf));
-}
-
</span> #ifndef VSNPRINTF_PERCENT_M
TEST(msyslog, format_errmsgHangingPercent)
{
<span style="color: #aaaaaa">@@ -160,6 +126,52 @@ TEST(msyslog, msnprintfTruncate)
</span> TEST_ASSERT_EQUAL_STRING(act_buf + 3, undist);
}
<span style="color: #000000;background-color: #ddffdd">+/* 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.
+ * 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__)
+# pragma GCC diagnostic push
+#endif
+#ifndef __FreeBSD__
+# pragma GCC diagnostic ignored "-Wformat-contains-nul"
+#endif
+#pragma GCC diagnostic ignored "-Wformat="
+#pragma GCC diagnostic ignored "-Wformat"
+#endif
+TEST(msyslog, msnprintfHangingPercent)
+{
+ char exp_buf[64];
+ char act_buf[64];
+ int exp_cnt;
+ int act_cnt;
+
+ ZERO(exp_buf);
+ ZERO(act_buf);
+/* warning: format string contains '\0' within the string body [-Wformat] */
+ exp_cnt = snprintf(exp_buf, sizeof(exp_buf), "percent then nul term then non-nul %\0oops!");
+ act_cnt = msnprintf(act_buf, sizeof(act_buf), "percent then nul term then non-nul %\0oops!");
+
+ TEST_ASSERT_EQUAL(exp_cnt, act_cnt);
+ TEST_ASSERT_EQUAL_STRING(exp_buf, act_buf);
+ TEST_ASSERT_EQUAL_STRING("", act_buf + 1 + strlen(act_buf));
+}
+#ifdef __clang__
+# pragma clang diagnostic pop
+#else
+#if ! defined(__NetBSD__) && ! defined(__FreeBSD__)
+# pragma GCC diagnostic pop
+#endif
+#endif
+
</span> TEST_GROUP_RUNNER(msyslog) {
RUN_TEST_CASE(msyslog, msnprintf)
RUN_TEST_CASE(msyslog, msnprintfLiteralPercentm)
</code></pre>
<br>
</li>
</div>
<div class='footer' style='margin-top: 10px;'>
<p>
—
<br>
<a href="https://gitlab.com/NTPsec/ntpsec/commit/876473a046f28c6c15ad9e4320fd9211aab88f82">View it on GitLab</a>.
<br>
You're receiving this email because of your account on gitlab.com.
If you'd like to receive fewer emails, you can adjust your notification settings.
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Commit","url":"https://gitlab.com/NTPsec/ntpsec/commit/876473a046f28c6c15ad9e4320fd9211aab88f82"}}</script>
</p>
</div>
</body>
</html>