compile error in RTEMS header when using -std=c99?
Cudmore, Alan P. (GSFC-5820)
alan.p.cudmore at nasa.gov
Tue Nov 13 16:30:52 UTC 2018
Hi Sebastian,
This is great for our application code that includes rtems.h.
Thanks,
Alan
On 11/12/18, 11:04 AM, "Sebastian Huber" <sebastian.huber at embedded-brains.de> wrote:
Hello Alan,
I removed several internal data types from <rtems.h>. Now, it is
possible to include <rtems.h> in -std=c99 mode.
https://devel.rtems.org/ticket/3598
On 12/09/2018 20:45, Cudmore, Alan P. (GSFC-5820) wrote:
>
> Hello,
>
> We are building our RTEMS applications with -std=c99 and other
> compiler warning switches.
>
> On the latest RTEMS master and RTEMS 5 toolchain ( from yesterday ),
> when I include the -std=c99 compiler switch, the compilation fails in
> an RTEMS header.
>
> Is it not recommended to use the “-std= “ switches when building RTEMS
> applications, or is this something that we should fix? We are able to
> use the “-std=c99” switches in 4.11. I noticed that the timestamp.h
> file did change between 4.11 and 5.x.
>
> Details of the error are below.
>
> Thanks,
>
> Alan
>
> It is reproducible with the “hello_world_c” example as follows:
>
> Command from unmodified examples-v2 Makefile:
>
> sparc-rtems5-gcc --pipe
> -B/home/alan/rtems/bsps/5/sparc-rtems5/leon3/lib/ -specs bsp_specs
> -qrtems -Wall -O2 -g -ffunction-sections -fdata-sections
> -mcpu=leon3 -c -o o-optimize/test.o test.c
>
> Command with -std=c99 added:
>
> sparc-rtems5-gcc --pipe
> -B/home/alan/rtems/bsps/5/sparc-rtems5/leon3/lib/ -specs bsp_specs
> -qrtems -std=c99 -Wall -O2 -g -ffunction-sections -fdata-sections
> -mcpu=leon3 -c -o o-optimize/test.o test.c
>
> In file included from
> /home/alan/rtems/bsps/5/sparc-rtems5/leon3/lib/include/rtems/score/thread.h:36:0,
>
> from
> /home/alan/rtems/bsps/5/sparc-rtems5/leon3/lib/include/rtems/score/heap.h:22,
>
> from
> /home/alan/rtems/bsps/5/sparc-rtems5/leon3/lib/include/rtems/rtems/types.h:26,
>
> from /home/alan/rtems/bsps/5/sparc-rtems5/leon3/lib/include/rtems.h:31,
>
> from test.c:5:
>
> /home/alan/rtems/bsps/5/sparc-rtems5/leon3/lib/include/rtems/score/timestamp.h:
> In function '_Timestamp_Divide':
>
> /home/alan/rtems/bsps/5/sparc-rtems5/leon3/lib/include/rtems/score/timestamp.h:219:12:
> error: incompatible types when assigning to type 'struct timespec'
> from type 'int'
>
> _ts_left = sbttots( *_lhs );
>
> ^
>
> /home/alan/rtems/bsps/5/sparc-rtems5/leon3/lib/include/rtems/score/timestamp.h:220:13:
> error: incompatible types when assigning to type 'struct timespec'
> from type 'int'
>
> _ts_right = sbttots( *_rhs );
>
> ^
>
> /home/alan/rtems/bsps/5/sparc-rtems5/leon3/lib/include/rtems/score/timestamp.h:
> In function '_Timestamp_Get_nanoseconds':
>
> /home/alan/rtems/bsps/5/sparc-rtems5/leon3/lib/include/rtems/score/timestamp.h:261:7:
> error: incompatible types when assigning to type 'struct timespec'
> from type 'int'
>
> _ts = sbttots( *_time );
>
> ^
>
> /home/alan/rtems/bsps/5/sparc-rtems5/leon3/lib/include/rtems/score/timestamp.h:
> In function '_Timestamp_Get_as_nanoseconds':
>
> /home/alan/rtems/bsps/5/sparc-rtems5/leon3/lib/include/rtems/score/timestamp.h:281:7:
> error: incompatible types when assigning to type 'struct timespec'
> from type 'int'
>
> _ts = sbttots( *_time );
>
> ^
>
> /home/alan/rtems/bsps/5/sparc-rtems5/leon3/lib/include/rtems/score/timestamp.h:
> In function '_Timestamp_To_timespec':
>
> /home/alan/rtems/bsps/5/sparc-rtems5/leon3/lib/include/rtems/score/timestamp.h:299:14:
> error: incompatible types when assigning to type 'struct timespec'
> from type 'int'
>
> *_timespec = sbttots( *_timestamp );
>
> ^
>
> /home/alan/rtems/bsps/5/sparc-rtems5/leon3/lib/include/rtems/score/timestamp.h:
> In function '_Timestamp_To_timeval':
>
> /home/alan/rtems/bsps/5/sparc-rtems5/leon3/lib/include/rtems/score/timestamp.h:313:13:
> error: incompatible types when assigning to type 'struct timeval' from
> type 'int'
>
> *_timeval = sbttotv( *_timestamp );
>
> ^
>
> In file included from
> /home/alan/rtems/bsps/5/sparc-rtems5/leon3/lib/include/rtems/score/timecounter.h:27:0,
>
> from
> /home/alan/rtems/bsps/5/sparc-rtems5/leon3/lib/include/rtems/score/timecounterimpl.h:26,
>
> from
> /home/alan/rtems/bsps/5/sparc-rtems5/leon3/lib/include/rtems/rtems/clock.h:37,
>
> from /home/alan/rtems/bsps/5/sparc-rtems5/leon3/lib/include/rtems.h:40,
>
> from test.c:5:
>
> /home/alan/rtems/bsps/5/sparc-rtems5/leon3/lib/include/sys/timetc.h:
> At top level:
>
> /home/alan/rtems/bsps/5/sparc-rtems5/leon3/lib/include/sys/timetc.h:72:2:
> error: unknown type name 'u_int'
>
> u_int tc_flags;
>
> ^~~~~
>
> In file included from
> /home/alan/rtems/bsps/5/sparc-rtems5/leon3/lib/include/rtems/confdefs.h:326:0,
>
> from test.c:32:
>
> /home/alan/rtems/bsps/5/sparc-rtems5/leon3/lib/include/rtems/imfs.h:
> In function '_IMFS_get_time':
>
> /home/alan/rtems/bsps/5/sparc-rtems5/leon3/lib/include/rtems/imfs.h:343:18:
> error: storage size of 'now' isn't known
>
> struct bintime now;
>
> ^~~
>
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
--
Sebastian Huber, embedded brains GmbH
Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail : sebastian.huber at embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
More information about the devel
mailing list