mirror of
https://github.com/reactos/CMake.git
synced 2024-11-28 22:10:32 +00:00
4bc17345c0
Avoid warnings (and therefore build failures etc) if a user happens to add -Wstrict-prototypes to CFLAGS. | $ gcc --version | gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4 | | $ gcc -Wstrict-prototypes -Werror -DCHECK_FUNCTION_EXISTS=pthread_create -o foo.o -c Modules/CheckFunctionExists.c | Modules/CheckFunctionExists.c:7:3: error: function declaration isn't a prototype [-Werror=strict-prototypes] | CHECK_FUNCTION_EXISTS(); | ^ | cc1: all warnings being treated as errors | Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
29 lines
421 B
C
29 lines
421 B
C
#ifdef CHECK_FUNCTION_EXISTS
|
|
|
|
#ifdef __cplusplus
|
|
extern "C"
|
|
#endif
|
|
char
|
|
CHECK_FUNCTION_EXISTS(void);
|
|
#ifdef __CLASSIC_C__
|
|
int main()
|
|
{
|
|
int ac;
|
|
char* av[];
|
|
#else
|
|
int main(int ac, char* av[])
|
|
{
|
|
#endif
|
|
CHECK_FUNCTION_EXISTS();
|
|
if (ac > 1000) {
|
|
return *av[0];
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
#else /* CHECK_FUNCTION_EXISTS */
|
|
|
|
#error "CHECK_FUNCTION_EXISTS has to specify the function"
|
|
|
|
#endif /* CHECK_FUNCTION_EXISTS */
|