Hi, Christian Jullien. Thanks for the feedback. I don't have a Windows setup for tinycc to test it on right now, but from a cursory glance, __CRT_INLINE is defined as `extern __inline__` in ./win32/include/_mingw.h. Before the patch, extern __inline__ would create static functions (and only if the function was later referenced). After the patch, it'll unconditionally instantiate the function (as an extern). I think redefining it to `__CRT_INLINE` `static __inline__` might fix the problem.
I'll try and get a tinycc build working on windows and see if it helps. Cheers, Petr S. On 6/12/19 11:10 AM, Christian Jullien wrote: > More specifically this one: "standard conformant inline functions" > > -----Original Message----- > From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=orange...@nongnu.org] > On Behalf Of Christian Jullien > Sent: Wednesday, June 12, 2019 07:20 > To: jull...@eligis.com; tinycc-devel@nongnu.org > Subject: Re: [Tinycc-devel] minor patches + standard compliant inline > functions > > Ooops, trying to compile tcc (after tcc has been compiled a first time) on > Windows with your recent patch (and w/o uchar.h), I now get: > > Building lib/libtcc1-32.a with tcc -m32 > ./include/winapi/winnt.h:1478: error: invalid operand reference after % > > Here: > #if(defined(_X86_) && !defined(__x86_64)) > __CRT_INLINE VOID MemoryBarrier(VOID) { > LONG Barrier; > __asm__ __volatile__("xchgl %eax,%0 " > :"=r" (Barrier)); > } > > > Here is the final version of uchar.h I'll push if nobody complains > > win32/include/uchar.h: > > /** > * This file has no copyright assigned and is placed in the Public Domain. > * This file is part of the TinyCC package. > * No warranty is given; refer to the file DISCLAIMER within this package. > */ > > #ifndef _INC_UCHAR > #define _INC_UCHAR > > /* > * The following defines are only valid when C11 (-std=c11) is used. > */ > > #if __STDC_VERSION__ >= 201112L > /** > * __STDC_UTF_16__ The integer constant 1, intended to indicate that > * values of type char16_t are UTF-16 encoded. > */ > #define __STDC_UTF_16__ 1 > /** > * __STDC_UTF_32__ The integer constant 1, intended to indicate that > * values of type char32_t are UTF-32 encoded. > */ > #define __STDC_UTF_32__ 1 > > typedef unsigned short char16_t; > typedef unsigned int char32_t; > #endif /* __STDC_VERSION__ */ > #endif /* _INC_UCHAR */ > > -----Original Message----- > From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=orange...@nongnu.org] > On Behalf Of Christian Jullien > Sent: Wednesday, June 12, 2019 06:49 > To: tinycc-devel@nongnu.org > Subject: Re: [Tinycc-devel] minor patches + standard compliant inline > functions > > Thanks for your patch, > FYI, for Windows compatibility: > > turn -fdollars-in-identifiers on by default is Ol as it also applies to cl on > Windows (the old VMS days :o) > Also ok to remove __STDC_ISO_10646__ as is not defined on Windows too. > > Please note that a conforming C11 implementation should have <uchar.h> which > is missing on Windows includes. Among others, on Windows it defines both: > > __STDC_UTF_16_ _ The integer constant 1, intended to indicate that values of > type char16_t are UTF−16 encoded. If some other encoding is used, the macro > shall not be defined and the actual encoding used is implementation defined. > > __STDC_UTF_32_ _ The integer constant 1, intended to indicate that values of > type char32_t are UTF−32 encoded. If some other encoding is used, the macro > shall not be defined and the actual encoding used is implementation defined. > > To make tcc more C11 compatible on Windows, I propose to add to the win32 > directory this file: > > win32/include/uchar.h: > > /** > * This file has no copyright assigned and is placed in the Public Domain. > * This file is part of the TinyCC package. > * No warranty is given; refer to the file DISCLAIMER within this package. > */ > > /** > * __STDC_UTF_16__ The integer constant 1, intended to indicate that values > of type char16_t are UTF−16 encoded. > */ > #define __STDC_UTF_16__ 1 > /** > * __STDC_UTF_32__ The integer constant 1, intended to indicate that values > of type char32_t are UTF−32 encoded. > */ > #define __STDC_UTF_32__ 1 > > typedef unsigned short char16_t; > typedef unsigned int char32_t; > > > > -----Original Message----- > From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=orange...@nongnu.org] > On Behalf Of Petr Skocík > Sent: Tuesday, June 11, 2019 16:41 > To: tinycc-devel@nongnu.org > Subject: [Tinycc-devel] minor patches + standard compliant inline functions > > Hi, > > I've pushed a bunch of patches to tinycc. > > > The first three: > > - turn -fdollars-in-identifiers on by default (gcc/clang do it too) > - in c11 mode, skip __STDC_ISO_10646__ (was causing a redefinition > warning in simple hello world programs compiled on linux with -std=c11) > - make -h|-hh succeed if the output is successfully written > > are small and should be noncontroversial. > > The last one is largish and I welcome any input on it. > > The issue was that tinycc's implementation of non-static inline > functions was very much nonconforming in terms of when > visible symbols would or would not be created. By looking at the at the > mailing list archive, it looks like it was discussed in 2013 but nothing > was done about it. > > The supplied patch should be fixing it. > > Best regards, > > Petr Skocik > > _______________________________________________ > Tinycc-devel mailing list > Tinycc-devel@nongnu.org > https://lists.nongnu.org/mailman/listinfo/tinycc-devel > > > _______________________________________________ > Tinycc-devel mailing list > Tinycc-devel@nongnu.org > https://lists.nongnu.org/mailman/listinfo/tinycc-devel > > > _______________________________________________ > Tinycc-devel mailing list > Tinycc-devel@nongnu.org > https://lists.nongnu.org/mailman/listinfo/tinycc-devel > > > _______________________________________________ > Tinycc-devel mailing list > Tinycc-devel@nongnu.org > https://lists.nongnu.org/mailman/listinfo/tinycc-devel > _______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel