summaryrefslogtreecommitdiff
path: root/usr/src/head
diff options
context:
space:
mode:
authorDan McDonald <danmcd@mnx.io>2022-12-16 13:29:26 -0500
committerDan McDonald <danmcd@mnx.io>2022-12-16 13:29:26 -0500
commitc2b15a66358531a6d0407d3678b210e752a0b606 (patch)
tree37db6d27eafd3b8bb0ff1c25ee6c8b98070f5444 /usr/src/head
parent3b01c8dd53b81ad475bf8152609c8c4803a9af55 (diff)
parentf4d2cf74960df993f48d42d323f16867fc6b9bdf (diff)
downloadillumos-joyent-master.tar.gz
[illumos-gate merge]HEADmaster
commit f4d2cf74960df993f48d42d323f16867fc6b9bdf 15253 14993 broke test-runner -l option commit fb2301db8e408458b542c1f5fa07b5b8a3a95395 15258 libsmb: tautological-pointer-compare commit abd30308264aa9ca2b1c71565b841fc94256d07b 15211 smbtorture failures in smb2.delete-on-close-perms.READONLY commit 0663b557d8c7575927b005cab08d9f19c8b98c25 15200 libdladm: error: '&&' within '||' commit bf7adeeaefd6f9806398f446e4b87af240a6770e 15199 libdladm: unused label commit 92f549282aaface1e6f92329085e28edcf24054f 15207 libfmd_agent: memory leak in fmd_agent_nvl_ioctl commit 7b5987898994d86cd20e00dbf8c305dfbfbb8bea 15135 stdalign.h is very C11-y, but perhaps disrespectful of C++
Diffstat (limited to 'usr/src/head')
-rw-r--r--usr/src/head/stdalign.h23
1 files changed, 18 insertions, 5 deletions
diff --git a/usr/src/head/stdalign.h b/usr/src/head/stdalign.h
index 2577a8de92..15160d660e 100644
--- a/usr/src/head/stdalign.h
+++ b/usr/src/head/stdalign.h
@@ -11,30 +11,43 @@
/*
* Copyright 2016 Joyent, Inc.
+ * Copyright 2022 Oxide Computer Company
*/
#ifndef _STDALIGN_H
#define _STDALIGN_H
/*
- * ISO/IEC C11 stdalign.h
+ * ISO/IEC C11 stdalign.h. This header is meant to provide definitions for the
+ * alignas and alignof 'keywords' into the underlying compiler-understood value.
+ * In addition, there are two macros that are meant to define that this process
+ * has happened. C++11 added alignas/alignof as keywords and including this
+ * header is meant to cause us to still have the _is_defined macros, but not
+ * define this overall.
+ *
+ * Unlike other cases we don't use any symbol guards here (other than C++) and
+ * just allow the implementation to either have _Alignas and _Alignof or not
+ * have it and lead to a compiler error for the user. The main justification of
+ * this is that this header is only defined in C11 (and newer). It's not defined
+ * in other standards and just as if you include a non-standard header, in this
+ * case we don't try to stop that (same as if you included something like
+ * libdevinfo.h).
*/
-#include <sys/feature_tests.h>
#ifdef __cplusplus
extern "C" {
#endif
-#if !defined(_STRICT_SYMBOLS) || defined(_STDC_C11)
+#ifndef __cplusplus
#define alignas _Alignas
#define alignof _Alignof
+#endif /* !__cplusplus */
+
#define __alignas_is_defined 1
#define __alignof_is_defined 1
-#endif /* !_STRICT_SYMBOLS || _STDC_C11 */
-
#ifdef __cplusplus
}
#endif