[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
improve clang support (26)
From: |
Bruno Haible |
Subject: |
improve clang support (26) |
Date: |
Sat, 15 Aug 2020 02:18:51 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-186-generic; KDE/5.18.0; x86_64; ; ) |
With clang on native Windows (i.e. the MSVC header files),
#include <stdlib.h>
#include <stdnoreturn.h>
works fine, but
#include <stdnoreturn.h>
#include <stdlib.h>
and
#include <stdnoreturn.h>
#include <process.h>
produce an error. The effect is that our configure test reports
checking for working stdnoreturn.h... yes
but then the compilation of the unit test fails. This patch fixes it.
2020-08-14 Bruno Haible <bruno@clisp.org>
stdnoreturn: Work around problem with MSVC/clang.
* m4/stdnoreturn.m4 (gl_STDNORETURN_H): On native Windows, include some
system header after <stdnoreturn.h>.
* doc/posix-headers/stdnoreturn.texi: Mention the issue.
diff --git a/doc/posix-headers/stdnoreturn.texi
b/doc/posix-headers/stdnoreturn.texi
index cb827dd..59eade7 100644
--- a/doc/posix-headers/stdnoreturn.texi
+++ b/doc/posix-headers/stdnoreturn.texi
@@ -13,6 +13,10 @@ Portability problems fixed by Gnulib:
@item
This header file is missing on many platforms:
FreeBSD 6.4, NetBSD 7.1, OpenBSD 3.8, Minix 3.3.0, AIX 7.1, HP-UX 11.31, IRIX
6.5, Solaris 11.3, Cygwin 2.9.0, mingw, MSVC 14, Android 9.0.
+@item
+This file conflicts with some system header files, such as @code{<stdlib.h>}
and
+@code{<process.h>}, on some platforms:
+MSVC/clang.
@end itemize
Portability problems not fixed by Gnulib:
diff --git a/m4/stdnoreturn.m4 b/m4/stdnoreturn.m4
index 5336a38..6a7aabf 100644
--- a/m4/stdnoreturn.m4
+++ b/m4/stdnoreturn.m4
@@ -24,6 +24,9 @@ AC_DEFUN([gl_STDNORETURN_H],
[AC_LANG_PROGRAM(
[[#include <stdlib.h>
#include <stdnoreturn.h>
+ #if defined _WIN32 && !defined __CYGWIN__
+ # include <process.h>
+ #endif
/* Do not check for 'noreturn' after the return type.
C11 allows it, but it's rarely done that way
and circa-2012 bleeding-edge GCC rejects it when given
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- improve clang support (26),
Bruno Haible <=