linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jarkko Sakkinen" <jarkko@kernel.org>
To: "Mirsad Todorovac" <mtodorovac69@gmail.com>,
	"John Hubbard" <jhubbard@nvidia.com>,
	<linux-kselftest@vger.kernel.org>
Cc: "Dave Hansen" <dave.hansen@linux.intel.com>,
	"Shuah Khan" <shuah@kernel.org>, <linux-sgx@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, "Edward Liaw" <edliaw@google.com>
Subject: Re: [PATCH v1 1/1] selftests/sgx: Fix the implicit declaration of asprintf() compiler error
Date: Mon, 13 May 2024 02:02:10 +0300	[thread overview]
Message-ID: <D181GV24ULEA.UWQHOSM80TEV@kernel.org> (raw)
In-Reply-To: <65a79654-90e8-42b9-a840-e2ef404fe1f2@gmail.com>

On Sat May 11, 2024 at 12:02 AM EEST, Mirsad Todorovac wrote:
> On 5/10/24 22:52, John Hubbard wrote:
> > On 5/10/24 1:37 PM, Mirsad Todorovac wrote:
> > ...
> >> The fix defines __USE_GNU before including <stdio.h> in case it isn't already
> >> defined. After this intervention the module compiles OK.
> > 
> > Instead of interventions, I believe the standard way to do this is to simply
> > define _GNU_SOURCE before including the header file(s). For example, the
> > following also fixes the compilation failure on Ubuntu:
> > 
> > diff --git a/tools/testing/selftests/sgx/main.c b/tools/testing/selftests/sgx/main.c
> > index 9820b3809c69..bb6e795d06e2 100644
> > --- a/tools/testing/selftests/sgx/main.c
> > +++ b/tools/testing/selftests/sgx/main.c
> > @@ -1,6 +1,7 @@
> >  // SPDX-License-Identifier: GPL-2.0
> >  /*  Copyright(c) 2016-20 Intel Corporation. */
> >  
> > +#define _GNU_SOURCE
> >  #include <cpuid.h>
> >  #include <elf.h>
> >  #include <errno.h>
> > 
> > 
> > However, that's not required, because Edward Liaw is already on v4 of
> > a patchset[1] that fixes up the _GNU_SOURCE problem for all selftests.
> > 
> > [1] https://lore.kernel.org/all/20240510000842.410729-2-edliaw@google.com/
> > 
> > thanks,
>
> Hi,
>
> Yes, I actually like Ed's solution more, because it solves the asprintf() prototype
> problem with TEST_HARNESS_MAIN macro for all of the tests.
>
> Sorry for the noise and the time wasted reviewing. 8-|
>
> Best regards,
> Mirsad Todorovac

Yeah, well, it does not cause any harm and I was not sure when the patch
set is in mainline so thus gave the pointers. Anyway, never ever touch
__USE_GNU and always look at the man page from man7.org next time and
should cause less friction...

BR, Jarkko

  reply	other threads:[~2024-05-12 23:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-10 20:37 [PATCH v1 1/1] selftests/sgx: Fix the implicit declaration of asprintf() compiler error Mirsad Todorovac
2024-05-10 20:52 ` John Hubbard
2024-05-10 21:02   ` Mirsad Todorovac
2024-05-12 23:02     ` Jarkko Sakkinen [this message]
2024-05-13  9:43       ` Mirsad Todorovac
2024-05-13 11:20         ` Jarkko Sakkinen
2024-05-12 22:58   ` Jarkko Sakkinen
2024-05-12 22:48 ` Jarkko Sakkinen
  -- strict thread matches above, loose matches on Subject: below --
2024-05-10 20:46 Mirsad Todorovac

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=D181GV24ULEA.UWQHOSM80TEV@kernel.org \
    --to=jarkko@kernel.org \
    --cc=dave.hansen@linux.intel.com \
    --cc=edliaw@google.com \
    --cc=jhubbard@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-sgx@vger.kernel.org \
    --cc=mtodorovac69@gmail.com \
    --cc=shuah@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).