[Git][NTPsec/ntpsec][master] Enable C99 features with -stdc=gnu99.
Eric S. Raymond
gitlab at mg.gitlab.com
Sat Jul 9 15:40:17 UTC 2016
Eric S. Raymond pushed to branch master at NTPsec / ntpsec
Commits:
eef377a6 by Eric S. Raymond at 2016-07-09T11:38:34-04:00
Enable C99 features with -stdc=gnu99.
Plain -std=c99 won't work because it makes some things we need
inaccessible, for example pthreads.
- - - - -
2 changed files:
- pylib/configure.py
- tests/libntp/clocktime.c
Changes:
=====================================
pylib/configure.py
=====================================
--- a/pylib/configure.py
+++ b/pylib/configure.py
@@ -171,7 +171,9 @@ def cmd_configure(ctx, config):
ctx.define("DEBUG", 1, comment="Enable debug mode")
ctx.env.BISONFLAGS += ["--debug"]
- ctx.env.CFLAGS += ["-Wall", "-Wextra"] # Default CFLAGS.
+ # We require some things that C99 doesn't enable, like pthreads.
+ # Thus -std=gnu99 rather than -std=c99 here.
+ ctx.env.CFLAGS += ["-Wall", "-Wextra", "-std=gnu99"] # Default CFLAGS.
# Check target platform.
=====================================
tests/libntp/clocktime.c
=====================================
--- a/tests/libntp/clocktime.c
+++ b/tests/libntp/clocktime.c
@@ -35,7 +35,7 @@ TEST(clocktime, CurrentYear) {
const int yday=175, hour=12, minute=50, second=0, tzoff=0;
- u_long yearstart=0;
+ u_int32_t yearstart=0;
u_int32_t actual;
TEST_ASSERT_TRUE(clocktime(yday, hour, minute, second, tzoff, timestamp,
@@ -57,7 +57,7 @@ TEST(clocktime, CurrentYearFuzz) {
const int yday=175, hour=12, minute=0, second=0, tzoff=0;
- u_long yearstart=0;
+ u_int32_t yearstart=0;
u_int32_t actual;
TEST_ASSERT_TRUE(clocktime(yday, hour, minute, second, tzoff, timestamp,
@@ -77,7 +77,7 @@ TEST(clocktime, TimeZoneOffset) {
const int yday=175, hour=4, minute=0, second=0, tzoff=8;
- u_long yearstart=0;
+ u_int32_t yearstart=0;
u_int32_t actual;
TEST_ASSERT_TRUE(clocktime(yday, hour, minute, second, tzoff, timestamp,
@@ -96,7 +96,7 @@ TEST(clocktime, WrongYearStart) {
const int yday=2, hour=11, minute=0, second=0, tzoff=0;
- u_long yearstart = 302024100UL; // Yearstart of 2009.
+ u_int32_t yearstart = 302024100UL; // Yearstart of 2009.
u_int32_t actual;
TEST_ASSERT_TRUE(clocktime(yday, hour, minute, second, tzoff, timestamp,
@@ -115,7 +115,7 @@ TEST(clocktime, PreviousYear) {
const int yday=365, hour=23, minute=0, second=0, tzoff=0;
- u_long yearstart = 0;
+ u_int32_t yearstart = 0;
u_int32_t actual;
TEST_ASSERT_TRUE(clocktime(yday, hour, minute, second, tzoff, timestamp,
@@ -133,7 +133,7 @@ TEST(clocktime, NextYear) {
const u_int32_t expected = 3471296400UL;
const int yday=1, hour=1, minute=0, second=0, tzoff=0;
- u_long yearstart = 0;
+ u_int32_t yearstart = 0;
u_int32_t actual;
TEST_ASSERT_TRUE(clocktime(yday, hour, minute, second, tzoff, timestamp,
@@ -146,7 +146,7 @@ TEST(clocktime, NoReasonableConversion) {
const u_int32_t timestamp = 3471418800UL;
const int yday=100, hour=12, minute=0, second=0, tzoff=0;
- u_long yearstart = 0;
+ u_int32_t yearstart = 0;
u_int32_t actual;
TEST_ASSERT_FALSE(clocktime(yday, hour, minute, second, tzoff, timestamp,
@@ -163,7 +163,7 @@ TEST(clocktime, AlwaysInLimit) {
u_short ydayinc;
int hour;
int minute;
- u_long yearstart;
+ u_int32_t yearstart;
u_int32_t actual;
u_int32_t diff;
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/eef377a69a4d9b0db73b605d8a2de1b6407f8c37
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20160709/07b81b03/attachment.html>
More information about the vc
mailing list