tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] __fp_unordered_compare defined twice on Windows


From: Christian Jullien
Subject: Re: [Tinycc-devel] __fp_unordered_compare defined twice on Windows
Date: Sun, 8 Dec 2013 09:24:32 +0100

Jared,

The file is in win32/include/math.h
It contains two times the exact same inline definition which is obviously an
error for any C compiler.

To me, all code from line 734 to 778 is duplicated from line 669 and should
be removed.
This file, as copyright notice says, is part of the w64 mingw-runtime
package.
However, math.h from 4.8.0 w64 mingw-runtime is similar but bigger (1056
lines V.S. 782). If it also contains the same __fp_unordered_compare inline
definition, at least this one is defined only once.
I suspect math.h from tcc is a very old copy of (buggy?) mingw and only
recently tcc protests when the same inline definition is seen twice, which
is the correct C behavior.

Easy fix: remove the second definition from current math.h in tcc.
Little bit harder (because it requires tests on all tcc supported
platforms), use newer version from mingw (and maybe also other *.h stolen
from this nice project).

The general question behind this bug is how tcc maintains *.h for Windows? I
vote for sharing those files with mingw.

M2c

Christian


-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of Jared
Maddox
Sent: dimanche 8 décembre 2013 04:16
To: address@hidden
Subject: Re: [Tinycc-devel] __fp_unordered_compare defined twice on Windows

> Date: Sat, 7 Dec 2013 16:48:17 +0000 (GMT)
> From: Rob <address@hidden>
> To: address@hidden
> Subject: Re: [Tinycc-devel] __fp_unordered_compare defined twice on
>       Windows
> Message-ID: <address@hidden>
> Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"
>
> So it looks like the bad commit is
> 76cb1144ef91924c53c57ea71e6f67ce73ce1cc6. I can't remember but they're 
> inline functions, and I think the standard allows two definitions - an 
> inline one and an extern one.
>
> I've attached a quick fix that modifies the header, but I suspect the 
> proper fix is the function inline redefinition logic in tcc.
>
> "An inline definition does not provide an external definition for the 
> function, and does not forbid an external definition in another 
> translation unit. An inline definition provides an alternative to an 
> external definition, which a translator may use to implement any call 
> to the function in the same translation unit. It is unspecified 
> whether a call to the function uses the inline definition or the 
> external definition." - C99, 6.7.4
>

Couldn't see the file (might be a Javascript filter on my end), but were
there two definitions of the function in the preprocessed source?
That bit of the standard reads to me as if it doesn't explicitly allow two
definitions in the same preprocessed source, just in the finished
executable. By the looks of it, it's aimed at allowing headers to have a
preprocessor switch that chooses between inlines and prototypes, so that
could be the catch.

_______________________________________________
Tinycc-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/tinycc-devel




reply via email to

[Prev in Thread] Current Thread [Next in Thread]