Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build problems with default flags on NetBSD #25

Open
0-wiz-0 opened this issue Jan 9, 2015 · 2 comments
Open

Build problems with default flags on NetBSD #25

0-wiz-0 opened this issue Jan 9, 2015 · 2 comments

Comments

@0-wiz-0
Copy link

0-wiz-0 commented Jan 9, 2015

When building on NetBSD-7.99.3/amd64 (gcc 4.8.4) with BSD make, I need to add
MAN=
to the Makefile generated by configure (patch available on request).

Then, the build fails because of the default c compiler flags, with

--- main_sim_client.o ---
main_sim_client.c: In function 'simfile_readline':
main_sim_client.c:138:17: error: conversion to 'unsigned int' from '__uint64_t' may alter its value [-Werror=conversion]
     sf->t0 = u1 - t0.sec;
                 ^
cc1: all warnings being treated as errors
*** [main_sim_client.o] Error code 1

make: stopped in /scratch/wip/ntimed-git/work/Ntimed
--- ntp_packet.o ---
In file included from ntp_packet.c:64:0:
ntimed_endian.h: In function 'Be16dec':
ntimed_endian.h:42:22: error: conversion to '__uint16_t' from 'int' may alter its value [-Werror=conversion]
  return ((p[0] << 8) | p[1]);
                      ^
ntimed_endian.h: In function 'Be32dec':
ntimed_endian.h:50:41: error: conversion to 'unsigned int' from 'int' may change the sign of the result [-Werror=sign-conversion]
  return (((unsigned)p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
                                         ^
ntimed_endian.h:50:56: error: conversion to 'unsigned int' from 'int' may change the sign of the result [-Werror=sign-conversion]
  return (((unsigned)p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
                                                        ^
ntimed_endian.h: In function 'Be16enc':
ntimed_endian.h:58:18: error: conversion to '__uint8_t' from 'int' may alter its value [-Werror=conversion]
  p[0] = (u >> 8) & 0xff;
                  ^
ntimed_endian.h:59:11: error: conversion to '__uint8_t' from 'int' may alter its value [-Werror=conversion]
  p[1] = u & 0xff;
           ^
ntimed_endian.h: In function 'Be32enc':
ntimed_endian.h:67:19: error: conversion to '__uint8_t' from '__uint32_t' may alter its value [-Werror=conversion]
  p[0] = (u >> 24) & 0xff;
                   ^
ntp_packet.c: In function 'ts_2ntp32':
ntp_packet.c:139:17: error: conversion to '__uint16_t' from '__uint64_t' may alter its value [-Werror=conversion]
  Be16enc(dst, ts->sec);
                 ^
ntp_packet.c:140:28: error: conversion to '__uint16_t' from '__uint64_t' may alter its value [-Werror=conversion]
  Be16enc(dst + 2, ts->frac >> 48ULL);
                            ^
ntp_packet.c: In function 'ts_2ntp64':
ntp_packet.c:148:23: error: conversion to '__uint32_t' from 'long unsigned int' may alter its value [-Werror=conversion]
  Be32enc(dst, ts->sec + NTP_UNIX);
                       ^
ntp_packet.c:149:28: error: conversion to '__uint32_t' from '__uint64_t' may alter its value [-Werror=conversion]
  Be32enc(dst + 4, ts->frac >> 32ULL);
                            ^
ntp_packet.c: In function 'NTP_Packet_Pack':
ntp_packet.c:163:34: error: conversion to '__uint8_t' from 'int' may alter its value [-Werror=conversion]
  pbuf[0] = (uint8_t)np->ntp_leap << 6;
                                  ^
ntp_packet.c:164:10: error: conversion to '__uint8_t' from 'int' may alter its value [-Werror=conversion]
  pbuf[0] |= np->ntp_version << 3;
          ^
cc1: all warnings being treated as errors
*** [ntp_packet.o] Error code 1

make: stopped in /scratch/wip/ntimed-git/work/Ntimed
--- combine_delta.o ---
combine_delta.c: In function 'cd_find_peak':
combine_delta.c:163:21: error: conversion to 'size_t' from 'long int' may change the sign of the result [-Werror=sign-conversion]
  qsort(st, cd->nsrc * 3L, sizeof st[0], stat_cmp);
                     ^
cc1: all warnings being treated as errors
*** [combine_delta.o] Error code 1

make: stopped in /scratch/wip/ntimed-git/work/Ntimed
--- ntp_peer.o ---
ntp_peer.c:136:17: error: conversion to 'int' from 'ssize_t' may alter its value [-Werror=conversion]
   i = UdpTimedRx(ocx, usc, np->sa->sa_family, &rss, &rssl, &t2,
                 ^
cc1: all warnings being treated as errors
*** [ntp_peer.o] Error code 1
@bsdphk
Copy link
Owner

bsdphk commented Jan 16, 2015

Is it WARNS=6 that enables these warnings on NetBSD ?

@0-wiz-0
Copy link
Author

0-wiz-0 commented Jan 16, 2015

When I change the WARNS to '5', there are no warnings, so "yes".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants