Add CONFIG_WARNINGS_ARE_ERRORS and set it for qemu.
authorMyles Watson <mylesgw@gmail.com>
Thu, 12 Nov 2009 16:38:03 +0000 (16:38 +0000)
committerMyles Watson <mylesgw@gmail.com>
Thu, 12 Nov 2009 16:38:03 +0000 (16:38 +0000)
Remove all remaining warnings from qemu.

Signed-off-by: Myles Watson <mylesgw@gmail.com>
Acked-by: Ronald G. Minnich <rminnich@gmail.com>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4939 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

12 files changed:
Makefile
src/Kconfig
src/arch/i386/boot/coreboot_table.c
src/arch/i386/include/arch/smp/spinlock.h
src/console/printk.c
src/console/vsprintf.c
src/cpu/emulation/qemu-x86/northbridge.c
src/devices/device.c
src/include/smp/spinlock.h
src/lib/cbmem.c
src/mainboard/emulation/qemu-x86/Kconfig
util/x86emu/x86.c

index e683f3949d814f70834640b03f1a5c1d57c03797..5dd79603c1360c846f9101647b004c7c03182689 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -247,6 +247,9 @@ CFLAGS = $(STACKPROTECT) $(INCLUDES) -Os -nostdinc
 CFLAGS += -nostdlib -Wall -Wundef -Wstrict-prototypes -Wmissing-prototypes
 CFLAGS += -Wwrite-strings -Wredundant-decls -Wno-trigraphs 
 CFLAGS += -Wstrict-aliasing -Wshadow 
+ifeq ($(CONFIG_WARNINGS_ARE_ERRORS),y)
+CFLAGS += -Werror
+endif
 CFLAGS += -fno-common -ffreestanding -fno-builtin -fomit-frame-pointer
 
 CBFS_COMPRESS_FLAG:=l
index cc61ba6225ba5a93954c0ef83acc19963fa779d0..c2a56e1dbf6c33505d3287342005b2c87d8c5698 100644 (file)
@@ -463,3 +463,7 @@ config USE_INIT
 config ENABLE_APIC_EXT_ID
        bool
        default n
+
+config WARNINGS_ARE_ERRORS
+       bool
+       default n
index 49fef60cdd8f854b1f9ead4b8dca47bba89ebad9..00c34b2ee84a18f1a9301c0d58975ad43f13ada2 100644 (file)
@@ -65,11 +65,13 @@ static struct lb_record *lb_last_record(struct lb_header *header)
        return rec;
 }
 
+#if 0
 static struct lb_record *lb_next_record(struct lb_record *rec)
 {
        rec = (void *)(((char *)rec) + rec->size);      
        return rec;
 }
+#endif
 
 static struct lb_record *lb_new_record(struct lb_header *header)
 {
@@ -218,6 +220,7 @@ static void lb_strings(struct lb_header *header)
 
 }
 
+#if CONFIG_WRITE_HIGH_TABLES == 1
 static struct lb_forward *lb_forward(struct lb_header *header, struct lb_header *next_header)
 {
        struct lb_record *rec;
@@ -229,6 +232,7 @@ static struct lb_forward *lb_forward(struct lb_header *header, struct lb_header
        forward->forward = (uint64_t)(unsigned long)next_header;
        return forward;
 }
+#endif
 
 void lb_memory_range(struct lb_memory *mem,
        uint32_t type, uint64_t start, uint64_t size)
index 71015452e8d5d3094de623791a3b577c30a8d18c..5c1dd94c363840d07f0bc62cc9473934f1286a14 100644 (file)
@@ -11,6 +11,7 @@ typedef struct {
 
 
 #define SPIN_LOCK_UNLOCKED (spinlock_t) { 1 }
+#define DECLARE_SPIN_LOCK(x) static spinlock_t x = SPIN_LOCK_UNLOCKED;
 
 /*
  * Simple spin lock operations.  There are two variants, one clears IRQ's
index 3b1ae24ec18e3decae8c84a88af1b0da8e173043..e06468236c4bc62f6c47f1e03e241180d287d769 100644 (file)
@@ -23,7 +23,7 @@ int default_message_loglevel = DEFAULT_MESSAGE_LOGLEVEL;
 int minimum_console_loglevel = MINIMUM_CONSOLE_LOGLEVEL;
 int default_console_loglevel = CONFIG_DEFAULT_CONSOLE_LOGLEVEL;
 
-static spinlock_t console_lock = SPIN_LOCK_UNLOCKED;
+DECLARE_SPIN_LOCK(console_lock)
 
 int do_printk(int msg_level, const char *fmt, ...)
 {
index c4c91115c2e1ddc3076f0c3dce855489a4f05adc..090063cf6257f3e1c05f80e219e7b99ef0d6c493 100644 (file)
@@ -24,7 +24,7 @@
 #include <smp/spinlock.h>
 #include <console/vtxprintf.h>
 
-static spinlock_t vsprintf_lock = SPIN_LOCK_UNLOCKED;
+DECLARE_SPIN_LOCK(vsprintf_lock)
 
 static char *str_buf;
 
index 7c3c18095c37cf22d4e49d8ab79286499ed8ad38..44fb1ce5981d76f7aca9c97248db1926a8095da1 100644 (file)
@@ -8,6 +8,7 @@
 #include <bitops.h>
 #include "chip.h"
 #include "northbridge.h"
+#include <delay.h>
 
 static void ram_resource(device_t dev, unsigned long index,
        unsigned long basek, unsigned long sizek)
@@ -157,9 +158,9 @@ struct chip_operations cpu_emulation_qemu_x86_ops = {
        .enable_dev = enable_dev,
 };
 
-void udelay(int usecs)
+void udelay(unsigned usecs)
 {
-       int i;
+       unsigned i;
        for(i = 0; i < usecs; i++)
                inb(0x80);
 }
index 9ce58c52c9420765004b1c4ea683b9340fbb50a5..c337294c1ff7ac1a1b4bf98e1607161e1ce18f29 100644 (file)
@@ -58,7 +58,9 @@ extern struct device **last_dev_p;
  *
  * @see device_path
  */
-static spinlock_t dev_lock = SPIN_LOCK_UNLOCKED;
+
+DECLARE_SPIN_LOCK(dev_lock)
+
 device_t alloc_dev(struct bus *parent, struct device_path *path)
 {
        device_t dev, child;
index aedd85b0ab26703802034d0a521f781b3c715a56..1b0b4fdde9cde85c22de0132117f66bff640e540 100644 (file)
@@ -5,15 +5,7 @@
 #include <arch/smp/spinlock.h>
 #else /* !CONFIG_SMP */
 
-/* Most GCC versions have a nasty bug with empty initializers */
-#if (__GNUC__ > 2) 
-typedef struct { } spinlock_t;
-#define SPIN_LOCK_UNLOCKED (spinlock_t) { }
-#else
-typedef struct { int gcc_is_buggy; } spinlock_t;
-#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
-#endif
-
+#define DECLARE_SPIN_LOCK(x)
 #define barrier()              do {} while(0)
 #define spin_is_locked(lock)   0
 #define spin_unlock_wait(lock) do {} while(0)
index 023ddeaeb28ad7d36ef4c6568d57a2f7308fa606..db761958a98f2ae0de5651b0bf0a3737a6094221 100644 (file)
@@ -35,9 +35,6 @@
 #define MAX_CBMEM_ENTRIES      16
 #define CBMEM_MAGIC            0x434f5245
 
-static void *cbmem_base;
-static int cbmem_size;
-
 struct cbmem_entry {
        u32 magic;
        u32 id;
@@ -151,7 +148,7 @@ void *cbmem_add(u32 id, u64 size)
        cbmem_toc[0].base += size;
        cbmem_toc[0].size -= size;
 
-       return (void *)cbmem_toc[i].base;
+       return (void *)(u32)cbmem_toc[i].base;
 }
 
 void *cbmem_find(u32 id)
index e319d98d2f404c5ac638e6823635ae36be0f589c..38d460df76038222713186bcdd539a7cba525622 100644 (file)
@@ -5,6 +5,7 @@ config BOARD_EMULATION_QEMU_X86
        select CPU_EMULATION_QEMU_X86
        select HAVE_PIRQ_TABLE
        select BOARD_ROMSIZE_KB_256
+       select WARNINGS_ARE_ERRORS
 
 config MAINBOARD_DIR
        string
index 2f314a043f8a389eb4a05045547420b6a4c843a7..4ceb4b2e0734496b94cad9c7dd74ceca99e437c0 100644 (file)
@@ -126,7 +126,7 @@ static void setup_realmode_idt(void)
 void run_bios(struct device *dev, unsigned long addr)
 {
        /* clear vga bios data area */
-       memset(0x400, 0, 0x200);
+       memset((void *)0x400, 0, 0x200);
        
        /* Set up C interrupt handlers */
        setup_interrupt_handlers();