Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wchar_t and stddef.h mess #9

Open
sezero opened this issue Jul 3, 2021 · 0 comments
Open

wchar_t and stddef.h mess #9

sezero opened this issue Jul 3, 2021 · 0 comments

Comments

@sezero
Copy link

sezero commented Jul 3, 2021

Doing #include <stddef.h> without any -mcrt args or with -mcrt=libnix
includes /opt/m68k-amigaos/lib/gcc-lib/m68k-amigaos/2.95.4/include/stddef.h
i.e. the gcc-provided header (not the libnix one), which defines whar_t
as unsigned int (see gcc/config/m68k/amigaos.h for WCHAR_TYPE definition.)
However, libnix headers (apparently copied from ixemul) defines it as int,
i.e. signed, in machine/ansi.h.

Because of this, including stddef.h followed by stdlib.h results in an
error: (if the include order is flipped, no errors, though.)

$ /opt/m68k-amigaos/bin/m68k-amigaos-gcc -c 1.c
In file included from /opt/m68k-amigaos/lib/gcc-lib/m68k-amigaos/2.95.4/../../../../m68k-amigaos/sys-include/stdlib.h:40,
                 from 1.c:2:
/opt/m68k-amigaos/lib/gcc-lib/m68k-amigaos/2.95.4/../../../../m68k-amigaos/sys-include/machine/ansi.h:51: warning: `_BSD_PTRDIFF_T_' redefined
/opt/m68k-amigaos/lib/gcc-lib/m68k-amigaos/2.95.4/include/stddef.h:112: warning: this is the location of the previous definition
/opt/m68k-amigaos/lib/gcc-lib/m68k-amigaos/2.95.4/../../../../m68k-amigaos/sys-include/machine/ansi.h:52: warning: `_BSD_SIZE_T_' redefined
/opt/m68k-amigaos/lib/gcc-lib/m68k-amigaos/2.95.4/include/stddef.h:159: warning: this is the location of the previous definition
In file included from /opt/m68k-amigaos/lib/gcc-lib/m68k-amigaos/2.95.4/../../../../m68k-amigaos/sys-include/stdlib.h:43,
                 from 1.c:2:
/opt/m68k-amigaos/lib/gcc-lib/m68k-amigaos/2.95.4/../../../../m68k-amigaos/sys-include/sys/types.h:110: warning: redefinition of `size_t'
/opt/m68k-amigaos/lib/gcc-lib/m68k-amigaos/2.95.4/include/stddef.h:170: warning: `size_t' previously declared here
In file included from 1.c:2:
/opt/m68k-amigaos/lib/gcc-lib/m68k-amigaos/2.95.4/../../../../m68k-amigaos/sys-include/stdlib.h:52: conflicting types for `wchar_t'
/opt/m68k-amigaos/lib/gcc-lib/m68k-amigaos/2.95.4/include/stddef.h:255: previous declaration of `wchar_t'

Is there actually a reason why gcc defines whar_t as unsigned int?
The gcc-6 fork of @bebbo seems to define it as unsigned int, too.
However, amigaos4 gcc-4.2 defines it as long int, so does morphos
gcc-4.4 and aros.

I guess machine/ansi.h of libnix (ixemul) needs changing to follow
gcc for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant