From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1ZPAmD-0005qd-Ad for mharc-grub-devel@gnu.org; Tue, 11 Aug 2015 10:43:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60458) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZPAm7-0005lw-Sq for grub-devel@gnu.org; Tue, 11 Aug 2015 10:43:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZPAm3-0004iW-FO for grub-devel@gnu.org; Tue, 11 Aug 2015 10:43:35 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:46661) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZPAm3-0004i3-8q for grub-devel@gnu.org; Tue, 11 Aug 2015 10:43:31 -0400 Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t7BEhJoG018219 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 11 Aug 2015 14:43:19 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.13.8/8.13.8) with ESMTP id t7BEhI8T011078 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Tue, 11 Aug 2015 14:43:19 GMT Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by userv0122.oracle.com (8.13.8/8.13.8) with ESMTP id t7BEhHb3005104; Tue, 11 Aug 2015 14:43:17 GMT Received: from l.oracle.com (/10.137.176.158) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 11 Aug 2015 07:43:17 -0700 Received: by l.oracle.com (Postfix, from userid 1000) id 81FDB6A3C92; Tue, 11 Aug 2015 10:43:15 -0400 (EDT) Date: Tue, 11 Aug 2015 10:43:15 -0400 From: Konrad Rzeszutek Wilk To: Daniel Kiper Subject: Re: [Xen-devel] [PATCH v2 21/23] x86/boot: implement early command line parser in C Message-ID: <20150811144315.GA31655@l.oracle.com> References: <1437402558-7313-1-git-send-email-daniel.kiper@oracle.com> <1437402558-7313-22-git-send-email-daniel.kiper@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1437402558-7313-22-git-send-email-daniel.kiper@oracle.com> User-Agent: Mutt/1.5.23 (2014-03-12) Content-Transfer-Encoding: quoted-printable X-Source-IP: aserv0021.oracle.com [141.146.126.233] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 141.146.126.69 Cc: jgross@suse.com, grub-devel@gnu.org, keir@xen.org, ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com, andrew.cooper3@citrix.com, gang.wei@intel.com, roy.franz@linaro.org, ning.sun@intel.com, david.vrabel@citrix.com, jbeulich@suse.com, phcoder@gmail.com, xen-devel@lists.xenproject.org, wei.liu2@citrix.com, richard.l.maliszewski@intel.com, qiaowei.ren@intel.com, fu.wei@linaro.org X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 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, 11 Aug 2015 14:43:37 -0000 > +static void vga_parse(const char *cmdline, early_boot_opts_t *ebo) > +{ > + const char *c; > + int tmp; > + size_t la; > + static const char empty_chars_comma[] __text =3D " \n\r\t,"; > + static const char x[] __text =3D "x"; > + static const char vga[] __text =3D "vga=3D"; > + static const char vga_current[] __text =3D "current"; > + static const char vga_gfx[] __text =3D "gfx-"; > + static const char vga_mode[] __text =3D "mode-"; > + static const char vga_text_80x[] __text =3D "text-80x"; > + > + c =3D find_opt(cmdline, vga, 1); > + > + if ( !c ) > + return; > + > + ebo->boot_vid_mode =3D ASK_VGA; > + > + c +=3D strlen_static(vga); > + la =3D strcspn(c, empty_chars_comma); > + > + if ( !strncmp(c, vga_current, max(la, strlen_static(vga_current)))= ) > + ebo->boot_vid_mode =3D VIDEO_CURRENT_MODE; > + else if ( !strncmp(c, vga_text_80x, strlen_static(vga_text_80x)) ) > + { > + c +=3D strlen_static(vga_text_80x); > + ebo->boot_vid_mode =3D rows2vmode(strtoi(c, empty_chars_comma,= NULL)); > + } > + else if ( !strncmp(c, vga_gfx, strlen_static(vga_gfx)) ) > + { > + tmp =3D strtoi(c + strlen_static(vga_gfx), x, &c); > + > + if ( tmp < 0 || tmp > U16_MAX ) > + return; > + > + ebo->vesa_size[VESA_WIDTH] =3D tmp; > + > + tmp =3D strtoi(++c, x, &c); My ancient OL5 installation: Choked on that with: gcc -O1 -fno-omit-frame-pointer -m32 -march=3Di686 -g -fno-strict-aliasin= g -std=3Dgnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -f= no-stack-protector -fno-exceptions -Werror -fno-builtin -msoft-float -c = -fpic cmdline.c -o cmdline.o cc1: warnings being treated as errors cmdline.c: In function =E2=80=98vga_parse=E2=80=99: cmdline.c:363: warning: operation on =E2=80=98c=E2=80=99 may be undefined Moving the ++c before the tmp assigment make the compiler happy.