Re: [Tinycc-devel] minor patches + standard compliant inline functions

2019-06-17 Thread Michael Matz
Hi,

On Mon, 17 Jun 2019, Christian Jullien wrote:

> Your patch gives many new warnings when I do a reproducible tcc build on

Aha!  That is the reason why that warning was conditional on !VT_INLINE 
(which in the abstract doesn't make sense and I removed that).  Gnah, so 
this is all a bit between a rock and a hard place.  The mingw headers do 
this:

  PVOID GetFiberData(void);
  __CRT_INLINE PVOID GetFiberData(void) {}

The mingw headers are (and _mingw.h before the patch was) written with 
gnu-inline behaviour in mind, so __CRT_INLINE is "extern inline 
__attribute__((gnu-inline))", and that's then okay.

Now with C99 inline behaviour __CRT_INLINE has to be "static inline", but 
can't be, and there are actually no valid choices for it anymore:
* it can't be "extern inline", because that emits a global instantiation
  of all these inlines, creating multiple def errors when e.g. linking
  together two .c files that include windows.h
* it can't be "inline" (without extern or static), because in C99 inline 
  semantics there _must_ be an external definition somewhere in a program, 
  when the respective function is used (and the definition in the header 
  would not be one); that could potentially be visible when taking the 
  address of such function.  But mingw isn't written in a way to provide
  such external definition, and we can't change this with only header 
  hackery.
* it can't be "static inline", because that's simply not allowed given
  the above declaration (actually this shouldn't be just a warning but a 
  hard error).

So, ..., hmmm.  Gnah!  But I said that already.

I don't see another way than to add back an implementation for the 
gnu-inline behaviour and activate it via an attribute.  If noone has an 
better idea I'm going to work on that :-/

> But, more annoying it now terminates with:
> 
> ./include/winapi/winnt.h:1141: error: 'ExChange' undeclared

Uhh, that's a nice one.  There are two decls for the function in question:

__CRT_INLINE PVOID InterlockedCompareExchangePointer(
 PVOID volatile *Destination,PVOID ExChange,PVOID Comperand) {}

(the definition) and then later from winbase.h:

PVOID _InterlockedCompareExchangePointer(
 PVOID volatile *Destination,PVOID Exchange,PVOID Comperand);

Spot the difference! ;-)  It's wrong of TCC to take the names from the 
non-definition, I've fixed this in mob.  I've also added back the hack of 
ignoring the warning when inline is given until gnu-inline is implemented 
again.


Ciao,
Michael.

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


Re: [Tinycc-devel] test 104 fails on windows: missing mkstemps

2019-06-17 Thread Christian Jullien
Yes it has been previously reported.

 

Michael, as said in a private mail, I agree with you that this test should be 
skipped on Windows.

 

C.

 

From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=orange...@nongnu.org] On 
Behalf Of avih
Sent: Monday, June 17, 2019 22:46
To: Tinycc-devel Mailing List
Subject: [Tinycc-devel] test 104 fails on windows: missing mkstemps

 

Test 104 log on windows (both tcc32 and tcc 64):

 

Test: 104_inline_test...
--- 104_inline_test.expect  2019-06-17 23:42:00.162697100 +0300
+++ 104_inline_test.output  2019-06-17 23:42:35.531550400 +0300
@@ -1,25 +1,2 @@
-extern_extern_postdeclared
-extern_extern_postdeclared2
-extern_extern_predeclared
-extern_extern_predeclared2
-extern_extern_prepostdeclared
-extern_extern_prepostdeclared2
-extern_extern_undeclared
-extern_extern_undeclared2
-extern_postdeclared
-extern_postdeclared2
-extern_predeclared
-extern_predeclared2
-extern_prepostdeclared
-extern_undeclared
-extern_undeclared2
-inst2_extern_inline_postdeclared
-inst2_extern_inline_predeclared
-inst3_extern_inline_predeclared
-inst_extern_inline_postdeclared
-inst_extern_inline_predeclared
-main
-noinst_extern_inline_func
-noinst_extern_inline_postdeclared
-noinst_extern_inline_postdeclared2
-noinst_extern_inline_undeclared
+104_inline_test.c:30: warning: implicit declaration of function 'mkstemps'
+tcc: error: undefined symbol 'mkstemps'
make[1]: *** [Makefile:70: 104_inline_test.test] Error 1
Test: 105_local_extern...
make[1]: Target 'all' not remade because of errors.

 

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


Re: [Tinycc-devel] test 104 fails on windows: missing mkstemps

2019-06-17 Thread avih
Wouldn't it be better to just create a known/fixed file instead? (assuming the 
test doesn't need explicitly mkstemps, I didn't look at its actual code).
 

On Monday, June 17, 2019 11:50 PM, Christian Jullien  
wrote:
 

 #yiv8167816049 #yiv8167816049 -- _filtered #yiv8167816049 
{font-family:Helvetica;panose-1:2 11 6 4 2 2 2 2 2 4;} _filtered #yiv8167816049 
{font-family:Helvetica;panose-1:2 11 6 4 2 2 2 2 2 4;} _filtered #yiv8167816049 
{font-family:Calibri;panose-1:2 15 5 2 2 2 4 3 2 4;} _filtered #yiv8167816049 
{font-family:Tahoma;panose-1:2 11 6 4 3 5 4 4 2 4;}#yiv8167816049 
#yiv8167816049 p.yiv8167816049MsoNormal, #yiv8167816049 
li.yiv8167816049MsoNormal, #yiv8167816049 div.yiv8167816049MsoNormal 
{margin:0in;margin-bottom:.0001pt;font-size:12.0pt;font-family:New;}#yiv8167816049
 a:link, #yiv8167816049 span.yiv8167816049MsoHyperlink 
{color:blue;text-decoration:underline;}#yiv8167816049 a:visited, #yiv8167816049 
span.yiv8167816049MsoHyperlinkFollowed 
{color:purple;text-decoration:underline;}#yiv8167816049 
span.yiv8167816049EmailStyle17 {color:#1F497D;}#yiv8167816049 
.yiv8167816049MsoChpDefault {font-size:10.0pt;} _filtered #yiv8167816049 
{margin:1.0in 1.0in 1.0in 1.0in;}#yiv8167816049 div.yiv8167816049WordSection1 
{}#yiv8167816049 Yes it has been previously reported.  Michael, as said in a 
private mail, I agree with you that this test should be skipped on Windows.  C. 
 From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=orange...@nongnu.org] 
On Behalf Of avih
Sent: Monday, June 17, 2019 22:46
To: Tinycc-devel Mailing List
Subject: [Tinycc-devel] test 104 fails on windows: missing mkstemps  Test 104 
log on windows (both tcc32 and tcc 64):  Test: 104_inline_test...
--- 104_inline_test.expect  2019-06-17 23:42:00.162697100 +0300
+++ 104_inline_test.output  2019-06-17 23:42:35.531550400 +0300
@@ -1,25 +1,2 @@
-extern_extern_postdeclared
-extern_extern_postdeclared2
-extern_extern_predeclared
-extern_extern_predeclared2
-extern_extern_prepostdeclared
-extern_extern_prepostdeclared2
-extern_extern_undeclared
-extern_extern_undeclared2
-extern_postdeclared
-extern_postdeclared2
-extern_predeclared
-extern_predeclared2
-extern_prepostdeclared
-extern_undeclared
-extern_undeclared2
-inst2_extern_inline_postdeclared
-inst2_extern_inline_predeclared
-inst3_extern_inline_predeclared
-inst_extern_inline_postdeclared
-inst_extern_inline_predeclared
-main
-noinst_extern_inline_func
-noinst_extern_inline_postdeclared
-noinst_extern_inline_postdeclared2
-noinst_extern_inline_undeclared
+104_inline_test.c:30: warning: implicit declaration of function 'mkstemps'
+tcc: error: undefined symbol 'mkstemps'
make[1]: *** [Makefile:70: 104_inline_test.test] Error 1
Test: 105_local_extern...
make[1]: Target 'all' not remade because of errors.  

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


[Tinycc-devel] ANSI C refers to which standard , C89 or C99?

2019-06-17 Thread Paul Jiao
Hi All,
 TinyCC claims it fully supports ANSI C, does it mean the first
standard from ANSI for C language:  ANSI X3 ?  which was referred as C89
from wiki page: https://en.wikipedia.org/wiki/ANSI_C
 I know TinyCC does not fully support ISO C99.

 Please help clarify.
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel