Skip to content

Commit

Permalink
apparently there is a macro
Browse files Browse the repository at this point in the history
I'll squash this back into the

  win32: detect ucrt versions of gcc and allow building with it

once it passes CI
  • Loading branch information
tonycoz committed Jul 12, 2023
1 parent 85b039f commit 73a6f54
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 19 deletions.
17 changes: 1 addition & 16 deletions win32/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -487,15 +487,6 @@ GCCVER2 := $(shell for /f "delims=. tokens=1,2,3" %%i in ('$(GCCBIN) -dumpversi
GCCVER3 := $(shell for /f "delims=. tokens=1,2,3" %%i in ('$(GCCBIN) -dumpversion') do echo %%k)
endif

# are we using UCRT or MSVCRT?
ifeq ($(CCTYPE),GCC)
CRT_TYPE := $(shell gcc --version 2>&1 | find "msvcrt" >nul && ( echo msvcrt) || ( echo ucrt) )
else ifeq ($(CCTYPE),MSVC120)
CRT_TYPE := msvcrt
else
CRT_TYPE := ucrt
endif

# Set the install location of the compiler headers/libraries.
# These are saved into $Config{incpath} and $Config{libpth}.
ifneq ($(GCCCROSS),)
Expand Down Expand Up @@ -786,11 +777,6 @@ TESTPREPGCC =

endif

ifeq ($(CRT_TYPE),ucrt)
BUILDOPT += -DPERL_WIN32_UCRT
MINIBUILDOPT += -DPERL_WIN32_UCRT
endif

CFLAGS_O = $(CFLAGS) $(BUILDOPT)

RSC_FLAGS =
Expand Down Expand Up @@ -1164,8 +1150,7 @@ ifeq ($(CCTYPE),GCC)
echo # WIN64=$(WIN64)&& \
echo # ARCHITECTURE=$(ARCHITECTURE)&& \
echo # ARCHNAME=$(ARCHNAME)&& \
echo # MAKE=$(PLMAKE) && \
echo # CRT_TYPE=$(CRT_TYPE)
echo # MAKE=$(PLMAKE)
else
@echo # CCTYPE=$(CCTYPE)&& \
echo # WIN64=$(WIN64)&& \
Expand Down
1 change: 0 additions & 1 deletion win32/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,6 @@ EXTRACFLAGS = -nologo -GF -W3
LIBC = msvcrt.lib
!ELSE
LIBC = ucrt.lib
DEFINES = $(DEFINES) -DPERL_WIN32_UCRT
!ENDIF

!IF "$(CFG)" == "Debug"
Expand Down
4 changes: 2 additions & 2 deletions win32/win32.h
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ extern const __declspec(selectany) union PerlNan __PL_nan_u = { 0x7FF80000000000
#endif /* ifdef _MSC_VER */

/* The CRT was rewritten in VS2015. */
#ifdef PERL_WIN32_UCRT
#ifdef _UCRT

/* No longer declared in stdio.h */
EXTERN_C char *gets(char* buffer);
Expand Down Expand Up @@ -297,7 +297,7 @@ typedef struct
#define PERLIO_FILE_flag(f) ((int)(((__crt_stdio_stream_data*)(f))->_flags))
#define PERLIO_FILE_file(f) (*(int*)(&((__crt_stdio_stream_data*)(f))->_file))

#else /* ifdef PERL_WIN32_UCRT */
#else /* ifdef _UCRT */

/* Note: PERLIO_FILE_ptr/base/cnt are not actually used for GCC or <VS2015
* since FILE_ptr/base/cnt do the same thing anyway but it doesn't hurt to
Expand Down

0 comments on commit 73a6f54

Please sign in to comment.