[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gettimeofday in c++
From: |
Bruno Haible |
Subject: |
Re: gettimeofday in c++ |
Date: |
Sat, 8 Aug 2009 11:54:52 +0200 |
User-agent: |
KMail/1.9.9 |
Sam Steingold wrote:
> modules which cannot be compiled with c++ (regex, gettimeofday) should depend
> on no-c++
For regex, this is due to a controversy between the glibc maintainers and our
position.
For gettimeofday, however, it can be fixed with a one-line change.
Before:
$ ./gnulib-tool --create-testdir --dir=/tmp/testdir --with-tests gettimeofday
$ cd /tmp/testdir
$ ./configure CPPFLAGS=-Wall CC=g++
$ make
fails with this error message:
g++ -DHAVE_CONFIG_H -I. -I.. -Wall -g -O2 -MT gettimeofday.o -MD -MP -MF
.deps/gettimeofday.Tpo -c -o gettimeofday.o gettimeofday.c
gettimeofday.c: In function ‘int rpl_gettimeofday(timeval*, void*)’:
gettimeofday.c:114: error: invalid conversion from ‘void* __restrict__’ to
‘timezone*’
gettimeofday.c:114: error: initializing argument 2 of ‘int
gettimeofday(timeval*, timezone*)’
make[4]: *** [gettimeofday.o] Fehler 1
Here's a proposed fix. Jim, is that OK to apply (I guess Paul does not
have time to read this any more)?
2009-08-08 Bruno Haible <address@hidden>
Avoid compilation error in C++ mode.
* lib/gettimeofday.c (rpl_gettimeofday): Cast timezone argument.
--- lib/gettimeofday.c.orig 2009-08-08 11:50:27.000000000 +0200
+++ lib/gettimeofday.c 2009-08-08 11:49:54.000000000 +0200
@@ -1,6 +1,6 @@
/* Provide gettimeofday for systems that don't have it or for which it's
broken.
- Copyright (C) 2001, 2002, 2003, 2005, 2006, 2007 Free Software
+ Copyright (C) 2001, 2002, 2003, 2005, 2006, 2007, 2009 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
@@ -111,7 +111,7 @@
struct tm save = *localtime_buffer_addr;
# endif
- int result = gettimeofday (tv, tz);
+ int result = gettimeofday (tv, (struct timezone *) tz);
# if GETTIMEOFDAY_CLOBBERS_LOCALTIME
*localtime_buffer_addr = save;
- no-c++, Sam Steingold, 2009/08/05
- Re: no-c++, Bruno Haible, 2009/08/08
- Re: no-c++, Sam Steingold, 2009/08/09
- Re: no-c++, Bruno Haible, 2009/08/09
- Re: no-c++, Simon Josefsson, 2009/08/10
- Re: no-c++, Sam Steingold, 2009/08/10
- Re: no-c++, Simon Josefsson, 2009/08/10
- Re: no-c++, Sam Steingold, 2009/08/10
- Re: no-c++, Paolo Bonzini, 2009/08/10
- Re: no-c++, Simon Josefsson, 2009/08/10
Re: gettimeofday in c++,
Bruno Haible <=