grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/3] configure: Enforce gnu99 C language standard


From: Daniel Kiper
Subject: Re: [PATCH 1/3] configure: Enforce gnu99 C language standard
Date: Thu, 2 Apr 2020 19:08:21 +0200
User-agent: NeoMutt/20170113 (1.7.2)

On Thu, Apr 02, 2020 at 05:28:33PM +0100, Leif Lindholm wrote:
> On Thu, Apr 02, 2020 at 17:07:48 +0200, Daniel Kiper wrote:
> > Commit d5a32255d (misc: Make grub_strtol() "end" pointers have safer
> > const qualifiers) introduced "restrict" keyword into some functions
> > definitions. This keyword was introduced in C99 standard. However, some
> > compilers by default may use C89 or something different. This behavior
> > leads to the breakage during builds when c89 or gnu89 is in force. So,
> > let's enforce gnu99 C language standard for all compilers. This way
> > a bit random build issue will be fixed and the GRUB source will be
> > build consistently regardless of type and version of the compiler.
> >
> > It was decided to use gnu99 C language standard because it fixes the
> > issue mentioned above and also provides some useful extensions which are
> > used here and there in the GRUB source. Potentially we can use gnu11 too.
> > However, this may reduce pool of older compilers which can be used to
> > build the GRUB. So, let's live with gnu99 until we do not discover that
> > we strongly require a feature from newer C standard.
> >
> > Signed-off-by: Daniel Kiper <address@hidden>
> > ---
> >  configure.ac | 11 +++++++++--
> >  1 file changed, 9 insertions(+), 2 deletions(-)
> >
> > diff --git a/configure.ac b/configure.ac
> > index 88c0adbae..b7f40a1c3 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -75,9 +75,16 @@ grub_TRANSFORM([grub-sparc64-setup])
> >  grub_TRANSFORM([grub-render-label])
> >  grub_TRANSFORM([grub-file])
> >
> > -# Optimization flag.  Allow user to override.
> > +if test "x$BUILD_CFLAGS" = x; then
> > +  BUILD_CFLAGS='-std=gnu99'
> > +fi
> > +
> > +if test "x$HOST_CFLAGS" = x; then
> > +  HOST_CFLAGS='-std=gnu99'
> > +fi
> > +
> >  if test "x$TARGET_CFLAGS" = x; then
> > -  TARGET_CFLAGS="$TARGET_CFLAGS -Os"
> > +  TARGET_CFLAGS='-Os -std=gnu99'
> >  fi
>
> Do these not add -std=gnu99 only if *_CFLAGS are not specified?

Exactly...

> Would we not want to override these always?
>
> For example, Debian/Ubuntu override HOST_CFLAGS when building grub.

I was not sure about it. So, after some thinking I decided to give
a user a chance to override C language type using *_CFLAGS. However,
I am not so strongly tied to that. If you think we should add
"-std=gnu99" unconditionally I am OK with that.

Daniel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]