libtool-patches
[Top][All Lists]
Advanced

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

avoid compiler warning


From: Eric Blake
Subject: avoid compiler warning
Date: Mon, 2 Nov 2009 19:00:43 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

I'm seeing this when compiling with -Wall:

| libltdl/ltdl.c: In function ‘try_dlopen’:
| libltdl/ltdl.c:1267: error: the address of ‘libext’ will always evaluate 
as ‘true’

The problem is that LT_STRLEN is checking for null pointers, but the address of 
an array can never be null.  But using a const * instead of an array silences 
the warning.  OK to commit this?


From: Eric Blake <address@hidden>
Date: Mon, 2 Nov 2009 11:58:28 -0700
Subject: [PATCH] Allow gcc builds with -Wall -Werror.

* libltdl/ltdl.c (libext): Declare as pointer rather than array to
silence gcc warning.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog      |    6 ++++++
 libltdl/ltdl.c |    4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index caf125a..ab0a39f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-11-02  Eric Blake  <address@hidden>
+
+       Allow gcc builds with -Wall -Werror.
+       * libltdl/ltdl.c (libext): Declare as pointer rather than array to
+       silence gcc warning.
+
 2009-11-01  Ralf Wildenhues  <address@hidden>

        Fix func_normal_abspath sed script for Solaris.
diff --git a/libltdl/ltdl.c b/libltdl/ltdl.c
index 80b5675..4c57496 100644
--- a/libltdl/ltdl.c
+++ b/libltdl/ltdl.c
@@ -1,7 +1,7 @@
 /* ltdl.c -- system independent dlopen wrapper

    Copyright (C) 1998, 1999, 2000, 2004, 2005, 2006,
-                2007, 2008 Free Software Foundation, Inc.
+                2007, 2008, 2009 Free Software Foundation, Inc.
    Written by Thomas Tanner, 1998

    NOTE: The canonical source of this file is maintained with the
@@ -71,7 +71,7 @@ or obtained by writing to the Free Software Foundation, Inc.,

 static const char      objdir[]                = LT_OBJDIR;
 static const char      archive_ext[]           = LT_ARCHIVE_EXT;
-static  const char     libext[]                = LT_LIBEXT;
+static  const char     * const libext          = LT_LIBEXT;
 #if defined(LT_MODULE_EXT)
 static const char      shlib_ext[]             = LT_MODULE_EXT;
 #endif
-- 
1.6.4.2







reply via email to

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