On Sat, 25 Jun 2016, Martin Winter wrote:
> 3) missing htonf on OpenBSD / NetBSD 6/7 / FreeBSD 8/9/10 / OmniOS:
>
> > […]
> > make all-am
> > CC network.lo
> > network.c: In function 'htonf':
> > network.c:109:2: error: #error "Please supply htonf implementation
> > for
> > this platform"
> > #error "Please supply htonf implementation for this platform"
> > ^
> > network.c:111:1: warning: control reaches end of non-void function
> > [-Wreturn-type]
> > }
> > ^
> > *** Error code 1
> > […]
Not sure where the other version is. I don't see a CI error for the BSDs
or Solaris. Do they not have __STDC_IEC_559__ ?
> Would appreciate if someone can spend a few cycles on fixing this BEFORE
> pushing more commits into this branch as these are multiple
> teststoppers.
Will have a look.
Can you do a grep for STDC_IEC_559 on those test hosts?
Doesn’t exist. I send the complete defines in a separate email to the list
(for future reference)
These are based on the default C compilers.
So options are:
- Also check for __GCC_IEC_559 >= 1, hopefully catches all GCC. Also
include features.h - seems to be enough to make clang 3.7.0 define
__STD_IEC_559__ on F23 (but, GCC already did by default on this
platform).
- Just don't try detect platforms and assume float is always IEC 60559
single format on anything we care about (which is likely the case).
I.e., if the macros to detect what should be a very rare case cause
problems with false-negatives and breakage on platforms that should
work.
Can you apply the following on top and see if it works on all platforms?
diff --git a/lib/stream.c b/lib/stream.c
index d85446d..4d4f867 100644
--- a/lib/stream.c
+++ b/lib/stream.c
@@ -22,6 +22,8 @@
#include <zebra.h>
#include <stddef.h>
+/* primarily for __STDC_IEC_559__ with clang */
+#include <features.h>
#include "stream.h"
#include "memory.h"
@@ -496,7 +498,9 @@ stream_get_ipv4 (struct stream *s)
float
stream_getf (struct stream *s)
{
-#ifdef __STDC_IEC_559__
+#if defined(__STDC_IEC_559__) || __GCC_IEC_559 >= 1
+/* we can safely assume 'float' is in the single precision
+ IEC 60559 binary format in host order */
union {
float r;
uint32_t d;
@@ -511,7 +515,7 @@ stream_getf (struct stream *s)
double
stream_getd (struct stream *s)
{
-#ifdef __STDC_IEC_559__
+#if defined(__STDC_IEC_559__) || __GCC_IEC_559 >= 1
union {
double r;
uint64_t d;
@@ -634,7 +638,9 @@ stream_putq (struct stream *s, uint64_t q)
int
stream_putf (struct stream *s, float f)
{
-#ifdef __STDC_IEC_559__
+#if defined(__STDC_IEC_559__) || __GCC_IEC_559 >= 1
+/* we can safely assume 'float' is in the single precision
+ IEC 60559 binary format in host order */
union {
float i;
uint32_t o;
@@ -649,7 +655,7 @@ stream_putf (struct stream *s, float f)
int
stream_putd (struct stream *s, double d)
{
-#ifdef __STDC_IEC_559__
+#if defined(__STDC_IEC_559__) || __GCC_IEC_559 >= 1
union {
double i;
uint64_t o;
regards,
--
Paul Jakma | [email protected] | @pjakma | Key ID: 0xD86BF79464A2FF6A
Fortune:
fortune: No such file or directory_______________________________________________
Quagga-dev mailing list
[email protected]
https://lists.quagga.net/mailman/listinfo/quagga-dev