https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=261310

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

Created attachment 231131
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=231131&action=edit
"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
e...@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 being
that the latter is a way to ask if the compiler supports this at all, and not
whether the current -std=* 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 seem
to have a way to request the C version in effect for the purposes of warnings
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 lines
also need duplicated "#pragma GCC...".

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

Reply via email to