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@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to