All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
To: The development of GNU GRUB <grub-devel@gnu.org>
Subject: Re: Lists and aliasing (Re: Freeze on 27 February)
Date: Wed, 22 Feb 2012 17:50:31 +0100	[thread overview]
Message-ID: <4F451CD7.9080106@gmail.com> (raw)
In-Reply-To: <20120222162522.GH24235@caffeine.csclub.uwaterloo.ca>

[-- Attachment #1: Type: text/plain, Size: 4241 bytes --]

On 22.02.2012 17:25, Lennart Sorensen wrote:
> On Wed, Feb 22, 2012 at 11:18:54AM -0500, Lennart Sorensen wrote:
>> Well it is in WARN_FLAGS and TARGET_CFLAGS in configure.
>>
>> And during build:
>> 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/grub-mkimage.c\" -I. -I../.. -I. -I../.. -I../../include -I./include -I./grub-core/gnulib -I../../grub-core/gnulib -DGRUB_PKGLIBROOTDIR=\"/usr/lib/grub\"   -g -Wall -O2 -Wall -W -Wshadow -Wold-style-declaration -Wold-style-definition -Wpointer-arith -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 -Wint-to-pointer-cast -Winvalid-pch -Wunsafe-loop-optimizations -Wlogical-op -Wmain -Wmissing-braces -W
>> missing-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 -Wstrict-aliasing -Wswitch -Wsync-nand -Wtrigraphs  -Wtype-limits -Wundef -Wuninitialized -Wunknown-pragmas -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 -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/grub_mkimage-grub-mkimage.o `test -f 'util/grub-mkimage.c' || echo '../../'`util/grub-mkimage.c
>> In file included from ../../util/grub-mkimage.c:45:
>> ../../grub-core/gnulib/argp.h:610: warning: no previous prototype for 'argp_usage'
>> ../../grub-core/gnulib/argp.h:616: warning: no previous prototype for '_option_is_short'
>> ../../grub-core/gnulib/argp.h:628: warning: no previous prototype for '_option_is_end'
>>
>> So something sure adds it.
> That actually looks like a mistake.
>
> HOST_CFLAGS="$HOST_CFLAGS $WARN_FLAGS"
> TARGET_CFLAGS="$TARGET_CFLAGS $WARN_FLAGS -g -Wredundant-decls -Wmissing-prototypes"
>
> but WARN_FLAGS="-Wall -W -Wshadow -Wold-style-declaration -Wold-style-definition -Wpointer-arith -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 -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 -Wstrict-aliasing -Wswitch -Wsync-nand -Wtrigraphs  -Wtype-limits -Wundef -Wuninitialized -Wunknown-pragmas -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"
>
> So by having -Wmissing-prototypes in WARN_FLAGS it gets set twice in
> TARGET_CFLAGS and also set once in HOST_CFLAGS.  Perhaps that was
> not meant to be in there and should only have been in TARGET_CFLAGS.
>


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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: warn.diff --]
[-- Type: text/x-diff; name="warn.diff", Size: 9600 bytes --]

=== modified file 'conf/Makefile.common'
--- conf/Makefile.common	2012-02-22 15:27:39 +0000
+++ conf/Makefile.common	2012-02-22 16:29:31 +0000
@@ -104,7 +104,7 @@
 CFLAGS_GCRY = -Wno-error -Wno-missing-field-initializers
 CPPFLAGS_GCRY = -I$(top_srcdir)/grub-core/lib/libgcrypt_wrap
 
-CFLAGS_GNULIB = -Wno-undef -Wno-sign-compare -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -Wno-conversion -Wno-old-style-definition
+CFLAGS_GNULIB = -Wno-undef -Wno-sign-compare -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -Wno-conversion -Wno-old-style-definition -Wno-unsafe-loop-optimisations
 CPPFLAGS_GNULIB = -I$(top_builddir)/grub-core/gnulib -I$(top_srcdir)/grub-core/gnulib
 
 CFLAGS_POSIX = -fno-builtin

=== modified file 'configure.ac'
--- configure.ac	2012-02-22 03:56:45 +0000
+++ configure.ac	2012-02-22 16:32:32 +0000
@@ -377,7 +377,7 @@
 LIBS=""
 
 # debug flags.
-WARN_FLAGS="-Wall -W -Wshadow -Wold-style-declaration -Wold-style-definition -Wpointer-arith -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 -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 -Wstrict-aliasing -Wswitch -Wsync-nand -Wtrigraphs  -Wtype-limits -Wundef -Wuninitialized -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value  -Wunused-variable -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wmissing-declarations -Wmissing-parameter-type  -Wmissing-prototypes -Wnested-externs -Wstrict-prototypes -Wpointer-sign"
+WARN_FLAGS="-Wall -W -Wshadow -Wold-style-declaration -Wold-style-definition -Wpointer-arith -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 -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 -Wstrict-aliasing -Wswitch -Wsync-nand -Wtrigraphs  -Wtype-limits -Wundef -Wuninitialized -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value  -Wunused-variable -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wmissing-declarations -Wmissing-parameter-type -Wnested-externs -Wstrict-prototypes -Wpointer-sign"
 HOST_CFLAGS="$HOST_CFLAGS $WARN_FLAGS"
 TARGET_CFLAGS="$TARGET_CFLAGS $WARN_FLAGS -g -Wredundant-decls -Wmissing-prototypes"
 TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g"

=== modified file 'grub-core/commands/legacycfg.c'
--- grub-core/commands/legacycfg.c	2012-02-12 14:25:25 +0000
+++ grub-core/commands/legacycfg.c	2012-02-22 16:06:00 +0000
@@ -547,11 +547,11 @@
 check_password_md5_real (const char *entered,
 			 struct legacy_md5_password *pw)
 {
-  int enteredlen = grub_strlen (entered);
+  grub_size_t enteredlen = grub_strlen (entered);
   unsigned char alt_result[MD5_HASHLEN];
   unsigned char *digest;
   grub_uint8_t ctx[GRUB_MD_MD5->contextsize];
-  int i;
+  grub_size_t i;
 
   GRUB_MD_MD5->init (ctx);
   GRUB_MD_MD5->write (ctx, entered, enteredlen);

=== modified file 'grub-core/commands/testload.c'
--- grub-core/commands/testload.c	2012-02-22 04:04:54 +0000
+++ grub-core/commands/testload.c	2012-02-22 16:25:36 +0000
@@ -77,19 +77,24 @@
   grub_printf ("Reading %s sequentially again", argv[0]);
   grub_file_seek (file, 0);
 
-  for (pos = 0; pos < size; pos += GRUB_DISK_SECTOR_SIZE)
+  for (pos = 0; pos < size;)
     {
       char sector[GRUB_DISK_SECTOR_SIZE];
-
-      if (grub_file_read (file, sector, GRUB_DISK_SECTOR_SIZE)
-	  != GRUB_DISK_SECTOR_SIZE)
+      grub_size_t curlen = GRUB_DISK_SECTOR_SIZE;
+
+      if (curlen > size - pos)
+	curlen = size - pos;
+
+      if (grub_file_read (file, sector, curlen)
+	  != (grub_ssize_t) curlen)
 	goto fail;
 
-      if (grub_memcmp (sector, buf + pos, GRUB_DISK_SECTOR_SIZE) != 0)
+      if (grub_memcmp (sector, buf + pos, curlen) != 0)
 	{
 	  grub_printf ("\nDiffers in %lld\n", (unsigned long long) pos);
 	  goto fail;
 	}
+      pos += curlen;
     }
   grub_printf (" Done.\n");
 

=== modified file 'grub-core/disk/ldm.c'
--- grub-core/disk/ldm.c	2012-02-10 11:36:02 +0000
+++ grub-core/disk/ldm.c	2012-02-22 15:59:21 +0000
@@ -831,7 +831,7 @@
 {
   struct grub_diskfilter_pv *pv = NULL;
   struct grub_diskfilter_vg *vg = NULL;
-  struct grub_diskfilter_lv *res, *lv;
+  struct grub_diskfilter_lv *res = 0, *lv, *res_lv;
 
   pv = grub_diskfilter_get_pv_from_disk (disk, &vg);
 
@@ -844,19 +844,21 @@
 	&& lv->segments->nodes->pv == pv
 	&& lv->segments->nodes->start + pv->start_sector == start)
       {
-	res = lv;
+	res_lv = lv;
 	break;
       }
+  if (!res_lv)
+    return NULL;
   for (lv = vg->lvs; lv; lv = lv->next)
     if (lv->segment_count == 1 && lv->segments->node_count == 1
 	&& lv->segments->type == GRUB_DISKFILTER_MIRROR
-	&& lv->segments->nodes->lv == lv)
+	&& lv->segments->nodes->lv == res_lv)
       {
 	res = lv;
 	break;
       }
-  if (res->fullname)
-    return grub_strdup (lv->fullname);
+  if (res && res->fullname)
+    return grub_strdup (res->fullname);
   return NULL;
 }
 

=== modified file 'grub-core/fs/zfs/zfs_sha256.c'
--- grub-core/fs/zfs/zfs_sha256.c	2010-12-01 21:55:26 +0000
+++ grub-core/fs/zfs/zfs_sha256.c	2012-02-22 16:17:39 +0000
@@ -129,7 +129,7 @@
   for (i = 0; i < 8; i++)
     pad[padsize++] = (size << 3) >> (56 - 8 * i);
   
-  for (i = 0; i < padsize; i += 64)
+  for (i = 0; i < padsize && i <= 64; i += 64)
     SHA256Transform(H, pad + i);
   
   zcp->zc_word[0] = grub_cpu_to_zfs64 ((grub_uint64_t)H[0] << 32 | H[1], 

=== modified file 'grub-core/io/gzio.c'
--- grub-core/io/gzio.c	2012-02-12 14:25:25 +0000
+++ grub-core/io/gzio.c	2012-02-22 16:45:45 +0000
@@ -363,6 +363,8 @@
   0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
 };
 
+#pragma GCC diagnostic ignored "-Wunsafe-loop-optimizations"
+
 #define NEEDBITS(n) do {while(k<(n)){b|=((ulg)get_byte(gzio))<<k;k+=8;}} while (0)
 #define DUMPBITS(n) do {b>>=(n);k-=(n);} while (0)
 

=== modified file 'grub-core/lib/LzmaEnc.c'
--- grub-core/lib/LzmaEnc.c	2012-02-10 15:48:48 +0000
+++ grub-core/lib/LzmaEnc.c	2012-02-22 16:16:26 +0000
@@ -1211,7 +1211,7 @@
       {
         UInt32 i;
         reps[0] = prevOpt->backs[pos];
-        for (i = 1; i <= pos; i++)
+        for (i = 1; i < pos + 1; i++)
           reps[i] = prevOpt->backs[i - 1];
         for (; i < LZMA_NUM_REPS; i++)
           reps[i] = prevOpt->backs[i];

=== modified file 'grub-core/normal/cmdline.c'
--- grub-core/normal/cmdline.c	2012-02-12 18:24:23 +0000
+++ grub-core/normal/cmdline.c	2012-02-22 16:21:47 +0000
@@ -49,13 +49,13 @@
       /* Remove the lines that don't fit in the new buffer.  */
       if (newsize < hist_used)
 	{
-	  int i;
-	  int delsize = hist_used - newsize;
+	  grub_size_t i;
+	  grub_size_t delsize = hist_used - newsize;
 	  hist_used = newsize;
 
-	  for (i = 1; i <= delsize; i++)
+	  for (i = 1; i < delsize + 1; i++)
 	    {
-	      int pos = hist_end - i;
+	      grub_ssize_t pos = hist_end - i;
 	      if (pos < 0)
 		pos += hist_size;
 	      grub_free (old_hist_lines[pos]);

=== modified file 'grub-core/script/parser.y'
--- grub-core/script/parser.y	2012-02-10 15:48:48 +0000
+++ grub-core/script/parser.y	2012-02-22 16:47:55 +0000
@@ -31,6 +31,7 @@
 #include "grub_script.tab.h"
 
 #pragma GCC diagnostic ignored "-Wunreachable-code"
+#pragma GCC diagnostic ignored "-Wmissing-declarations"
 %}
 
 %union {

=== modified file 'grub-core/script/yylex.l'
--- grub-core/script/yylex.l	2012-02-03 10:56:49 +0000
+++ grub-core/script/yylex.l	2012-02-22 16:49:25 +0000
@@ -27,6 +27,8 @@
 
 #pragma GCC diagnostic ignored "-Wunused-parameter"
 #pragma GCC diagnostic ignored "-Wmissing-prototypes"
+#pragma GCC diagnostic ignored "-Wmissing-declarations"
+#pragma GCC diagnostic ignored "-Wunsafe-loop-optimizations"
 
 #define yyfree    grub_lexer_yyfree
 #define yyalloc   grub_lexer_yyalloc

=== modified file 'util/grub-mkfont.c'
--- util/grub-mkfont.c	2012-02-10 12:31:43 +0000
+++ util/grub-mkfont.c	2012-02-22 16:15:31 +0000
@@ -717,7 +717,7 @@
 
       bitmap = glyph->bitmap;
       mask = 0x80;
-      for (y = ymax - 1; y >= ymin; y--)
+      for (y = ymax - 1; y > ymin - 1; y--)
 	{
 	  int line_pos;
 


  parent reply	other threads:[~2012-02-22 16:50 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-21 16:12 Freeze on 27 February Vladimir 'φ-coder/phcoder' Serbinenko
2012-02-21 16:19 ` Lennart Sorensen
2012-02-21 17:09   ` Lists and aliasing (Re: Freeze on 27 February) Vladimir 'φ-coder/phcoder' Serbinenko
2012-02-21 18:46     ` Lennart Sorensen
2012-02-21 19:58       ` Lennart Sorensen
2012-02-21 20:29         ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-02-22 15:34           ` Lennart Sorensen
2012-02-22 15:50             ` Lennart Sorensen
2012-02-22 15:57               ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-02-22 16:18                 ` Lennart Sorensen
2012-02-22 16:25                   ` Lennart Sorensen
2012-02-22 16:43                     ` Lennart Sorensen
2012-02-22 16:50                     ` Vladimir 'φ-coder/phcoder' Serbinenko [this message]
2012-02-22 17:16                       ` Lennart Sorensen
2012-02-22 17:35                         ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-02-22 17:41                           ` Lennart Sorensen
2012-02-22 17:46                             ` Lennart Sorensen
2012-02-22 18:01                               ` Lennart Sorensen
2012-02-22 18:28                                 ` Lennart Sorensen
2012-02-22 18:41                                   ` Lennart Sorensen
2012-02-22 19:00                                     ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-02-22 22:50                                       ` Lennart Sorensen
2012-02-22 23:03                                         ` Lennart Sorensen
2012-02-23  2:39                                           ` Isaac Dupree
2012-02-23  6:17                                           ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-02-23 17:43                                             ` Lennart Sorensen
2012-02-24 23:16                                               ` Lennart Sorensen
2012-02-22 17:38                         ` Lennart Sorensen
2012-02-22 16:51                   ` Lennart Sorensen
2012-02-21 21:40         ` Lennart Sorensen
2012-02-22  5:35 ` Freeze on 27 February Richard Laager
2012-02-23  6:34   ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-02-27  6:58     ` Richard Laager
2012-02-27 18:17       ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-02-27  7:32     ` Richard Laager
     [not found]     ` <1330033617.3895.26.camel@watermelon.coderich.net>
     [not found]       ` <4F4AC782.1090402@gmail.com>
     [not found]         ` <1330322499.2901.5.camel@watermelon.coderich.net>
     [not found]           ` <1330322681.2901.8.camel@watermelon.coderich.net>
2012-02-27 18:18             ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-02-27 18:20           ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-02-27 19:46             ` Richard Laager
2012-03-08 22:51               ` Remaining ZFS Changes for 2.00 (Was: Re: Freeze on 27 February) Richard Laager
2012-03-10 12:44                 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-03-10 13:39                 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-03-10 15:51                   ` Richard Laager
2012-03-10 16:01                     ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-03-10 13:41                 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-03-10 17:51                 ` Vladimir 'φ-coder/phcoder' Serbinenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F451CD7.9080106@gmail.com \
    --to=phcoder@gmail.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.