Page 1 of 1

SDK 54.16 newlib math.h problem

Posted: Sun Oct 16, 2022 3:05 pm
by blmara
Hi,

I've got a project that includes newlib math.h in one module. This is compiled with VBCC 0.9h. After installing SDK 54.16, including the SDK version of VBCC, I get this error when compiling the project

Code: Select all

'vbcc:bin/vc +newlib -cpp-comments -Lvlibos4: -ISDK:local/newlib/include/ -ISDK:local/common/include/ -g -static  -c -o o/lineclass.o lineclass.c
>          ((sizeof(x)==sizeof(float)) ? __fpclassifyf(x) : __fpclassifyd(x))
error 272 in line 282 of "math.h": macro 'fpclassify' redefined unidentically
    included from file "lineclass.c":30
1 error found!
vbccppc keskeytyi, palautuskoodi 20
vbccppc -quiet "lineclass.c" -o= "T:t_9_0.asm" -cpp-comments -ISDK:local/newlib/include/ -ISDK:local/common/include/ -g -elf -no-regnames -no-multiple-ccs -madd -setccs -use-commons -D__amigaos4__ -D__NEWLIB__ -D__mask=___mask  -O=1 -ISDK:local/common/include -ISDK:local/newlib/include -ISDK:newlib/include -ISDK:include/include_h failed
vbcc:bin/vc keskeytyi, palautuskoodi 20 
Asked about this from Frank Wille, the author of Amiga version of VBCC. His answer
I didn't check the new SDK yet, but it looks like a problem in the newlib
math.h from SDK 54.16, which is not part of vbcc.
          ((sizeof(x)==sizeof(float)) ? __fpclassifyf(x) :
__fpclassifyd(x))
error 272 in line 282 of "math.h": macro 'fpclassify' redefined
unidentically

My SDK has just:

extern int __fpclassifyf (float x);
extern int __fpclassifyd (double x);

Probably the new SDK has a second declaration for __fpclassifyX() somewhere?
Then this is a bug, which should be reported.
How and who to correct this problem?

Marko

Re: SDK 54.16 newlib math.h problem

Posted: Tue Oct 18, 2022 8:20 am
by salass00
Since it complains that fpclassify is being redefined unidentically can you find where the other definition is (is it in the program you are compiling, a vbcc internal header or ...)? When using gcc and it encounters a problem like this it lists also the previous definition which is a quite handy feature.

Re: SDK 54.16 newlib math.h problem

Posted: Tue Oct 18, 2022 4:07 pm
by salass00
Okay, I found the problem: The fpclassify macro is first defined in a compiler generic section nearer the top of the header file and then defined again lower down in a VBCC specific section.

This modified math.h header file should fix the double macro definitions when using VBCC:
https://www.dropbox.com/s/oh1rf9quvgel7aa/math.h?dl=0

Re: SDK 54.16 newlib math.h problem

Posted: Sun Oct 30, 2022 10:31 am
by blmara
Thanks and sorry for delay replying,

the DropBox link provided in the previous message doesn't seem to work with Amiga Browsers (Odyssey, Netsurf) but with the help of my Android phone I manage to download the new math.h. Now it compiles flawlessly with VBCC. Thanks a lot! Hopefully this will go to the next update of SDK.

Marko

Re: SDK 54.16 newlib math.h problem

Posted: Sun Oct 30, 2022 3:12 pm
by Raziel
The link works if you change the last 0 to 1.

dl=1 means the site won't load, instead it will immediately download the file