[Git][NTPsec/ntpsec][master] Disable Unity's support for printing floating point numbers to avoid warnings

Matt Selsky gitlab at mg.gitlab.com
Thu Dec 21 21:12:32 UTC 2017


Matt Selsky pushed to branch master at NTPsec / ntpsec


Commits:
b4e2b376 by Matt Selsky at 2017-12-21T15:57:19-05:00
Disable Unity's support for printing floating point numbers to avoid warnings

Example:
../../tests/unity/unity.c: In function ‘UnityPrintFloat’:
../../tests/unity/unity.c:271:34: warning: comparing floating point with == or != is unsafe [-Wfloat-equal]
     if (number < 0.0f || (number == 0.0f && 1.0f / number < 0.0f))
                                  ^
../../tests/unity/unity.c:278:16: warning: comparing floating point with == or != is unsafe [-Wfloat-equal]
     if (number == 0.0f) UnityPrint("0");
                ^

Fixes Gitlab issue #427

Upstream ticket filed at https://github.com/ThrowTheSwitch/Unity/issues/314

- - - - -


1 changed file:

- wscript


Changes:

=====================================
wscript
=====================================
--- a/wscript
+++ b/wscript
@@ -542,6 +542,10 @@ int main(int argc, char **argv) {
                 ]
     # else:  # gcc, probably
 
+    # Exclude Unity's support for printing floating point numbers since it triggers warnings
+    # with -Wfloat-equal
+    ctx.env.CFLAGS = ['-DUNITY_EXCLUDE_FLOAT_PRINT'] + ctx.env.CFLAGS
+
     # XXX: hack
     if ctx.env.DEST_OS in ["freebsd", "openbsd"]:
         ctx.env.PLATFORM_INCLUDES = ["/usr/local/include"]



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/b4e2b3761b329a1d7c3ccfd8bc9b489567afe4fd

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/b4e2b3761b329a1d7c3ccfd8bc9b489567afe4fd
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20171221/a7b6eba6/attachment.html>


More information about the vc mailing list