[PATCH/ob]: Declare struct tm in wchar.h

View: New views
1 Messages — Rating Filter:   Alert me  

[PATCH/ob]: Declare struct tm in wchar.h

by Corinna Vinschen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I applied the below obvious fix.  The wchar.h header declares the
wcsftime function, which uses the struct tm type.  The wchar.h header
does not pull in the time.h header, though.

So POSIX-1.2008 requires that tm is declared in wchar.h:

  "The tag tm shall be declared as naming an incomplete structure type,
   the contents of which are described in the <time.h> header."

The below patch just adds this declaration to wchar.h.


Corinna


        * libc/include/wchar.h (struct tm0: Declare as incomplete type.


Index: libc/include/wchar.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/wchar.h,v
retrieving revision 1.27
diff -u -p -r1.27 wchar.h
--- libc/include/wchar.h 15 Mar 2009 13:39:06 -0000 1.27
+++ libc/include/wchar.h 15 Oct 2009 08:20:10 -0000
@@ -38,6 +38,10 @@
 
 _BEGIN_STD_C
 
+/* As required by POSIX.1-2008, declare tm as incomplete type.
+   The actual definition is in time.h. */
+struct tm;
+
 #ifndef _MBSTATE_T
 #define _MBSTATE_T
 typedef _mbstate_t mbstate_t;


--
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat