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]

Re: [patch] hash: fix build time warnings w/hash funcs


Makes sense.  Patch checked in.

-- Jeff J.

On 12/30/2013 10:57 PM, Mike Frysinger wrote:
Building newlib currently yields the warnings:
.../newlib/libc/search/hash.c: In function â__hash_openâ:
.../newlib/libc/search/hash.c:237:11: warning: assignment from incompatible
pointer type [enabled by default]
   dbp->del = hash_delete;
            ^
.../newlib/libc/search/hash.c:239:11: warning: assignment from incompatible
pointer type [enabled by default]
   dbp->get = hash_get;
            ^
.../newlib/libc/search/hash.c:240:11: warning: assignment from incompatible
pointer type [enabled by default]
   dbp->put = hash_put;
            ^
.../newlib/libc/search/hash.c:241:11: warning: assignment from incompatible
pointer type [enabled by default]
   dbp->seq = hash_seq;
            ^
.../newlib/libc/search/hash.c:242:12: warning: assignment from incompatible
pointer type [enabled by default]
   dbp->sync = hash_sync;
             ^

This is because dbp is a DB struct which uses a u_int for its flag type (see
libc/search/db_local.h), but the hash funcs in this file use __uint32_t.
Simple fix is to change this file to use u_int instead.
-mike

2013-12-30  Mike Frysinger  <vapier@gentoo.org>

	* libc/search/hash.c (hash_delete): Change __uint32_t to u_int.
	(hash_get): Likewise.
	(hash_put): Likewise.
	(hash_seq): Likewise.
	(hash_sync): Likewise.

--- newlib/libc/search/hash.c	19 Apr 2013 09:13:27 -0000	1.12
+++ newlib/libc/search/hash.c	31 Dec 2013 03:52:57 -0000
@@ -63,13 +63,13 @@ static int   alloc_segs(HTAB *, int);
  static int   flush_meta(HTAB *);
  static int   hash_access(HTAB *, ACTION, DBT *, DBT *);
  static int   hash_close(DB *);
-static int   hash_delete(const DB *, const DBT *, __uint32_t);
+static int   hash_delete(const DB *, const DBT *, u_int);
  static int   hash_fd(const DB *);
-static int   hash_get(const DB *, const DBT *, DBT *, __uint32_t);
-static int   hash_put(const DB *, DBT *, const DBT *, __uint32_t);
+static int   hash_get(const DB *, const DBT *, DBT *, u_int);
+static int   hash_put(const DB *, DBT *, const DBT *, u_int);
  static void *hash_realloc(SEGMENT **, int, int);
-static int   hash_seq(const DB *, DBT *, DBT *, __uint32_t);
-static int   hash_sync(const DB *, __uint32_t);
+static int   hash_seq(const DB *, DBT *, DBT *, u_int);
+static int   hash_sync(const DB *, u_int);
  static int   hdestroy(HTAB *);
  static HTAB *init_hash(HTAB *, const char *, const HASHINFO *);
  static int   init_htab(HTAB *, int);
@@ -494,7 +494,7 @@ hdestroy(hashp)
  static int
  hash_sync(dbp, flags)
  	const DB *dbp;
-	__uint32_t flags;
+	u_int flags;
  {
  	HTAB *hashp;
@@ -573,7 +573,7 @@ hash_get(dbp, key, data, flag)
  	const DB *dbp;
  	const DBT *key;
  	DBT *data;
-	__uint32_t flag;
+	u_int flag;
  {
  	HTAB *hashp;
@@ -590,7 +590,7 @@ hash_put(dbp, key, data, flag)
  	const DB *dbp;
  	DBT *key;
  	const DBT *data;
-	__uint32_t flag;
+	u_int flag;
  {
  	HTAB *hashp;
@@ -612,7 +612,7 @@ static int
  hash_delete(dbp, key, flag)
  	const DB *dbp;
  	const DBT *key;
-	__uint32_t flag;		/* Ignored */
+	u_int flag;		/* Ignored */
  {
  	HTAB *hashp;
@@ -764,7 +764,7 @@ static int
  hash_seq(dbp, key, data, flag)
  	const DB *dbp;
  	DBT *key, *data;
-	__uint32_t flag;
+	u_int flag;
  {
  	__uint32_t bucket;
  	BUFHEAD *bufp;


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