/[base]/head/sys/sys/cdefs.h
ViewVC logotype

Log of /head/sys/sys/cdefs.h

Parent Directory Parent Directory | Revision Log Revision Log


Links to HEAD: (view) (download) (annotate)
Sticky Revision:


Revision 367032 - (view) (download) (annotate) - [select for diffs]
Modified Sat Oct 24 23:21:31 2020 UTC (3 years, 8 months ago) by imp
File length: 28599 byte(s)
Diff to previous 366168
cdefs.h: remove intel_compiler support

The  age  of   the  intel  compiler  support  is  so   old  as  to  be
uninteresting. No recent recports of  intel compiler support have been
received.  Remove  all the  special  case  workarounds for  the  Intel
compiler. Should there be interest in supporting the compiler, contact
me and I'll work with people to make it happen, though I suspect these
instances are more likely to be in the way than to be helpful.

Reviewed by: cem, emaste, vangyzen, dim
Differential Revision: https://reviews.freebsd.org/D26817


Revision 366168 - (view) (download) (annotate) - [select for diffs]
Modified Fri Sep 25 19:02:49 2020 UTC (3 years, 9 months ago) by imp
File length: 29278 byte(s)
Diff to previous 365652
Dont let kernel and standalone both be defined at the same time

_KERNEL and _STANDALONE are different things. They cannot both be true
at the same time. If things that are normally visible only to _KERNEL
are needed for the _STANDALONE environment, you need to also make them
visible to _STANDALONE. Often times, this will be just a subset of the
required things for _KERNEL (eg global variables are but one example).

sys/cdefs.h is included by pretty much everything in both the loader
and the kernel, so is the ideal choke point.


Revision 365652 - (view) (download) (annotate) - [select for diffs]
Modified Sat Sep 12 07:04:00 2020 UTC (3 years, 9 months ago) by jah
File length: 29169 byte(s)
Diff to previous 355969
amd64: prevent KCSan false positives on LAPIC mapping

For configurations without x2APIC support (guests, older hardware), the global
LAPIC MMIO mapping will trigger false-positive KCSan reports as it will appear
that multiple CPUs are concurrently reading and writing the same address.
This isn't actually true, as the underlying physical access will be performed
on the local CPU's APIC. Additionally, because LAPIC access can happen during
event timer configuration, the resulting KCSan printf can produce a panic due
to attempted recursion on event timer resources.

Add a __nosanitizethread preprocessor define to prevent the compiler from
inserting TSan hooks, and apply it to the x86 LAPIC accessors.

PR:		249149
Reported by:	gbe
Reviewed by:	andrew, kib
Tested by:	gbe
Differential Revision:	https://reviews.freebsd.org/D26354


Revision 355969 - (view) (download) (annotate) - [select for diffs]
Modified Sat Dec 21 02:43:20 2019 UTC (4 years, 6 months ago) by rlibby
File length: 29076 byte(s)
Diff to previous 355776
gcc: quiet Wattribute for no_sanitize("address")

This is an unfortunate instance where the __has_attribute check does
not function usefully.  Gcc does have the attribute, but for gcc it only
applies to functions, not variables, and trying to apply it to a
variable generates Wattribute.  So far we only apply the attribute to
variables.  Only enable the attribute for clang, for now.

Reviewed by:	Anton Rang <rang at acm.org>
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D22875


Revision 355776 - (view) (download) (annotate) - [select for diffs]
Modified Sun Dec 15 17:33:26 2019 UTC (4 years, 6 months ago) by cem
File length: 28932 byte(s)
Diff to previous 355762
Revert r355760, r355759

And remove the inline/deprecated attribute use entirely in stdlib.h, from
r355747.  The intent was to provide a buildable API transitionary period, but
clearly that was counter-productive.

Reported by:	delphij, imp, others


Revision 355762 - (view) (download) (annotate) - [select for diffs]
Modified Sun Dec 15 01:56:56 2019 UTC (4 years, 6 months ago) by pfg
File length: 29157 byte(s)
Diff to previous 355759
cdefs: use more accurate GCC version for the deprecated attribute.

The message argument in the "deprecated" attribute was introduced in GCC 4.5 *.
Use the accurate version number for consistency, as done already with other
attributes.

* https://gcc.gnu.org/onlinedocs/gcc-4.5.0/gcc/Function-Attributes.html


Revision 355759 - (view) (download) (annotate) - [select for diffs]
Modified Sat Dec 14 21:52:49 2019 UTC (4 years, 6 months ago) by cem
File length: 29148 byte(s)
Diff to previous 355719
cdefs: Add __deprecated(message) function attribute macro

The legacy version of GCC4 currently in base does not support the
parameterized form of this function attribute, as recent introduced in
stdlib.h (r355747).

As we have done for other function attributes with similar compatibility
problems, add a version-compatibile definition in sys/cdefs.h.  Note that
Clang defines itself to be GCC 4, so one must check for __clang__ in
addition to __GNUC__ version.  On legacy GCC 4, the macro expands to just
the __deprecated__ attribute; on modern GCC or Clang, the macro expands to
the parameterized variant with the message.

Ignoring legacy or unsupported compilers, the macro is also beneficial in
that it is a bit more ergonomic than the full
__attribute__((__deprecated__())) boilerplate.

Reported by:	CI (but not tinderbox); imp and others
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D22817


Revision 355719 - (view) (download) (annotate) - [select for diffs]
Modified Fri Dec 13 18:18:14 2019 UTC (4 years, 6 months ago) by bdragon
File length: 28932 byte(s)
Diff to previous 354854
[PowerPC] Enable TLS usage in system libraries on ELFv2.

Currently, __NO_TLS is defined to 1 on powerpc64. TLS usage works much
better on ELFv2 due to the modern tooling, so take the opportunity to
reenable TLS on ELFv2.

If you are using a self-built ELFv2 environment on powerpc64, you will
have to run installworld twice due to RuneLocale changes. This is the only
known regression, and if you are using the ELFv2 isos, you likely already
have the updated libraries installed, as this change is part of the
patchset that the isos integrate.

(No UPDATING note about this because ELFv2 is still an unofficial build.)

Reviewed by:	luporl, Alfredo Dal'Ava Junior <alfredo.junior@eldorado.org.br>
Differential Revision:	https://reviews.freebsd.org/D22524


Revision 354854 - (view) (download) (annotate) - [select for diffs]
Modified Tue Nov 19 14:46:28 2019 UTC (4 years, 7 months ago) by dab
File length: 28881 byte(s)
Diff to previous 337399
Don't sanitize linker_set

The assumptions of linker_set don't play nicely with
AddressSanitizer. AddressSanitizer adds a 'redzone' of zeros around
globals (including those in named sections), whereas linker_set
assumes they are all packed consecutively like a pointer array. So:
let's annotate linker_set so that AddressSanitizer ignores it.

Submitted by:	Matthew Bryan <matthew.bryan@isilon.com>
Reviewed by:	kib, rang_acm.org
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D22239


Revision 337399 - (view) (download) (annotate) - [select for diffs]
Modified Mon Aug 6 23:51:08 2018 UTC (5 years, 10 months ago) by jhb
File length: 28662 byte(s)
Diff to previous 331266
Make the system C11 atomics headers fully compatible with external GCC.

The <sys/cdefs.h> and <stdatomic.h> headers already included support for
C11 atomics via intrinsincs in modern versions of GCC, but these versions
tried to "hide" atomic variables inside a wrapper structure.  This wrapper
is not compatible with GCC's internal <stdatomic.h> header, so that if
GCC's <stdatomic.h> was used together with <sys/cdefs.h>, use of C11
atomics would fail to compile.  Fix this by not hiding atomic variables
in a structure for modern versions of GCC.  The headers already avoid
using a wrapper structure on clang.

Note that this wrapper was only used if C11 was not enabled (e.g.
via -std=c99), so this also fixes compile failures if a modern version
of GCC was used with -std=c11 but with FreeBSD's <stdatomic.h> instead
of GCC's <stdatomic.h> and this change fixes that case as well.

Reported by:	Mark Millard
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D16585


Revision 331266 - (view) (download) (annotate) - [select for diffs]
Modified Tue Mar 20 21:18:40 2018 UTC (6 years, 3 months ago) by imp
File length: 28639 byte(s)
Diff to previous 328221
Drop support for lint for cdefs.h.


Revision 328221 - (view) (download) (annotate) - [select for diffs]
Modified Sun Jan 21 20:27:47 2018 UTC (6 years, 5 months ago) by pfg
File length: 28657 byte(s)
Diff to previous 326576
Define a new __alloc_size2 attribute to complement the exiting support.

At least on GCC7 calling __alloc_size(x) twice is not equivalent to
calling using the attribute once with two arguments. The later is the
documented use in GCC documentation so add a new alloc_size(n, x)
alternative to cover for the few places where it is used: basically:
calloc(3), reallocarray(3) and  mallocarray(9).

Submitted by:	Mark Millard
MFC after:	3 days
Reference:
http://docs.freebsd.org/cgi/mid.cgi?F227842D-6BE2-4680-82E7-07906AF61CD7


Revision 326576 - (view) (download) (annotate) - [select for diffs]
Modified Tue Dec 5 20:19:13 2017 UTC (6 years, 6 months ago) by emaste
File length: 28563 byte(s)
Diff to previous 326123
use @@@ instead of @@ in __sym_default

Using
    .symver foo,foo@@VER
causes foo and foo@@VER to be output to the .o file. This requires foo
to be weak since the linker handles foo@@VER as foo.

Using
    .symver foo,foo@@@VER
causes just foo@@ver to be output and avoid the need for making foo
weak. It also reduces the constraint on how exactly a linker has to
handle foo and foo@@VER being present.

Submitted by:	Rafael EspĂ­ndola
Reviewed by:	dim, kib
Differential Revision:	https://reviews.freebsd.org/D11653


Revision 326123 - (view) (download) (annotate) - [select for diffs]
Modified Thu Nov 23 11:40:16 2017 UTC (6 years, 7 months ago) by kib
File length: 28561 byte(s)
Diff to previous 326023
Remove lint support from system headers and MD x86 headers.

Reviewed by:	dim, jhb
Discussed with:	imp
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D13156


Revision 326023 - (view) (download) (annotate) - [select for diffs]
Modified Mon Nov 20 19:43:44 2017 UTC (6 years, 7 months ago) by pfg
File length: 28828 byte(s)
Diff to previous 322965
sys: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.


Revision 322965 - (view) (download) (annotate) - [select for diffs]
Modified Mon Aug 28 09:35:17 2017 UTC (6 years, 10 months ago) by ed
File length: 28784 byte(s)
Diff to previous 322168
Make _Static_assert() work with GCC in older C++ standards.

GCC only activates C11 keywords in C mode, not C++ mode. This means
that when targeting an older C++ standard, we cannot fall back to using
_Static_assert(). In this case, do define _Static_assert() as a macro
that uses a typedef'ed array.

Discussed in:	r322875 commit thread
Reported by:	Mark MIllard
MFC after:	1 month


Revision 322168 - (view) (download) (annotate) - [select for diffs]
Modified Mon Aug 7 14:09:57 2017 UTC (6 years, 10 months ago) by br
File length: 28759 byte(s)
Diff to previous 316213
o Replace __riscv__ with __riscv
o Replace __riscv64 with (__riscv && __riscv_xlen == 64)

This is required to support new GCC 7.1 compiler.
This is compatible with current GCC 6.1 compiler.

RISC-V is extensible ISA and the idea here is to have built-in define
per each extension, so together with __riscv we will have some subset
of these as well (depending on -march string passed to compiler):

__riscv_compressed
__riscv_atomic
__riscv_mul
__riscv_div
__riscv_muldiv
__riscv_fdiv
__riscv_fsqrt
__riscv_float_abi_soft
__riscv_float_abi_single
__riscv_float_abi_double
__riscv_cmodel_medlow
__riscv_cmodel_medany
__riscv_cmodel_pic
__riscv_xlen

Reviewed by:	ngie
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D11901


Revision 316213 - (view) (download) (annotate) - [select for diffs]
Modified Thu Mar 30 04:57:26 2017 UTC (7 years, 3 months ago) by kib
File length: 28761 byte(s)
Diff to previous 314436
Implement the memset_s(3) function as specified by the C11 ISO/IEC
9899:2011 Appendix K 3.7.4.1.

Other needed supporting types, defines and constraint_handler
infrastructure is added as specified in the C11 spec.

Submitted by:	Tom Rix <trix@juniper.net>
Sponsored by:	Juniper Networks
Discussed with:	ed
MFC after:	3 weeks
Differential revision:	https://reviews.freebsd.org/D9903
Differential revision:	https://reviews.freebsd.org/D10161


Revision 314436 - (view) (download) (annotate) - [select for diffs]
Modified Tue Feb 28 23:42:47 2017 UTC (7 years, 4 months ago) by imp
File length: 28435 byte(s)
Diff to previous 314101
Renumber copyright clause 4

Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by:	Jan Schaumann <jschauma@stevens.edu>
Pull Request:	https://github.com/freebsd/freebsd/pull/96


Revision 314101 - (view) (download) (annotate) - [select for diffs]
Modified Wed Feb 22 17:20:18 2017 UTC (7 years, 4 months ago) by avg
File length: 28435 byte(s)
Diff to previous 314100
don't use C99 static array indices with older GCC versions

For example, the FreeBSD GCC (4.2.1) has a spotty support for that
feature.  If the static keyword is used with an unnamed array parameter
in a function declaration, then the compilation fails with:
error: static or type qualifiers in abstract declarator

The feature does work if the parameter is named.
So, the restriction introduced in this commit can be removed when all
affected function prototypes have the workaround.

MFC after:	1 week
Sponsored by:	Panzura


Revision 314100 - (view) (download) (annotate) - [select for diffs]
Modified Wed Feb 22 17:13:00 2017 UTC (7 years, 4 months ago) by avg
File length: 28380 byte(s)
Diff to previous 312942
fix a typo in __STDC_VERSION__ in __min_size requirements

MFC after:	1 week
Sponsored by:	Panzura


Revision 312942 - (view) (download) (annotate) - [select for diffs]
Modified Sun Jan 29 00:45:52 2017 UTC (7 years, 5 months ago) by pfg
File length: 28378 byte(s)
Diff to previous 312538
Remove GCC's __nonnull() attribute definition.

While GCC's __nonnull__ attribute is generally useful to prevent misuse of
some functions it also tends to do rather dangerous "optimizations". Now
that we have replaced (r312934) all such uses with the clang nullability
qualifiers, the GCC attribute is unnecessary.

Remove the definition completely to prevent its use in system's headers.


Revision 312538 - (view) (download) (annotate) - [select for diffs]
Modified Fri Jan 20 15:56:40 2017 UTC (7 years, 5 months ago) by pfg
File length: 28565 byte(s)
Diff to previous 311896
Addition of clang nullability qualifiers.

For consistency with the qualifiers added in r310977, define a new
qualifier _Null_unspecified which is also defined in clang 3.7+.

Add two new macros:
__NULLABILITY_PRAGMA_PUSH
__NULLABILITY_PRAGMA_POP

These are for use in headers when we want avoid noisy warnings if
some pointers are left without nullability annotations.

These are added with way ahead of their first use to teach the GCC
ports headers of their existance before their first use.


Revision 311896 - (view) (download) (annotate) - [select for diffs]
Modified Tue Jan 10 20:44:31 2017 UTC (7 years, 5 months ago) by pfg
File length: 28264 byte(s)
Diff to previous 310977
Remove unused __gnu_inline() attribute.

This was meant to be used by a future FORTIFY_SOURCE implementation.
Probably for good, FORTIFY_SOURCE and this particular GCCism were never
well supported by clang or other compilers. Furthermore, the technology
has long since been replaced by either static checkers, sanitizers, or
even just the strong stack protector that was enabled by default.

Drop __gnu_inline to avoid cluttering the headers.

MFC after:	5 days


Revision 310977 - (view) (download) (annotate) - [select for diffs]
Modified Sat Dec 31 15:58:15 2016 UTC (7 years, 6 months ago) by pfg
File length: 28851 byte(s)
Diff to previous 307584
Addition of clang nullability qualifiers.

Add two new qualifiers for use by the static checkers:

_Nonnull
The _Nonnull nullability qualifier indicates that null is not a meaningful
value for a value of the _Nonnull pointer type.

_Nullable
The _Nullable nullability qualifier indicates that a value of the
_Nullable pointer type can be null.

These were introduced in Clang 3.7. For more information, see:
http://clang.llvm.org/docs/AttributeReference.html#nonnull

We add these now without using them so that the GCC ports have time to
pick up the header change.

Hinted by:	Android Bionic libc [1]
Also seen in:	Apple's Libc-1158.20.4

[1]
https://github.com/android/platform_bionic/commit/baa2a973bd776a51bb05a8590ab05d86eea7b321


Revision 307584 - (view) (download) (annotate) - [select for diffs]
Modified Tue Oct 18 23:20:49 2016 UTC (7 years, 8 months ago) by asomers
File length: 28683 byte(s)
Diff to previous 300967
Fix C++ includability of crypto headers with static array sizes

C99 allows array function parameters to use the static keyword for their
sizes. This tells the compiler that the parameter will have at least the
specified size, and calling code will fail to compile if that guarantee is
not met. However, this syntax is not legal in C++.

This commit reverts r300824, which worked around the problem for
sys/sys/md5.h only, and introduces a new macro: min_size(). min_size(x) can
be used in headers as a static array size, but will still compile in C++
mode.

Reviewed by:	cem, ed
MFC after:	4 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D8277


Revision 300967 - (view) (download) (annotate) - [select for diffs]
Modified Sun May 29 17:32:19 2016 UTC (8 years, 1 month ago) by dim
File length: 28204 byte(s)
Diff to previous 300694
Stop exposing the C11 _Atomic() macro in <sys/cdefs.h>, when compiling
for C++.  It clashes with the one in libc++'s <atomic> header.

(Previously, the _Atomic() macro was defined in <stdatomic.h>, which is
only for use with C11, but for various reasons it was moved to its
current location in r251804.)

Discussed with:	bdrewery, ed
MFC after:	2 weeks


Revision 300694 - (view) (download) (annotate) - [select for diffs]
Modified Wed May 25 19:44:26 2016 UTC (8 years, 1 month ago) by ian
File length: 28173 byte(s)
Diff to previous 295041
Include machine/acle-compat.h in cdefs.h on arm if the compiler doesn't
have ACLE support built in.  The ACLE (ARM C Language Extensions) defines
a set of standardized symbols which indicate the architecture version and
features available.  ACLE support is built in to modern compilers (both
clang and gcc), but absent from gcc prior to 4.4.

ARM (the company) provides the acle-compat.h header file to define the
right symbols for older versions of gcc.  Basically, acle-compat.h does
for arm about the same thing cdefs.h does for freebsd: defines
standardized macros that work no matter which compiler you use.  If ARM
hadn't provided this file we would have ended up with a big #ifdef __arm__
section in cdefs.h with our own compatibility shims.

Remove #include <machine/acle-compat.h> from the zillion other places (an
ever-growing list) that it appears.  Since style(9) requires sys/types.h
or sys/param.h early in the include list, and both of those lead to
including cdefs.h, only a couple special cases still need to include
acle-compat.h directly.

Loves it:     imp


Revision 295041 - (view) (download) (annotate) - [select for diffs]
Modified Fri Jan 29 15:12:31 2016 UTC (8 years, 5 months ago) by br
File length: 27928 byte(s)
Diff to previous 290394
Welcome the RISC-V 64-bit kernel.

This is the final step required allowing to compile and to run RISC-V
kernel and userland from HEAD.

RISC-V is a completely open ISA that is freely available to academia
and industry.

Thanks to all the people involved! Special thanks to Andrew Turner,
David Chisnall, Ed Maste, Konstantin Belousov, John Baldwin and
Arun Thomas for their help.
Thanks to Robert Watson for organizing this project.

This project sponsored by UK Higher Education Innovation Fund (HEIF5) and
DARPA CTSRD project at the University of Cambridge Computer Laboratory.

FreeBSD/RISC-V project home: https://wiki.freebsd.org/riscv

Reviewed by:	andrew, emaste, kib
Relnotes:	Yes
Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
Differential Revision:	https://reviews.freebsd.org/D4982


Revision 290394 - (view) (download) (annotate) - [select for diffs]
Modified Thu Nov 5 14:55:58 2015 UTC (8 years, 7 months ago) by pfg
File length: 27906 byte(s)
Diff to previous 287259
Rename __sentinel to __null_sentinel

GCC 5 uses a conflicting __sentinel definition in include/c++/bits/stl_algo.h

Reported by:	matteo


Revision 287259 - (view) (download) (annotate) - [select for diffs]
Modified Fri Aug 28 15:36:05 2015 UTC (8 years, 10 months ago) by pfg
File length: 27896 byte(s)
Diff to previous 287255
Add underscores to attributes when checking for __has_attribute.

This is a good practice to avoid confusion with allowed macros.

Suggested by:	jilles


Revision 287255 - (view) (download) (annotate) - [select for diffs]
Modified Fri Aug 28 14:13:01 2015 UTC (8 years, 10 months ago) by pfg
File length: 27876 byte(s)
Diff to previous 287254
trailing space


Revision 287254 - (view) (download) (annotate) - [select for diffs]
Modified Fri Aug 28 14:06:28 2015 UTC (8 years, 10 months ago) by pfg
File length: 27877 byte(s)
Diff to previous 287206
Be more GCC-friendly with attributes

Being clang the default compiler, we were always giving precedence to
the __has_attribute check. Unfortunately clang generally doesn't support
the new attributes (alloc_size was briefly supported and then reverted)
so we were always doing both checks. Give the precedence to GCC as that is
the working case now.

Do the same for  __has_builtin() for consistency.


Revision 287206 - (view) (download) (annotate) - [select for diffs]
Modified Thu Aug 27 14:00:23 2015 UTC (8 years, 10 months ago) by kan
File length: 27876 byte(s)
Diff to previous 286531
Repair sys/cdefs.h enough to be usable with GCC 5.x

The __alloc_size and __alloc_align need to be defined to
nothingness for lint, but the existing check is deficient
and allows attributes with working __has_attrubute() to
slip through.


Revision 286531 - (view) (download) (annotate) - [select for diffs]
Modified Sun Aug 9 15:38:32 2015 UTC (8 years, 10 months ago) by pfg
File length: 27830 byte(s)
Diff to previous 284917
cdefs: reduce code duplication


Revision 284917 - (view) (download) (annotate) - [select for diffs]
Modified Mon Jun 29 00:30:30 2015 UTC (9 years ago) by pfg
File length: 28167 byte(s)
Diff to previous 284890
Add a new __sentinel attribute.

The sentinel attribute was originally implemented in OpenBSD's gcc and
later adopted by upstream GCC 4.0 (and clang). From the OpenBSD's
gcc-local manpage:

-   gcc recognizes the extra attribute __sentinel__, which can be used to
    mark varargs function that need a NULL pointer to mark argument
    termination, like execl(3).  This exposes latent bugs for 64-bit
    architectures, where a terminating 0 will expand to a 32-bit int, and
    not a full-fledged 64-bits pointer.

While here sort the visibility attributes.

Hinted-by:	OpenBSD


Revision 284890 - (view) (download) (annotate) - [select for diffs]
Modified Sat Jun 27 15:13:14 2015 UTC (9 years ago) by pfg
File length: 28099 byte(s)
Diff to previous 284858
Change detection for the gnu_inline attribute.

According to the GCC documentation:
"This attribute is available in GCC 4.1.3 and later. It is available
if either of the preprocessor macros __GNUC_GNU_INLINE__ or
__GNUC_STDC_INLINE__ are defined."

We don't keep the gcc granularity up to the minor number so it's
better to use the documented way. Current clang defines both
macros.

Reference:
https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes


Revision 284858 - (view) (download) (annotate) - [select for diffs]
Modified Thu Jun 25 19:39:07 2015 UTC (9 years ago) by tijl
File length: 28059 byte(s)
Diff to previous 284743
Enable the use of __builtin_va_* for ICC.

PR:		198822
Submitted by:	Sergey Melnikov <sergey.melnikov@intel.com>
MFC after:	5 days


Revision 284743 - (view) (download) (annotate) - [select for diffs]
Modified Tue Jun 23 22:40:22 2015 UTC (9 years ago) by hselasky
File length: 28089 byte(s)
Diff to previous 282990
Rename __weak to __weak_symbol to avoid language conflict with objective-C.

PR:		200972 (exp-run)
Suggested by:	theraven@
MFC after:	3 days


Revision 282990 - (view) (download) (annotate) - [select for diffs]
Modified Fri May 15 20:53:43 2015 UTC (9 years, 1 month ago) by pfg
File length: 28076 byte(s)
Diff to previous 282989
Break apart the gnu_inline attribute and use "artificial" if available.

Missing #endif (in wrong place)

Pointed hat:	me


Revision 282989 - (view) (download) (annotate) - [select for diffs]
Modified Fri May 15 20:47:25 2015 UTC (9 years, 1 month ago) by pfg
File length: 28059 byte(s)
Diff to previous 282987
Break apart the gnu_inline attribute and use "artificial" if available.

Missing #endif

Reported by:	jhb, jenkins
Pointed hat:	me


Revision 282987 - (view) (download) (annotate) - [select for diffs]
Modified Fri May 15 19:51:05 2015 UTC (9 years, 1 month ago) by pfg
File length: 28052 byte(s)
Diff to previous 282981
Break apart the gnu_inline attribute and use "artificial" if available.

In general it is bad practice to use the gnu_inline attribute but we
will need it in special cases like FORTIFY_SOURCE. In this specific
case it is also useful to have the "artificial" attribute:

"This attribute is useful for small inline wrappers which if possible
should appear during debugging as a unit, depending on the debug info
format it will either mean marking the function as artificial or using the
caller location for all instructions within the inlined body."

This attribute appears to be currently implemented only in GCC. Use it
only in conjuntion with gnu_inline in the cases where it is available,
which is similar in spirit in how it's used in glibc.


Revision 282981 - (view) (download) (annotate) - [select for diffs]
Modified Fri May 15 17:51:03 2015 UTC (9 years, 1 month ago) by pfg
File length: 27607 byte(s)
Diff to previous 282907
Replace a CONSTCOND for a void value as a replacement for __unreachable builtin

This only applies if we are not using clang or gcc but it lets us use the
__unreachable() buitin in expressions.

Suggested by:	tijl


Revision 282907 - (view) (download) (annotate) - [select for diffs]
Modified Thu May 14 15:49:48 2015 UTC (9 years, 1 month ago) by pfg
File length: 27626 byte(s)
Diff to previous 282863
Add new __unreachable() builtin

This is one of the few post gcc4.2 builtins that has been implemented by
clang:

__builtin_unreachable is used to indicate that a specific point in the
program cannot be reached, even if the compiler might otherwise think it
can. This is useful to improve optimization and eliminates certain
warnings.

Hinted by:	NetBSD
Differential Revision:	https://reviews.freebsd.org/D2536


Revision 282863 - (view) (download) (annotate) - [select for diffs]
Modified Wed May 13 15:26:44 2015 UTC (9 years, 1 month ago) by pfg
File length: 27445 byte(s)
Diff to previous 281986
Adjust visibility macros.

The GCC visibility attributes were introduced in GCC 4.0.
Apparently the "protected" attribute was introduced only
until GCC 4.2, but we are not currently using it.

MFC after:	1 week


Revision 281986 - (view) (download) (annotate) - [select for diffs]
Modified Sat Apr 25 18:17:08 2015 UTC (9 years, 2 months ago) by pfg
File length: 27445 byte(s)
Diff to previous 281945
Cleanup a bit the clang attributes for type safety checking.

Cleanup r281861 by moving the definitions to their own section but
still leave the definitions out of lint.

In addition to the 'argument_with_type_tag' attribute, bring
'type_tag_for_datatype' which is necessary for annotating the
data types.


Revision 281945 - (view) (download) (annotate) - [select for diffs]
Modified Fri Apr 24 18:07:34 2015 UTC (9 years, 2 months ago) by pfg
File length: 27125 byte(s)
Diff to previous 281861
Add definition to support alloc_align attribute.

gcc 4.9 added support for new alignment attribute alloc_align:

The alloc_align attribute is used to tell the compiler that the function
return value points to memory, where the returned pointer minimum
alignment is given by one of the functions parameters. GCC uses this
information to improve pointer alignment analysis.

This attribute is not (yet) available on clang.


Revision 281861 - (view) (download) (annotate) - [select for diffs]
Modified Wed Apr 22 18:13:28 2015 UTC (9 years, 2 months ago) by pfg
File length: 26967 byte(s)
Diff to previous 281469
Add definition for the argument_with_type_tag attribute.

This attribute originates in clang and brings support for checking types
of variadic functions' arguments for functions like fcntl() and ioctl().

Unfortunately lint(1) will complain about them: in particular as one of
the parameters is the function being tagged. For now define this attribute
in the lint-sensitive section.

Reference:
http://clang.llvm.org/docs/AttributeReference.html#type-safety-checking


Revision 281469 - (view) (download) (annotate) - [select for diffs]
Modified Sun Apr 12 16:43:55 2015 UTC (9 years, 2 months ago) by pfg
File length: 26658 byte(s)
Diff to previous 280801
Add definition for the gcc gnu_inline attribute.

This uses a non-standard (who would guess that) inlining method
that is useful for legacy GNU software. This attribute was added
in GCC 4.1.3. Older versions of clang would just ignore the
attribute but as lately it is supported also there.

This is currently unused but it is required for the
FORTIFY_SOURCE extension.


Revision 280801 - (view) (download) (annotate) - [select for diffs]
Modified Sun Mar 29 03:16:52 2015 UTC (9 years, 3 months ago) by pfg
File length: 26584 byte(s)
Diff to previous 280726
cdefs.h: Fix macros for pre-C99 compilers.

Older compilers, and compatibility modes, may not support variadic macros.
I normally wouldn't go out of my way to support those old compilers but
there is a prescendent in other system headers for using the same macro
multiple times, and the solution (although non-elegant IMHO) works.

Requested by:	bde
Solution by:	tijl


Revision 280726 - (view) (download) (annotate) - [select for diffs]
Modified Fri Mar 27 02:01:22 2015 UTC (9 years, 3 months ago) by pfg
File length: 26539 byte(s)
Diff to previous 280700
Fix __size_alloc()

Use underscore for the attributes name: this should fix the use of the
attributes in macros for lint(1).

Suggested by:	bde

X-MFC with:	r280700


Revision 280700 - (view) (download) (annotate) - [select for diffs]
Modified Thu Mar 26 16:00:35 2015 UTC (9 years, 3 months ago) by pfg
File length: 26560 byte(s)
Diff to previous 280359
Introduce some allocation function attributes.

Bring support for two gcc function attributes that are likely to be used
in our system headers:

__alloc_size
The alloc_size attribute is used to tell the compiler that the function
return value points to memory, where the size is given by one or two of
the functions parameters.

__result_use_check
Causes a warning to be emitted if a caller of the function with this
attribute does not use its return value. This is known in gcc as
"warn_unused_result" but we considered the original naming unsuitable
for an attribute.

The __alloc_size attribute required some workarounds for lint(1).
Both attributes are supported by clang.

Also see: D2107

MFC after:	3 days


Revision 280359 - (view) (download) (annotate) - [select for diffs]
Modified Sun Mar 22 23:42:21 2015 UTC (9 years, 3 months ago) by pfg
File length: 26206 byte(s)
Diff to previous 280346
Small style(9) cleanup.

Fix yet more issues, but certainly not all.

Pointed out by:	bde


Revision 280346 - (view) (download) (annotate) - [select for diffs]
Modified Sun Mar 22 15:37:05 2015 UTC (9 years, 3 months ago) by pfg
File length: 26218 byte(s)
Diff to previous 280273
Small style(9) cleanup.

#define should always be followed by a tab not space.


Revision 280273 - (view) (download) (annotate) - [select for diffs]
Modified Fri Mar 20 01:07:48 2015 UTC (9 years, 3 months ago) by pfg
File length: 26218 byte(s)
Diff to previous 278222
Permit multiple arguments for the nonnull attribute.

This is very useful for non-trivial functions and doesn't
affect existing uses.

MFC after:	5 days


Revision 278222 - (view) (download) (annotate) - [select for diffs]
Modified Wed Feb 4 20:55:21 2015 UTC (9 years, 4 months ago) by dim
File length: 26204 byte(s)
Diff to previous 277883
Mark typedefs for manually implementing _Static_assert() as unused, so
they won't show up unecessarily for -Wunused-local-typedefs.

MFC after:	3 days


Revision 277883 - (view) (download) (annotate) - [select for diffs]
Modified Thu Jan 29 18:44:21 2015 UTC (9 years, 5 months ago) by dim
File length: 26189 byte(s)
Diff to previous 272881
Ensure that lint does not pick up C11 keywords (e.g.  _Noreturn), even
if C11 mode is used.  It does not support any C11 constructs.

MFC after:	3 days


Revision 272881 - (view) (download) (annotate) - [select for diffs]
Modified Fri Oct 10 00:35:13 2014 UTC (9 years, 8 months ago) by imp
File length: 26172 byte(s)
Diff to previous 271155
For gcc 4.6 and newer, _Static_assert is a keyword, so don't try to
redefine it. It does what we want, and is always available unlike
other alternatives.


Revision 271155 - (view) (download) (annotate) - [select for diffs]
Modified Fri Sep 5 05:36:32 2014 UTC (9 years, 9 months ago) by ed
File length: 26083 byte(s)
Diff to previous 271154
Roll back r271012 even more aggressively.

I've looked at the GCC sources and I now understand what's going wrong.
THe C11 keywords are simply nonexistent when using C++ mode. They are
marked as C-only in the parser. This is absolutely impractical for
multiple reasons:

- The C11 keywords do not conflict with C++ naming rules. They all start
  with _[A-Z]. There is no reason to make them C-only.

- It makes it practically impossible for people to use these keywords in
  C header files and expect them to work from within C++ sources.

As I said in my previous commit message: GCC is by far the weirdest
compiler that I've ever used.


Revision 271154 - (view) (download) (annotate) - [select for diffs]
Modified Fri Sep 5 05:20:52 2014 UTC (9 years, 9 months ago) by ed
File length: 26194 byte(s)
Diff to previous 271012
Partially revert r271012.

Incredibly weird: GCC 4.7/4.9 do support the _Noreturn and _Thread_local
keywords, but not during bootstrapping. GCC is by far the weirdest
compiler that I've ever used.

Reported by:	andreast@


Revision 271012 - (view) (download) (annotate) - [select for diffs]
Modified Wed Sep 3 09:35:38 2014 UTC (9 years, 10 months ago) by ed
File length: 26254 byte(s)
Diff to previous 270994
Leave the C11 keywords alone when we have a recent version of GCC.

As GCC also gained support for the C11 keywords over time, we can patch
up <sys/cdefs.h> to not define these anymore. This has the advantage
that error messages for static assertions are printed natively and that
_Alignas() will work with even a type outside of C11 mode.

All C11 keywords are supported with GCC 4.7 and higher, with the
exception of _Thread_local and _Generic. These are only supported as of
GCC 4.9.


Revision 270994 - (view) (download) (annotate) - [select for diffs]
Modified Wed Sep 3 06:34:16 2014 UTC (9 years, 10 months ago) by ed
File length: 26034 byte(s)
Diff to previous 270964
Partially revert r270964. Don't test for C++11 to define _Thread_local.

In addition to Clang 3.3, it turns out that GCC 4.7 in Ports also does
not support the _Thread_local keyword. Let's document this in a bit more
detail.

Reported by:	antoine@


Revision 270964 - (view) (download) (annotate) - [select for diffs]
Modified Tue Sep 2 11:16:44 2014 UTC (9 years, 10 months ago) by ed
File length: 25822 byte(s)
Diff to previous 270942
Clean up <sys/cdefs.h> slightly.

- Remove c++0x hack from <sys/cdefs.h> that was needed when Clang did
  not fully implement C++11. We can now safely test against C++11 to
  check whether thread_local is available, like we do for all other
  C++11 keywords.

- Don't use __clang__ to test for thread safety annotation presence. It
  turns out we have a proper attribute for this.


Revision 270942 - (view) (download) (annotate) - [select for diffs]
Modified Mon Sep 1 18:28:11 2014 UTC (9 years, 10 months ago) by ed
File length: 25874 byte(s)
Diff to previous 270941
Enable lock annotations on HEAD when using Clang.

MFC after:	never


Revision 270941 - (view) (download) (annotate) - [select for diffs]
Modified Mon Sep 1 18:27:04 2014 UTC (9 years, 10 months ago) by ed
File length: 25925 byte(s)
Diff to previous 268137
Add lock annotations to <sys/cdefs.h>.

Clang has support for annotating mutexes and code that uses mutexes to
validate certain aspects of thread safety:

- Whether acquiring/releasing locks is done properly (e.g., whether you
  unlock a mutex before leaving a function).
- Whether a lock is held while reading/writing data from/to memory.

Analysis is performed at the function level. Functions can be annotated
to indicate they:

- (try to) pick up a lock,
- release a lock,
- can only be called when (not) holding a lock,
- assert that a lock is held.

Variables and structure members can be annotated to indicate that they
are guarded by a certain lock. In C++, these annotations can refer
to both global variables, but also other class/structure members. In C,
it is only possible to refer to global variables.

This change adds wrappers for the annotations used by Clang to
<sys/cdefs.h>. They currently have no effect, but this is on purpose.
This change will be merged back to FreeBSD 9 and 10, which means we can
safely experiment with these annotations on HEAD without making it
harder to port changes back.

Reviewed by:	announced on arch@ and toolchain@
MFC after:	3 weeks


Revision 268137 - (view) (download) (annotate) - [select for diffs]
Modified Wed Jul 2 08:45:26 2014 UTC (10 years ago) by hselasky
File length: 23909 byte(s)
Diff to previous 251804
Define a "__weak" macro for declaring symbols "weak".


Revision 251804 - (view) (download) (annotate) - [select for diffs]
Modified Sun Jun 16 10:48:47 2013 UTC (11 years ago) by ed
File length: 23852 byte(s)
Diff to previous 250806
Move _Atomic() into <sys/cdefs.h>.

That way _Atomic() is defined next to all the other C11 keywords for
which we provide compatibility for pre-C11 compilers. While there, fix
the definition to place "volatile" at the end. Otherwise pointer types
will become "volatile T *" instead of "T * volatile".


Revision 250806 - (view) (download) (annotate) - [select for diffs]
Modified Sun May 19 07:44:01 2013 UTC (11 years, 1 month ago) by ed
File length: 23609 byte(s)
Diff to previous 250623
Remove lint case for _Thread_local.

I added this block, knowing that lint does not support _Thread_local.
When linting, we could argue that we don't care about TLS (yet). It
seems, however, that external pieces of software also sometimes do a
-Dlint, regex the output and compile it again.

Reported by:	swills


Revision 250623 - (view) (download) (annotate) - [select for diffs]
Modified Mon May 13 21:46:07 2013 UTC (11 years, 1 month ago) by ed
File length: 23651 byte(s)
Diff to previous 241374
Rework the way C11 keywords are defined.

Instead of only checking the __STDC_VERSION__, we can also use Clang's
__has_extension() to check for features specifically. This allows us to,
say, use Clang's native _Static_assert() instead of the typedef hack,
making the compiler error messages a lot more readable.

Reviewed by:	theraven


Revision 241374 - (view) (download) (annotate) - [select for diffs]
Modified Tue Oct 9 14:32:30 2012 UTC (11 years, 8 months ago) by attilio
File length: 22988 byte(s)
Diff to previous 241190
Add an unified macro to deny ability from the compiler to reorder
instruction loads/stores at its will.
The macro __compiler_membar() is currently supported for both gcc and
clang, but kernel compilation will fail otherwise.

Reviewed by:	bde, kib
Discussed with:	dim, theraven
MFC after:	2 weeks


Revision 241190 - (view) (download) (annotate) - [select for diffs]
Modified Thu Oct 4 08:53:05 2012 UTC (11 years, 9 months ago) by tijl
File length: 22830 byte(s)
Diff to previous 240450
Define clang feature test macro __has_extension. It's used in stdatomic.h.


Revision 240450 - (view) (download) (annotate) - [select for diffs]
Modified Thu Sep 13 08:13:01 2012 UTC (11 years, 9 months ago) by ed
File length: 22760 byte(s)
Diff to previous 240422
Rename __member2struct() to __containerof().

Compared to __member2struct(), this macro has the following advantages:

- It ensures that the type of the pointer is compatible with the member
  field of the structure (or a void pointer).
- It works properly in combination with volatile and const, though
  unfortunately it drops these qualifiers from the returned value.

mdf@ proposed to add the container_of() macro, just like Linux has.
Eventually I decided against this, as <sys/param.h> is included all over
the place. It seems container_of() on Linux is specific to the kernel,
not userspace. I'd rather not pollute userspace with this.

I also thought about adding __container_of(), but this would have two
advantages. Xorg seems to already have a __container_of(), which is not
compatible with this version. Also, the underscore in the middle
conflicts with our existing macros (__offsetof, __rangeof, etc).

I'm changing member2struct() to use its old code, as the extra
strictness of this new macro conflicts with existing code (read: cxgb).

MFC after:	1 month


Revision 240422 - (view) (download) (annotate) - [select for diffs]
Modified Wed Sep 12 21:03:48 2012 UTC (11 years, 9 months ago) by ed
File length: 22322 byte(s)
Diff to previous 237025
Implement LIST_PREV().

Regular LISTs have been implemented in such a way that the prev-pointer
does not point to the previous element, but to the next-pointer stored
in the previous element. This is done to simplify LIST_REMOVE(). This
macro can be implemented without knowing the address of the list head.

Unfortunately this makes it harder to implement LIST_PREV(), which is
why this macro was never here. Still, it is possible to implement this
macro. If the prev-pointer points to the list head, we return NULL.
Otherwise we simply subtract the offset of the prev-pointer within the
structure.

It's not as efficient as traversing forward of course, but in practice
it shouldn't be that bad. In almost all use cases, people will want to
compare the value returned by LIST_PREV() against NULL, so an optimizing
compiler will not emit code that does more branching than TAILQs.

While there, make the code a bit more readable by introducing
__member2struct(). This makes STAILQ_LAST() far more readable.

MFC after:	1 month


Revision 237025 - (view) (download) (annotate) - [select for diffs]
Modified Wed Jun 13 20:41:45 2012 UTC (12 years ago) by jkim
File length: 22220 byte(s)
Diff to previous 234785
Add a convenience macro for the fastcall attribute.

MFC after:	2 weeks


Revision 234785 - (view) (download) (annotate) - [select for diffs]
Modified Sun Apr 29 11:04:31 2012 UTC (12 years, 2 months ago) by dim
File length: 22112 byte(s)
Diff to previous 232498
Add a convenience macro for the returns_twice attribute, and apply it to
the prototypes of the appropriate functions (getcontext, savectx,
setjmp, sigsetjmp and vfork).

MFC after:	2 weeks


Revision 232498 - (view) (download) (annotate) - [select for diffs]
Modified Sun Mar 4 15:31:13 2012 UTC (12 years, 4 months ago) by theraven
File length: 21989 byte(s)
Diff to previous 231714
Reapply 227753 (xlocale cleanup), plus some fixes so that it passes build
universe with gcc.

Approved by:	dim (mentor)


Revision 231714 - (view) (download) (annotate) - [select for diffs]
Modified Tue Feb 14 21:48:46 2012 UTC (12 years, 4 months ago) by dim
File length: 21533 byte(s)
Diff to previous 231673
Revert r231673 and r231682 for now, until we can run a full make
universe with them.  Sorry for the breakage.

Pointy hat to:	     me and brooks


Revision 231673 - (view) (download) (annotate) - [select for diffs]
Modified Tue Feb 14 12:03:23 2012 UTC (12 years, 4 months ago) by theraven
File length: 21981 byte(s)
Diff to previous 230277
Cleanup of xlocale:

- Address performance regressions encountered by das@ by caching per-thread
  data in TLS where available.
- Add a __NO_TLS flag to cdefs.h to indicate where not available.
- Reorganise the xlocale.h definitions into xlocale/*.h so that they can be
  included from multiple places.
- Export the POSIX2008 subset of xlocale when POSIX2008 says it should be
  exported, independently of whether xlocale.h is included.
- Fix the bug where programs using ctype functions always assumed ASCII unless
  recompiled.
- Fix some style(9) violations.

Reviewed by:	brooks (mentor)
Approved by:	dim (mentor)


Revision 230277 - (view) (download) (annotate) - [select for diffs]
Modified Tue Jan 17 20:21:31 2012 UTC (12 years, 5 months ago) by ed
File length: 21533 byte(s)
Diff to previous 229574
Don't expose __generic() when not using C++.

According to the GCC documentation, the constructs used to implement
<tgmath.h> are only available in C mode. They only cause breakage when
used used with g++.

Reported by:	tijl


Revision 229574 - (view) (download) (annotate) - [select for diffs]
Modified Thu Jan 5 10:43:03 2012 UTC (12 years, 6 months ago) by ed
File length: 21508 byte(s)
Diff to previous 228900
Add __generic(), to be able to use a very simple _Generic().

Already introducing this allows us to be forward compatible with C11
compilers. By implementing <tgmath.h> on top of this interface, it
becomes trivial to support both our existing GCC and newer compilers.


Revision 228900 - (view) (download) (annotate) - [select for diffs]
Modified Mon Dec 26 18:49:56 2011 UTC (12 years, 6 months ago) by ed
File length: 20821 byte(s)
Diff to previous 228897
Add cdefs-magic to add optional C11 bits to headers.


Revision 228897 - (view) (download) (annotate) - [select for diffs]
Modified Mon Dec 26 10:58:21 2011 UTC (12 years, 6 months ago) by ed
File length: 20645 byte(s)
Diff to previous 228859
The standard is now called C11 -- C12.

While there, compare against the proper __STDC_VERSION value.


Revision 228859 - (view) (download) (annotate) - [select for diffs]
Modified Sat Dec 24 13:28:49 2011 UTC (12 years, 6 months ago) by theraven
File length: 20644 byte(s)
Diff to previous 228564
Some GCC-compatibility definitions.  Define clang's feature test pseudomacros
to always evaluate to 0 if we are using a compiler that doesn't implement them.
This lets us use the macros easily in standard headers (e.g. stdatomic.h, which
should be the subject of my next commit).

Approved by:	dim (mentor)


Revision 228564 - (view) (download) (annotate) - [select for diffs]
Modified Fri Dec 16 09:56:22 2011 UTC (12 years, 6 months ago) by ed
File length: 20475 byte(s)
Diff to previous 228562
Fix typo in macro.

I copied this macro directly from Bruce's email, as I assumed it was
awesome already.

Reported by:	tijl@


Revision 228562 - (view) (download) (annotate) - [select for diffs]
Modified Fri Dec 16 08:22:23 2011 UTC (12 years, 6 months ago) by ed
File length: 20476 byte(s)
Diff to previous 228495
Process a lot of feedback from bde@ on <sys/cdefs.h>:

- Add __alignof() for non-GCC and GCC < 2.95.
- Simply implement the C1X keywords on top of the existing __macros.
- Add struct __hack to _Static_assert to require consumers to add a
  semicolon.
- Add an extra underscore to __assert_ to allow it to be combined with
  locally defined versions of CTASSERT in the tree.
- Add proper casts to __offsetof() to make it work for cases where
  sizeof(size_t) != sizeof(uintptr_t).
- Globally replace size_t and uintptr_t by __size_t and __uintptr_t.
  This removes the dependency on <sys/types.h> / <stdint.h>. Practically
  any header file ends up including <machines/_types.h> somehow.
- Change argument names of macros to match with the rest of the file.

MFC after:	3 months


Revision 228495 - (view) (download) (annotate) - [select for diffs]
Modified Wed Dec 14 09:09:37 2011 UTC (12 years, 6 months ago) by ed
File length: 20497 byte(s)
Diff to previous 228477
Slightly alter the C1X definitions in in cdefs.h:

- Add _Alignas(). Unfortunately this macro is only partially functional.
  The C1X standard will allow both an integer and a type name to be
  passed to this macro, while this macro only allows an integer. To be
  portable, one must use _Alignas(_Alignof(double)) to use type names.

- Don't do _Static_assert() when __COUNTER__ is not supported. We'd
  better keep this implementation robust and allow it to be used in
  header files, without mysteriously breaking older compilers.


Revision 228477 - (view) (download) (annotate) - [select for diffs]
Modified Tue Dec 13 19:37:27 2011 UTC (12 years, 6 months ago) by ed
File length: 20421 byte(s)
Diff to previous 228330
Make support for C1X keywords more complete.

- _Alignof(), which returns the aligment of a certain type.
- _Static_assert(), which can be used to check compile-time assertions.
- _Thread_local, which uses TLS on a variable.

MFC after:	3 months
Reviewed by:	mdf


Revision 228330 - (view) (download) (annotate) - [select for diffs]
Modified Wed Dec 7 21:17:50 2011 UTC (12 years, 6 months ago) by theraven
File length: 19783 byte(s)
Diff to previous 228322
As per das@'s suggestion, s/__noreturn/_Noreturn/, since the latter is an
identifier reserved for the implementation in C99 and earlier so there is
no sensible reason for introducing yet another reserved identifier when we
could just use the one C1x uses.

Approved by:	brooks (mentor)


Revision 228322 - (view) (download) (annotate) - [select for diffs]
Modified Wed Dec 7 15:25:48 2011 UTC (12 years, 6 months ago) by theraven
File length: 19774 byte(s)
Diff to previous 227478
Implement quick_exit() / at_quick_exit() from C++11 / C1x.  Also add a
__noreturn macro and modify the other exiting functions to use it.

The __noreturn macro, unlike __dead2, must be used BEFORE the function.
This is in line with the C and C++ specifications that place _Noreturn (c1x)
and [[noreturn]] (C++11) in front of the functions.  As with __dead2, this
macro falls back to using the GCC attribute.

Unfortunately, clang currently sets the same value for the C version macro
in C99 and C1x modes, so these functions are hidden by default.  At some
point before 10.0, I need to go through the headers and clean up the C1x /
C++11 visibility.

Reviewed by:	brooks (mentor)


Revision 227478 - (view) (download) (annotate) - [select for diffs]
Modified Sat Nov 12 23:17:54 2011 UTC (12 years, 7 months ago) by dim
File length: 19490 byte(s)
Diff to previous 227475
Fix kernel build breakage after r227475.  I had forgotten kernels are
built with -Wundef, as opposed to world.

Additionally, cdefs.h tends to not use indentation for preprocessor
directives, so remove that too.

Pointy hat to:	me


Revision 227475 - (view) (download) (annotate) - [select for diffs]
Modified Sat Nov 12 20:25:11 2011 UTC (12 years, 7 months ago) by theraven
File length: 19475 byte(s)
Diff to previous 227082
Expose all of the C99 limits.h stuff when we're in C++11 mode (or some approximation thereof).  C++11 finally adds long long to C++.  Now even C++ programmers are allowed to use 64-bit integers!

Approved by:	dim (mentor)


Revision 227082 - (view) (download) (annotate) - [select for diffs]
Modified Fri Nov 4 15:34:31 2011 UTC (12 years, 8 months ago) by rmh
File length: 19229 byte(s)
Diff to previous 218824
Silence an (otherwise harmless) very recurrent warning when building the
kernel of FreeBSD with a non-FreeBSD compiler.

Approved by:	kib (mentor)


Revision 218824 - (view) (download) (annotate) - [select for diffs]
Modified Fri Feb 18 21:44:53 2011 UTC (13 years, 4 months ago) by nwhitehorn
File length: 19190 byte(s)
Diff to previous 217146
Turn off default generation of userland dot symbols on powerpc64 now that
we have a binutils that supports it. Kernel dot symbols remain on to assist
DDB.


Revision 217146 - (view) (download) (annotate) - [select for diffs]
Modified Sat Jan 8 11:47:55 2011 UTC (13 years, 5 months ago) by tijl
File length: 19505 byte(s)
Diff to previous 215701
On 32 bit architectures define (u)int64_t as (unsigned) long long instead
of (unsigned) int __attribute__((__mode__(__DI__))). This aligns better
with macros such as (U)INT64_C, (U)INT64_MAX, etc. which assume (u)int64_t
has type (unsigned) long long.

The mode attribute was used because long long wasn't standardised until
C99. Nowadays compilers should support long long and use of the mode
attribute is discouraged according to GCC Internals documentation.

The type definition has to be marked with __extension__ to support
compilation with "-std=c89 -pedantic".

Discussed with:	bde
Approved by:	kib (mentor)


Revision 215701 - (view) (download) (annotate) - [select for diffs]
Modified Mon Nov 22 19:32:54 2010 UTC (13 years, 7 months ago) by dim
File length: 19545 byte(s)
Diff to previous 215318
After some off-list discussion, revert a number of changes to the
DPCPU_DEFINE and VNET_DEFINE macros, as these cause problems for various
people working on the affected files.  A better long-term solution is
still being considered.  This reversal may give some modules empty
set_pcpu or set_vnet sections, but these are harmless.

Changes reverted:

------------------------------------------------------------------------
r215318 | dim | 2010-11-14 21:40:55 +0100 (Sun, 14 Nov 2010) | 4 lines

Instead of unconditionally emitting .globl's for the __start_set_xxx and
__stop_set_xxx symbols, only emit them when the set_vnet or set_pcpu
sections are actually defined.

------------------------------------------------------------------------
r215317 | dim | 2010-11-14 21:38:11 +0100 (Sun, 14 Nov 2010) | 3 lines

Apply the STATIC_VNET_DEFINE and STATIC_DPCPU_DEFINE macros throughout
the tree.

------------------------------------------------------------------------
r215316 | dim | 2010-11-14 21:23:02 +0100 (Sun, 14 Nov 2010) | 2 lines

Add macros to define static instances of VNET_DEFINE and DPCPU_DEFINE.


Revision 215318 - (view) (download) (annotate) - [select for diffs]
Modified Sun Nov 14 20:40:55 2010 UTC (13 years, 7 months ago) by dim
File length: 19508 byte(s)
Diff to previous 215137
Instead of unconditionally emitting .globl's for the __start_set_xxx and
__stop_set_xxx symbols, only emit them when the set_vnet or set_pcpu
sections are actually defined.


Revision 215137 - (view) (download) (annotate) - [select for diffs]
Modified Thu Nov 11 19:17:59 2010 UTC (13 years, 7 months ago) by dim
File length: 19545 byte(s)
Diff to previous 211868
Revert r103230, which depended on ld preserving the __start_xxx and
__stop_xxx symbols for custom sections, even when these were not
referenced (at link time).  This behaviour was changed again in binutils
commit 0b8ed435c3fe8bd09a08c23920e65bfb03251221.

This time, put the __GLOBL macro definition in cdefs.h, so it can be
reused in a few other places where it will be needed.

Reviewed by:	kib


Revision 211868 - (view) (download) (annotate) - [select for diffs]
Modified Fri Aug 27 09:55:51 2010 UTC (13 years, 10 months ago) by kib
File length: 19463 byte(s)
Diff to previous 211741
Use private namespace for visibility keyword.

Noted by:	bde
MFC after:	3 days


Revision 211741 - (view) (download) (annotate) - [select for diffs]
Modified Tue Aug 24 11:53:30 2010 UTC (13 years, 10 months ago) by kib
File length: 19455 byte(s)
Diff to previous 211335
Use preferred spelling for the __attribute__.

MFC after:	3 days


Revision 211335 - (view) (download) (annotate) - [select for diffs]
Added Sun Aug 15 14:38:01 2010 UTC (13 years, 10 months ago) by kib
File length: 19451 byte(s)
Diff to previous 210226
Add convenience defines for hidden and default/exported attributes.

MFC after:	2 weeks



This form allows you to request diffs between any two revisions of this file. For each of the two "sides" of the diff, enter a numeric revision.

  Diffs between and
  Type of Diff should be a

  ViewVC Help
Powered by ViewVC 1.1.27