On 18.09.2025 21:04, noneofyourbusiness wrote:
grischka <gris...@gmx.de> wrote:
Also, what's the problem with tcctest.c & musl there:
https://repo.or.cz/tinycc.git/commitdiff/8f23997ca7c7bd34756bbbae1f5363afec422907
  From the comment I can't figure out what it is.
      "despite being defined in tcc's own stddef.h, intended to be included by
      libtcc.h, libtcc.h actually included the libc's standard include"
???

I mean if things don't happen as indented then why don't you fix that?
I didn't come up with a better fix by that time.

But what problem were you trying to fix, in the first place ???

for one case it includes the system's, for another tinycc's - simply including 
stdint.h unconditionally breaks because of this:
        ------------ dlltest with PIC ------------
        Hello World
        ------------ cross-test ------------
         . i386
         In file included from tcctest.c:56:
         In file included from ../tcclib.h:10:
         ../include/stddef.h:8: error: incompatible redefinition of 'intptr_t'

That old define was there for uintptr_t, which is what stdint.h is for, 
stddef.h would be the wrong place.
An alternative solution (and, in my opinion, a more correct fix) would be to 
remove that definition from stddef (see 
https://en.cppreference.com/w/c/header/stddef):

Solution for what problem, again ???

--- a/include/stddef.h
+++ b/include/stddef.h
@@ -2,11 +2,8 @@
  #define _STDDEF_H

  typedef __SIZE_TYPE__ size_t;
  typedef __PTRDIFF_TYPE__ ssize_t;
  typedef __WCHAR_TYPE__ wchar_t;
  typedef __PTRDIFF_TYPE__ ptrdiff_t;
-typedef __PTRDIFF_TYPE__ intptr_t;
-typedef __SIZE_TYPE__ uintptr_t;

which works fine for compiling tcc, but when modified to unconditionally 
include stdint.h (otherwise it errors out because of missing typedef):
        ------------ cross-test ------------
         . i386
         . i386-win32
        tcctest.c:1: error: include file 'stdint.h' not found
which explains why it included tcc's own stddef.h - system includes are not 
searched?
should be fixable by modifying tests/Makefile

My suggestion would be to revert that commit, to remove (u)intptr_t from 
stddef.h, and to fix the makefile.

But what is wrong with "the makefile" ?

-- gr

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

Reply via email to