This is the mail archive of the newlib@sourceware.org mailing list for the newlib 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]

[PATCH] Define _TIMEVAL_DEFINED consistently whenever defining timeval.


    Hi all,

  Granted that the whole _TIMEVAL_DEFINED/__USE_W32_SOCKETS thing is basically
an ugly and undesirable hack, but until we have a plan to fix the whole
tcl/tk/expect/dejagnu/gdb/insight combo (as well as gnat), I figure we have to
live with it, and so it should at least be correct consistent and complete.

  There is still one place that struct timeval is defined but _TIMEVAL_DEFINED
is not, causing order-of-include problems.  The attached patch is the most
minimal adjustment that could be made to the whole thing to make it
at-least-not-any-worse-than-it-already-is, and solves problems compiling GNAT
from upstream sources.

newlib/ChangeLog:

	* libc/include/sys/time.h (_TIMEVAL_DEFINED): Define when
	defining struct timeval.

  Sanity-checked by building winsup on i686-pc-cygwin, but I think it's fairly
clear by inspection that this could only ever prevent a redefinition error,
and it's exactly how the MinGW headers solve the same problem.  Is this OK?

    cheers,
      DaveK
Index: newlib/libc/include/sys/time.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/sys/time.h,v
retrieving revision 1.13
diff -p -u -r1.13 time.h
--- newlib/libc/include/sys/time.h	11 Dec 2008 22:48:38 -0000	1.13
+++ newlib/libc/include/sys/time.h	14 Sep 2009 01:21:20 -0000
@@ -13,6 +13,7 @@ extern "C" {
 #endif
 
 #ifndef _WINSOCK_H
+#define _TIMEVAL_DEFINED
 struct timeval {
   time_t      tv_sec;
   suseconds_t tv_usec;

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