From: "Darrick J. Wong" <djwong@kernel.org>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: Eric Sandeen <sandeen@redhat.com>, fstests@vger.kernel.org
Subject: Re: [PATCH 2/7] builddefs: define linux
Date: Thu, 6 Feb 2025 18:01:36 -0800 [thread overview]
Message-ID: <20250207020136.GK21828@frogsfrogsfrogs> (raw)
In-Reply-To: <006e3012-c4e9-4672-a9bb-ccb726017b21@sandeen.net>
On Thu, Feb 06, 2025 at 07:09:21PM -0600, Eric Sandeen wrote:
> On 2/6/25 4:39 PM, Darrick J. Wong wrote:
> > On Thu, Feb 06, 2025 at 03:19:57PM -0600, Eric Sandeen wrote:
> >> There are several #ifdef linux guards in the code, but nothing
> >> defined it. This caused several sparse warnings, so define it
> >> when building on linux.
> >
> > cpp in gcc 12.2 defines this:
> >
> > $ touch /tmp/moo.h ; cpp -dM /tmp/moo.h | grep define.linux
> > #define linux 1
>
> Huh, on my test box too.
> And yet without this sparse coughs up lots of things for me:
>
> tlibio.c:90:20: error: undefined identifier 'LIO_IO_TYPES'
> tlibio.c:90:33: error: undefined identifier 'LIO_WAIT_TYPES'
> tlibio.c:92:20: error: undefined identifier 'LIO_IO_TYPES'
> tlibio.c:92:33: error: undefined identifier 'LIO_WAIT_TYPES'
> tlibio.c:118:20: error: undefined identifier 'LIO_IO_TYPES'
> tlibio.c:118:33: error: undefined identifier 'LIO_WAIT_TYPES'
>
> because i.e.:
>
> #ifdef linux
> #define LIO_IO_TYPES 00021 /* all io types */
> #endif /* linux */
>
> make V=1 shows:
>
> /bin/sh ../libtool --quiet --tag=CC --mode=compile gcc -g -O2 -g -O2 -DDEBUG -I../include -DVERSION=\"1.1.1\" -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -funsigned-char -fno-strict-aliasing -Wall -c tlibio.c
>
> so not sure what's going on here ?
sparse doesn't define linux by default:
$ cat > /tmp/a.c << ENDL
#ifdef linux
# warning not
#else
# warning me
#endif
ENDL
$ gcc -o /tmp/a.o /tmp/a.c
/tmp/a.c:2:3: warning: #warning not [-Wcpp]
2 | # warning not
| ^~~~~~~
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
$ sparse /tmp/a.c
/tmp/a.c:4:3: warning: me
$ sparse /tmp/a.c -Dlinux
/tmp/a.c:2:3: warning: not
--D
>
> > --D
> >
> >> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> >> ---
> >> include/builddefs.in | 2 +-
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/include/builddefs.in b/include/builddefs.in
> >> index 7274cde8..00dec0ea 100644
> >> --- a/include/builddefs.in
> >> +++ b/include/builddefs.in
> >> @@ -78,7 +78,7 @@ HAVE_FICLONE = @have_ficlone@
> >> GCCFLAGS = -funsigned-char -fno-strict-aliasing -Wall
> >>
> >> ifeq ($(PKG_PLATFORM),linux)
> >> -PCFLAGS = -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 $(GCCFLAGS)
> >> +PCFLAGS = -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -Dlinux $(GCCFLAGS)
> >> endif
> >> ifeq ($(PKG_PLATFORM),darwin)
> >> PCFLAGS = -traditional-cpp $(GCCFLAGS)
> >> --
> >> 2.48.0
> >>
> >>
> >
>
next prev parent reply other threads:[~2025-02-07 2:01 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-06 21:19 [PATCH 0/7] fstests: enable sparse checking & fix fallout Eric Sandeen
2025-02-06 21:19 ` [PATCH 1/7] fstests: enable sparse checking with make C=[12] Eric Sandeen
2025-02-06 22:36 ` Darrick J. Wong
2025-02-07 4:56 ` Christoph Hellwig
2025-02-06 21:19 ` [PATCH 2/7] builddefs: define linux Eric Sandeen
2025-02-06 22:39 ` Darrick J. Wong
2025-02-07 1:09 ` Eric Sandeen
2025-02-07 2:01 ` Darrick J. Wong [this message]
2025-02-07 4:57 ` Christoph Hellwig
2025-02-07 5:06 ` Darrick J. Wong
2025-02-06 21:19 ` [PATCH 3/7] lib: Fix non-ANSI function declarations Eric Sandeen
2025-02-06 22:39 ` Darrick J. Wong
2025-02-07 4:59 ` Christoph Hellwig
2025-02-06 21:19 ` [PATCH 4/7] lib: fix empty arg function prototypes Eric Sandeen
2025-02-06 22:45 ` Darrick J. Wong
2025-02-07 4:59 ` Christoph Hellwig
2025-02-06 21:20 ` [PATCH 5/7] lib: replace aiocb_t with struct aiocb Eric Sandeen
2025-02-06 22:46 ` Darrick J. Wong
2025-02-07 5:00 ` Christoph Hellwig
2025-02-06 21:20 ` [PATCH 6/7] lib: make a few symbols static Eric Sandeen
2025-02-06 22:46 ` Darrick J. Wong
2025-02-07 5:00 ` Christoph Hellwig
2025-02-06 21:20 ` [PATCH 7/7] lib: remove random.c Eric Sandeen
2025-02-06 22:47 ` Darrick J. Wong
2025-02-07 5:01 ` Christoph Hellwig
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=20250207020136.GK21828@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=fstests@vger.kernel.org \
--cc=sandeen@redhat.com \
--cc=sandeen@sandeen.net \
/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