Project

General

Profile

Bug #5423

poll.h incompatible with gcc -std=c99

Added by Geoff Adams almost 6 years ago. Updated about 5 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Start date:
2014-12-10
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:

Description

It seems that sys/signal.h does not define sigset_t in standard C mode. Here is a very quick way to demonstrate the problem:

echo "#include <poll.h>" > /tmp/polltest.c
gcc -std=c99 /tmp/polltest.c

You'll see this error:

In file included from /tmp/polltest.c:1:0:
/usr/include/poll.h:51:18: error: unknown type name 'sigset_t'

poll.h does include <signal.h>, which includes <sys/signal.h>, which in turn defines sigset_t. However, the definition of sigset_t is wrapped in:

#if defined(EXTENSIONS) || defined(KERNEL) || !defined(_STRICT_STDC) || \\
defined(
_XOPEN_OR_POSIX)

I imagine that that's what's preventing this from working in c99 mode, and I'm not sure the correct way to deal with this.

History

#1

Updated by Joshua M. Clulow over 5 years ago

  • Project changed from site to illumos gate
#2

Updated by Gary Mills over 5 years ago

On the web, I've seen the same question asked about Linux. The underlying reason in both cases is that sigset_t is not a part of the C99 standard, the one enforced by `gcc -std=c99'. It's an extension to the standard. Probably the best thing to do in both cases is to compile with `gcc -std=c99 -D_XOPEN_SOURCE=600'.

I'd recommend that this bug report be closed, as there is no real bug here.

#3

Updated by Geoff Adams over 5 years ago

But shouldn't the system's own poll.h be not broken by C99 mode? Or is your argument that the interface exposed by poll.h is also not covered by the C99 standard, and so poll.h doesn't even have to parse in C99 mode?

Thanks for taking the time to weight in.

#4

Updated by Peter Tribble about 5 years ago

I keep hitting variations of this issue while building applications.

The fundamental problem is that the guards around the definition of sigset_t differ from the guards around the consumers of sigset_t. We should at least be consistent.

Also available in: Atom PDF