Bug 4590 - Defining _POSIX_ breaks math.h
Defining _POSIX_ breaks math.h
Product: Red Hat Raw Hide
Classification: Retired
Component: glibc (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Cristian Gafton
Depends On:
  Show dependency treegraph
Reported: 1999-08-18 13:05 EDT by mcfarlan
Modified: 2008-05-01 11:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 1999-08-27 19:43:00 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description mcfarlan 1999-08-18 13:05:24 EDT
It seems that due to recent changes in glibc, defining
_POSIX_ in a C source file that includes math.h will cause
parsing of math.h to fail.  A minimal example:

#define _POSIX_

#include <stdio.h>
#include <math.h>

int main()
  printf("y = %g\n", sin(1.5));
  return 0;

If I compile this via

    cc -Wall -lm foo.c -o foo

I get the error message

    In file included from foo.c:4:
    /usr/include/math.h:241: parse error before `,'

But if I delete the line #define _POSIX_, this code compiles
and runs.

At a glance, I suspect that _ISOC_ on line 242 of
/usr/include/math.h is not always defined.

I'm running RH 6.0 on a Pentium with a kernel built from the
2.2.11-1 sources.  glibc and glibc-devel are version 2.1.2-4
from rawhide.
Comment 1 Cristian Gafton 1999-08-27 19:43:59 EDT
_POSIX_ is a reserved identifier by the ISO C 98

Note You need to log in before you can comment on or make changes to this bug.