There are two build errors on NetBSD 6.1.1 with gcc 4.5.3 1. dbus-launch.c: In function 'read_machine_uuid_if_needed': dbus-launch.c:135:3: error: array subscript has type 'char' 2. dbus-monitor.c: In function 'profile_print_with_attrs': dbus-monitor.c:130:3: error: format '%lu' expects type 'long unsigned int', but argument 4 has type 'suseconds_t' dbus-monitor.c:130:3: error: format '%lu' expects type 'long unsigned int', but argument 4 has type 'suseconds_t' dbus-monitor.c: In function 'print_message_profile': dbus-monitor.c:200:2: error: format '%lu' expects type 'long unsigned int', but argument 4 has type 'suseconds_t' dbus-monitor.c:200:2: error: format '%lu' expects type 'long unsigned int', but argument 4 has type 'suseconds_t' For the first one, just cast char to int to fix it. For the second, struct timeval on NetBSD defined as below in /usr/include/sys/time.h struct timeval { time_t tv_sec; /* seconds */ suseconds_t tv_usec; /* and microseconds */ }; time_t defined as int64_t while suseconds_t defined as int.
Created attachment 86630 [details] [review] [PATCH] Fix build on NetBSD 6.1.1 with gcc 4.5.3
(In reply to comment #0) > There are two build errors on NetBSD 6.1.1 with gcc 4.5.3 > > 1. > dbus-launch.c: In function 'read_machine_uuid_if_needed': > dbus-launch.c:135:3: error: array subscript has type 'char' > > 2. > dbus-monitor.c: In function 'profile_print_with_attrs': > dbus-monitor.c:130:3: error: format '%lu' expects type 'long unsigned int', > but argument 4 has type 'suseconds_t' > dbus-monitor.c:130:3: error: format '%lu' expects type 'long unsigned int', > but argument 4 has type 'suseconds_t' > dbus-monitor.c: In function 'print_message_profile': > dbus-monitor.c:200:2: error: format '%lu' expects type 'long unsigned int', > but argument 4 has type 'suseconds_t' > dbus-monitor.c:200:2: error: format '%lu' expects type 'long unsigned int', > but argument 4 has type 'suseconds_t' > > > For the first one, just cast char to int to fix it. > > For the second, struct timeval on NetBSD defined as below in > /usr/include/sys/time.h > > struct timeval { > time_t tv_sec; /* seconds */ > suseconds_t tv_usec; /* and microseconds */ > }; > > time_t defined as int64_t while suseconds_t defined as int. Some more information in case you don't have a settled NetBSD around. The exctags seems can't generate tags for included files on NetBSD, so grep used below. For time_t definition: # egrep -r "(typedef|define).*\<time_t\>" /usr/include /usr/include/krb5/krb5-v4compat.h:#define NEVERDATE ((time_t)0x7fffffffL) /usr/include/krb5/krb5.h:typedef time_t krb5_deltat; /usr/include/krb5/krb5.h:typedef time_t krb5_timestamp; /usr/include/krb5/krb5_asn1.h:typedef time_t KerberosTime; /usr/include/rump/rumpclient.h:#define RUMPCLIENT_RETRYCONN_INFTIME ((time_t)-1) /usr/include/rump/rumpclient.h:#define RUMPCLIENT_RETRYCONN_ONCE ((time_t)-2) /usr/include/rump/rumpclient.h:#define RUMPCLIENT_RETRYCONN_DIE ((time_t)-3) /usr/include/sys/quota.h:#define QUOTA_NOTIME ((time_t)-1) /usr/include/sys/time.h:#define timespecclear(tsp) (tsp)->tv_sec = (time_t)((tsp)->tv_nsec = 0L) /usr/include/sys/types.h:typedef _BSD_TIME_T_ time_t; /usr/include/krb5.h:typedef time_t krb5_deltat; /usr/include/krb5.h:typedef time_t krb5_timestamp; /usr/include/time.h:typedef _BSD_TIME_T_ time_t; /usr/include/util.h:typedef _BSD_TIME_T_ time_t; /usr/include/utime.h:typedef _BSD_TIME_T_ time_t; # egrep -r "(typedef|define).*\<_BSD_TIME_T_\>" /usr/include /usr/include/machine/ansi.h:#define _BSD_TIME_T_ __int64_t /* time() */ /usr/include/sys/types.h:typedef _BSD_TIME_T_ time_t; /usr/include/time.h:typedef _BSD_TIME_T_ time_t; /usr/include/util.h:typedef _BSD_TIME_T_ time_t; /usr/include/utime.h:typedef _BSD_TIME_T_ time_t; /usr/include/amd64/ansi.h:#define _BSD_TIME_T_ __int64_t /* time() */ /usr/include/i386/ansi.h:#define _BSD_TIME_T_ __int64_t /* time() */ # egrep -r "(typedef|define).*\<__int64_t\>" /usr/include /usr/include/machine/ansi.h:#define _BSD_TIME_T_ __int64_t /* time() */ /usr/include/machine/int_types.h:typedef long int __int64_t; /usr/include/sys/ansi.h:typedef __int64_t __off_t; /* file offset */ /usr/include/sys/socket.h:#define _SS_ALIGNSIZE (sizeof(__int64_t)) /usr/include/sys/stdint.h:typedef __int64_t int64_t; /usr/include/sys/stdint.h:#define int64_t __int64_t /usr/include/sys/types.h:typedef __int64_t int64_t; /usr/include/sys/types.h:#define int64_t __int64_t /usr/include/stdint.h:typedef __int64_t int64_t; /usr/include/stdint.h:#define int64_t __int64_t /usr/include/amd64/ansi.h:#define _BSD_TIME_T_ __int64_t /* time() */ /usr/include/amd64/int_types.h:typedef long int __int64_t; /usr/include/i386/ansi.h:#define _BSD_TIME_T_ __int64_t /* time() */ /usr/include/i386/int_types.h:typedef __COMPILER_INT64__ __int64_t; /usr/include/i386/int_types.h:typedef long long int __int64_t; For suseconds_t definition: # egrep -r "(typedef|define).*\<suseconds_t\>" /usr/include /usr/include/machine/ansi.h:#define _BSD_SUSECONDS_T_ int /* suseconds_t */ /usr/include/sys/types.h:typedef _BSD_SUSECONDS_T_ suseconds_t; /usr/include/amd64/ansi.h:#define _BSD_SUSECONDS_T_ int /* suseconds_t */ /usr/include/i386/ansi.h:#define _BSD_SUSECONDS_T_ int /* suseconds_t */
Comment on attachment 86630 [details] [review] [PATCH] Fix build on NetBSD 6.1.1 with gcc 4.5.3 Review of attachment 86630 [details] [review]: ----------------------------------------------------------------- ::: tools/dbus-monitor.c @@ +106,5 @@ > > #ifdef __APPLE__ > #define PROFILE_TIMED_FORMAT "%s\t%lu\t%d" > +#elif defined(__NetBSD__) > +#include <inttypes.h> According to #bug717, I think this is acceptable.
Looks OK. Based on what I quoted on Bug #717, <inttypes.h> is OK in a .c (but would not be OK in a public .h, for the reasons Havoc cited there). I'll apply reviewed patches as a batch at some point (I try to avoid D-Bus eating up too much of my development time, since it isn't my main project).
(In reply to comment #4) > Looks OK. Based on what I quoted on Bug #717, <inttypes.h> is OK in a .c > (but would not be OK in a public .h, for the reasons Havoc cited there). > > I'll apply reviewed patches as a batch at some point (I try to avoid D-Bus > eating up too much of my development time, since it isn't my main project). Understand, I'm trying to be here and trying to be helpful.
I changed the long commit message a bit for better clarity, I hope that's OK: > There are two build failure on NetBSD 6.1.1 with gcc 4.5.3, the first > one is char to int, warning treated as error. The second one is a mismatch > between format string and arguments. Please be careful with commit messages, comments etc. - I realize English probably isn't your first language, but text is at least as important as code :-) Applied with that change for dbus 1.7.6. Thanks!
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.