diff mbox series

[07/10] cmake (Windows): complain when encountering an unknown compiler

Message ID dddfa3a9b48fa24466a20952d485be1a7f515019.1601044118.git.gitgitgadget@gmail.com (mailing list archive)
State Superseded
Headers show
Series CMake and Visual Studio | expand

Commit Message

Jean-Noël Avila via GitGitGadget Sept. 25, 2020, 2:28 p.m. UTC
From: Johannes Schindelin <johannes.schindelin@gmx.de>

We have some custom handling regarding the link options, which are
specific to each compiler.

Therefore: let's not just continue without setting the link options when
configuring for a currently unhandled compiler, but error out.

Note: for some reason, the `invalidcontinue.obj` trick seems not to work
in this developer's hands when building Git in Debug mode: the assertion
dialog that is supposed to be suppressed still pops up, complaining
about the `entry` variable being uninitialized when it is used in
`config.c`'s line 1961.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 contrib/buildsystems/CMakeLists.txt | 2 ++
 1 file changed, 2 insertions(+)

Comments

Sibi Siddharthan Sept. 25, 2020, 5:29 p.m. UTC | #1
On Fri, Sep 25, 2020 at 7:58 PM Johannes Schindelin via GitGitGadget
<gitgitgadget@gmail.com> wrote:
>
> From: Johannes Schindelin <johannes.schindelin@gmx.de>
>
> We have some custom handling regarding the link options, which are
> specific to each compiler.
>
> Therefore: let's not just continue without setting the link options when
> configuring for a currently unhandled compiler, but error out.
>
> Note: for some reason, the `invalidcontinue.obj` trick seems not to work
> in this developer's hands when building Git in Debug mode: the assertion
> dialog that is supposed to be suppressed still pops up, complaining
> about the `entry` variable being uninitialized when it is used in
> `config.c`'s line 1961.

Does this happen when running Git under the Visual Studio debugger?
If so this might help
_CrtSetReportMode(_CRT_ASSERT,0);

After digging a bit more I found out that _CRTDBG_MODE_DEBUG is
environment sensitive.
It depends on how the debugger handles DbgPrintEx().

Thank You,
Sibi Siddharthan
Johannes Schindelin Sept. 26, 2020, 8:33 p.m. UTC | #2
Hi Sibi,

On Fri, 25 Sep 2020, Sibi Siddharthan wrote:

> On Fri, Sep 25, 2020 at 7:58 PM Johannes Schindelin via GitGitGadget
> <gitgitgadget@gmail.com> wrote:
> >
> > From: Johannes Schindelin <johannes.schindelin@gmx.de>
> >
> > We have some custom handling regarding the link options, which are
> > specific to each compiler.
> >
> > Therefore: let's not just continue without setting the link options when
> > configuring for a currently unhandled compiler, but error out.
> >
> > Note: for some reason, the `invalidcontinue.obj` trick seems not to work
> > in this developer's hands when building Git in Debug mode: the assertion
> > dialog that is supposed to be suppressed still pops up, complaining
> > about the `entry` variable being uninitialized when it is used in
> > `config.c`'s line 1961.
>
> Does this happen when running Git under the Visual Studio debugger?

Whoops. I meant to remove this paragraph after addressing that `run-time
check failure #3` problem.

Will remove it before sending the next iteration.

Thanks,
Dscho

> If so this might help
> _CrtSetReportMode(_CRT_ASSERT,0);
>
> After digging a bit more I found out that _CRTDBG_MODE_DEBUG is
> environment sensitive.
> It depends on how the debugger handles DbgPrintEx().
>
> Thank You,
> Sibi Siddharthan
>
>
diff mbox series

Patch

diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 5a4e0ccb01..d21849b730 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -620,6 +620,8 @@  if(WIN32)
 		target_link_options(common-main PUBLIC -municode -Wl,-nxcompat -Wl,-dynamicbase -Wl,-entry:wmainCRTStartup -Wl,invalidcontinue.obj)
 	elseif(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
 		target_link_options(common-main PUBLIC /IGNORE:4217 /IGNORE:4049 /NOLOGO /ENTRY:wmainCRTStartup /SUBSYSTEM:CONSOLE invalidcontinue.obj)
+	else()
+		message(FATAL_ERROR "Unhandled compiler: ${CMAKE_C_COMPILER_ID}")
 	endif()
 elseif(UNIX)
 	target_link_libraries(common-main pthread rt)