mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-15 04:32:24 +00:00
Do not use noreturn in C99 mode on Solaris Sudio cc (re: c4f980eb
)
If the -xc99 or -std=c99 flag is passed to Solaris Studio cc, the
build fails with a syntax error on the 'noreturn' keyword. That
keyword was introduced in the C11 standard; C99 does not have it.
The features/common test decides that we can use the 'noreturn'
optimization if the <stdnoreturn.h> header is present on the
system, but that is not correct; standards flags may disable it.
src/lib/libast/features/common:
- Remove two unused tests for extern and void*, all part of C90
which we now require (re: a1f5c992
).
- Add test that checks for 'noreturn' by compiling a test program.
- Use that test's result to decide whether to define 'noreturn' as
empty or not.
This commit is contained in:
parent
3a25aa0d93
commit
cd18b4f7f4
1 changed files with 8 additions and 11 deletions
|
@ -1,19 +1,16 @@
|
|||
iff AST_COMMON
|
||||
hdr pthread,stdarg,stddef,stdint,stdnoreturn,inttypes,types,unistd
|
||||
hdr pthread,stdarg,stddef,stdint,inttypes,types,unistd
|
||||
sys types
|
||||
typ long.double,size_t,ssize_t
|
||||
typ __va_list stdio.h
|
||||
|
||||
mac SF_APPEND,SF_CLOSE sys/stat.h sys/socket.h
|
||||
|
||||
std proto note{ standard C prototypes ok }end compile{
|
||||
extern int foo(int, int);
|
||||
bar() { foo(1, 1); }
|
||||
}end
|
||||
|
||||
tst ptr_void note{ standard C void* ok }end compile{
|
||||
extern void* foo();
|
||||
void* bar() { return foo(); }
|
||||
std noreturn note{ noreturn ok }end compile{
|
||||
#include <stdlib.h>
|
||||
#include <stdnoreturn.h>
|
||||
noreturn void foo(void) { exit(0); }
|
||||
int main(void) { foo(); }
|
||||
}end
|
||||
|
||||
cat{
|
||||
|
@ -70,7 +67,7 @@ cat{
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#if !_hdr_stdnoreturn
|
||||
#if !_std_noreturn
|
||||
#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4))
|
||||
#define noreturn __attribute__((noreturn))
|
||||
#else
|
||||
|
@ -78,7 +75,7 @@ cat{
|
|||
#endif /* __GNUC__ */
|
||||
#else
|
||||
#include <stdnoreturn.h>
|
||||
#endif /* _hdr_stdnoreturn */
|
||||
#endif /* _std_noreturn */
|
||||
}end
|
||||
|
||||
if tst - note{ <stdarg.h>+<wchar.h> works }end compile{
|
||||
|
|
Loading…
Reference in a new issue