Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 161296 - Extraneous #define from ctype.h
Summary: Extraneous #define from ctype.h
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: glibc
Version: 4
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-06-22 03:35 UTC by Ralph Loader
Modified: 2007-11-30 22:11 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-06-22 15:40:42 UTC


Attachments (Terms of Use)

Description Ralph Loader 2005-06-22 03:35:59 UTC
Description of problem:

When _BSD_SOURCE is defined, <ctype.h> defines extraneous macros such as BIG_ENDIAN.

Version-Release number of selected component (if applicable):

glibc-2.3.5-10

Steps to Reproduce:

Compile the following:

#define _BSD_SOURCE
#include <ctype.h>
#define BIG_ENDIAN NO

Actual results:

/home/rloader/temp.c:3:1: warning: "BIG_ENDIAN" redefined
In file included from /usr/include/ctype.h:41,
                 from /home/rloader/temp.c:2:
/usr/include/endian.h:47:1: warning: this is the location of the previous definition


Expected results:

I don't think that there should be a warning;  ctype.h shouldn't be defining
BIG_ENDIAN even with _BSD_SOURCE - at least it doesn't on modern BSD systems as
far as I can see.  (Apologies if that is indeed intended).

Comment 1 Jakub Jelinek 2005-06-22 08:24:43 UTC
I don't think _BSD_SOURCE has similar rigorous namespace requirements as _XOPEN*,
because no standard is defining the namespace.
<ctype.h> needs <endian.h> for the bit testing macros in that header.
If there was a standard that required <ctype.h> must not include <endian.h>,
then the solution would be obvious, play with __need_* macros in endian.h
like some other headers do.  But for _BSD_SOURCE, this is not that obvious
something like that is really needed.

Comment 2 Ulrich Drepper 2005-06-22 15:40:42 UTC
There are no namespace guarantees for anything but POSIX and x/open modes.

Comment 3 Ralph Loader 2005-06-22 21:10:26 UTC
Compiling as C++ with _XOPEN_SOURCE and without _BSD_SOURCE also gives the
warning.  Is it intended to give namespace guarentees in that case?

$ cat temp.cc
// Compile as C++
#include <ctype.h>
#define BIG_ENDIAN NO

$ g++ -D_XOPEN_SOURCE=600 -c temp.cc
temp.cc:3:1: warning: "BIG_ENDIAN" redefined
In file included from /usr/include/ctype.h:41,
                 from temp.cc:2:
/usr/include/endian.h:47:1: warning: this is the location of the previous definition


Comment 4 Jakub Jelinek 2005-06-22 21:14:00 UTC
That's because g++ (at the moment) implies _GNU_SOURCE, which has no namespace
guarantees either.


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