Commit Graph

25 Commits

Author SHA1 Message Date
kamil 3e0acd5a41 Remove the static_assert() fallback for pre-C11 and pre-C++11
C++ without real static_assert() can be incompatible with the C fallback
as presented in openjdk.

A pre-C11 compiler can be picky on the implementation.
2020-04-17 15:22:34 +00:00
kamil 002b04a5d5 As a _NETBSD_SOURCE extension define static_assert for pre-c11/c++99
Proposed on source-changes-d.
2019-05-27 07:31:11 +00:00
maya 4f1d88618a Limit static_assert visibility to C11.
The existing definition caused issues as GCC only provides _Static_assert
when building C11 code.
This follows the C standard: static_assert available since C11.

Fixes https://rt.perl.org/Public/Bug/Display.html?id=134023
2019-05-22 21:25:01 +00:00
kamil ba27f5b7d6 Add static_assert macro definition in <assert.h>
This declaration conforms to the C11 standard
Reference: ISO/IEC 9899:201x 7.2 Diagnostics <assert.h>

_Static_assert performs compile-time assertion checking.

According to ISO/IEC 9899:201x (draft) 7.2 Diagnostics <assert.h> defines
the static_assert macro which expands to _Static_assert. It's not
conditionalized by NDEBUG like the assert macro.

According to ISO/IEC N3242=11-0012 (C++1x) the <cassert> header shall
define only the assert macro, but not static_assert as it's already part
of the C++11 language.

Allow to define static_assert in C++ prior the C++11 standard. It might be
broken but a nonstandard C++ compiler might support C11-like _Static_assert
feature. Note that it's fatal for g++ 5.4, but it works for clang++ 3.8.1.

Approved by <joerg>.
2016-10-03 12:08:39 +00:00
joerg be47d2fc97 __assert and __assert13 are dead 2011-08-26 01:10:49 +00:00
christos 3e6c484639 include <sys/null.h> because _DIAGASSERT(foo == NULL) is too common and some
include it.
2008-11-02 14:27:44 +00:00
gmcgarry ff2c02da97 Define away __assert_function__ if __lint__. 2008-08-17 00:24:35 +00:00
perry 19b7469a00 de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
2005-02-03 04:39:32 +00:00
kleink 11f7fb5f29 Tidy up the namespace: lint -> __lint__. 2004-07-01 22:31:28 +00:00
kleink 3788baa149 Remove _assert() again. As has been noted by Ben Harris, this had been
removed already in rev. 1.4 and was subsequently reinstated by the
Lite-2 import.  Nothing uses it, and it pollutes user namespace.
2004-05-18 21:03:08 +00:00
agc 039cc95684 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22270, verified by myself.
2003-08-07 09:44:09 +00:00
bjh21 ffa655f9a4 EBENISANIDIOT: Remove a spurious '#endif' that crept in under the radar. 2003-06-05 18:37:45 +00:00
bjh21 37a103a1fa Namespace cleanup: _assert is in the application's namespace, and thus should
only be exposed if _NETBSD_SOURCE is defined.  To make life less complicated,
define _assert() in terms of assert(), since they always seem to have identical
definitions.

_assert() was removed back in 1993, but got reinstated with the 4.4Lite
import.  Maybe it should go again.  Nothing in the tree uses it.
2003-06-05 17:27:14 +00:00
kleink c3dba0b26e Employ __static_cast(); suggested by Dave Sainty in PR lib/11766. 2001-05-06 15:31:09 +00:00
christos b87a6ffa85 avoid multiple declarations. 2000-12-20 18:35:46 +00:00
kleink f02540ff10 C99: Print the name of the function enclosing the assertion, if possible. 2000-12-19 14:32:59 +00:00
kleink beec935659 #ifdef __STDC__ -> #if __STDC__ 2000-08-07 16:21:32 +00:00
lukem 6504726483 if _DIAGNOSTIC is defined, define _DIAGASSERT() to call __diagassert(),
otherwise it's a no-op.
prototype __diagassert().
1999-09-15 23:53:26 +00:00
christos e5571040ba Define assert and _assert macros for lint when NDEBUG is present as nothing. 1998-11-14 16:30:07 +00:00
cgd 4d2cbfce0a new RCS ID format. 1994-10-26 00:55:40 +00:00
cgd e6b5ddd91e update all but ctype.h, dumprestore.h, time.h to 4.4-Lite versions.
USL copyright additions on those.  Kill varargs.h, because it can simply
be a link to the machine-dependent version.
1994-05-16 10:58:53 +00:00
jtc b050bfde2c Use _ASSERT_H_ guard macro so that <sys/cdefs.h> is only included once and
the __assert() helper function is declared once if <assert.h> is included
multiple times.
Don't support the _assert() macro, nothing uses it and it pollutes the
user's namespace.
1993-10-07 22:15:29 +00:00
mycroft e9d867ef50 Add RCS identifiers. 1993-08-01 17:54:45 +00:00
jtc 7fb7e975c7 Make assert macro ansi complient. 1993-06-16 23:18:35 +00:00
cgd 61f282557f initial import of 386bsd-0.1 sources 1993-03-21 09:45:37 +00:00