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

fix foreign test for i3nt #860

Merged
merged 1 commit into from
Aug 6, 2024
Merged

fix foreign test for i3nt #860

merged 1 commit into from
Aug 6, 2024

Conversation

mflatt
Copy link
Contributor

@mflatt mflatt commented Aug 3, 2024

For some build environments, _WIN32 is needed (as in other "foreign*.c" files) instead of WIN32 without the leading underscore.

@burgerrg
Copy link
Contributor

burgerrg commented Aug 6, 2024

Do you want to update mats/ftype.h too?

@mflatt
Copy link
Contributor Author

mflatt commented Aug 6, 2024

That seems like a good idea. It turns out that build.zuo goes out of its way to add -DWIN32 to FTYPE_CFLAGS, but it would be nicer to not do that.

For some build environments, `_WIN32` is needed in "foreign3.c" (as in
other "foreign*.c" files) instead of `WIN32` without the leading
underscore. Also, simplify "mats/build.zuo" by using `_WIN32` in
"ftype.h".
@burgerrg
Copy link
Contributor

burgerrg commented Aug 6, 2024

There are many other files in Chez Scheme that use WIN32 without the underscore:

c/compress-io.c:#ifdef WIN32
c/compress-io.c:#ifdef WIN32
c/compress-io.c:#ifdef WIN32
c/expeditor.c:#ifdef WIN32
c/expeditor.c:#else /* WIN32 */
c/expeditor.c:#endif /* WIN32 */
c/externs.h:#ifndef WIN32
c/externs.h:#ifdef WIN32
c/externs.h:#ifndef WIN32
c/externs.h:#endif /* WIN32 */
c/externs.h:#ifndef WIN32
c/externs.h:#endif /* WIN32 */
c/externs.h:#ifdef WIN32
c/externs.h:#ifdef WIN32
c/externs.h:#ifdef WIN32
c/externs.h:#ifdef WIN32
c/externs.h:#endif /* WIN32 */
c/fasl.c:#ifdef WIN32
c/fasl.c:#endif /* WIN32 */
c/fasl.c:#ifndef WIN32 /* msvc returns true for s_nan==s_nan! */
c/fasl.c:#ifdef WIN32
c/fasl.c:#else /* WIN32 */
c/fasl.c:#endif /* WIN32 */
c/fasl.c:  if (WIN32 && (unsigned int)nx != nx) nx = 0xffffffff;
c/foreign.c:#elif defined(WIN32)
c/foreign.c:#ifdef WIN32
c/foreign.c:#endif /* WIN32 */
c/foreign.c:#if defined(WIN32) || defined(HPUX)
c/gc.c:#ifndef WIN32
c/gc.c:#endif /* WIN32 */
c/gc.c:#ifndef WIN32
c/gc.c:#endif /* WIN32 */
c/gcwrapper.c:#ifndef WIN32
c/gcwrapper.c:#endif /* WIN32 */
c/gcwrapper.c:#ifndef WIN32
c/gcwrapper.c:#endif /* WIN32 */
c/gcwrapper.c:#ifndef WIN32
c/globals.h:#ifndef WIN32
c/globals.h:#endif /* WIN32 */
c/io.c:#ifdef WIN32
c/io.c:#else /* WIN32 */
c/io.c:#endif /* WIN32 */
c/io.c:#ifdef WIN32
c/io.c:#ifdef WIN32
c/io.c:#ifdef WIN32
c/io.c:#else /* WIN32 */
c/io.c:#endif /* WIN32 */
c/io.c:#ifdef WIN32
c/io.c:#ifdef WIN32
c/io.c:#ifdef WIN32
c/io.c:#else /* WIN32 */
c/io.c:#endif /* WIN32 */
c/io.c:#ifdef WIN32
c/io.c:#else /* WIN32 */
c/io.c:#endif /* WIN32 */
c/io.c:#ifdef WIN32
c/io.c:#else /* WIN32 */
c/io.c:#endif /* WIN32 */
c/io.c:#ifdef WIN32
c/io.c:#else /* WIN32 */
c/io.c:#endif /* WIN32 */
c/io.c:#ifdef WIN32
c/io.c:#else /* WIN32 */
c/io.c:#endif /* WIN32 */
c/main.c:#ifdef WIN32
c/main.c:#else /* WIN32 */
c/main.c:#endif /* WIN32 */
c/main.c:#if defined(WIN32) && !defined(__MINGW32__)
c/main.c:#else /* WIN32 */
c/main.c:#endif /* WIN32 */
c/main.c:#ifdef WIN32
c/new-io.c:#ifdef WIN32
c/new-io.c:#else /* WIN32 */
c/new-io.c:#endif /* WIN32 */
c/new-io.c:#ifdef WIN32
c/new-io.c:#ifdef WIN32
c/new-io.c:#else /* WIN32 */
c/new-io.c:#endif /* WIN32 */
c/new-io.c:  if ((WIN32 || gzflag) && (unsigned int)count != count) count = 0xffffffff;
c/new-io.c:#ifdef WIN32
c/new-io.c:#endif /* WIN32 */
c/new-io.c:#ifdef WIN32
c/new-io.c:#else /* WIN32 */
c/new-io.c:#endif /* WIN32 */
c/new-io.c:  if ((WIN32 || gzflag) && (unsigned int)cx != cx) cx = 0xffffffff;
c/new-io.c:#ifdef WIN32
c/new-io.c:#else /* WIN32 */
c/new-io.c:#endif /* WIN32 */
c/new-io.c:#ifdef WIN32
c/new-io.c:#else /* WIN32 */
c/new-io.c:#endif /* WIN32 */
c/new-io.c:#ifdef WIN32
c/new-io.c:#endif /* WIN32 */
c/number.c:# ifdef WIN32
c/prim5.c:#ifdef WIN32
c/prim5.c:#ifdef WIN32
c/prim5.c:#ifdef WIN32
c/prim5.c:#ifdef WIN32
c/prim5.c:#ifdef WIN32
c/prim5.c:#else /* WIN32 */
c/prim5.c:#endif /* WIN32 */
c/prim5.c:#ifdef WIN32
c/prim5.c:#endif /* WIN32 */
c/prim5.c:#ifdef WIN32
c/prim5.c:#else /* WIN32 */
c/prim5.c:#endif /* WIN32 */
c/prim5.c:#ifdef WIN32
c/prim5.c:#else /* WIN32 */
c/prim5.c:#endif /* WIN32 */
c/prim5.c:#ifdef WIN32
c/prim5.c:#else /* WIN32 */
c/prim5.c:#endif /* WIN32 */
c/prim5.c:#ifdef WIN32
c/prim5.c:#else /* WIN32 */
c/prim5.c:#endif /* WIN32 */
c/prim5.c:#ifdef WIN32
c/prim5.c:#else /* WIN32 */
c/prim5.c:#endif /* WIN32 */
c/prim5.c:#ifdef WIN32
c/prim5.c:#else /* WIN32 */
c/prim5.c:#endif /* WIN32 */
c/prim5.c:#ifdef WIN32
c/prim5.c:#else /* WIN32 */
c/prim5.c:#endif /* WIN32 */
c/prim5.c:#ifdef WIN32
c/prim5.c:#else /* WIN32 */
c/prim5.c:#endif /* WIN32 */
c/prim5.c:#ifdef WIN32
c/prim5.c:#ifdef WIN32
c/prim5.c:#else /* WIN32 */
c/prim5.c:#endif /* WIN32 */
c/prim5.c:#ifdef WIN32
c/prim5.c:#ifdef WIN32
c/prim5.c:#ifdef WIN32
c/prim5.c:#else /* WIN32 */
c/prim5.c:#endif /* WIN32 */
c/prim5.c:#ifdef WIN32
c/prim5.c:#else /* WIN32 */
c/prim5.c:#endif /* WIN32 */
c/prim5.c:#elif defined(WIN32)
c/prim5.c:#ifdef WIN32
c/prim5.c:#endif /* WIN32 */
c/prim5.c:#ifdef WIN32
c/prim5.c:#endif /* WIN32 */
c/prim5.c:#ifdef WIN32
c/prim5.c:#endif /* WIN32 */
c/prim5.c:#ifdef WIN32
c/scheme.c:#ifdef WIN32
c/scheme.c:#ifndef WIN32
c/scheme.c:#ifndef WIN32
c/scheme.c:#elif defined(WIN32) && !defined(__MINGW32__)
c/scheme.c:#ifdef WIN32
c/scheme.c:#ifdef WIN32
c/scheme.c:#else /* not WIN32: */
c/scheme.c:#endif /* WIN32 */
c/scheme.c:#ifdef WIN32
c/scheme.c:#ifdef WIN32
c/scheme.c:#endif /* WIN32 */
c/scheme.c:#ifdef WIN32
c/scheme.c:#ifdef WIN32
c/schsig.c:#ifdef WIN32
c/schsig.c:#else /* WIN32 */
c/schsig.c:#endif /* WIN32 */
c/schsig.c:#ifndef WIN32
c/self-exe.c:#ifndef WIN32
c/self-exe.c:#  define WIN32
c/self-exe.c:#ifdef WIN32
c/self-exe.c:#else /* WIN32 */
c/self-exe.c:#endif /* WIN32 */
c/stats.c:#ifdef WIN32
c/stats.c:#else /* WIN32 */
c/stats.c:#ifdef WIN32
c/stats.c:#elif defined(USE_DEV_URANDOM_UUID) /* WIN32 */
c/stats.c:#endif /* WIN32 */
c/stats.c:#ifdef WIN32
c/stats.c:#else /* WIN32 */
c/stats.c:#endif /* WIN32 */
c/stats.c:#ifdef WIN32
c/stats.c:#ifdef WIN32
c/version.h:#ifdef WIN32
csug/foreign.stex:#ifdef WIN32
csug/foreign.stex:#ifdef WIN32
mats/foreign3.c:#ifndef WIN32
mats/foreign3.c:#ifdef WIN32
mats/foreign3.c:#endif /* WIN32 */
mats/ftype.h:#ifdef WIN32

@burgerrg
Copy link
Contributor

burgerrg commented Aug 6, 2024

Would it make more sense to convert the few _WIN32 cases to use WIN32, and then make sure WIN32 is defined in all the build environments?

boot/pb/scheme.h:#ifdef _WIN32
mats/foreign1.c:#ifdef _WIN32
mats/foreign1.c:#ifdef _WIN32
mats/foreign2.c:#ifdef _WIN32
mats/foreign2.c:#ifdef _WIN32
mats/foreign3.c:#ifdef _WIN32
mats/foreign4.c:#ifdef _WIN32
mats/foreign4.c:# ifdef _WIN32
mats/foreign4.c:#ifdef _WIN32
mats/foreign4.c:#elif defined(_WIN32)
mats/foreign4.c:#if defined(_WIN32)
s/mkheader.ss:        (pr "#ifdef _WIN32~%")

@burgerrg
Copy link
Contributor

burgerrg commented Aug 6, 2024

Microsoft documents _WIN32, so maybe it would make more sense to convert all the WIN32 instances to _WIN32?

https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=msvc-170

@mflatt
Copy link
Contributor Author

mflatt commented Aug 6, 2024

The build issues for files that make up the kernel are a little different than for files for tests (e.g., tests don't need to cross-compile, and they don't need the various linking modes that the kernel might be compiled for on Windows). I'm inclined to leave things alone in the "c" directory, because C-level build changes so often have surprises. That said, I do think it would make sense switch to _WIN32, and I wouldn't object to that direction if moving to _WIN32 seems significantly better to you and others.

@burgerrg
Copy link
Contributor

burgerrg commented Aug 6, 2024

Let's fix the ones in mats to use _WIN32 and leave WIN32 for the rest. That shouldn't rock the boat. The ones in csug work because the example compiler command uses -DWIN32.

@mflatt
Copy link
Contributor Author

mflatt commented Aug 6, 2024

Sounds great to me - thanks!

@mflatt mflatt merged commit 6822651 into cisco:main Aug 6, 2024
15 checks passed
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

Successfully merging this pull request may close these issues.

2 participants