Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Aug 2017 02:02:05 -0700
From:      Mark Millard <markmi@dsl-only.net>
To:        Ed Schouten <ed@nuxi.nl>
Cc:        David Chisnall <theraven@freebsd.org>, Warner Losh <imp@freebsd.org>, svn-src-head@freebsd.org, FreeBSD Current <freebsd-current@freebsd.org>, FreeBSD-STABLE Mailing List <freebsd-stable@freebsd.org>, freebsd-hackers <freebsd-hackers@freebsd.org>
Subject:   Re: svn commit: r322875 - head/sys/dev/nvme
Message-ID:  <0639EC0E-1F0F-4CB0-A3FE-4E8CD814B6D3@dsl-only.net>
In-Reply-To: <CABh_MK=rqqR8bVD5dy0wn815nhRkak%2B8CHyRopYZh7dgOh4nDQ@mail.gmail.com>
References:  <1C5A448F-C91A-4599-8500-E4E46E6F5205@dsl-only.net> <DCD7947D-DA37-4255-A147-4B9E3B1631ED@FreeBSD.org> <E4AB54D2-9535-4345-BB1A-96CE9AADC2F8@dsl-only.net> <CABh_MKm-jU0_jdXrQSCjkTcjhzt_bN23br9-vpaPT-y2KqhbGw@mail.gmail.com> <CABh_MK=rqqR8bVD5dy0wn815nhRkak%2B8CHyRopYZh7dgOh4nDQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2017-Aug-27, at 11:54 PM, Ed Schouten <ed at nuxi.nl> wrote:

> 2017-08-25 14:53 GMT+02:00 Ed Schouten <ed a tnuxi.nl>:
>> 2017-08-25 9:46 GMT+02:00 Mark Millard <markmi at dsl-only.net>:
>>> It appears that at least 11.1-STABLE -r322807 does not handle
>>> -std=c++98 styles of use of _Static_assert for g++7 in that
>>> g++7 reports an error:
>> 
>> Maybe we need to do something like this?
>> 
>> Index: sys/sys/cdefs.h
>> ===================================================================
>> --- sys/sys/cdefs.h (revision 322887)
>> +++ sys/sys/cdefs.h (working copy)
>> @@ -294,7 +294,7 @@
>> #if (defined(__cplusplus) && __cplusplus >= 201103L) || \
>>     __has_extension(cxx_static_assert)
>> #define _Static_assert(x, y) static_assert(x, y)
>> -#elif __GNUC_PREREQ__(4,6)
>> +#elif __GNUC_PREREQ__(4,6) && !defined(__cplusplus)
>> /* Nothing, gcc 4.6 and higher has _Static_assert built-in */
>> #elif defined(__COUNTER__)
>> #define _Static_assert(x, y) __Static_assert(x, __COUNTER__)
> 
> Could you let me know whether this patch fixes the build for you? If
> so, I'll commit it!

As a variant of stable/11 -r322807 . . .

buildworld and buildkernel seem to work fine.
(I did not try any port [re-]builds.)

Based on the same main.cc as before . . .

g++7 -std=c++98 main.cc
g++7 -Wpedantic -std=c++98 main.cc
g++7 -std=c++03 main.cc
g++7 -Wpedantic -std=c++03 main.cc

no longer complain (so no error, no
warning).

clang++ -Wpedantic -std=c++11 main.cc
clang++ -Wpedantic -std=c++98 main.cc
clang++ -Wpedantic -std=c++03 main.cc

each still give the warning but no error.

g++7 -Wpedantic -std=c++11 main.cc
g++7 -std=c++11 main.cc
clang++ -std=c++11 main.cc
clang++ -std=c++98 main.cc
clang++ -std=c++03 main.cc

are still silent, no errors, no warnings.

Note that clang here is version 4 --the
same as in my original report that had the
g++7 rejection example. This is because of
the stable/11 context that I used. (An
intended MFC had been listed.)

If needed I could probably try under some
version of head (and so test clang version
5).

===
Mark Millard
markmi at dsl-only.net




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?0639EC0E-1F0F-4CB0-A3FE-4E8CD814B6D3>