On 10.02.2012 19:15, Lennart Sorensen wrote:
On Fri, Feb 10, 2012 at 05:02:42PM +0100, Vladimir 'φ-coder/phcoder' Serbinenko 
wrote:
Yes, those are annoying but important since otherwise GCC might
misoptimise the code.
I will grab the latest code again and run the compiler and get the
exact message.

Funny, the changelog says it was removed from powerpc about 3 weeks ago
by you:

2012-01-18  Vladimir Serbinenko<phco...@gmail.com>

         * grub-core/kern/powerpc/dl.c (grub_arch_dl_get_tramp_got_size): Remove
         set but not used variable.
Read again: I've just removed an unused variable.
Hmm I misread it.  You didn't remove grub_arch_dl_get_tramp_got_size,
just something in it.  I wonder why the linker can find
grub_arch_dl_get_tramp_got_size then.

Actually removing powerpc from here builds successfully and grub
is booting the machine, so it seems to work without it.
It results in memory corruption.
Where should grub_arch_dl_get_tramp_got_size come from?  The linker
whines about it.

So here are errors and warnings I am seeing with a current checkout:

gcc-4.4 -DHAVE_CONFIG_H -I. -I../..  -Wall -W -I./include -DGRUB_UTIL=1 
-DGRUB_LIBDIR=\"/usr/lib/grub\" -DLOCALEDIR=\"/usr/share/locale\"  -DGRUB_MACHINE_EMU=1 
-DGRUB_MACHINE=POWERPC_EMU -DGRUB_TARGET_CPU_POWERPC=1 -DGRUB_FILE=\"util/getroot.c\" -I. -I../.. 
-I. -I../.. -I../../include -I./include  -I./grub-core/gnulib -I../../grub-core/gnulib                -g 
-Wall -O2 -Wall -W -Wshadow -Wold-style-declaration -Wold-style-definition -Wpointer-arith 
-Wmissing-prototypes -Wundef -Wextra -Waddress -Warray-bounds -Wattributes -Wbuiltin-macro-redefined 
-Wcast-align -Wchar-subscripts -Wclobbered -Wcomment -Wcoverage-mismatch -Wdeprecated 
-Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wempty-body -Wendif-labels -Wfloat-equal 
-Wformat-contains-nul -Wformat-extra-args -Wformat-security -Wformat-y2k -Wignored-qualifiers -Wimplicit 
-Wimplicit-function-declaration -Wimplicit-int -Winit-self -Winline -Wint-to-pointer-cast -Winvalid-pch 
-Wunsafe-loop-optimizations -Wlogical-op -Wmain -Wmissing-braces -Wmissing-field-initializers 
-Wmissing-format-attribute -Wmissing-noreturn -Wmudflap -Wmultichar -Wnonnull -Woverflow 
-Wpacked-bitfield-compat -Wparentheses -Wpointer-arith -Wpointer-to-int-cast -Wreturn-type -Wsequence-point 
-Wshadow -Wsign-compare -Wstack-protector -Wstrict-aliasing -Wstrict-overflow -Wswitch -Wsync-nand 
-Wtrigraphs  -Wtype-limits -Wundef -Wuninitialized -Wunknown-pragmas -Wunreachable-code -Wunused 
-Wunused-function -Wunused-label -Wunused-parameter -Wunused-result -Wunused-value  -Wunused-variable 
-Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wmissing-declarations -Wmissing-parameter-type  
-Wmissing-prototypes -Wnested-externs -Wstrict-prototypes -Wpointer-sign -Werror  -Wno-undef 
-Wno-sign-compare -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code 
-Wno-conversion -Wno-old-style-definition                -c -o util/libgrubkern_a-getroot.o `test -f 
'util/getroot.c' || echo '../../'`util/getroot.c
cc1: warnings being treated as errors
../../util/getroot.c: In function 'find_partition':
../../util/getroot.c:1995: error: format '%lu' expects type 'long unsigned 
int', but argument 3 has type 'grub_disk_addr_t'
../../util/getroot.c: In function 'grub_util_biosdisk_get_grub_dev':
../../util/getroot.c:2025: error: format '%lu' expects type 'long unsigned 
int', but argument 3 has type 'grub_disk_addr_t'

Then after changing %lu to %llu I get:

gcc-4.4 -DHAVE_CONFIG_H -I. -I../..  -Wall -W -I./include -DGRUB_UTIL=1 
-DGRUB_LIBDIR=\"/usr/lib/grub\" -DLOCALEDIR=\"/usr/share/locale\"  -DGRUB_MACHINE_EMU=1 
-DGRUB_MACHINE=POWERPC_EMU -DGRUB_TARGET_CPU_POWERPC=1 -DGRUB_FILE=\"util/getroot.c\" -I. -I../.. 
-I. -I../.. -I../../include -I./include  -I./grub-core/gnulib -I../../grub-core/gnulib                -g 
-Wall -O2 -Wall -W -Wshadow -Wold-style-declaration -Wold-style-definition -Wpointer-arith 
-Wmissing-prototypes -Wundef -Wextra -Waddress -Warray-bounds -Wattributes -Wbuiltin-macro-redefined 
-Wcast-align -Wchar-subscripts -Wclobbered -Wcomment -Wcoverage-mismatch -Wdeprecated 
-Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wempty-body -Wendif-labels -Wfloat-equal 
-Wformat-contains-nul -Wformat-extra-args -Wformat-security -Wformat-y2k -Wignored-qualifiers -Wimplicit 
-Wimplicit-function-declaration -Wimplicit-int -Winit-self -Winline -Wint-to-pointer-cast -Winvalid-pch 
-Wunsafe-loop-optimizations -Wlogical-op -Wmain -Wmissing-braces -Wmissing-field-initializers 
-Wmissing-format-attribute -Wmissing-noreturn -Wmudflap -Wmultichar -Wnonnull -Woverflow 
-Wpacked-bitfield-compat -Wparentheses -Wpointer-arith -Wpointer-to-int-cast -Wreturn-type -Wsequence-point 
-Wshadow -Wsign-compare -Wstack-protector -Wstrict-aliasing -Wstrict-overflow -Wswitch -Wsync-nand 
-Wtrigraphs  -Wtype-limits -Wundef -Wuninitialized -Wunknown-pragmas -Wunreachable-code -Wunused 
-Wunused-function -Wunused-label -Wunused-parameter -Wunused-result -Wunused-value  -Wunused-variable 
-Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wmissing-declarations -Wmissing-parameter-type  
-Wmissing-prototypes -Wnested-externs -Wstrict-prototypes -Wpointer-sign -Werror  -Wno-undef 
-Wno-sign-compare -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code 
-Wno-conversion -Wno-old-style-definition                -c -o util/libgrubkern_a-getroot.o `test -f 
'util/getroot.c' || echo '../../'`util/getroot.c
cc1: warnings being treated as errors
../../util/getroot.c: In function 'grub_find_root_devices_from_mountinfo':
../../util/getroot.c:448: error: assuming signed overflow does not occur when 
simplifying conditional to constant
../../util/getroot.c:448: error: assuming signed overflow does not occur when 
simplifying conditional to constant

I am not even sure what that one means.  It's a new one to me.
Try this:
=== modified file 'util/getroot.c'
--- util/getroot.c    2012-02-10 12:17:12 +0000
+++ util/getroot.c    2012-02-10 18:48:24 +0000
@@ -372,7 +372,7 @@ grub_find_root_devices_from_mountinfo (c
   char *buf = NULL;
   size_t len = 0;
   char **ret = NULL;
-  int entry_len = 0, entry_max = 4;
+  grub_size_t entry_len = 0, entry_max = 4;
   struct mountinfo_entry *entries;
   struct mountinfo_entry parent_entry = { 0, 0, 0, "", "", "", "" };
   int i;
@@ -1991,7 +1991,7 @@ grub_util_biosdisk_get_grub_dev (const c
             const grub_partition_t partition)
       {
     grub_disk_addr_t part_start = 0;
-    grub_util_info ("Partition %d starts from %lu",
+    grub_util_info ("Partition %d starts from %" PRIuGRUB_UINT64_T,
             partition->number, partition->start);

     part_start = grub_partition_get_start (partition);
@@ -2022,7 +2022,7 @@ grub_util_biosdisk_get_grub_dev (const c
     return 0;
       }

-    grub_util_info ("%s starts from %lu", os_dev, start);
+    grub_util_info ("%s starts from %" PRIuGRUB_UINT64_T, os_dev, start);

     if (start == 0 && device_is_wholedisk (os_dev))
       return name;





--
Regards
Vladimir 'φ-coder/phcoder' Serbinenko



_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to