Fix code to allow usage of -Wall in libpayload and the sample (trivial).
authorUwe Hermann <uwe@hermann-uwe.de>
Thu, 20 Mar 2008 20:46:44 +0000 (20:46 +0000)
committerUwe Hermann <uwe@hermann-uwe.de>
Thu, 20 Mar 2008 20:46:44 +0000 (20:46 +0000)
This even fixes two bugs:

 - get_cpu_speed() didn't return a value.

 - The line
     win->_color - PAIR_NUMBER(0);
   should actually be
     win->_color = PAIR_NUMBER(0);

Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3182 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

payloads/libpayload/Makefile
payloads/libpayload/curses/colors.c
payloads/libpayload/curses/keyboard.c
payloads/libpayload/curses/tinycurses.c
payloads/libpayload/drivers/vga.c
payloads/libpayload/i386/coreboot.c
payloads/libpayload/i386/main.c
payloads/libpayload/i386/timer.c
payloads/libpayload/include/libpayload.h
payloads/libpayload/sample/Makefile

index 8d28c2dcca157bfc165cb7ee79be73bd76939b9a..aa3f07d639deec916e811bcf66662b3df60b3689 100644 (file)
@@ -61,7 +61,7 @@ include $(PLATFORM-y) $(BUILD-y)
 
 INCLUDES := -I./include
 INCLUDES += -I$(shell $(CC) -print-search-dirs | head -n 1 | cut -d' ' -f2)include
-CFLAGS := -Werror -Os -fno-stack-protector -nostdinc $(INCLUDES)
+CFLAGS := -Wall -Werror -Os -fno-stack-protector -nostdinc $(INCLUDES)
 
 libpayload.a: $(TARGETS-y)
        $(AR) rc $@ $(TARGETS-y)
index 34091498c0970749f888464e62440b5687146d7a..5065f5c8253c7b687b950a86684a1b06297aaaf2 100644 (file)
@@ -57,4 +57,6 @@ int pair_content(short index, short *fg, short *bg)
 
        *bg = (color_pairs[index] >> 4) & 0xF;
        *fg = color_pairs[index] & 0xF;
+
+       return 0;
 }
index 3ec4d9d7bfeba200b04b3e8dbc479c4714e61092..2062ac2ffed3682a41f379c49007943ee7be3857 100644 (file)
@@ -268,6 +268,7 @@ int wgetch(WINDOW *win)
 int nodelay(WINDOW *win, NCURSES_BOOL flag)
 {
        win->_delay = flag ? 0 : -1;
+       return 0;
 }
 
 #ifdef CONFIG_VGA_CONSOLE
index 946cdeb18b2490c6afb9def51f1c4653c339bba9..f9c0798d0580a1fa808f3d7ecd6b41deec4e36b1 100644 (file)
@@ -145,7 +145,7 @@ int delwin(WINDOW *win)
 }
 WINDOW *derwin(WINDOW *orig, int num_lines, int num_columns, int begy, int begx)
 {
-       WINDOW *win;
+       WINDOW *win = NULL;
        int i;
        int flags = _SUBWIN;
 
@@ -167,6 +167,7 @@ WINDOW *derwin(WINDOW *orig, int num_lines, int num_columns, int begy, int begx)
        if (orig->_flags & _ISPAD)
                flags |= _ISPAD;
 
+       // FIXME
        //// if ((win = _nc_makenew(num_lines, num_columns, orig->_begy + begy,
        ////                        orig->_begx + begx, flags)) == 0)
        ////     return NULL;
@@ -308,8 +309,8 @@ WINDOW *newwin(int num_lines, int num_columns, int begy, int begx)
 
        win->_line = &ldat_list[ldat_count++];
 
-       /* FIXME:  Is this right?  Should the window attributes be normal? */
-       win->_color - PAIR_NUMBER(0);
+       /* FIXME: Is this right? Should the window attributes be normal? */
+       win->_color = PAIR_NUMBER(0);
        win->_attrs = A_NORMAL;
 
        for (i = 0; i < num_lines; i++)
index fd1dd35abb19c4824bea4db2c2d86cb0ef4ef3c2..1c1315935c864ea9a9db8f8afe6db58d87e7d3fd 100644 (file)
@@ -184,7 +184,7 @@ void vga_putchar(unsigned int ch)
        vga_fixup_cursor();
 }
 
-int vga_move_cursor(int x, int y)
+void vga_move_cursor(int x, int y)
 {
        cursorx = x;
        cursory = y;
index 0eb76dcf4ba91b8b8a3f9a1a5cef9bad975bf411..8e4a19a5eedeeccaed84e71dd456f9053398a339 100644 (file)
@@ -83,7 +83,7 @@ static int cb_parse_header(void *addr, int len, struct sysinfo_t *info)
 
        for (i = 0; i < len; i += 16, ptr += 16) {
                header = (struct cb_header *)ptr;
-               if (!strncmp(header->signature, "LBIO", 4))
+               if (!strncmp((const char *)header->signature, "LBIO", 4))
                        break;
        }
 
index ed5c1b9e9cde00afd2e47c25c143408e6ffc121a..c880937e9837fd63f31bfea432653e9b57d61604 100644 (file)
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 
-#include <arch/types.h>
+#include <libpayload.h>
 
 /*
  * This structure seeds the stack. We provide the return address of our main
index a7876460735fb70683ae8012f57562eb0eeb3d81..e11973f2fa28f23e9b66fcd2c5c42e3307223188 100644 (file)
@@ -62,6 +62,8 @@ unsigned int get_cpu_speed(void)
         * Multiply that by the number of measured clocks to get the kHz value.
         */
        cpu_khz = (unsigned int)((end - start) * 1193180U / (1000 * 0xffff));
+
+       return cpu_khz;
 }
 
 static inline void _delay(unsigned int delta)
index 48150089bdd425856c1d4ed17dc2723e5ca4eb03..d1ca842b94260f56acee11c2196ea94ecdcbb53b 100644 (file)
@@ -59,7 +59,7 @@ void vga_fill(uint8_t ch, uint8_t attr);
 void vga_clear(void);
 void vga_putc(uint8_t row, uint8_t col, unsigned int c);
 void vga_putchar(unsigned int ch);
-int vga_move_cursor(int x, int y);
+void vga_move_cursor(int x, int y);
 void vga_init(void);
 
 /* libc/console.c */
index 9ab3249e1254a3f2d4c4618b8da761e38f4cc170..1daea5f6ec60900cd0e4ea6451991dada990ae9b 100644 (file)
@@ -37,7 +37,7 @@ INCLUDES += -I$(shell $(CC) $(CROSS_CFLAGS) -print-search-dirs | head -n 1 | cut
 
 LIBPAYLOAD = ../libpayload.a
 LIBGCC := $(shell $(CC) $(CROSS_CFLAGS) -print-libgcc-file-name)
-CFLAGS := -Werror -Os -fno-stack-protector -nostdinc $(INCLUDES)
+CFLAGS := -Wall -Werror -Os -fno-stack-protector -nostdinc $(INCLUDES)
 
 all: hello.elf