[flashrom] [commit] r860 - trunk
svn at flashrom.org
svn at flashrom.org
Tue Jan 12 16:36:25 CET 2010
Author: mkarcher
Date: 2010-01-12 16:36:24 +0100 (Tue, 12 Jan 2010)
New Revision: 860
Modified:
trunk/Makefile
trunk/cbtable.c
trunk/cli_classic.c
trunk/flash.h
trunk/hwaccess.h
Log:
Enable -Wshadow, clean code for that
This is not just for fun. We hit a real bug on BSD with the outl macros.
The macro variable tmp collided with the tmp from outer scope.
second revision, now also taking care of inb/inw/inl. While that shadowing
did not introduce bugs (yet), of course it breaks the build on BSD when
-Wshadow is enabled.
Signed-off-by: Michael Karcher <flashrom at mkarcher.dialup.fu-berlin.de>
Acked-by: Luc Verhaegen <libv at skynet.be>
Modified: trunk/Makefile
===================================================================
--- trunk/Makefile 2010-01-10 15:01:08 UTC (rev 859)
+++ trunk/Makefile 2010-01-12 15:36:24 UTC (rev 860)
@@ -25,7 +25,7 @@
DIFF = diff
PREFIX ?= /usr/local
MANDIR ?= $(PREFIX)/share/man
-CFLAGS ?= -Os -Wall -Werror
+CFLAGS ?= -Os -Wall -Werror -Wshadow
EXPORTDIR ?= .
OS_ARCH = $(shell uname)
Modified: trunk/cbtable.c
===================================================================
--- trunk/cbtable.c 2010-01-10 15:01:08 UTC (rev 859)
+++ trunk/cbtable.c 2010-01-12 15:36:24 UTC (rev 860)
@@ -50,7 +50,7 @@
volatile union {
uint8_t byte[2];
uint16_t word;
- } value;
+ } chksum;
unsigned long sum;
unsigned long i;
@@ -72,10 +72,10 @@
sum = (sum + (sum >> 16)) & 0xFFFF;
}
}
- value.byte[0] = sum & 0xff;
- value.byte[1] = (sum >> 8) & 0xff;
+ chksum.byte[0] = sum & 0xff;
+ chksum.byte[1] = (sum >> 8) & 0xff;
- return (~value.word) & 0xFFFF;
+ return (~chksum.word) & 0xFFFF;
}
#define for_each_lbrec(head, rec) \
Modified: trunk/cli_classic.c
===================================================================
--- trunk/cli_classic.c 2010-01-10 15:01:08 UTC (rev 859)
+++ trunk/cli_classic.c 2010-01-12 15:36:24 UTC (rev 860)
@@ -150,7 +150,6 @@
if (argc > 1) {
/* Yes, print them. */
- int i;
printf_debug("The arguments are:\n");
for (i = 1; i < argc; ++i)
printf_debug("%s\n", argv[i]);
Modified: trunk/flash.h
===================================================================
--- trunk/flash.h 2010-01-10 15:01:08 UTC (rev 859)
+++ trunk/flash.h 2010-01-12 15:36:24 UTC (rev 860)
@@ -297,7 +297,6 @@
extern uint32_t io_base_addr;
extern struct pci_access *pacc;
-extern struct pci_filter filter;
extern struct pci_dev *pcidev_dev;
struct pcidev_status {
uint16_t vendor_id;
Modified: trunk/hwaccess.h
===================================================================
--- trunk/hwaccess.h 2010-01-10 15:01:08 UTC (rev 859)
+++ trunk/hwaccess.h 2010-01-12 15:36:24 UTC (rev 860)
@@ -46,12 +46,12 @@
#include <machine/cpufunc.h>
#define off64_t off_t
#define lseek64 lseek
- #define OUTB(x, y) do { u_int tmp = (y); outb(tmp, (x)); } while (0)
- #define OUTW(x, y) do { u_int tmp = (y); outw(tmp, (x)); } while (0)
- #define OUTL(x, y) do { u_int tmp = (y); outl(tmp, (x)); } while (0)
- #define INB(x) __extension__ ({ u_int tmp = (x); inb(tmp); })
- #define INW(x) __extension__ ({ u_int tmp = (x); inw(tmp); })
- #define INL(x) __extension__ ({ u_int tmp = (x); inl(tmp); })
+ #define OUTB(x, y) do { u_int outb_tmp = (y); outb(outb_tmp, (x)); } while (0)
+ #define OUTW(x, y) do { u_int outw_tmp = (y); outw(outw_tmp, (x)); } while (0)
+ #define OUTL(x, y) do { u_int outl_tmp = (y); outl(outl_tmp, (x)); } while (0)
+ #define INB(x) __extension__ ({ u_int inb_tmp = (x); inb(inb_tmp); })
+ #define INW(x) __extension__ ({ u_int inw_tmp = (x); inw(inw_tmp); })
+ #define INL(x) __extension__ ({ u_int inl_tmp = (x); inl(inl_tmp); })
#else
#if defined(__DARWIN__)
#include <DirectIO/darwinio.h>
More information about the flashrom
mailing list