[#6584] rint in c99 results in warning

Document created by Aaronwu Employee on Oct 17, 2013
Version 1Show Document
  • View in full screen mode

[#6584] rint in c99 results in warning

Submitted By: Anton Shokurov

Open Date

2011-05-10 05:03:33     Close Date

2011-05-10 13:44:00

Priority:

Medium     Assignee:

Stuart Henderson

Board:

N/A     Silicon Revision:

Resolution:

Fixed     Fixed In Release:

2011R1

Processor:

ALL     

Host Operating System:

toolchain rev.:

    kernel rev.:

State:

Closed     Found In Release:

2010R1-RC4

Is this bug repeatable?:

yes     

Summary: rint in c99 results in warning

Details:

 

Isn't rint (and the like) part of c99?

I get a compiler warning if i compile the code with -std=c99, but if i compile with -std=gnu99 i don't get any warnings.

 

Follow-ups

 

--- Stuart Henderson                                         2011-05-10 10:08:22

rint et al are indeed part of c99 and should work.  Can you provide example code

and a command line to reproduce the warning?

 

--- Anton Shokurov                                           2011-05-10 11:29:42

Yes, i posted the file

 

>bfin-elf-gcc  -std=c99 test_rint.c -c

test_rint.c: In function 'main':

test_rint.c:7: warning: implicit declaration of function 'rint'

test_rint.c:7: warning: incompatible implicit declaration of built-in function

'rint'

 

But,

>bfin-elf-gcc  -std=gnu99 test_rint.c -c

runs without any warnings.

 

--- Mike Frysinger                                           2011-05-10 11:50:37

please fill out all the fields in the bug.  you have to provide as many details

as possible for the report to be useful.

 

gcc-4.3.5 works just fine for me -- no warnings.

 

--- Stuart Henderson                                         2011-05-10 12:17:20

ah, the problem is with the bare metal toolchain.  the version of newlib

included with the 2010R1 release (which i'm assuming you're using) was 1.14.0,

the math.h included with this release contains a bug where fint et al are only

included:

#ifndef __STRICT_ANSI__

 

which is clearly wrong since it should be included for c99.  This has since

been updated in the 1.19.0 release that we will use for the 2011 release:

#if !defined(__STRICT_ANSI__) || defined(__cplusplus) || __STDC_VERSION__ >=

199901L

 

Since the section it's guarding is titled "/* ISO C99 types and macros.

*/", it should be ok to just update this #if in your:

bfin-elf/bfin-elf/include/math.h

to avoid these warnings.

 

--- Anton Shokurov                                           2011-05-10 13:41:05

Yes, the problem is with the bare metal toolchain.

When will the 2011 release be available?

 

>it should be ok to just update this

Yes, thanks, this worked for me. But nevertheless, when will the update be

available officially?

 

--- Stuart Henderson                                         2011-05-11 06:41:16

It's too early to give an accurate picture of when the final 2011R1 release will

be made, however there is an alpha release available for download now if you

want to try it out:

http://blackfin.uclinux.org/gf/project/toolchain/frs/?action=FrsReleaseView&release_id=513

 

 

 

    Files

    Changes

    Commits

    Dependencies

    Duplicates

    Associations

    Tags

 

File Name     File Type     File Size     Posted By

test_rint.c    text/x-csrc    167    Anton Shokurov

Attachments

Outcomes