Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Jan 2022 15:43:49 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 261310] The libgen.h sources use C11-specific features under e.g. -std=gnu99, causing a -Wc11-extensions warning
Message-ID:  <bug-261310-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D261310

            Bug ID: 261310
           Summary: The libgen.h sources use C11-specific features under
                    e.g. -std=3Dgnu99, causing a -Wc11-extensions warning
           Product: Base System
           Version: CURRENT
          Hardware: Any
               URL: https://lore.kernel.org/git/patch-1.1-06cc12be94d-2022
                    0118T151234Z-avarab@gmail.com/
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: misc
          Assignee: bugs@FreeBSD.org
          Reporter: avarab@gmail.com
                CC: ed@FreeBSD.org, fuz@fuz.su

Created attachment 231131
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D231131&action=
=3Dedit
"fix" the issue with _Generic() in libgen.h by ignoring -Wc11-extension

The $subject issue was encountered when testing a pre-release of git. I've
submitted a workaround for it in $url.

As noted in $url I think this is a regression in the 2014-era commit by
ed@FreeBSD.org to sys/cdefs.h
(https://github.com/freebsd/freebsd-src/commit/62b7f85d4749).

Since then the __generic() wrapper for the C11-_Generic() has checked the
__STDC_VERSION__ *or* __has_extension(c_generic_selections). The problem be=
ing
that the latter is a way to ask if the compiler supports this at all, and n=
ot
whether the current -std=3D* would emit a warning about it conflicting with=
 the
currently selected C version.

There's probably a less crappy way to solve this, but I can't think of one =
that
isn't the attached patch. I.e. the issue is that both GCC and Clang don't s=
eem
to have a way to request the C version in effect for the purposes of warnin=
gs
being emitted, so we can just quiet the relevant warning. If such a thing
exists I haven't found it.

I'm not sure if FreeBSD still cares about GCC, but if so the added pragma l=
ines
also need duplicated "#pragma GCC...".

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-261310-227>