This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[COMMITTED] Fix include/wchar.h for C++


It is not possible, at least not initially to me, to use typeof
in C++ to express a function declaration. The g++ frontend
disallows what it believes is a conversion from 'int' to the type.

In file included from /usr/include/c++/5.3.1/cwchar:44:0,
                 from /usr/include/c++/5.3.1/bits/postypes.h:40,
                 from /usr/include/c++/5.3.1/bits/char_traits.h:40,
                 from /usr/include/c++/5.3.1/string:40,
                 from /usr/include/c++/5.3.1/stdexcept:39,
                 from /usr/include/c++/5.3.1/array:38,
                 from /usr/include/c++/5.3.1/tuple:39,
                 from /usr/include/c++/5.3.1/functional:55,
                 from /usr/include/c++/5.3.1/thread:39,
                 from tst-thread-quick_exit.cc:19:
../include/wchar.h:105:23: error: invalid conversion from âwchar_t* (*)(wchar_t*, wchar_t, size_t) throw () {aka wchar_t* (*)(wchar_t*, wchar_t, long unsigned int) throw ()}â to âintâ [-fpermissive]
 extern typeof (wmemset) __wmemset;
                       ^
../include/wchar.h:105:25: error: expected â,â or â;â before â__wmemsetâ
 extern typeof (wmemset) __wmemset;
                         ^
This change fixes this by avoiding typeof entirely and declaring
the function using the expected prototype.

No regressions on x86_64. Committed as an obvious fix. The
include/wchar.h header is only for internal build uses and
therefore is not ever seen by any external users and needs
no bug #. This change is needed for a followup C++ program
that uses threads and causes the above failure.

-- 
Cheers,
Carlos.

2016-06-03  Carlos O'Donell  <carlos@redhat.com>

	* include/wchar.h (__wmemset): Declare function without typeof.

diff --git a/include/wchar.h b/include/wchar.h
index 0f33d09..96b0438 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -102,7 +102,7 @@ extern int __wcscoll (const wchar_t *__s1, const wchar_t *__s2) __THROW;
 libc_hidden_proto (__wcscoll)
 libc_hidden_proto (wcspbrk)
 
-extern typeof (wmemset) __wmemset;
+extern wchar_t *__wmemset (wchar_t *__s, wchar_t __c, size_t __n) __THROW;
 extern wchar_t *__wmemchr (const wchar_t *__s, wchar_t __c, size_t __n)
      __THROW __attribute_pure__;
 libc_hidden_proto (wmemchr)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]