Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/include Expose max_align_t to C99/C++



details:   https://anonhg.NetBSD.org/src/rev/9af623f4617d
branches:  trunk
changeset: 745407:9af623f4617d
user:      kamil <kamil%NetBSD.org@localhost>
date:      Sun Mar 01 15:08:16 2020 +0000

description:
Expose max_align_t to C99/C++

max_align_t does not depend on any pre-C99 or !C++ language feature.

This structure is in use in 3rd party essential C++ code as an extension
for older language revisions and in gnu99 code in the NetBSD distribution
(RTLD's build rules define -std=gnu11 just for exposing this struct).

Exposing max_align_t from the central NetBSD header avoid duplicate
definition in 3rd party code that could differ and produce ABI mismatched
binaries between -std= revisions.

This problem does not exist on OSs like Linux as they get this namespace
visibility defined inside LLVM or GNU toolchain headers. NetBSD ships with
its own stddef.h, rather than relying on a toolchain and its internal
extensions.

diffstat:

 include/stddef.h |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (19 lines):

diff -r afd7be9b5b0b -r 9af623f4617d include/stddef.h
--- a/include/stddef.h  Sun Mar 01 14:51:06 2020 +0000
+++ b/include/stddef.h  Sun Mar 01 15:08:16 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: stddef.h,v 1.20 2016/03/20 16:26:06 christos Exp $     */
+/*     $NetBSD: stddef.h,v 1.21 2020/03/01 15:08:16 kamil Exp $        */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -67,7 +67,8 @@
     (&reinterpret_cast<const volatile char &>(static_cast<type *>(0)->member))))
 #endif  
 
-#if (__STDC_VERSION__ - 0) >= 201112L || (__cplusplus - 0) >= 201103L
+#if (__STDC_VERSION__ - 0) > 199901L || defined(__cplusplus)
+/* Introduced in C99/C++11, as an extension exposed to C99/C++98 */
 typedef union {
        void *_v;
        long double _ld;



Home | Main Index | Thread Index | Old Index