public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/2633] New: _GLIBCPP_USE_NAMESPACES issues
@ 2006-05-02 17:08 marc dot glisse at normalesup dot org
2007-02-17 18:44 ` [Bug libc/2633] " drepper at redhat dot com
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: marc dot glisse at normalesup dot org @ 2006-05-02 17:08 UTC (permalink / raw)
To: glibc-bugs
Hello,
I tried to define the _GLIBCPP_USE_NAMESPACES macro for c++ and hit several
problems. Here are some of them (I should have taken notes...).
In stdio.h, there is "typedef struct _IO_FILE FILE;" in namespace std, but
struct _IO_FILE has not been declared yet so the compiler assumes it is in
namespace std and later refuses to convert stdout to a std::FILE*. It would be
sufficient to declare _IO_FILE (in the global namespace) before this typedef.
pthread.h declares __jmp_buf_tag in the global namespace but setjmp.h declares
it in namespace std. This means the declarations for __sigsetjmp that follow
don't match.
locale.h: I believe __BEGIN_NAMESPACE_STD could be moved before the definition
of struct lconv.
In wchar.h, I can read there is a workaround for gcc stddef.h that puts wint_t
in the global namespace, but if I modify stddef.h to put wint_t in namespace std
and define _WINT_T, the functions declared in namespace __c99 or in the global
namespace have trouble with wint_t not being visible.
wchar.h: the declaration of struct tm looks like this:
__BEGIN_NAMESPACE_STD
struct tm;
__USING_NAMESPACE_STD(tm)
__END_NAMESPACE_STD
My guess is that the last 2 lines are in the wrong order.
Functions like wcscpy, wcscat or wcscmp should be in namespace std, not __c99.
I almost started my tests by replacing __c99 by std in sys/cdefs.h to remove
some errors. I was surprised to see __c99 was not made a subnamespace of std
(and there is no using namespace std in __c99), but I guess there are reasons.
--
Summary: _GLIBCPP_USE_NAMESPACES issues
Product: glibc
Version: 2.4
Status: NEW
Severity: minor
Priority: P3
Component: libc
AssignedTo: drepper at redhat dot com
ReportedBy: marc dot glisse at normalesup dot org
CC: glibc-bugs at sources dot redhat dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=2633
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug libc/2633] _GLIBCPP_USE_NAMESPACES issues
2006-05-02 17:08 [Bug libc/2633] New: _GLIBCPP_USE_NAMESPACES issues marc dot glisse at normalesup dot org
@ 2007-02-17 18:44 ` drepper at redhat dot com
2007-02-19 17:09 ` marc dot glisse at normalesup dot org
2007-10-07 20:30 ` drepper at redhat dot com
2 siblings, 0 replies; 4+ messages in thread
From: drepper at redhat dot com @ 2007-02-17 18:44 UTC (permalink / raw)
To: glibc-bugs
------- Additional Comments From drepper at redhat dot com 2007-02-17 18:43 -------
I've fixed a number of things. Most of the wchar.h changes you request I did
not do. You have to provide concrete evidence that what you describe is a real
problem on a modern system and that it is required. Reopen the bug in case you
want to provide the information.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://sourceware.org/bugzilla/show_bug.cgi?id=2633
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug libc/2633] _GLIBCPP_USE_NAMESPACES issues
2006-05-02 17:08 [Bug libc/2633] New: _GLIBCPP_USE_NAMESPACES issues marc dot glisse at normalesup dot org
2007-02-17 18:44 ` [Bug libc/2633] " drepper at redhat dot com
@ 2007-02-19 17:09 ` marc dot glisse at normalesup dot org
2007-10-07 20:30 ` drepper at redhat dot com
2 siblings, 0 replies; 4+ messages in thread
From: marc dot glisse at normalesup dot org @ 2007-02-19 17:09 UTC (permalink / raw)
To: glibc-bugs
------- Additional Comments From marc dot glisse at normalesup dot org 2007-02-19 17:09 -------
Thank you for the fixes. About wchar.h, the c++ standard, in the description of
cwchar, talks about wcscpy, wcsncpy, wcscat, etc, which means that they should
be in namespace std, while namespace c99 is for functions like wcstoll if I
understand the rational behind namespaces in glibc correctly.
Minor: for wint_t, the wchar.h header works if stddef.h has a typedef of wint_t
in the global namespace, but not if it only has such a typedef in the std
namespace (then it fails as early as __mbstate_t) as might be logical (but that
is not such a big issue, it simply forces an ugly "using std::wint_t;" in the
global namespace in stddef.h)
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|FIXED |
http://sourceware.org/bugzilla/show_bug.cgi?id=2633
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug libc/2633] _GLIBCPP_USE_NAMESPACES issues
2006-05-02 17:08 [Bug libc/2633] New: _GLIBCPP_USE_NAMESPACES issues marc dot glisse at normalesup dot org
2007-02-17 18:44 ` [Bug libc/2633] " drepper at redhat dot com
2007-02-19 17:09 ` marc dot glisse at normalesup dot org
@ 2007-10-07 20:30 ` drepper at redhat dot com
2 siblings, 0 replies; 4+ messages in thread
From: drepper at redhat dot com @ 2007-10-07 20:30 UTC (permalink / raw)
To: glibc-bugs
------- Additional Comments From drepper at redhat dot com 2007-10-07 20:30 -------
I changed the wchar.h header. The wint_t issue is in the stddef.h file which
comes from gcc.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |RESOLVED
Resolution| |FIXED
http://sourceware.org/bugzilla/show_bug.cgi?id=2633
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-10-07 20:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-02 17:08 [Bug libc/2633] New: _GLIBCPP_USE_NAMESPACES issues marc dot glisse at normalesup dot org
2007-02-17 18:44 ` [Bug libc/2633] " drepper at redhat dot com
2007-02-19 17:09 ` marc dot glisse at normalesup dot org
2007-10-07 20:30 ` drepper at redhat dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).