All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Grégoire Sutre" <gregoire.sutre@gmail.com>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: [PATCH] Fix getline name clash
Date: Thu, 23 Sep 2010 13:36:48 +0200	[thread overview]
Message-ID: <4C9B3BD0.3060108@gmail.com> (raw)

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

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

[-- Attachment #2: patch-getline.diff --]
[-- Type: text/plain, Size: 2003 bytes --]

=== 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.sutre@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  <phcoder@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.


             reply	other threads:[~2010-09-23 11:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-23 11:36 Grégoire Sutre [this message]
2010-09-24 10:18 ` [PATCH] Fix getline name clash Colin Watson
2010-09-24 10:37   ` Grégoire Sutre
2010-10-19  9:17     ` BVK Chaitanya
2010-10-19 12:39       ` Grégoire Sutre
2010-10-22 21:56       ` 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=4C9B3BD0.3060108@gmail.com \
    --to=gregoire.sutre@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.