From: Ben Pfaff <blp@cs.stanford.edu>
Date: Wed, 26 Sep 2012 04:18:32 +0000 (-0700)
Subject: Suppress GCC 4.7 warnings by changes to code that make it less clear.
X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d1e072157ee3c8273e328c491be3c8bf57452da;p=pspp

Suppress GCC 4.7 warnings by changes to code that make it less clear.

I'm not entirely happy with these changes, because they make the code
slightly less obvious.  However, it's still not really bad code, and
it's convenient to have a warning-free build.
---

diff --git a/src/data/por-file-reader.c b/src/data/por-file-reader.c
index 58d4d03985..e2c06b8be9 100644
--- a/src/data/por-file-reader.c
+++ b/src/data/por-file-reader.c
@@ -1,5 +1,5 @@
 /* PSPP - a program for statistical analysis.
-   Copyright (C) 1997-9, 2000, 2006, 2009, 2010, 2011 Free Software Foundation, Inc.
+   Copyright (C) 1997-9, 2000, 2006, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -540,7 +540,7 @@ read_version_data (struct pfm_reader *r, struct pfm_read_info *info)
 {
   static const char empty_string[] = "";
   char *date, *time;
-  const char *product, *author, *subproduct;
+  const char *product, *subproduct;
   int i;
 
   /* Read file. */
@@ -549,7 +549,11 @@ read_version_data (struct pfm_reader *r, struct pfm_read_info *info)
   date = read_pool_string (r);
   time = read_pool_string (r);
   product = match (r, '1') ? read_pool_string (r) : empty_string;
-  author = match (r, '2') ? read_pool_string (r) : empty_string;
+  if (match (r, '2'))
+    {
+      /* Skip "author" field. */
+      read_pool_string (r);
+    }
   subproduct = match (r, '3') ? read_pool_string (r) : empty_string;
 
   /* Validate file. */
diff --git a/src/libpspp/hmapx.c b/src/libpspp/hmapx.c
index 25dabf6eda..ca5900c282 100644
--- a/src/libpspp/hmapx.c
+++ b/src/libpspp/hmapx.c
@@ -1,5 +1,5 @@
 /* PSPP - a program for statistical analysis.
-   Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010, 2012 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -51,10 +51,12 @@ void
 hmapx_clear (struct hmapx *map)
 {
   struct hmapx_node *node, *next;
-  void *data;
 
-  HMAPX_FOR_EACH_SAFE (data, node, next, map)
-    hmapx_delete (map, node);
+  for (node = hmapx_first (map); node; node = next)
+    {
+      next = hmapx_next (map, node);
+      hmapx_delete (map, node);
+    }
 }
 
 /* Allocates and returns a new hmapx_node with DATA as its data
diff --git a/utilities/pspp-dump-sav.c b/utilities/pspp-dump-sav.c
index 54e4712b58..a3aad0bf24 100644
--- a/utilities/pspp-dump-sav.c
+++ b/utilities/pspp-dump-sav.c
@@ -227,7 +227,6 @@ read_header (struct sfm_reader *r)
   char eye_catcher[61];
   uint8_t raw_layout_code[4];
   int32_t layout_code;
-  int32_t nominal_case_size;
   int32_t compressed;
   int32_t weight_index;
   int32_t ncases;
@@ -254,7 +253,7 @@ read_header (struct sfm_reader *r)
   layout_code = integer_get (r->integer_format,
                              raw_layout_code, sizeof raw_layout_code);
 
-  nominal_case_size = read_int (r);
+  read_int (r);                 /* Nominal case size (not actually useful). */
   compressed = read_int (r);
   weight_index = read_int (r);
   ncases = read_int (r);