Hi,

On NetBSD 5, the latest trunk does not build:

$ ./autogen.sh ; ./configure CFLAGS='-std=gnu99' ; gmake
[...]
gcc -DHAVE_CONFIG_H -I. -Wall -W -I./include -DGRUB_UTIL=1 -DGRUB_LIBDIR=\"/usr/local/lib/grub\" -DLOCALEDIR=\"/usr/local/share/locale\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_MACHINE=I386_PC -DGRUB_FILE=\"grub-core/script/lexer.c\" -I. -I. -I. -I. -I./include -I./include -I./grub-core/gnulib -I./grub-core/gnulib -I./grub-core/lib/libgcrypt_wrap -Wno-undef -Wno-sign-compare -Wno-unused -Wno-error -Wno-missing-field-initializers -std=gnu99 -MT grub-core/script/libgrub_a-lexer.o -MD -MP -MF grub-core/script/.deps-util/libgrub_a-lexer.Tpo -c -o grub-core/script/libgrub_a-lexer.o `test -f 'grub-core/script/lexer.c' || echo './'`grub-core/script/lexer.c
grub-core/script/lexer.c: In function 'grub_script_lexer_yywrap':
grub-core/script/lexer.c:136: error: 'struct grub_lexer_param' has no member named 'rpl_getline' grub-core/script/lexer.c:144: error: 'struct grub_lexer_param' has no member named 'rpl_getline'
grub-core/script/lexer.c: In function 'grub_script_lexer_init':
grub-core/script/lexer.c:222: error: 'struct grub_lexer_param' has no member named 'rpl_getline'


I believe that this comes from grub-core/gnulib/stdio.in.h, which
contains:

#if @GNULIB_GETLINE@
/* [...] */
# if @REPLACE_GETLINE@
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
#   undef getline
#   define getline rpl_getline
#  endif

On my system, both @GNULIB_GETLINE@ and @REPLACE_GETLINE@ get replaced
by 1 in the generated file grub-core/gnulib/stdio.h.  This file gets
included in the above compilation command, which leads to a
substitution of `getline' by `rpl_getline' in lexer.c, even for the
accesses to the field `getline' of the struct grub_lexer_param.

The attached patch simply renames this field by `getnewline'.

Grégoire
=== modified file 'ChangeLog'
--- ChangeLog   2010-09-23 00:10:44 +0000
+++ ChangeLog   2010-09-23 11:18:51 +0000
@@ -1,3 +1,10 @@
+2010-09-23  Grégoire Sutre  <gregoire.su...@gmail.com>
+
+       * include/grub/script_sh.h (grub_lexer_param): Renamed field `getline'
+       into `getnewline'.
+       * grub-core/script/lexer.c (grub_script_lexer_yywrap): Likewise.
+       (grub_script_lexer_init): Likewise.
+
 2010-09-23  Vladimir Serbinenko  <phco...@gmail.com>
 
        Support xz compression on yeeloong.

=== modified file 'grub-core/script/lexer.c'
--- grub-core/script/lexer.c    2010-09-04 05:26:23 +0000
+++ grub-core/script/lexer.c    2010-09-23 07:32:35 +0000
@@ -133,7 +133,7 @@ grub_script_lexer_yywrap (struct grub_pa
   if (! lexerstate->refs && ! lexerstate->prefix && ! input)
     return 1;
 
-  if (! lexerstate->getline && ! input)
+  if (! lexerstate->getnewline && ! input)
     {
       grub_script_yyerror (parserstate, "unexpected end of file");
       return 1;
@@ -141,7 +141,7 @@ grub_script_lexer_yywrap (struct grub_pa
 
   line = 0;
   if (! input)
-    lexerstate->getline (&line, 1);
+    lexerstate->getnewline (&line, 1);
   else
     line = grub_strdup (input);
 
@@ -219,7 +219,7 @@ grub_script_lexer_init (struct grub_pars
       return 0;
     }
 
-  lexerstate->getline = getline;       /* rest are all zeros already */
+  lexerstate->getnewline = getline;    /* rest are all zeros already */
   if (yylex_init (&lexerstate->yyscanner))
     {
       grub_free (lexerstate->text);

=== modified file 'include/grub/script_sh.h'
--- include/grub/script_sh.h    2010-09-04 17:04:32 +0000
+++ include/grub/script_sh.h    2010-09-23 07:33:42 +0000
@@ -160,7 +160,7 @@ struct grub_lexer_param
 {
   /* Function used by the lexer to get a new line when more input is
      expected, but not available.  */
-  grub_reader_getline_t getline;
+  grub_reader_getline_t getnewline;
 
   /* A reference counter.  If this is >0 it means that the parser
      expects more tokens and `getline' should be called to fetch more.

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

Reply via email to