mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
Add bare minimum functionality to compile C code and link on Windows. Explicitly label tests that are expected to work with `CFLAGS=-Ze`. Leave out documentation for now because this is not usable in general. Issue: #21536 Inspired-by: Serguei E. Leontiev <leo@sai.msu.ru>
19 lines
564 B
C
19 lines
564 B
C
#ifdef __POCC__
|
|
# pragma warn(disable : 2801) /* Store to a non-writable location. */
|
|
#endif
|
|
|
|
int main(int argc, char const* argv[])
|
|
{
|
|
#ifndef __clang_analyzer__ /* Suppress clang-analyzer warnings */
|
|
/* Construct an invalid address that cannot be predicted by the
|
|
compiler/optimizer, and that is not NULL (which is undefined
|
|
behavior to dereference). */
|
|
int volatile* invalidAddress = 0;
|
|
invalidAddress += argc ? 1 : 2;
|
|
(void)argv;
|
|
/* Write to the invalid address to cause SIGSEGV or similar. */
|
|
*invalidAddress = 0;
|
|
#endif
|
|
return 0;
|
|
}
|