From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1NrY1H-0004G6-5Q for mharc-grub-devel@gnu.org; Tue, 16 Mar 2010 10:45:19 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NrY1C-0004F4-VL for grub-devel@gnu.org; Tue, 16 Mar 2010 10:45:15 -0400 Received: from [140.186.70.92] (port=58576 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NrY15-0004CI-9O for grub-devel@gnu.org; Tue, 16 Mar 2010 10:45:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NrY12-0002T8-D4 for grub-devel@gnu.org; Tue, 16 Mar 2010 10:45:06 -0400 Received: from mail-bw0-f211.google.com ([209.85.218.211]:42860) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NrY12-0002Sk-3Z for grub-devel@gnu.org; Tue, 16 Mar 2010 10:45:04 -0400 Received: by bwz3 with SMTP id 3so12227bwz.9 for ; Tue, 16 Mar 2010 07:45:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type; bh=2ZpgKDh++J87ee7XHLA503tAqDcYwtGEsYYYc5zmayo=; b=S+4YpLn/QYUcaOK1Q3Wlpy92LnsFKHbAJgPj9izUbRu7gY7tYQgjiE9TucTAiA5vkl Qdcc9AqW+jPd2FzIg7KjMrkSwKRHshRNFAi4sSBc5bc+a7Z40Zr/Wwm98CzzRYvkdNH2 ZdNMkUrYIqZrz4lke1/H04KjLAeb60jaoDAFg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type; b=lYcFz6YPznTn7B20kcZjYK/T5IEtxT404n1yjHSg+Tg00n9w9F+ueKAClL0lqnHSeV ILIoO8/KxpOPdBxBwUyrGpqR9xiRpMADsOHZXKprabkMbHlYwXGrIIMC9HZG+maURUsc TuSsGsavjEpzRUMp2cwoa4zYMSzjvho5/jh4A= Received: by 10.204.21.197 with SMTP id k5mr17090bkb.28.1268750684807; Tue, 16 Mar 2010 07:44:44 -0700 (PDT) Received: from [147.210.129.1] (laptop-147-210-129-1.labri.fr [147.210.129.1]) by mx.google.com with ESMTPS id x16sm26297481bku.11.2010.03.16.07.44.41 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 16 Mar 2010 07:44:41 -0700 (PDT) Message-ID: <4B9F9977.1040904@gmail.com> Date: Tue, 16 Mar 2010 15:45:11 +0100 From: =?ISO-8859-1?Q?Gr=E9goire_Sutre?= User-Agent: Thunderbird 2.0.0.23 (X11/20091027) MIME-Version: 1.0 To: The development of GRUB 2 Content-Type: multipart/mixed; boundary="------------040700030207080906010401" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: [PATCH] Lexer sed post-processing instead of pragmas X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2010 14:45:16 -0000 This is a multi-part message in MIME format. --------------040700030207080906010401 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Hi, The lexer code in script/yylex.l uses pragmas that are not supported by gcc < 4.2. However, without these pragmas, the build fails because of warnings in the lexer code generated by flex (recall that some targets are built with -Werror by default). I've discussed this issue with sethmeisterg on irc. Of course, dropping compatibility with gcc 4.1.3 is a possible solution, but we believe that a better alternative would be to modify the generated lexer so that it does not trigger any warning. There are already some sed commands in conf/common.rmk that remove #includes from the generated lexer. The attached patch extends the sed post-processing of the lexer to get rid of the warnings, and removes the pragmas. This way, grub can still be compiled with gcc 4.1.3 (which is the current required version in INSTALL). The patch also replaces the non-portable -i sed option with temporary files. Thanks for your comments, Grégoire --------------040700030207080906010401 Content-Type: text/x-patch; name="lexer_no_pragma.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="lexer_no_pragma.diff" === modified file 'conf/common.rmk' --- conf/common.rmk 2010-03-14 16:50:55 +0000 +++ conf/common.rmk 2010-03-16 14:13:32 +0000 @@ -95,10 +95,21 @@ grub_bin2h_SOURCES = gnulib/progname.c util/bin2h.c # For the lexer. +lex_fix_includes = '/^\#include[[:space:]]*<(stdio|string|errno|stdlib|unistd)\.h>/d' +lex_fix_h = '/^(static)?[[:space:]]*void[[:space:]]*yy_flex_strncpy[[:space:]]*\(.*\)[[:space:]]*;$$/d' +lex_fix_c1 = '/^(static)?[[:space:]]*void[[:space:]]*yy_fatal_error[[:space:]]*\(.*\)[[:space:]]*;$$/d' +lex_fix_c2 = '/^(static)?[[:space:]]*(int|void)[[:space:]]*yy(get_column|set_column|_fatal_error)[[:space:]]*\(.*\)$$/,/^}$$/d' +lex_fix_c3 = '/^static[[:space:]]*void[[:space:]]*yy_flex_strncpy[[:space:]]*\(.*\)$$/{\ +s/yyscanner/yyscanner __attribute__ ((unused))/;\ +};' + grub_script.yy.c grub_script.yy.h: script/yylex.l $(LEX) -o grub_script.yy.c --header-file=grub_script.yy.h $(srcdir)/script/yylex.l - sed -i 's/^#include.*\(\|\|\|\|\)//g' grub_script.yy.h - sed -i 's/^#include.*\(\|\|\|\|\)//g' grub_script.yy.c + mv grub_script.yy.h grub_script.yy.h.tmp + mv grub_script.yy.c grub_script.yy.c.tmp + sed -r -e $(lex_fix_includes) -e $(lex_fix_h) grub_script.yy.h.tmp > grub_script.yy.h + sed -r -e $(lex_fix_includes) -e $(lex_fix_c1) -e $(lex_fix_c2) -e $(lex_fix_c3) grub_script.yy.c.tmp > grub_script.yy.c + rm grub_script.yy.h.tmp grub_script.yy.c.tmp DISTCLEANFILES += grub_script.yy.c grub_script.yy.h # For grub-script-check. === modified file 'script/yylex.l' --- script/yylex.l 2010-01-25 16:31:14 +0000 +++ script/yylex.l 2010-03-16 14:11:34 +0000 @@ -94,12 +94,6 @@ #define fprintf(...) 0 #define exit(...) -#pragma GCC diagnostic warning "-Wunused-variable" -#pragma GCC diagnostic warning "-Wunused-function" -#pragma GCC diagnostic warning "-Wunused-parameter" -#pragma GCC diagnostic warning "-Wstrict-prototypes" -#pragma GCC diagnostic warning "-Wmissing-prototypes" - } %option ecs --------------040700030207080906010401--