All of lore.kernel.org
 help / color / mirror / Atom feed
* Fix for grub_assert_fail undefined on NetBSD and other platforms
@ 2009-12-22 16:09 BVK Chaitanya
  2009-12-22 16:28 ` BVK Chaitanya
  2009-12-24 21:55 ` Robert Millan
  0 siblings, 2 replies; 11+ messages in thread
From: BVK Chaitanya @ 2009-12-22 16:09 UTC (permalink / raw)
  To: The development of GRUB 2; +Cc: gregoire.sutre

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

Hi


Attached is the patch, which removes use of undefined grub_assert_fail
function for catching bad-type-cast errors, with a better version
__attribute__((error("msg"))) gcc extension.  With this extension, gcc
can give the exact location of the bad type cast at compile time.

Unfortunately, I couldn't test this on NetBSD, where old technique was
reported failing as GCC optimizations didn't happen.  Can Grégoire
Sutr or anybody else try this out on NetBSD and confirm?


thanks,
-- 
bvk.chaitanya

[-- Attachment #2: grub-assert-fail.patch.txt --]
[-- Type: text/plain, Size: 3310 bytes --]

=== modified file 'include/grub/handler.h'
--- include/grub/handler.h	2009-03-01 17:51:44 +0000
+++ include/grub/handler.h	2009-12-22 13:34:38 +0000
@@ -55,6 +55,6 @@
     GRUB_FIELD_MATCH (ptr, grub_handler_t, name) && \
     GRUB_FIELD_MATCH (ptr, grub_handler_t, init) && \
     GRUB_FIELD_MATCH (ptr, grub_handler_t, fini)) ? \
-   (grub_handler_t) ptr : grub_assert_fail ())
+   (grub_handler_t) ptr : grub_bad_type_cast ())
 
 #endif /* ! GRUB_HANDLER_HEADER */

=== modified file 'include/grub/list.h'
--- include/grub/list.h	2009-11-09 14:25:03 +0000
+++ include/grub/list.h	2009-12-22 13:33:08 +0000
@@ -22,6 +22,7 @@
 
 #include <grub/symbol.h>
 #include <grub/types.h>
+#include <grub/misc.h>
 
 struct grub_list
 {
@@ -39,31 +40,27 @@
 void EXPORT_FUNC(grub_list_insert) (grub_list_t *head, grub_list_t item,
 				    grub_list_test_t test);
 
-/* This function doesn't exist, so if assertion is false for some reason, the
-   linker would fail.  */
-#ifdef APPLE_CC
-/* This approach fails with Apple's gcc. Use grub_abort.  */
-#include <grub/misc.h>
-static inline void *
-grub_assert_fail (void)
+static inline void *
+grub_bad_type_cast (void) __attribute__ ((error("bad type cast between incompatible grub types")));
+
+static inline void *
+grub_bad_type_cast (void)
 {
-	grub_abort ();
-	return 0;
+  grub_fatal ("bad type case between incompatible grub types detected");
+  grub_abort ();
+  return 0;
 }
-#else
-extern void* grub_assert_fail (void);
-#endif
 
 #define GRUB_FIELD_MATCH(ptr, type, field) \
   ((char *) &(ptr)->field == (char *) &((type) (ptr))->field)
 
 #define GRUB_AS_LIST(ptr) \
   (GRUB_FIELD_MATCH (ptr, grub_list_t, next) ? \
-   (grub_list_t) ptr : grub_assert_fail ())
+   (grub_list_t) ptr : grub_bad_type_cast ())
 
 #define GRUB_AS_LIST_P(pptr) \
   (GRUB_FIELD_MATCH (*pptr, grub_list_t, next) ? \
-   (grub_list_t *) (void *) pptr : grub_assert_fail ())
+   (grub_list_t *) (void *) pptr : grub_bad_type_cast ())
 
 struct grub_named_list
 {
@@ -78,12 +75,12 @@
 #define GRUB_AS_NAMED_LIST(ptr) \
   ((GRUB_FIELD_MATCH (ptr, grub_named_list_t, next) && \
     GRUB_FIELD_MATCH (ptr, grub_named_list_t, name))? \
-   (grub_named_list_t) ptr : grub_assert_fail ())
+   (grub_named_list_t) ptr : grub_bad_type_cast ())
 
 #define GRUB_AS_NAMED_LIST_P(pptr) \
   ((GRUB_FIELD_MATCH (*pptr, grub_named_list_t, next) && \
     GRUB_FIELD_MATCH (*pptr, grub_named_list_t, name))? \
-   (grub_named_list_t *) (void *) pptr : grub_assert_fail ())
+   (grub_named_list_t *) (void *) pptr : grub_bad_type_cast ())
 
 #define GRUB_PRIO_LIST_PRIO_MASK	0xff
 #define GRUB_PRIO_LIST_FLAG_ACTIVE	0x100
@@ -111,12 +108,12 @@
   ((GRUB_FIELD_MATCH (ptr, grub_prio_list_t, next) && \
     GRUB_FIELD_MATCH (ptr, grub_prio_list_t, name) && \
     GRUB_FIELD_MATCH (ptr, grub_prio_list_t, prio))? \
-   (grub_prio_list_t) ptr : grub_assert_fail ())
+   (grub_prio_list_t) ptr : grub_bad_type_cast ())
 
 #define GRUB_AS_PRIO_LIST_P(pptr) \
   ((GRUB_FIELD_MATCH (*pptr, grub_prio_list_t, next) && \
     GRUB_FIELD_MATCH (*pptr, grub_prio_list_t, name) && \
     GRUB_FIELD_MATCH (*pptr, grub_prio_list_t, prio))? \
-   (grub_prio_list_t *) (void *) pptr : grub_assert_fail ())
+   (grub_prio_list_t *) (void *) pptr : grub_bad_type_cast ())
 
 #endif /* ! GRUB_LIST_HEADER */


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Fix for grub_assert_fail undefined on NetBSD and other platforms
  2009-12-22 16:09 Fix for grub_assert_fail undefined on NetBSD and other platforms BVK Chaitanya
@ 2009-12-22 16:28 ` BVK Chaitanya
  2009-12-22 17:07   ` Grégoire Sutre
  2009-12-24 21:55 ` Robert Millan
  1 sibling, 1 reply; 11+ messages in thread
From: BVK Chaitanya @ 2009-12-22 16:28 UTC (permalink / raw)
  To: The development of GRUB 2; +Cc: gregoire.sutre

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

grub_fatal already calls grub_abort, so grub_abort line is removed.



-- 
bvk.chaitanya

[-- Attachment #2: grub-assert-fail.patch2.txt --]
[-- Type: text/plain, Size: 3292 bytes --]

=== modified file 'include/grub/handler.h'
--- include/grub/handler.h	2009-03-01 17:51:44 +0000
+++ include/grub/handler.h	2009-12-22 13:34:38 +0000
@@ -55,6 +55,6 @@
     GRUB_FIELD_MATCH (ptr, grub_handler_t, name) && \
     GRUB_FIELD_MATCH (ptr, grub_handler_t, init) && \
     GRUB_FIELD_MATCH (ptr, grub_handler_t, fini)) ? \
-   (grub_handler_t) ptr : grub_assert_fail ())
+   (grub_handler_t) ptr : grub_bad_type_cast ())
 
 #endif /* ! GRUB_HANDLER_HEADER */

=== modified file 'include/grub/list.h'
--- include/grub/list.h	2009-11-09 14:25:03 +0000
+++ include/grub/list.h	2009-12-22 16:25:10 +0000
@@ -22,6 +22,7 @@
 
 #include <grub/symbol.h>
 #include <grub/types.h>
+#include <grub/misc.h>
 
 struct grub_list
 {
@@ -39,31 +40,26 @@
 void EXPORT_FUNC(grub_list_insert) (grub_list_t *head, grub_list_t item,
 				    grub_list_test_t test);
 
-/* This function doesn't exist, so if assertion is false for some reason, the
-   linker would fail.  */
-#ifdef APPLE_CC
-/* This approach fails with Apple's gcc. Use grub_abort.  */
-#include <grub/misc.h>
-static inline void *
-grub_assert_fail (void)
+static inline void *
+grub_bad_type_cast (void) __attribute__ ((error("bad type cast between incompatible grub types")));
+
+static inline void *
+grub_bad_type_cast (void)
 {
-	grub_abort ();
-	return 0;
+  grub_fatal ("bad type cast between incompatible grub types detected");
+  return 0;
 }
-#else
-extern void* grub_assert_fail (void);
-#endif
 
 #define GRUB_FIELD_MATCH(ptr, type, field) \
   ((char *) &(ptr)->field == (char *) &((type) (ptr))->field)
 
 #define GRUB_AS_LIST(ptr) \
   (GRUB_FIELD_MATCH (ptr, grub_list_t, next) ? \
-   (grub_list_t) ptr : grub_assert_fail ())
+   (grub_list_t) ptr : grub_bad_type_cast ())
 
 #define GRUB_AS_LIST_P(pptr) \
   (GRUB_FIELD_MATCH (*pptr, grub_list_t, next) ? \
-   (grub_list_t *) (void *) pptr : grub_assert_fail ())
+   (grub_list_t *) (void *) pptr : grub_bad_type_cast ())
 
 struct grub_named_list
 {
@@ -78,12 +74,12 @@
 #define GRUB_AS_NAMED_LIST(ptr) \
   ((GRUB_FIELD_MATCH (ptr, grub_named_list_t, next) && \
     GRUB_FIELD_MATCH (ptr, grub_named_list_t, name))? \
-   (grub_named_list_t) ptr : grub_assert_fail ())
+   (grub_named_list_t) ptr : grub_bad_type_cast ())
 
 #define GRUB_AS_NAMED_LIST_P(pptr) \
   ((GRUB_FIELD_MATCH (*pptr, grub_named_list_t, next) && \
     GRUB_FIELD_MATCH (*pptr, grub_named_list_t, name))? \
-   (grub_named_list_t *) (void *) pptr : grub_assert_fail ())
+   (grub_named_list_t *) (void *) pptr : grub_bad_type_cast ())
 
 #define GRUB_PRIO_LIST_PRIO_MASK	0xff
 #define GRUB_PRIO_LIST_FLAG_ACTIVE	0x100
@@ -111,12 +107,12 @@
   ((GRUB_FIELD_MATCH (ptr, grub_prio_list_t, next) && \
     GRUB_FIELD_MATCH (ptr, grub_prio_list_t, name) && \
     GRUB_FIELD_MATCH (ptr, grub_prio_list_t, prio))? \
-   (grub_prio_list_t) ptr : grub_assert_fail ())
+   (grub_prio_list_t) ptr : grub_bad_type_cast ())
 
 #define GRUB_AS_PRIO_LIST_P(pptr) \
   ((GRUB_FIELD_MATCH (*pptr, grub_prio_list_t, next) && \
     GRUB_FIELD_MATCH (*pptr, grub_prio_list_t, name) && \
     GRUB_FIELD_MATCH (*pptr, grub_prio_list_t, prio))? \
-   (grub_prio_list_t *) (void *) pptr : grub_assert_fail ())
+   (grub_prio_list_t *) (void *) pptr : grub_bad_type_cast ())
 
 #endif /* ! GRUB_LIST_HEADER */


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Fix for grub_assert_fail undefined on NetBSD and other platforms
  2009-12-22 16:28 ` BVK Chaitanya
@ 2009-12-22 17:07   ` Grégoire Sutre
  2009-12-22 17:32     ` Felix Zielcke
  2009-12-22 17:55     ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 2 replies; 11+ messages in thread
From: Grégoire Sutre @ 2009-12-22 17:07 UTC (permalink / raw)
  To: The development of GRUB 2; +Cc: BVK Chaitanya

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

Hi,

 > Unfortunately, I couldn't test this on NetBSD, where old technique was
 > reported failing as GCC optimizations didn't happen.  Can Grégoire
 > Sutr or anybody else try this out on NetBSD and confirm?

Thanks for looking into this.

I tested the second version of the patch.  Linking now works without 
errors but I get new warnings:

./include/grub/list.h:44: warning: 'error' attribute directive ignored

I attach the log of (./autogen.sh && ./configure && gmake grub-fstest 
LDFLAGS=-lintl).  This is on NetBSD 5.0 with gcc 4.1.3 (the default). 
If I use gcc 4.4 instead, then I do not get any warning.

Grégoire

[-- Attachment #2: build.log --]
[-- Type: text/plain, Size: 31014 bytes --]

acinclude.m4:17: warning: underquoted definition of grub_PROG_TARGET_CC
acinclude.m4:17:   run info '(automake)Extending aclocal'
acinclude.m4:17:   or see http://sources.redhat.com/automake/automake.html#Extending-aclocal
configure.ac:42: warning: AC_ARG_PROGRAM was called before AC_CANONICAL_TARGET
../../lib/autoconf/general.m4:1819: AC_CANONICAL_TARGET is expanded from...
configure.ac:42: the top level
configure.ac:42: warning: AC_ARG_PROGRAM was called before AC_CANONICAL_TARGET
../../lib/autoconf/general.m4:1819: AC_CANONICAL_TARGET is expanded from...
configure.ac:42: the top level
configure.ac:42: warning: AC_ARG_PROGRAM was called before AC_CANONICAL_TARGET
../../lib/autoconf/general.m4:1819: AC_CANONICAL_TARGET is expanded from...
configure.ac:42: the top level
configure.ac:42: warning: AC_ARG_PROGRAM was called before AC_CANONICAL_TARGET
../../lib/autoconf/general.m4:1819: AC_CANONICAL_TARGET is expanded from...
configure.ac:42: the top level
configure.ac:41: installing `./config.guess'
configure.ac:176: required file `./config.rpath' not found
configure.ac:41: installing `./config.sub'
configure.ac:35: installing `./install-sh'
configure.ac:35: installing `./missing'
automake: no `Makefile.am' found for any configure output
WARNING: C file isn't a module: ac.c
WARNING: C file isn't a module: cipher.c
WARNING: C file isn't a module: dsa.c
WARNING: C file isn't a module: ecc.c
WARNING: C file isn't a module: elgamal.c
WARNING: C file isn't a module: hash-common.c
WARNING: C file isn't a module: hmac-tests.c
WARNING: C file isn't a module: md.c
WARNING: C file isn't a module: primegen.c
WARNING: C file isn't a module: pubkey.c
WARNING: C file isn't a module: rsa.c
checking for a BSD-compatible install... /usr/pkg/bin/ginstall -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/pkg/bin/gmkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking build system type... i386-unknown-netbsdelf5.0.
checking host system type... i386-unknown-netbsdelf5.0.
checking target system type... i386-unknown-netbsdelf5.0.
checking for cmp... cmp
checking for bison... bison
checking for gawk... (cached) gawk
checking whether make sets $(MAKE)... (cached) yes
checking for ruby... /usr/pkg/bin/ruby
checking for makeinfo... /usr/bin/makeinfo
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... none
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/pkg/bin/ggrep
checking for egrep... /usr/pkg/bin/ggrep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking whether NLS is requested... yes
checking for msgfmt... /usr/bin/msgfmt
checking for gmsgfmt... /usr/bin/msgfmt
checking for xgettext... /usr/bin/xgettext
checking for msgmerge... /usr/bin/msgmerge
checking whether we are using the GNU C Library 2 or newer... no
checking for ranlib... ranlib
checking for strerror in -lcposix... no
checking for an ANSI C-conforming const... yes
checking for signed... yes
checking for inline... inline
checking for off_t... yes
checking for size_t... yes
checking for long long... yes
checking for long double... yes
checking for wchar_t... yes
checking for wint_t... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for intmax_t... yes
checking whether printf() supports POSIX/XSI format strings... yes
checking for working alloca.h... no
checking for alloca... yes
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking for sys/param.h... yes
checking for getpagesize... yes
checking for working mmap... yes
checking whether we are using the GNU C Library 2.1 or newer... no
checking whether integer division by zero raises SIGFPE... yes
checking for unsigned long long... yes
checking for inttypes.h... yes
checking whether the inttypes.h PRIxNN macros are broken... no
checking for stdint.h... (cached) yes
checking for SIZE_MAX... yes
checking for stdint.h... (cached) yes
checking for CFPreferencesCopyAppValue... no
checking for CFLocaleCopyCurrent... no
checking for ld used by GCC... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for shared library run path origin... /bin/ksh: ./config.rpath: No such file or directory
done
checking for ptrdiff_t... yes
checking argz.h usability... no
checking argz.h presence... no
checking for argz.h... no
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking locale.h usability... yes
checking locale.h presence... yes
checking for locale.h... yes
checking nl_types.h usability... yes
checking nl_types.h presence... yes
checking for nl_types.h... yes
checking malloc.h usability... yes
checking malloc.h presence... yes
checking for malloc.h... yes
checking stddef.h usability... yes
checking stddef.h presence... yes
checking for stddef.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for unistd.h... (cached) yes
checking for sys/param.h... (cached) yes
checking for asprintf... yes
checking for fwprintf... yes
checking for getcwd... yes
checking for getegid... yes
checking for geteuid... yes
checking for getgid... yes
checking for getuid... yes
checking for mempcpy... no
checking for munmap... yes
checking for putenv... yes
checking for setenv... yes
checking for setlocale... yes
checking for snprintf... yes
checking for stpcpy... no
checking for strcasecmp... yes
checking for strdup... yes
checking for strtoul... yes
checking for tsearch... yes
checking for wcslen... yes
checking for __argz_count... no
checking for __argz_stringify... no
checking for __argz_next... no
checking for __fsetlocking... no
checking whether _snprintf is declared... no
checking whether _snwprintf is declared... no
checking whether feof_unlocked is declared... no
checking whether fgets_unlocked is declared... no
checking whether getc_unlocked is declared... yes
checking for iconv... yes
checking for iconv declaration... install-shextern size_t iconv (iconv_t cd, const char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
checking for nl_langinfo and CODESET... yes
checking for LC_MESSAGES... yes
checking for bison... bison
checking version of bison... 2.4.1, ok
checking for CFPreferencesCopyAppValue... (cached) no
checking for CFLocaleCopyCurrent... (cached) no
checking whether NLS is requested... yes
checking whether included gettext is requested... no
checking for GNU gettext in libc... no
checking for GNU gettext in libintl... no
checking whether to use NLS... yes
checking where the gettext function comes from... included intl directory
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking whether byte ordering is bigendian... no
checking size of void *... 4
checking size of long... 4
checking whether our compiler is apple cc... no
checking for help2man... /usr/pkg/bin/help2man
checking for posix_memalign... yes
checking for memalign... no
checking for asprintf... (cached) yes
checking for vasprintf... yes
checking whether sys/types.h defines makedev... yes
checking for dirent.h that defines DIR... yes
checking for library containing opendir... none required
checking for memmove... yes
checking for sbrk... yes
checking for strdup... (cached) yes
checking for lstat... yes
checking for getuid... (cached) yes
checking for getgid... (cached) yes
checking sys/mkdev.h usability... no
checking sys/mkdev.h presence... no
checking for sys/mkdev.h... no
checking sys/sysmacros.h usability... no
checking sys/sysmacros.h presence... no
checking for sys/sysmacros.h... no
checking for malloc.h... (cached) yes
checking termios.h usability... yes
checking termios.h presence... yes
checking for termios.h... yes
checking for sys/types.h... (cached) yes
checking for unistd.h... (cached) yes
checking for string.h... (cached) yes
checking for strings.h... (cached) yes
checking for sys/stat.h... (cached) yes
checking sys/fcntl.h usability... yes
checking sys/fcntl.h presence... yes
checking for sys/fcntl.h... yes
checking for objcopy... objcopy
checking for strip... strip
checking for nm... nm
checking whether our target compiler is apple cc... no
checking for command to convert module to ELF format... 
checking whether `gcc' generates calls to `__enable_execute_stack()'... yes
checking whether `gcc' has `-fPIE' as default... no
checking whether `gcc' accepts `-fstack-protector'... yes
checking whether `gcc' accepts `-mstack-arg-probe'... yes
checking for __bswapsi2... no
checking for __bswapdi2... no
checking for __ashldi3... yes
checking for __ashrdi3... yes
checking for __lshrdi3... yes
checking for __trampoline_setup... no
checking for __ucmpdi2... yes
checking whether target compiler is working... yes
checking whether objcopy works for absolute addresses... yes
checking whether linker accepts --build-id=none... no
checking if C symbols get an underscore after compilation... no
checking if __bss_start is defined by the compiler... yes
checking if edata is defined by the compiler... yes
checking if _edata is defined by the compiler... yes
checking if end is defined by the compiler... yes
checking if _end is defined by the compiler... yes
checking whether addr32 must be in the same line as the instruction... yes
checking for .code16 addr32 assembler support... yes
checking whether an absolute indirect call/jump must not be prefixed with an asterisk... no
checking whether options required for efiemu work... no
checking for freetype-config... freetype-config
checking whether ln can handle directories properly... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating gensymlist.sh
config.status: creating genkernsyms.sh
config.status: creating stamp-h
config.status: creating config.h
config.status: linking include/grub/i386 to include/grub/cpu
config.status: linking include/grub/i386/pc to include/grub/machine
config.status: executing depfiles commands
config.status: executing default-1 commands
*******************************************************
GRUB2 will be compiled with following components:
Platform: i386-pc
With memory debugging: No
efiemu runtime: No (cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib)
grub-fstest: Yes
grub-mkfont: Yes
*******************************************************
gcc -Ignulib -I./gnulib -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-gnulib_progname.o gnulib/progname.c
rm -f grub_fstest_init.lst; grep GRUB_MOD_INIT gnulib/progname.c util/grub-fstest.c util/hostfs.c util/misc.c kern/file.c kern/device.c kern/disk.c kern/err.c kern/misc.c disk/host.c disk/loopback.c kern/list.c kern/command.c lib/arg.c commands/extcmd.c normal/datetime.c normal/misc.c lib/hexdump.c lib/crc.c commands/blocklist.c commands/ls.c fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c fs/befs.c fs/befs_be.c fs/tar.c kern/partition.c partmap/msdos.c partmap/apple.c partmap/sun.c partmap/gpt.c kern/fs.c kern/env.c fs/fshelp.c disk/raid.c disk/raid5_recover.c disk/raid6_recover.c disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c /dev/null > grub_fstest_init.lst
rm -f grub_fstest_init.h; sh ./geninitheader.sh grub_fstest_init.lst > grub_fstest_init.h
gcc -Iutil -I./util -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-util_grub_fstest.o util/grub-fstest.c
In file included from ./include/grub/handler.h:23,
                 from ./include/grub/term.h:41,
                 from util/grub-fstest.c:29:
./include/grub/list.h:44: warning: 'error' attribute directive ignored
gcc -Iutil -I./util -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-util_hostfs.o util/hostfs.c
gcc -Iutil -I./util -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-util_misc.o util/misc.c
In file included from ./include/grub/handler.h:23,
                 from ./include/grub/term.h:41,
                 from util/misc.c:39:
./include/grub/list.h:44: warning: 'error' attribute directive ignored
gcc -Ikern -I./kern -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-kern_file.o kern/file.c
gcc -Ikern -I./kern -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-kern_device.o kern/device.c
gcc -Ikern -I./kern -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-kern_disk.o kern/disk.c
gcc -Ikern -I./kern -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-kern_err.o kern/err.c
gcc -Ikern -I./kern -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-kern_misc.o kern/misc.c
In file included from ./include/grub/handler.h:23,
                 from ./include/grub/term.h:41,
                 from kern/misc.c:24:
./include/grub/list.h:44: warning: 'error' attribute directive ignored
gcc -Idisk -I./disk -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-disk_host.o disk/host.c
gcc -Idisk -I./disk -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-disk_loopback.o disk/loopback.c
In file included from ./include/grub/command.h:24,
                 from ./include/grub/extcmd.h:23,
                 from disk/loopback.c:25:
./include/grub/list.h:44: warning: 'error' attribute directive ignored
gcc -Ikern -I./kern -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-kern_list.o kern/list.c
In file included from kern/list.c:20:
./include/grub/list.h:44: warning: 'error' attribute directive ignored
gcc -Ikern -I./kern -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-kern_command.o kern/command.c
In file included from ./include/grub/command.h:24,
                 from kern/command.c:21:
./include/grub/list.h:44: warning: 'error' attribute directive ignored
gcc -Ilib -I./lib -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-lib_arg.o lib/arg.c
In file included from ./include/grub/handler.h:23,
                 from ./include/grub/term.h:41,
                 from lib/arg.c:23:
./include/grub/list.h:44: warning: 'error' attribute directive ignored
gcc -Icommands -I./commands -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-commands_extcmd.o commands/extcmd.c
In file included from commands/extcmd.c:21:
./include/grub/list.h:44: warning: 'error' attribute directive ignored
gcc -Inormal -I./normal -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-normal_datetime.o normal/datetime.c
gcc -Inormal -I./normal -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-normal_misc.o normal/misc.c
In file included from ./include/grub/command.h:24,
                 from ./include/grub/normal.h:27,
                 from normal/misc.c:20:
./include/grub/list.h:44: warning: 'error' attribute directive ignored
gcc -Ilib -I./lib -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-lib_hexdump.o lib/hexdump.c
gcc -Ilib -I./lib -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-lib_crc.o lib/crc.c
gcc -Icommands -I./commands -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-commands_blocklist.o commands/blocklist.c
In file included from ./include/grub/command.h:24,
                 from commands/blocklist.c:26:
./include/grub/list.h:44: warning: 'error' attribute directive ignored
gcc -Icommands -I./commands -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-commands_ls.o commands/ls.c
In file included from ./include/grub/handler.h:23,
                 from ./include/grub/term.h:41,
                 from commands/ls.c:27:
./include/grub/list.h:44: warning: 'error' attribute directive ignored
gcc -Ifs -I./fs -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-fs_affs.o fs/affs.c
gcc -Ifs -I./fs -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-fs_cpio.o fs/cpio.c
gcc -Ifs -I./fs -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-fs_fat.o fs/fat.c
gcc -Ifs -I./fs -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-fs_ext2.o fs/ext2.c
gcc -Ifs -I./fs -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-fs_hfs.o fs/hfs.c
gcc -Ifs -I./fs -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-fs_hfsplus.o fs/hfsplus.c
gcc -Ifs -I./fs -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-fs_iso9660.o fs/iso9660.c
gcc -Ifs -I./fs -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-fs_udf.o fs/udf.c
gcc -Ifs -I./fs -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-fs_jfs.o fs/jfs.c
gcc -Ifs -I./fs -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-fs_minix.o fs/minix.c
gcc -Ifs -I./fs -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-fs_ntfs.o fs/ntfs.c
gcc -Ifs -I./fs -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-fs_ntfscomp.o fs/ntfscomp.c
gcc -Ifs -I./fs -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-fs_reiserfs.o fs/reiserfs.c
gcc -Ifs -I./fs -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-fs_sfs.o fs/sfs.c
gcc -Ifs -I./fs -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-fs_ufs.o fs/ufs.c
gcc -Ifs -I./fs -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-fs_ufs2.o fs/ufs2.c
gcc -Ifs -I./fs -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-fs_xfs.o fs/xfs.c
gcc -Ifs -I./fs -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-fs_afs.o fs/afs.c
gcc -Ifs -I./fs -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-fs_afs_be.o fs/afs_be.c
gcc -Ifs -I./fs -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-fs_befs.o fs/befs.c
gcc -Ifs -I./fs -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-fs_befs_be.o fs/befs_be.c
gcc -Ifs -I./fs -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-fs_tar.o fs/tar.c
gcc -Ikern -I./kern -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-kern_partition.o kern/partition.c
gcc -Ipartmap -I./partmap -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-partmap_msdos.o partmap/msdos.c
gcc -Ipartmap -I./partmap -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-partmap_apple.o partmap/apple.c
gcc -Ipartmap -I./partmap -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-partmap_sun.o partmap/sun.c
gcc -Ipartmap -I./partmap -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-partmap_gpt.o partmap/gpt.c
gcc -Ikern -I./kern -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-kern_fs.o kern/fs.c
In file included from ./include/grub/handler.h:23,
                 from ./include/grub/term.h:41,
                 from kern/fs.c:28:
./include/grub/list.h:44: warning: 'error' attribute directive ignored
gcc -Ikern -I./kern -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-kern_env.o kern/env.c
gcc -Ifs -I./fs -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-fs_fshelp.o fs/fshelp.c
gcc -Idisk -I./disk -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-disk_raid.o disk/raid.c
gcc -Idisk -I./disk -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-disk_raid5_recover.o disk/raid5_recover.c
gcc -Idisk -I./disk -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-disk_raid6_recover.o disk/raid6_recover.c
gcc -Idisk -I./disk -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-disk_mdraid_linux.o disk/mdraid_linux.c
gcc -Idisk -I./disk -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-disk_dmraid_nvidia.o disk/dmraid_nvidia.c
gcc -Idisk -I./disk -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-disk_lvm.o disk/lvm.c
rm -f grub_fstest_init.c; sh ./geninit.sh grub_fstest_init.lst gnulib/progname.c util/grub-fstest.c util/hostfs.c util/misc.c kern/file.c kern/device.c kern/disk.c kern/err.c kern/misc.c disk/host.c disk/loopback.c kern/list.c kern/command.c lib/arg.c commands/extcmd.c normal/datetime.c normal/misc.c lib/hexdump.c lib/crc.c commands/blocklist.c commands/ls.c fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c fs/befs.c fs/befs_be.c fs/tar.c kern/partition.c partmap/msdos.c partmap/apple.c partmap/sun.c partmap/gpt.c kern/fs.c kern/env.c fs/fshelp.c disk/raid.c disk/raid5_recover.c disk/raid6_recover.c disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c > grub_fstest_init.c
gcc -I. -I./. -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1  -MD -c -o grub_fstest-grub_fstest_init.o grub_fstest_init.c
gcc -o grub-fstest grub_fstest-gnulib_progname.o grub_fstest-util_grub_fstest.o grub_fstest-util_hostfs.o grub_fstest-util_misc.o grub_fstest-kern_file.o grub_fstest-kern_device.o grub_fstest-kern_disk.o grub_fstest-kern_err.o grub_fstest-kern_misc.o grub_fstest-disk_host.o grub_fstest-disk_loopback.o grub_fstest-kern_list.o grub_fstest-kern_command.o grub_fstest-lib_arg.o grub_fstest-commands_extcmd.o grub_fstest-normal_datetime.o grub_fstest-normal_misc.o grub_fstest-lib_hexdump.o grub_fstest-lib_crc.o grub_fstest-commands_blocklist.o grub_fstest-commands_ls.o grub_fstest-fs_affs.o grub_fstest-fs_cpio.o grub_fstest-fs_fat.o grub_fstest-fs_ext2.o grub_fstest-fs_hfs.o grub_fstest-fs_hfsplus.o grub_fstest-fs_iso9660.o grub_fstest-fs_udf.o grub_fstest-fs_jfs.o grub_fstest-fs_minix.o grub_fstest-fs_ntfs.o grub_fstest-fs_ntfscomp.o grub_fstest-fs_reiserfs.o grub_fstest-fs_sfs.o grub_fstest-fs_ufs.o grub_fstest-fs_ufs2.o grub_fstest-fs_xfs.o grub_fstest-fs_afs.o grub_fstest-fs_afs_be.o grub_fstest-fs_befs.o grub_fstest-fs_befs_be.o grub_fstest-fs_tar.o grub_fstest-kern_partition.o grub_fstest-partmap_msdos.o grub_fstest-partmap_apple.o grub_fstest-partmap_sun.o grub_fstest-partmap_gpt.o grub_fstest-kern_fs.o grub_fstest-kern_env.o grub_fstest-fs_fshelp.o grub_fstest-disk_raid.o grub_fstest-disk_raid5_recover.o grub_fstest-disk_raid6_recover.o grub_fstest-disk_mdraid_linux.o grub_fstest-disk_dmraid_nvidia.o grub_fstest-disk_lvm.o grub_fstest-grub_fstest_init.o -lintl 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Fix for grub_assert_fail undefined on NetBSD and other platforms
  2009-12-22 17:07   ` Grégoire Sutre
@ 2009-12-22 17:32     ` Felix Zielcke
  2009-12-22 17:55     ` Vladimir 'φ-coder/phcoder' Serbinenko
  1 sibling, 0 replies; 11+ messages in thread
From: Felix Zielcke @ 2009-12-22 17:32 UTC (permalink / raw)
  To: The development of GNU GRUB

Am Dienstag, den 22.12.2009, 18:07 +0100 schrieb Grégoire Sutre:
> This is on NetBSD 5.0 with gcc 4.1.3 (the default). 
> If I use gcc 4.4 instead, then I do not get any warning. 

It looks like gcc 4.3 introduced the error attribute.
But this isn't documented at the gcc.gnu.org/gcc-4.X/changes.html pages.
Only the gcc-4.3 manual avaible there explains it but not the gcc-4.2
one.
-- 
Felix Zielcke
Proud Debian Maintainer and GNU GRUB developer




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Fix for grub_assert_fail undefined on NetBSD and other platforms
  2009-12-22 17:07   ` Grégoire Sutre
  2009-12-22 17:32     ` Felix Zielcke
@ 2009-12-22 17:55     ` Vladimir 'φ-coder/phcoder' Serbinenko
  2009-12-23  6:01       ` BVK Chaitanya
  1 sibling, 1 reply; 11+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2009-12-22 17:55 UTC (permalink / raw)
  To: The development of GNU GRUB; +Cc: BVK Chaitanya

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

Grégoire Sutre wrote:
> Hi,
>
> > Unfortunately, I couldn't test this on NetBSD, where old technique was
> > reported failing as GCC optimizations didn't happen.  Can Grégoire
> > Sutr or anybody else try this out on NetBSD and confirm?
>
> Thanks for looking into this.
>
> I tested the second version of the patch.  Linking now works without
> errors but I get new warnings:
>
> ./include/grub/list.h:44: warning: 'error' attribute directive ignored
This situation is acceptable. In unlikely case that cast is indeed bad
you will get runtime error instead of compile error. But it would be a
benefit if abort message would de improved by defining intermidiate
macro while will pass __LINE__ and __FILE__ to bad_cast_real which will
use it to tell developper where there is a problem
>
> I attach the log of (./autogen.sh && ./configure && gmake grub-fstest
> LDFLAGS=-lintl).  This is on NetBSD 5.0 with gcc 4.1.3 (the default).
> If I use gcc 4.4 instead, then I do not get any warning.
>
> Grégoire
> ------------------------------------------------------------------------
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel


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



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 293 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Fix for grub_assert_fail undefined on NetBSD and other platforms
  2009-12-22 17:55     ` Vladimir 'φ-coder/phcoder' Serbinenko
@ 2009-12-23  6:01       ` BVK Chaitanya
  2009-12-23 11:16         ` Gre'goire Sutre
  0 siblings, 1 reply; 11+ messages in thread
From: BVK Chaitanya @ 2009-12-23  6:01 UTC (permalink / raw)
  To: Vladimir 'φ-coder/phcoder' Serbinenko
  Cc: The development of GNU GRUB

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

2009/12/22 Vladimir 'φ-coder/phcoder' Serbinenko <phcoder@gmail.com>:
>> ./include/grub/list.h:44: warning: 'error' attribute directive ignored
> This situation is acceptable. In unlikely case that cast is indeed bad
> you will get runtime error instead of compile error. But it would be a
> benefit if abort message would de improved by defining intermidiate
> macro while will pass __LINE__ and __FILE__ to bad_cast_real which will
> use it to tell developper where there is a problem


Attached patch has __LINE__ and __FILE__ tags added.

I ran indent on modified headers (list.h, handler.h) so patch has few
coding style changes extra.



-- 
bvk.chaitanya

[-- Attachment #2: grub-assert-fail.patch3.txt --]
[-- Type: text/plain, Size: 6247 bytes --]

=== modified file 'include/grub/handler.h'
--- include/grub/handler.h	2009-03-01 17:51:44 +0000
+++ include/grub/handler.h	2009-12-23 04:14:29 +0000
@@ -27,8 +27,8 @@
 {
   struct grub_handler *next;
   const char *name;
-  grub_err_t (*init) (void);
-  grub_err_t (*fini) (void);
+    grub_err_t (*init) (void);
+    grub_err_t (*fini) (void);
 };
 typedef struct grub_handler *grub_handler_t;
 
@@ -41,20 +41,20 @@
 };
 typedef struct grub_handler_class *grub_handler_class_t;
 
-extern grub_handler_class_t EXPORT_VAR(grub_handler_class_list);
+extern grub_handler_class_t EXPORT_VAR (grub_handler_class_list);
 
-void EXPORT_FUNC(grub_handler_register) (grub_handler_class_t class,
-					 grub_handler_t handler);
-void EXPORT_FUNC(grub_handler_unregister) (grub_handler_class_t class,
-					   grub_handler_t handler);
-grub_err_t EXPORT_FUNC(grub_handler_set_current) (grub_handler_class_t class,
-						  grub_handler_t handler);
+void EXPORT_FUNC (grub_handler_register) (grub_handler_class_t class,
+					  grub_handler_t handler);
+void EXPORT_FUNC (grub_handler_unregister) (grub_handler_class_t class,
+					    grub_handler_t handler);
+grub_err_t EXPORT_FUNC (grub_handler_set_current) (grub_handler_class_t class,
+						   grub_handler_t handler);
 
 #define GRUB_AS_HANDLER(ptr) \
   ((GRUB_FIELD_MATCH (ptr, grub_handler_t, next) && \
     GRUB_FIELD_MATCH (ptr, grub_handler_t, name) && \
     GRUB_FIELD_MATCH (ptr, grub_handler_t, init) && \
     GRUB_FIELD_MATCH (ptr, grub_handler_t, fini)) ? \
-   (grub_handler_t) ptr : grub_assert_fail ())
+   (grub_handler_t) ptr : grub_bad_type_cast (__LINE__, __FILE__))
 
 #endif /* ! GRUB_HANDLER_HEADER */

=== modified file 'include/grub/list.h'
--- include/grub/list.h	2009-11-09 14:25:03 +0000
+++ include/grub/list.h	2009-12-23 05:54:34 +0000
@@ -22,6 +22,7 @@
 
 #include <grub/symbol.h>
 #include <grub/types.h>
+#include <grub/misc.h>
 
 struct grub_list
 {
@@ -32,38 +33,34 @@
 typedef int (*grub_list_hook_t) (grub_list_t item);
 typedef int (*grub_list_test_t) (grub_list_t new_item, grub_list_t item);
 
-void EXPORT_FUNC(grub_list_push) (grub_list_t *head, grub_list_t item);
-void * EXPORT_FUNC(grub_list_pop) (grub_list_t *head);
-void EXPORT_FUNC(grub_list_remove) (grub_list_t *head, grub_list_t item);
-int EXPORT_FUNC(grub_list_iterate) (grub_list_t head, grub_list_hook_t hook);
-void EXPORT_FUNC(grub_list_insert) (grub_list_t *head, grub_list_t item,
-				    grub_list_test_t test);
-
-/* This function doesn't exist, so if assertion is false for some reason, the
-   linker would fail.  */
-#ifdef APPLE_CC
-/* This approach fails with Apple's gcc. Use grub_abort.  */
-#include <grub/misc.h>
+void EXPORT_FUNC (grub_list_push) (grub_list_t * head, grub_list_t item);
+void *EXPORT_FUNC (grub_list_pop) (grub_list_t * head);
+void EXPORT_FUNC (grub_list_remove) (grub_list_t * head, grub_list_t item);
+int EXPORT_FUNC (grub_list_iterate) (grub_list_t head, grub_list_hook_t hook);
+void EXPORT_FUNC (grub_list_insert) (grub_list_t * head, grub_list_t item,
+				     grub_list_test_t test);
+
+static inline void *grub_bad_type_cast (int line, const char *file)
+  __attribute__ ((error ("bad type cast between incompatible grub types")));
+
 static inline void *
-grub_assert_fail (void)
+grub_bad_type_cast (int line, const char *file)
 {
-	grub_abort ();
-	return 0;
+  grub_fatal ("error:%s:%u: bad type cast between incompatible grub types",
+	      file, line);
+  return 0;
 }
-#else
-extern void* grub_assert_fail (void);
-#endif
 
 #define GRUB_FIELD_MATCH(ptr, type, field) \
   ((char *) &(ptr)->field == (char *) &((type) (ptr))->field)
 
 #define GRUB_AS_LIST(ptr) \
   (GRUB_FIELD_MATCH (ptr, grub_list_t, next) ? \
-   (grub_list_t) ptr : grub_assert_fail ())
+   (grub_list_t) ptr : grub_bad_type_cast (__LINE__, __FILE__))
 
 #define GRUB_AS_LIST_P(pptr) \
   (GRUB_FIELD_MATCH (*pptr, grub_list_t, next) ? \
-   (grub_list_t *) (void *) pptr : grub_assert_fail ())
+   (grub_list_t *) (void *) pptr : grub_bad_type_cast (__LINE__, __FILE__))
 
 struct grub_named_list
 {
@@ -72,18 +69,18 @@
 };
 typedef struct grub_named_list *grub_named_list_t;
 
-void * EXPORT_FUNC(grub_named_list_find) (grub_named_list_t head,
+void *EXPORT_FUNC (grub_named_list_find) (grub_named_list_t head,
 					  const char *name);
 
 #define GRUB_AS_NAMED_LIST(ptr) \
   ((GRUB_FIELD_MATCH (ptr, grub_named_list_t, next) && \
     GRUB_FIELD_MATCH (ptr, grub_named_list_t, name))? \
-   (grub_named_list_t) ptr : grub_assert_fail ())
+   (grub_named_list_t) ptr : grub_bad_type_cast (__LINE__, __FILE__))
 
 #define GRUB_AS_NAMED_LIST_P(pptr) \
   ((GRUB_FIELD_MATCH (*pptr, grub_named_list_t, next) && \
     GRUB_FIELD_MATCH (*pptr, grub_named_list_t, name))? \
-   (grub_named_list_t *) (void *) pptr : grub_assert_fail ())
+   (grub_named_list_t *) (void *) pptr : grub_bad_type_cast (__LINE__, __FILE__))
 
 #define GRUB_PRIO_LIST_PRIO_MASK	0xff
 #define GRUB_PRIO_LIST_FLAG_ACTIVE	0x100
@@ -96,11 +93,11 @@
 };
 typedef struct grub_prio_list *grub_prio_list_t;
 
-void EXPORT_FUNC(grub_prio_list_insert) (grub_prio_list_t *head,
-					 grub_prio_list_t item);
+void EXPORT_FUNC (grub_prio_list_insert) (grub_prio_list_t * head,
+					  grub_prio_list_t item);
 
 static inline void
-grub_prio_list_remove (grub_prio_list_t *head, grub_prio_list_t item)
+grub_prio_list_remove (grub_prio_list_t * head, grub_prio_list_t item)
 {
   if ((item->prio & GRUB_PRIO_LIST_FLAG_ACTIVE) && (item->next))
     item->next->prio |= GRUB_PRIO_LIST_FLAG_ACTIVE;
@@ -111,12 +108,12 @@
   ((GRUB_FIELD_MATCH (ptr, grub_prio_list_t, next) && \
     GRUB_FIELD_MATCH (ptr, grub_prio_list_t, name) && \
     GRUB_FIELD_MATCH (ptr, grub_prio_list_t, prio))? \
-   (grub_prio_list_t) ptr : grub_assert_fail ())
+   (grub_prio_list_t) ptr : grub_bad_type_cast (__LINE__, __FILE__))
 
 #define GRUB_AS_PRIO_LIST_P(pptr) \
   ((GRUB_FIELD_MATCH (*pptr, grub_prio_list_t, next) && \
     GRUB_FIELD_MATCH (*pptr, grub_prio_list_t, name) && \
     GRUB_FIELD_MATCH (*pptr, grub_prio_list_t, prio))? \
-   (grub_prio_list_t *) (void *) pptr : grub_assert_fail ())
+   (grub_prio_list_t *) (void *) pptr : grub_bad_type_cast (__LINE__, __FILE__))
 
 #endif /* ! GRUB_LIST_HEADER */


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Fix for grub_assert_fail undefined on NetBSD and other platforms
  2009-12-23  6:01       ` BVK Chaitanya
@ 2009-12-23 11:16         ` Gre'goire Sutre
  2009-12-23 16:53           ` BVK Chaitanya
  0 siblings, 1 reply; 11+ messages in thread
From: Gre'goire Sutre @ 2009-12-23 11:16 UTC (permalink / raw)
  To: The development of GNU GRUB

BVK Chaitanya wrote:
> 
> Attached patch has __LINE__ and __FILE__ tags added.

For your information, I tested it on NetBSD 5.0 (with default gcc 
4.1.3), and everything seems fine.

Thanks,

Gre'goire



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Fix for grub_assert_fail undefined on NetBSD and other platforms
  2009-12-23 11:16         ` Gre'goire Sutre
@ 2009-12-23 16:53           ` BVK Chaitanya
  0 siblings, 0 replies; 11+ messages in thread
From: BVK Chaitanya @ 2009-12-23 16:53 UTC (permalink / raw)
  To: The development of GNU GRUB

2009/12/23 Gre'goire Sutre <gregoire.sutre@labri.fr>:
>
> For your information, I tested it on NetBSD 5.0 (with default gcc 4.1.3),
> and everything seems fine.
>


Thanks Gre'goire.  I wanted to ask you to verify, but i forgot to mention :-(



-- 
bvk.chaitanya



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Fix for grub_assert_fail undefined on NetBSD and other platforms
  2009-12-22 16:09 Fix for grub_assert_fail undefined on NetBSD and other platforms BVK Chaitanya
  2009-12-22 16:28 ` BVK Chaitanya
@ 2009-12-24 21:55 ` Robert Millan
  2009-12-25 17:21   ` Felix Zielcke
  1 sibling, 1 reply; 11+ messages in thread
From: Robert Millan @ 2009-12-24 21:55 UTC (permalink / raw)
  To: The development of GNU GRUB; +Cc: gregoire.sutre

On Tue, Dec 22, 2009 at 09:39:07PM +0530, BVK Chaitanya wrote:
> Hi
> 
> 
> Attached is the patch, which removes use of undefined grub_assert_fail
> function for catching bad-type-cast errors, with a better version
> __attribute__((error("msg"))) gcc extension.  With this extension, gcc
> can give the exact location of the bad type cast at compile time.

Is this really a kind of error we'd like to report at run time?  Sorry if
I'm missing something, but if we need additional code to handle it, and it
was known at compile time, why do we do this?

-- 
Robert Millan

  "Be the change you want to see in the world" -- Gandhi



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Fix for grub_assert_fail undefined on NetBSD and other platforms
  2009-12-24 21:55 ` Robert Millan
@ 2009-12-25 17:21   ` Felix Zielcke
  2009-12-26 13:28     ` Robert Millan
  0 siblings, 1 reply; 11+ messages in thread
From: Felix Zielcke @ 2009-12-25 17:21 UTC (permalink / raw)
  To: The development of GNU GRUB

Am Donnerstag, den 24.12.2009, 22:55 +0100 schrieb Robert Millan:
> On Tue, Dec 22, 2009 at 09:39:07PM +0530, BVK Chaitanya wrote:
> > Hi
> > 
> > 
> > Attached is the patch, which removes use of undefined
> grub_assert_fail
> > function for catching bad-type-cast errors, with a better version
> > __attribute__((error("msg"))) gcc extension.  With this extension,
> gcc
> > can give the exact location of the bad type cast at compile time.
> 
> Is this really a kind of error we'd like to report at run time?  Sorry
> if
> I'm missing something, but if we need additional code to handle it,
> and it
> was known at compile time, why do we do this?

__attribute__ ((error)) still reports it at compile time just like the
old grub_assert_fail method.
But the advantage is that you can specify the error message instead of
just getting a `ld: unknown symbol grub_assert_fail' error during
linking. And as BVK said above also the exact location where this
happened.

-- 
Felix Zielcke
Proud Debian Maintainer and GNU GRUB developer




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Fix for grub_assert_fail undefined on NetBSD and other platforms
  2009-12-25 17:21   ` Felix Zielcke
@ 2009-12-26 13:28     ` Robert Millan
  0 siblings, 0 replies; 11+ messages in thread
From: Robert Millan @ 2009-12-26 13:28 UTC (permalink / raw)
  To: The development of GNU GRUB

On Fri, Dec 25, 2009 at 06:21:58PM +0100, Felix Zielcke wrote:
> Am Donnerstag, den 24.12.2009, 22:55 +0100 schrieb Robert Millan:
> > On Tue, Dec 22, 2009 at 09:39:07PM +0530, BVK Chaitanya wrote:
> > > Hi
> > > 
> > > 
> > > Attached is the patch, which removes use of undefined
> > grub_assert_fail
> > > function for catching bad-type-cast errors, with a better version
> > > __attribute__((error("msg"))) gcc extension.  With this extension,
> > gcc
> > > can give the exact location of the bad type cast at compile time.
> > 
> > Is this really a kind of error we'd like to report at run time?  Sorry
> > if
> > I'm missing something, but if we need additional code to handle it,
> > and it
> > was known at compile time, why do we do this?
> 
> __attribute__ ((error)) still reports it at compile time just like the
> old grub_assert_fail method.
> But the advantage is that you can specify the error message instead of
> just getting a `ld: unknown symbol grub_assert_fail' error during
> linking. And as BVK said above also the exact location where this
> happened.

Oh, ok.  Seems fine then.

-- 
Robert Millan

  "Be the change you want to see in the world" -- Gandhi



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2009-12-26 13:28 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-22 16:09 Fix for grub_assert_fail undefined on NetBSD and other platforms BVK Chaitanya
2009-12-22 16:28 ` BVK Chaitanya
2009-12-22 17:07   ` Grégoire Sutre
2009-12-22 17:32     ` Felix Zielcke
2009-12-22 17:55     ` Vladimir 'φ-coder/phcoder' Serbinenko
2009-12-23  6:01       ` BVK Chaitanya
2009-12-23 11:16         ` Gre'goire Sutre
2009-12-23 16:53           ` BVK Chaitanya
2009-12-24 21:55 ` Robert Millan
2009-12-25 17:21   ` Felix Zielcke
2009-12-26 13:28     ` Robert Millan

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.