All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Li Wang <liwang@redhat.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] openat2: Move includes to lapi, remove _GNU_SOURCE
Date: Thu, 5 Feb 2026 11:25:10 +0100	[thread overview]
Message-ID: <20260205102510.GC294817@pevik> (raw)
In-Reply-To: <aYRl0mUYv1aYLlyC@redhat.com>

> On Thu, Feb 05, 2026 at 02:08:42PM +0800, Li Wang wrote:
> > On Wed, Feb 04, 2026 at 01:43:23PM +0100, Petr Vorel wrote:
> > > Improve 767b3e519e. struct open_how is also used in lapi/openat2.h,
> > > which is used by all openat2*.c tests.  Therefore move <fcntl.h> to the
> > > lapi header (and use lapi/fcntl.h instead).

> > > Also remove _GNU_SOURCE which should not be needed.

> > > While at it, move include "config.h" to the top.

> > > Signed-off-by: Petr Vorel <pvorel@suse.cz>
> > > ---
> > > Hi Li,

> > > my points from the original patchset why not use _GNU_SOURCE:

> > > glibc test tst-openat2.c [1] which includes <fcntl.h>, uses struct

> > Interesting, I haven't figure out why it can be built within glibc itself.

> I think that becuase it uses '-D_GNU_SOURCE' cflags has already globally
> enabled the GNU extension (equivalent to '#define _GNU_SOURCE'), which is
> done uniformly by glibc's build system.

Interesting, I did not know they compile tree with _GNU_SOURCE.

>  glibc/Makerules: ALL_BUILD_CFLAGS = $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -D_GNU_SOURCE \
> 			-DIS_IN_build -include $(common-objpfx)config.h

Yes, -D is equivalent to #define.  IMHO it's better to use #define _GNU_SOURCE
(more obvious than command line switch).

> To verify this, when I add the '-D_GNU_SOURCE' cflgs in the LTP/openat20*.c
> compliation, it build succeed as well:

>  # gcc -I../../../../include -I../../../../include \
>    -I../../../../include/old/ -Wformat -Werror=format-security \
>    -Werror=implicit-function-declaration -Werror=return-type -fno-common \
>    -g -O2 -fno-strict-aliasing -pipe -Wall -W -Wold-style-definition \
>    -D_GNU_SOURCE \
>    -std=gnu99 -L../../../../lib openat202.c  -lltp -o openat202

> So, to this patch, we need to add the _GNU_SOURCE definition.

Thanks for investigating, I'm sorry for bothering with it.

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2026-02-05 10:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-04 12:43 [LTP] [PATCH] openat2: Move includes to lapi, remove _GNU_SOURCE Petr Vorel
2026-02-05  6:08 ` Li Wang via ltp
2026-02-05  9:41   ` Li Wang via ltp
2026-02-05 10:25     ` Petr Vorel [this message]
2026-02-05  9:44   ` Petr Vorel
2026-02-05 10:17     ` Li Wang via ltp

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=20260205102510.GC294817@pevik \
    --to=pvorel@suse.cz \
    --cc=liwang@redhat.com \
    --cc=ltp@lists.linux.it \
    /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.