bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] sys_time: avoid compiler warnings


From: Eric Blake
Subject: [PATCH] sys_time: avoid compiler warnings
Date: Wed, 31 Mar 2010 07:59:47 -0600

sys/time uses #if/#else/#endif, and is therefore not subject
to the gcc optimization.  The #pragma GCC system_header must
occur up front.

* lib/sys_time.in.h (includes): Ensure gcc pragma is
unconditional, fixing regression from 2010-03-29.
Reported by Simon Josefsson.

Signed-off-by: Eric Blake <address@hidden>
---

> ./../gl/sys/time.h:353: error: redundant redeclaration of 
> '_gl_cxxalias_dummy' [-Wredundant-decls]
> ./../gl/string.h:1103: note: previous declaration of '_gl_cxxalias_dummy' was 
> here
> 
> I have some non-default warnings enabled.
> 
> Maybe we could protect double declaration of the symbol?

The correct way to protect it is with the use of #pragma GCC
system_header.  (I just recently fixed the same bug for arpa/inet.h on
mingw).  I'm pushing this.

 ChangeLog         |    7 +++++++
 lib/sys_time.in.h |    4 ++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 87b2083..23db960 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-03-31  Eric Blake  <address@hidden>
+
+       sys_time: avoid compiler warnings
+       * lib/sys_time.in.h (includes): Ensure gcc pragma is
+       unconditional, fixing regression from 2010-03-29.
+       Reported by Simon Josefsson.
+
 2010-03-28  Jose E. Marchesi  <address@hidden>

        maint.mk: s/_header_without_use/_sc_header_without_use/
diff --git a/lib/sys_time.in.h b/lib/sys_time.in.h
index 6d818d1..6e0c7db 100644
--- a/lib/sys_time.in.h
+++ b/lib/sys_time.in.h
@@ -18,12 +18,12 @@

 /* Written by Paul Eggert.  */

-#if defined _GL_SYS_TIME_H
-
 #if __GNUC__ >= 3
 @PRAGMA_SYSTEM_HEADER@
 #endif

+#if defined _GL_SYS_TIME_H
+
 /* Simply delegate to the system's header, without adding anything.  */
 # if @HAVE_SYS_TIME_H@
 #  @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
-- 
1.6.6.1





reply via email to

[Prev in Thread] Current Thread [Next in Thread]